Removes useless space at the end of tickers

This commit is contained in:
Alexandre Paillier
2023-01-10 14:12:39 +01:00
parent 41c5d3e011
commit 74f880dce9
10 changed files with 68 additions and 73 deletions

View File

@@ -63,12 +63,8 @@ void eth_plugin_prepare_query_contract_UI(ethQueryContractUI_t *queryContractUI,
queryContractUI->item2 = &tmpCtx.transactionContext.extraInfo[0];
}
strlcpy(queryContractUI->network_ticker, get_network_ticker(), MAX_TICKER_LEN);
queryContractUI->screenIndex = screenIndex;
strlcpy(queryContractUI->network_ticker,
get_network_ticker(),
sizeof(queryContractUI->network_ticker));
strlcpy(queryContractUI->network_ticker, get_network_ticker(), MAX_TICKER_LEN);
queryContractUI->title = title;
queryContractUI->titleLength = titleLength;
queryContractUI->msg = msg;

View File

@@ -20,8 +20,7 @@ int handle_get_printable_amount(get_printable_amount_parameters_t* params, chain
if (params->is_fee) {
uint8_t ticker_len = strnlen(config->coinName, sizeof(config->coinName));
memcpy(ticker, config->coinName, ticker_len);
ticker[ticker_len] = ' ';
ticker[ticker_len + 1] = '\0';
ticker[ticker_len] = '\0';
decimals = WEI_TO_ETHER;
} else {
// If the amount is *not* a fee, decimals and ticker are built from the given config

View File

@@ -918,7 +918,7 @@ void app_exit() {
void init_coin_config(chain_config_t *coin_config) {
memset(coin_config, 0, sizeof(chain_config_t));
strcpy(coin_config->coinName, CHAINID_COINNAME " ");
strcpy(coin_config->coinName, CHAINID_COINNAME);
coin_config->chainId = CHAIN_ID;
coin_config->kind = CHAIN_KIND;
}

View File

@@ -21,7 +21,7 @@
#include <stdint.h>
#include "ethUstream.h"
#define MAX_TICKER_LEN 12 // 10 characters + ' ' + '\0'
#define MAX_TICKER_LEN 11 // 10 characters + '\0'
#define MAX_ITEMS 2
typedef struct tokenDefinition_t {

View File

@@ -132,6 +132,9 @@ void amountToString(const uint8_t *amount,
uint8_t ticker_len = strnlen(ticker, MAX_TICKER_LEN);
memcpy(out_buffer, ticker, MIN(out_buffer_size, ticker_len));
if (ticker_len > 0) {
out_buffer[ticker_len++] = ' ';
}
if (adjustDecimals(tmp_buffer,
amount_len,
@@ -155,8 +158,7 @@ bool parse_swap_config(const uint8_t *config, uint8_t config_len, char *ticker,
}
memcpy(ticker, config + offset, ticker_len);
offset += ticker_len;
ticker[ticker_len] = ' ';
ticker[ticker_len + 1] = '\0';
ticker[ticker_len] = '\0';
if (config_len - offset < 1) {
return false;