Clang-format

This commit is contained in:
pscott
2021-04-22 14:01:52 +02:00
parent b899edfaaf
commit a4dcec436f
2 changed files with 27 additions and 30 deletions

View File

@@ -1,6 +1,6 @@
#include "stdint.h" #include "stdint.h"
#define INDEX_MAX 1337 // scott #define INDEX_MAX 1337 // scott
void handleSetEth2WithdrawalIndex(uint8_t p1, void handleSetEth2WithdrawalIndex(uint8_t p1,
uint8_t p2, uint8_t p2,

View File

@@ -38,18 +38,15 @@ static void to_lowercase(char *str, unsigned char size) {
} }
} }
// Fills the `out` buffer with the lowercase string representation of the pubkey passed in as binary format by `in`. // Fills the `out` buffer with the lowercase string representation of the pubkey passed in as binary
// Does not check the size, so expects `out` to be big enough to told the string representation. // format by `in`. Does not check the size, so expects `out` to be big enough to told the string
// Returns the length of string (counting the null terminating character). // representation. Returns the length of string (counting the null terminating character).
static int getEthDisplayableAddress(char *out, uint8_t *in) { static int getEthDisplayableAddress(char *out, uint8_t *in) {
out[0] = '0'; out[0] = '0';
out[1] = 'x'; out[1] = 'x';
getEthAddressStringFromBinary(in, getEthAddressStringFromBinary(in, (uint8_t *) out + 2, &global_sha3, chainConfig);
(uint8_t *) out + 2,
&global_sha3,
chainConfig);
uint8_t destinationLen = strlen(out) + 1; // Adding one to account for \0. uint8_t destinationLen = strlen(out) + 1; // Adding one to account for \0.
// Ensure address is in lowercase, to match DEPOSIT_CONTRACT_ADDRESS' case. // Ensure address is in lowercase, to match DEPOSIT_CONTRACT_ADDRESS' case.
to_lowercase(out, destinationLen); to_lowercase(out, destinationLen);
@@ -144,27 +141,27 @@ void eth2_plugin_call(int message, void *parameters) {
} break; } break;
case 4 + (32 * 5): // deposit pubkey 1 case 4 + (32 * 5): // deposit pubkey 1
{ {
// Copy the first 32 bytes. // Copy the first 32 bytes.
memcpy(deposit_address, msg->parameter, sizeof(deposit_address)); memcpy(deposit_address, msg->parameter, sizeof(deposit_address));
msg->result = ETH_PLUGIN_RESULT_OK; msg->result = ETH_PLUGIN_RESULT_OK;
break; break;
} }
case 4 + (32 * 6): // deposit pubkey 2 case 4 + (32 * 6): // deposit pubkey 2
{ {
// Copy the last 16 bytes. // Copy the last 16 bytes.
memcpy(deposit_address + 32, msg->parameter, sizeof(deposit_address) - 32); memcpy(deposit_address + 32, msg->parameter, sizeof(deposit_address) - 32);
// Use a temporary buffer to store the string representation. // Use a temporary buffer to store the string representation.
char tmp[ETH2_DEPOSIT_PUBKEY_LENGTH]; char tmp[ETH2_DEPOSIT_PUBKEY_LENGTH];
getEthDisplayableAddress(tmp, (uint8_t *)deposit_address); getEthDisplayableAddress(tmp, (uint8_t *) deposit_address);
// Copy back the string to the global variable. // Copy back the string to the global variable.
strcpy(deposit_address, tmp); strcpy(deposit_address, tmp);
msg->result = ETH_PLUGIN_RESULT_OK; msg->result = ETH_PLUGIN_RESULT_OK;
break; break;
} }
case 4 + (32 * 3): // deposit data root case 4 + (32 * 3): // deposit data root
case 4 + (32 * 10): // signature case 4 + (32 * 10): // signature
case 4 + (32 * 11): case 4 + (32 * 11):
case 4 + (32 * 12): case 4 + (32 * 12):
@@ -228,7 +225,7 @@ void eth2_plugin_call(int message, void *parameters) {
// eth2_deposit_parameters_t *context = // eth2_deposit_parameters_t *context =
// (eth2_deposit_parameters_t*)msg->pluginContext; // (eth2_deposit_parameters_t*)msg->pluginContext;
switch (msg->screenIndex) { switch (msg->screenIndex) {
case 0: { // Amount screen case 0: { // Amount screen
uint8_t decimals = WEI_TO_ETHER; uint8_t decimals = WEI_TO_ETHER;
uint8_t *ticker = (uint8_t *) PIC(chainConfig->coinName); uint8_t *ticker = (uint8_t *) PIC(chainConfig->coinName);
strcpy(msg->title, "Amount"); strcpy(msg->title, "Amount");
@@ -240,7 +237,7 @@ void eth2_plugin_call(int message, void *parameters) {
100); 100);
msg->result = ETH_PLUGIN_RESULT_OK; msg->result = ETH_PLUGIN_RESULT_OK;
} break; } break;
case 1: { // Deposit pubkey screen case 1: { // Deposit pubkey screen
strcpy(msg->title, "Validator"); strcpy(msg->title, "Validator");
strcpy(msg->msg, deposit_address); strcpy(msg->msg, deposit_address);
msg->result = ETH_PLUGIN_RESULT_OK; msg->result = ETH_PLUGIN_RESULT_OK;