diff --git a/src_common/network.c b/src_common/network.c index f568855..392b7d5 100644 --- a/src_common/network.c +++ b/src_common/network.c @@ -45,27 +45,27 @@ uint64_t get_chain_id(void) { return chain_id; } -network_info_t *get_network(void) { +const network_info_t *get_network(void) { uint64_t chain_id = get_chain_id(); - for (uint8_t i = 0; i < sizeof(NETWORK_MAPPING) / sizeof(*NETWORK_MAPPING); i++) { + for (size_t i = 0; i < sizeof(NETWORK_MAPPING) / sizeof(*NETWORK_MAPPING); i++) { if (NETWORK_MAPPING[i].chain_id == chain_id) { - return (network_info_t *) PIC(&NETWORK_MAPPING[i]); + return (const network_info_t *) PIC(&NETWORK_MAPPING[i]); } } return NULL; } -char *get_network_name(void) { - network_info_t *network = get_network(); +const char *get_network_name(void) { + const network_info_t *network = get_network(); if (network == NULL) { return NULL; } else { - return (char *) PIC(network->name); + return (const char *) PIC(network->name); } } -char *get_network_ticker(void) { - network_info_t *network = get_network(); +const char *get_network_ticker(void) { + const network_info_t *network = get_network(); if (network == NULL) { return chainConfig->coinName; } else { diff --git a/src_common/network.h b/src_common/network.h index 23bffc1..7a6d2fc 100644 --- a/src_common/network.h +++ b/src_common/network.h @@ -13,8 +13,8 @@ typedef struct network_info_s { // Returns the current chain id. Defaults to 0 if txType was not found. uint64_t get_chain_id(void); // Returns a pointer to the network struct, or NULL if there is none. -network_info_t *get_network(void); +const network_info_t *get_network(void); // Returns a pointer to the network name, or NULL if there is none. -char *get_network_name(void); +const char *get_network_name(void); // Returns a pointer to the network ticker, or chainConfig->coinName if there is none. -char *get_network_ticker(void); \ No newline at end of file +const char *get_network_ticker(void); \ No newline at end of file diff --git a/src_features/signTx/logic_signTx.c b/src_features/signTx/logic_signTx.c index 6c65cff..eb8e10f 100644 --- a/src_features/signTx/logic_signTx.c +++ b/src_features/signTx/logic_signTx.c @@ -214,7 +214,7 @@ static void computeFees(txInt256_t *BEgasPrice, txInt256_t *BEgasLimit, uint256_ } static void feesToString(uint256_t *rawFee, char *displayBuffer, uint32_t displayBufferSize) { - char *feeTicker = get_network_ticker(); + const char *feeTicker = get_network_ticker(); uint8_t tickerOffset = 0; uint32_t i; @@ -261,7 +261,7 @@ void prepareFeeDisplay() { } void prepareNetworkDisplay() { - char *name = get_network_name(); + const char *name = get_network_name(); if (name == NULL) { // No network name found so simply copy the chain ID as the network name. uint64_t chain_id = get_chain_id(); @@ -296,7 +296,7 @@ static void get_public_key(uint8_t *out, uint8_t outLength) { void finalizeParsing(bool direct) { char displayBuffer[50]; uint8_t decimals = WEI_TO_ETHER; - char *ticker = get_network_ticker(); + const char *ticker = get_network_ticker(); ethPluginFinalize_t pluginFinalize; bool genericUI = true;