Unify the include guards accross all header files

This commit is contained in:
Alexandre Paillier
2022-03-07 14:21:32 +01:00
parent 89070cd2be
commit c548aba364
27 changed files with 97 additions and 38 deletions

View File

@@ -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_

View File

@@ -69,4 +69,4 @@ typedef struct chain_config_s {
#define ETHEREUM_MAINNET_CHAINID 1
#endif /* _CHAIN_CONFIG_H_ */
#endif // _CHAIN_CONFIG_H_

View File

@@ -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_

View File

@@ -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_

View File

@@ -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_

View File

@@ -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_

View File

@@ -1,5 +1,5 @@
#ifndef __POORSTREAM_H__
#define __POORSTREAM_H__
#ifndef _POORSTREAM_H_
#define _POORSTREAM_H_
#include <stdbool.h>
#include <stdint.h>
@@ -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_

View File

@@ -1,6 +1,5 @@
#ifndef __SHARED_CONTEXT_H__
#define __SHARED_CONTEXT_H__
#ifndef _SHARED_CONTEXT_H_
#define _SHARED_CONTEXT_H_
#include <stdbool.h>
#include <stdint.h>
@@ -221,4 +220,4 @@ extern uint32_t eth2WithdrawalIndex;
void reset_app_context(void);
#endif // __SHARED_CONTEXT_H__
#endif // _SHARED_CONTEXT_H_

View File

@@ -1,5 +1,5 @@
#ifndef __STARK_CRYPTO_H__
#define __STARK_CRYPTO_H__
#ifndef _STARK_CRYPTO_H_
#define _STARK_CRYPTO_H_
#include <stdbool.h>
#include <stdint.h>
@@ -18,4 +18,4 @@ void pedersen(FieldElement res, /* out */
FieldElement a,
FieldElement b);
#endif
#endif // _STARK_CRYPTO_H_

View File

@@ -1,5 +1,5 @@
#ifndef __STARK_UTILS_H__
#define __STARK_UTILS_H__
#ifndef _STARK_UTILS_H_
#define _STARK_UTILS_H_
#include <stdbool.h>
#include <stdint.h>
@@ -32,4 +32,4 @@ int stark_sign(uint8_t *signature, /* out */
FieldElement msg,
FieldElement condition);
#endif
#endif // _STARK_UTILS_H_

View File

@@ -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_

View File

@@ -141,4 +141,4 @@ extern tokenDefinition_t const TOKENS_SHYFT[NUM_TOKENS_SHYFT];
#endif /* HAVE_TOKENS_LIST */
#endif /* _TOKENS_H_ */
#endif // _TOKENS_H_

View File

@@ -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_

View File

@@ -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_

View File

@@ -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_ */
#endif // _UTILS_H_

View File

@@ -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_ */
#endif // _ETHUSTREAM_H_

View File

@@ -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_

View File

@@ -1,3 +1,6 @@
#ifndef _NETWORK_H_
#define _NETWORK_H_
#include <stdint.h>
#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);
const char *get_network_ticker(void);
#endif // _NETWORK_H_

View File

@@ -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_ */
#endif // _UINT256_H_

View File

@@ -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_

View File

@@ -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_

View File

@@ -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);
unsigned int *tx);
#endif // _SET_WITHDRAWAL_INDEX_H_

View File

@@ -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_

View File

@@ -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);
void display_next_plugin_item(bool entering);
#endif // _UI_PLUGIN_H_

View File

@@ -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_

View File

@@ -1,6 +1,7 @@
#ifdef HAVE_NFT_SUPPORT
#ifndef _ERC1155_PLUGIN_H_
#define _ERC1155_PLUGIN_H_
#pragma once
#ifdef HAVE_NFT_SUPPORT
#include <string.h>
#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_

View File

@@ -1,6 +1,7 @@
#ifdef HAVE_NFT_SUPPORT
#ifndef _ERC721_PLUGIN_H_
#define _ERC721_PLUGIN_H_
#pragma once
#ifdef HAVE_NFT_SUPPORT
#include <string.h>
#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_