Change type of output length in amountToString

Defining out_buffer_size as uint8_t triggers warnings with static
analysers when sizeof() is used on the output buffer.

There is no reason to use uint8_t here.
This commit is contained in:
Jean-Baptiste Bédrune
2022-02-04 17:52:52 +01:00
parent 89fddf3ef8
commit ed4e10628a
4 changed files with 8 additions and 8 deletions

View File

@@ -115,7 +115,7 @@ void amountToString(const uint8_t *amount,
uint8_t decimals,
const char *ticker,
char *out_buffer,
uint8_t out_buffer_size) {
size_t out_buffer_size) {
char tmp_buffer[100] = {0};
if (uint256_to_decimal(amount, amount_size, tmp_buffer, sizeof(tmp_buffer)) == false) {

View File

@@ -37,7 +37,7 @@ void amountToString(const uint8_t* amount,
uint8_t decimals,
const char* ticker,
char* out_buffer,
uint8_t out_buffer_size);
size_t out_buffer_size);
bool parse_swap_config(uint8_t* config, uint8_t config_len, char* ticker, uint8_t* decimals);

View File

@@ -243,10 +243,10 @@ uint8_t *getNftContractAddress(const ethQueryContractUI_t *const msg) {
: msg->pluginSharedRO->txContent->destination);
}
bool adjustDecimals(char *src,
uint32_t srcLength,
bool adjustDecimals(const char *src,
size_t srcLength,
char *target,
uint32_t targetLength,
size_t targetLength,
uint8_t decimals) {
uint32_t startOffset;
uint32_t lastZeroOffset = 0;

View File

@@ -61,10 +61,10 @@ void getEthDisplayableAddress(uint8_t *in,
uint8_t *getNftContractAddress(const ethQueryContractUI_t *const msg);
bool adjustDecimals(char *src,
uint32_t srcLength,
bool adjustDecimals(const char *src,
size_t srcLength,
char *target,
uint32_t targetLength,
size_t targetLength,
uint8_t decimals);
static __attribute__((no_instrument_function)) inline int allzeroes(void *buf, size_t n) {