From c548aba364fd199d8eeaab3cc2fa9f1474d897e4 Mon Sep 17 00:00:00 2001 From: Alexandre Paillier Date: Mon, 7 Mar 2022 14:21:32 +0100 Subject: [PATCH] Unify the include guards accross all header files --- src/apdu_constants.h | 5 +++++ src/chainConfig.h | 2 +- src/eth_plugin_handler.h | 5 +++-- src/eth_plugin_interface.h | 7 +++---- src/eth_plugin_internal.h | 5 +++-- src/nft.h | 5 +++++ src/poorstream.h | 6 +++--- src/shared_context.h | 7 +++---- src/stark_crypto.h | 6 +++--- src/stark_utils.h | 6 +++--- src/swap_lib_calls.h | 6 +++--- src/tokens.h | 2 +- src/ui_callbacks.h | 5 +++++ src/ui_flow.h | 5 +++++ src/utils.h | 2 +- src_common/ethUstream.h | 2 +- src_common/ethUtils.h | 2 +- src_common/network.h | 7 ++++++- src_common/uint256.h | 2 +- src_features/getEth2PublicKey/feature_getEth2PublicKey.h | 5 +++++ src_features/getPublicKey/feature_getPublicKey.h | 5 +++++ src_features/setEth2WithdrawalIndex/withdrawal_index.h | 7 ++++++- src_features/signTx/feature_signTx.h | 5 +++++ src_features/signTx/ui_plugin.h | 7 +++++-- .../stark_getPublicKey/feature_stark_getPublicKey.h | 5 +++++ src_plugins/erc1155/erc1155_plugin.h | 7 +++++-- src_plugins/erc721/erc721_plugin.h | 7 +++++-- 27 files changed, 97 insertions(+), 38 deletions(-) diff --git a/src/apdu_constants.h b/src/apdu_constants.h index f0c149b..474b29d 100644 --- a/src/apdu_constants.h +++ b/src/apdu_constants.h @@ -1,3 +1,6 @@ +#ifndef _APDU_CONSTANTS_H_ +#define _APDU_CONSTANTS_H_ + #include "shared_context.h" #define APP_FLAG_DATA_ALLOWED 0x01 @@ -156,3 +159,5 @@ void handleStarkwareUnsafeSign(uint8_t p1, unsigned int *tx); #endif + +#endif // _APDU_CONSTANTS_H_ diff --git a/src/chainConfig.h b/src/chainConfig.h index 733a1a6..0fe3834 100644 --- a/src/chainConfig.h +++ b/src/chainConfig.h @@ -69,4 +69,4 @@ typedef struct chain_config_s { #define ETHEREUM_MAINNET_CHAINID 1 -#endif /* _CHAIN_CONFIG_H_ */ +#endif // _CHAIN_CONFIG_H_ diff --git a/src/eth_plugin_handler.h b/src/eth_plugin_handler.h index 864c15c..76a7f1e 100644 --- a/src/eth_plugin_handler.h +++ b/src/eth_plugin_handler.h @@ -1,4 +1,5 @@ -#ifndef __ETH_PLUGIN_HANDLER_H__ +#ifndef _ETH_PLUGIN_HANDLER_H_ +#define _ETH_PLUGIN_HANDLER_H_ #include "eth_plugin_interface.h" @@ -27,4 +28,4 @@ eth_plugin_result_t eth_plugin_call(int method, void *parameter); void plugin_ui_start(void); -#endif +#endif // _ETH_PLUGIN_HANDLER_H_ diff --git a/src/eth_plugin_interface.h b/src/eth_plugin_interface.h index 31cbbde..f8b301c 100644 --- a/src/eth_plugin_interface.h +++ b/src/eth_plugin_interface.h @@ -1,6 +1,5 @@ -#ifndef __ETH_PLUGIN_INTERFACE_H__ - -#define __ETH_PLUGIN_INTERFACE_H__ +#ifndef _ETH_PLUGIN_INTERFACE_H_ +#define _ETH_PLUGIN_INTERFACE_H_ #include "os.h" #include "cx.h" @@ -179,4 +178,4 @@ typedef struct ethQueryContractUI_t { } ethQueryContractUI_t; -#endif +#endif // _ETH_PLUGIN_INTERFACE_H_ diff --git a/src/eth_plugin_internal.h b/src/eth_plugin_internal.h index 3285d73..f475797 100644 --- a/src/eth_plugin_internal.h +++ b/src/eth_plugin_internal.h @@ -1,4 +1,5 @@ -#ifndef __ETH_PLUGIN_INTERNAL_H__ +#ifndef _ETH_PLUGIN_INTERNAL_H_ +#define _ETH_PLUGIN_INTERNAL_H_ #include "eth_plugin_interface.h" @@ -45,4 +46,4 @@ extern const uint8_t* const STARKWARE_SELECTORS[NUM_STARKWARE_SELECTORS]; extern internalEthPlugin_t const INTERNAL_ETH_PLUGINS[]; -#endif +#endif // _ETH_PLUGIN_INTERNAL_H_ diff --git a/src/nft.h b/src/nft.h index 0ddda84..7c8b836 100644 --- a/src/nft.h +++ b/src/nft.h @@ -1,3 +1,6 @@ +#ifndef _NFT_H_ +#define _NFT_H_ + #include "tokens.h" #define COLLECTION_NAME_MAX_LEN 70 @@ -6,3 +9,5 @@ typedef struct nftInfo_t { uint8_t contractAddress[ADDRESS_LENGTH]; // must be first item char collectionName[COLLECTION_NAME_MAX_LEN + 1]; } nftInfo_t; + +#endif // _NFT_H_ diff --git a/src/poorstream.h b/src/poorstream.h index 7890687..6ac17a5 100644 --- a/src/poorstream.h +++ b/src/poorstream.h @@ -1,5 +1,5 @@ -#ifndef __POORSTREAM_H__ -#define __POORSTREAM_H__ +#ifndef _POORSTREAM_H_ +#define _POORSTREAM_H_ #include #include @@ -18,4 +18,4 @@ void poorstream_init(poorstream_t *stream, uint8_t *buffer); void poorstream_flush(poorstream_t *stream); void poorstream_write_bits(poorstream_t *stream, uint64_t bits, uint32_t num_bits); -#endif +#endif // _POORSTREAM_H_ diff --git a/src/shared_context.h b/src/shared_context.h index 43dc533..b8ea64b 100644 --- a/src/shared_context.h +++ b/src/shared_context.h @@ -1,6 +1,5 @@ -#ifndef __SHARED_CONTEXT_H__ - -#define __SHARED_CONTEXT_H__ +#ifndef _SHARED_CONTEXT_H_ +#define _SHARED_CONTEXT_H_ #include #include @@ -221,4 +220,4 @@ extern uint32_t eth2WithdrawalIndex; void reset_app_context(void); -#endif // __SHARED_CONTEXT_H__ +#endif // _SHARED_CONTEXT_H_ diff --git a/src/stark_crypto.h b/src/stark_crypto.h index 635cb79..5ce1be3 100644 --- a/src/stark_crypto.h +++ b/src/stark_crypto.h @@ -1,5 +1,5 @@ -#ifndef __STARK_CRYPTO_H__ -#define __STARK_CRYPTO_H__ +#ifndef _STARK_CRYPTO_H_ +#define _STARK_CRYPTO_H_ #include #include @@ -18,4 +18,4 @@ void pedersen(FieldElement res, /* out */ FieldElement a, FieldElement b); -#endif +#endif // _STARK_CRYPTO_H_ diff --git a/src/stark_utils.h b/src/stark_utils.h index aaf9d17..9ba69a2 100644 --- a/src/stark_utils.h +++ b/src/stark_utils.h @@ -1,5 +1,5 @@ -#ifndef __STARK_UTILS_H__ -#define __STARK_UTILS_H__ +#ifndef _STARK_UTILS_H_ +#define _STARK_UTILS_H_ #include #include @@ -32,4 +32,4 @@ int stark_sign(uint8_t *signature, /* out */ FieldElement msg, FieldElement condition); -#endif +#endif // _STARK_UTILS_H_ diff --git a/src/swap_lib_calls.h b/src/swap_lib_calls.h index c041964..937d610 100644 --- a/src/swap_lib_calls.h +++ b/src/swap_lib_calls.h @@ -1,5 +1,5 @@ -#ifndef SWAP_LIB_CALLS -#define SWAP_LIB_CALLS +#ifndef _SWAP_LIB_CALLS_H_ +#define _SWAP_LIB_CALLS_H_ #include "stdbool.h" @@ -50,4 +50,4 @@ typedef struct create_transaction_parameters_s { char* destination_address_extra_id; } create_transaction_parameters_t; -#endif +#endif // _SWAP_LIB_CALLS_H_ diff --git a/src/tokens.h b/src/tokens.h index 53a354e..ea69628 100644 --- a/src/tokens.h +++ b/src/tokens.h @@ -141,4 +141,4 @@ extern tokenDefinition_t const TOKENS_SHYFT[NUM_TOKENS_SHYFT]; #endif /* HAVE_TOKENS_LIST */ -#endif /* _TOKENS_H_ */ +#endif // _TOKENS_H_ diff --git a/src/ui_callbacks.h b/src/ui_callbacks.h index e7e78ab..a1a74cd 100644 --- a/src/ui_callbacks.h +++ b/src/ui_callbacks.h @@ -1,3 +1,6 @@ +#ifndef _UI_CALLBACKS_H_ +#define _UI_CALLBACKS_H_ + #include "shared_context.h" #include "ux.h" @@ -22,3 +25,5 @@ void io_seproxyhal_send_status(uint32_t sw); void format_signature_out(const uint8_t *signature); void finalizeParsing(bool direct); extraInfo_t *getKnownToken(uint8_t *contractAddress); + +#endif // _UI_CALLBACKS_H_ diff --git a/src/ui_flow.h b/src/ui_flow.h index 8797b95..aadc40d 100644 --- a/src/ui_flow.h +++ b/src/ui_flow.h @@ -1,3 +1,6 @@ +#ifndef _UI_FLOW_H_ +#define _UI_FLOW_H_ + #include "shared_context.h" #include "os_io_seproxyhal.h" @@ -52,3 +55,5 @@ extern const ux_flow_step_t* const ux_approval_starkware_verify_escape_flow[]; extern const ux_flow_step_t* const ux_stark_unsafe_sign_flow[]; #endif + +#endif // _UI_FLOW_H_ diff --git a/src/utils.h b/src/utils.h index be5ba3e..988ce08 100644 --- a/src/utils.h +++ b/src/utils.h @@ -41,4 +41,4 @@ void amountToString(const uint8_t* amount, bool parse_swap_config(uint8_t* config, uint8_t config_len, char* ticker, uint8_t* decimals); -#endif /* _UTILS_H_ */ \ No newline at end of file +#endif // _UTILS_H_ diff --git a/src_common/ethUstream.h b/src_common/ethUstream.h index e73cc95..f63dd65 100644 --- a/src_common/ethUstream.h +++ b/src_common/ethUstream.h @@ -164,4 +164,4 @@ parserStatus_e continueTx(txContext_t *context); void copyTxData(txContext_t *context, uint8_t *out, uint32_t length); uint8_t readTxByte(txContext_t *context); -#endif /* _ETHUSTREAM_H_ */ \ No newline at end of file +#endif // _ETHUSTREAM_H_ diff --git a/src_common/ethUtils.h b/src_common/ethUtils.h index 1099080..eadd639 100644 --- a/src_common/ethUtils.h +++ b/src_common/ethUtils.h @@ -87,4 +87,4 @@ static __attribute__((no_instrument_function)) inline int ismaxint(uint8_t *buf, static const char HEXDIGITS[] = "0123456789abcdef"; -#endif /* _ETHUTILS_H_ */ +#endif // _ETHUTILS_H_ diff --git a/src_common/network.h b/src_common/network.h index 7a6d2fc..8a4513a 100644 --- a/src_common/network.h +++ b/src_common/network.h @@ -1,3 +1,6 @@ +#ifndef _NETWORK_H_ +#define _NETWORK_H_ + #include #include "tokens.h" #include "shared_context.h" @@ -17,4 +20,6 @@ const network_info_t *get_network(void); // Returns a pointer to the network name, or NULL if there is none. const char *get_network_name(void); // Returns a pointer to the network ticker, or chainConfig->coinName if there is none. -const char *get_network_ticker(void); \ No newline at end of file +const char *get_network_ticker(void); + +#endif // _NETWORK_H_ diff --git a/src_common/uint256.h b/src_common/uint256.h index c55cd0c..5683c3e 100644 --- a/src_common/uint256.h +++ b/src_common/uint256.h @@ -73,4 +73,4 @@ void divmod256(uint256_t *l, uint256_t *r, uint256_t *div, uint256_t *mod); bool tostring128(uint128_t *number, uint32_t base, char *out, uint32_t outLength); bool tostring256(uint256_t *number, uint32_t base, char *out, uint32_t outLength); -#endif /* _UINT256_H_ */ \ No newline at end of file +#endif // _UINT256_H_ diff --git a/src_features/getEth2PublicKey/feature_getEth2PublicKey.h b/src_features/getEth2PublicKey/feature_getEth2PublicKey.h index 3b6dbe2..3d302f4 100644 --- a/src_features/getEth2PublicKey/feature_getEth2PublicKey.h +++ b/src_features/getEth2PublicKey/feature_getEth2PublicKey.h @@ -1,3 +1,8 @@ +#ifndef _GET_ETH2_PUB_KEY_H_ +#define _GET_ETH2_PUB_KEY_H_ + #include "shared_context.h" uint32_t set_result_get_eth2_publicKey(void); + +#endif // _GET_ETH2_PUB_KEY_H_ diff --git a/src_features/getPublicKey/feature_getPublicKey.h b/src_features/getPublicKey/feature_getPublicKey.h index e8e041a..8f819ba 100644 --- a/src_features/getPublicKey/feature_getPublicKey.h +++ b/src_features/getPublicKey/feature_getPublicKey.h @@ -1,3 +1,8 @@ +#ifndef _GET_PUB_KEY_H_ +#define _GET_PUB_KEY_H_ + #include "shared_context.h" uint32_t set_result_get_publicKey(void); + +#endif // _GET_PUB_KEY_H_ diff --git a/src_features/setEth2WithdrawalIndex/withdrawal_index.h b/src_features/setEth2WithdrawalIndex/withdrawal_index.h index 497b489..bf9d6a3 100644 --- a/src_features/setEth2WithdrawalIndex/withdrawal_index.h +++ b/src_features/setEth2WithdrawalIndex/withdrawal_index.h @@ -1,3 +1,6 @@ +#ifndef _SET_WITHDRAWAL_INDEX_H_ +#define _SET_WITHDRAWAL_INDEX_H_ + #include "stdint.h" void handleSetEth2WithdrawalIndex(uint8_t p1, @@ -5,4 +8,6 @@ void handleSetEth2WithdrawalIndex(uint8_t p1, uint8_t *dataBuffer, uint16_t dataLength, unsigned int *flags, - unsigned int *tx); \ No newline at end of file + unsigned int *tx); + +#endif // _SET_WITHDRAWAL_INDEX_H_ diff --git a/src_features/signTx/feature_signTx.h b/src_features/signTx/feature_signTx.h index 24400da..84d2cd5 100644 --- a/src_features/signTx/feature_signTx.h +++ b/src_features/signTx/feature_signTx.h @@ -1,3 +1,6 @@ +#ifndef _SIGN_TX_H_ +#define _SIGN_TX_H_ + #include "shared_context.h" typedef enum { @@ -12,3 +15,5 @@ void finalizeParsing(bool direct); void prepareFeeDisplay(); void prepareNetworkDisplay(); void ux_approve_tx(bool fromPlugin); + +#endif // _SIGN_TX_H_ diff --git a/src_features/signTx/ui_plugin.h b/src_features/signTx/ui_plugin.h index 28179b2..ae86b6a 100644 --- a/src_features/signTx/ui_plugin.h +++ b/src_features/signTx/ui_plugin.h @@ -1,5 +1,8 @@ -#pragma once +#ifndef _UI_PLUGIN_H_ +#define _UI_PLUGIN_H_ void plugin_ui_get_id(); void plugin_ui_get_item(); -void display_next_plugin_item(bool entering); \ No newline at end of file +void display_next_plugin_item(bool entering); + +#endif // _UI_PLUGIN_H_ diff --git a/src_features/stark_getPublicKey/feature_stark_getPublicKey.h b/src_features/stark_getPublicKey/feature_stark_getPublicKey.h index bb50747..4859722 100644 --- a/src_features/stark_getPublicKey/feature_stark_getPublicKey.h +++ b/src_features/stark_getPublicKey/feature_stark_getPublicKey.h @@ -1,3 +1,8 @@ +#ifndef _STARK_GET_PUB_KEY_H_ +#define _STARK_GET_PUB_KEY_H_ + #include "shared_context.h" uint32_t set_result_get_stark_publicKey(void); + +#endif // _STARK_GET_PUB_KEY_H_ diff --git a/src_plugins/erc1155/erc1155_plugin.h b/src_plugins/erc1155/erc1155_plugin.h index 0702fdf..691ebdf 100644 --- a/src_plugins/erc1155/erc1155_plugin.h +++ b/src_plugins/erc1155/erc1155_plugin.h @@ -1,6 +1,7 @@ -#ifdef HAVE_NFT_SUPPORT +#ifndef _ERC1155_PLUGIN_H_ +#define _ERC1155_PLUGIN_H_ -#pragma once +#ifdef HAVE_NFT_SUPPORT #include #include "eth_plugin_handler.h" @@ -53,3 +54,5 @@ void handle_provide_parameter_1155(void *parameters); void handle_query_contract_ui_1155(void *parameters); #endif // HAVE_NFT_SUPPORT + +#endif // _ERC1155_PLUGIN_H_ diff --git a/src_plugins/erc721/erc721_plugin.h b/src_plugins/erc721/erc721_plugin.h index 1846609..9c0f5c3 100644 --- a/src_plugins/erc721/erc721_plugin.h +++ b/src_plugins/erc721/erc721_plugin.h @@ -1,6 +1,7 @@ -#ifdef HAVE_NFT_SUPPORT +#ifndef _ERC721_PLUGIN_H_ +#define _ERC721_PLUGIN_H_ -#pragma once +#ifdef HAVE_NFT_SUPPORT #include #include "eth_plugin_handler.h" @@ -44,3 +45,5 @@ void handle_provide_parameter_721(void *parameters); void handle_query_contract_ui_721(void *parameters); #endif // HAVE_NFT_SUPPORT + +#endif // _ERC721_PLUGIN_H_