From 7b4388dfc1861b38ff2c8536f97325113ae0bf54 Mon Sep 17 00:00:00 2001 From: timemarkovqtum Date: Mon, 16 Oct 2023 11:56:56 +0200 Subject: [PATCH] Fix code style check --- src/common/script.c | 2 +- src/constants.h | 2 +- src/handler/sign_psbt.c | 7 ++++--- src/ui/display_bagl.c | 32 +++++++++++++++----------------- src/ui/menu_bagl.c | 6 +++--- src/ui/menu_nbgl.c | 8 +++++++- 6 files changed, 31 insertions(+), 26 deletions(-) diff --git a/src/common/script.c b/src/common/script.c index 47811fb3d..a35c08cfe 100644 --- a/src/common/script.c +++ b/src/common/script.c @@ -15,7 +15,6 @@ #include "../crypto.h" #endif -#ifndef SKIP_FOR_CMOCKA #define DELEGATIONS_ADDRESS "\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x86" #define ADD_DELEGATION_HASH "\x4c\x0e\x96\x8c" #define REMOVE_DELEGATION_HASH "\x3d\x66\x6e\x8b" @@ -413,6 +412,7 @@ bool get_sender_sig(uint8_t *buffer, size_t size, uint8_t **sig, unsigned int *s *sigSize > 0; } +#ifndef SKIP_FOR_CMOCKA bool opcall_addr_encode(const uint8_t script[], size_t script_len, char *out, diff --git a/src/constants.h b/src/constants.h index 855a36199..4c5fbe27c 100644 --- a/src/constants.h +++ b/src/constants.h @@ -33,7 +33,7 @@ * Maximum scriptPubKey length for an output that we can recognize. */ #define MAX_OUTPUT_SCRIPTPUBKEY_LEN 400 // max 393 for contracts; other scripts are shorter -#define MAX_INPUT_SCRIPTPUBKEY_LEN 35 // P2PK's scriptPubKeys are the longest supported +#define MAX_INPUT_SCRIPTPUBKEY_LEN 35 // P2PK's scriptPubKeys are the longest supported /** * Maximum length of a wallet registered into the device (characters), excluding terminating NULL. diff --git a/src/handler/sign_psbt.c b/src/handler/sign_psbt.c index f777465bd..e1686f60f 100644 --- a/src/handler/sign_psbt.c +++ b/src/handler/sign_psbt.c @@ -1439,10 +1439,11 @@ static bool read_outputs(dispatcher_context_t *dc, ++external_outputs_count; // check if output contract data is allowed - bool isContractBlindSign = is_contract_blind_sign(output.in_out.scriptPubKey, output.in_out.scriptPubKey_len); - if(isContractBlindSign && !N_storage.dataAllowed) { + bool isContractBlindSign = + is_contract_blind_sign(output.in_out.scriptPubKey, output.in_out.scriptPubKey_len); + if (isContractBlindSign && !N_storage.dataAllowed) { ui_warn_contract_data(dc); - if(!N_storage.dataAllowed) { + if (!N_storage.dataAllowed) { SEND_SW(dc, SW_SIGNATURE_FAIL); return false; } diff --git a/src/ui/display_bagl.c b/src/ui/display_bagl.c index 5e193ba54..21445eb9b 100644 --- a/src/ui/display_bagl.c +++ b/src/ui/display_bagl.c @@ -248,24 +248,22 @@ UX_STEP_CB(ux_sign_message_accept_new, {&C_icon_validate_14, "Sign", "message"}); #ifdef TARGET_NANOS -UX_STEP_CB( - ux_warning_contract_data_step, - bnnn_paging, - set_ux_flow_response(false), - { - "Error", - "Blind signing must be enabled in Settings", - }); +UX_STEP_CB(ux_warning_contract_data_step, + bnnn_paging, + set_ux_flow_response(false), + { + "Error", + "Blind signing must be enabled in Settings", + }); #else -UX_STEP_CB( - ux_warning_contract_data_step, - pnn, - set_ux_flow_response(false), - { - &C_icon_crossmark, - "Blind signing must be", - "enabled in Settings", - }); +UX_STEP_CB(ux_warning_contract_data_step, + pnn, + set_ux_flow_response(false), + { + &C_icon_crossmark, + "Blind signing must be", + "enabled in Settings", + }); #endif // FLOW to display BIP32 path and a message hash to sign: diff --git a/src/ui/menu_bagl.c b/src/ui/menu_bagl.c index 5ef8bb74f..29dc09170 100644 --- a/src/ui/menu_bagl.c +++ b/src/ui/menu_bagl.c @@ -34,7 +34,7 @@ UX_STEP_NOCB(ux_menu_ready_step_bitcoin_testnet, UX_STEP_NOCB(ux_menu_version_step, bn, {"Version", APPVERSION}); UX_STEP_CB(ux_menu_about_step, pb, ui_menu_about(), {&C_icon_certificate, "About"}); -UX_STEP_CB(ux_menu_settings_step, pb, ui_menu_settings(), {&C_icon_eye,"Settings"}); +UX_STEP_CB(ux_menu_settings_step, pb, ui_menu_settings(), {&C_icon_eye, "Settings"}); UX_STEP_VALID(ux_menu_exit_step, pb, os_sched_exit(-1), {&C_icon_dashboard_x, "Quit"}); // FLOW for the main menu (for bitcoin): @@ -99,8 +99,8 @@ void ui_menu_settings(void) { #define DISABLED_STR "Disabled" #define BUF_INCREMENT (MAX(strlen(ENABLED_STR), strlen(DISABLED_STR)) + 1) char strings[BUF_INCREMENT]; -#define SETTING_BLIND_SIGNING_STATE strings -#define BOOL_TO_STATE_STR(b) (b ? ENABLED_STR : DISABLED_STR) +#define SETTING_BLIND_SIGNING_STATE strings +#define BOOL_TO_STATE_STR(b) (b ? ENABLED_STR : DISABLED_STR) // clang-format off UX_STEP_CB( diff --git a/src/ui/menu_nbgl.c b/src/ui/menu_nbgl.c index dd792f751..4d5473762 100644 --- a/src/ui/menu_nbgl.c +++ b/src/ui/menu_nbgl.c @@ -101,6 +101,12 @@ void settings_call_back(void) { } void ui_menu_settings(void) { - nbgl_useCaseSettings("Qtum", 1, 2, false, settings_call_back, navigation_cb, controls_call_back); + nbgl_useCaseSettings("Qtum", + 1, + 2, + false, + settings_call_back, + navigation_cb, + controls_call_back); } #endif // HAVE_NBGL