Bugfixes for stack size and market cap with small chars, write tests for the small char mcap

This commit is contained in:
Djuri 2024-09-28 00:03:18 +02:00
parent e8a9e253f7
commit 85579e98cf
7 changed files with 162 additions and 15 deletions

View file

@ -220,7 +220,7 @@ std::array<std::string, NUM_SCREENS> parseMarketCap(std::uint32_t blockHeight, s
std::array<std::string, NUM_SCREENS> ret;
std::uint32_t firstIndex = 0;
double supply = getSupplyAtBlock(blockHeight);
int64_t marketCap = static_cast<std::int64_t>(supply * double(price));
uint64_t marketCap = static_cast<std::uint64_t>(supply * double(price));
ret[0] = getCurrencyCode(currencySymbol) + "/MCAP";
@ -256,7 +256,7 @@ std::array<std::string, NUM_SCREENS> parseMarketCap(std::uint32_t blockHeight, s
ret[i] = "";
}
ret[NUM_SCREENS - groups - 1] = " $ ";
ret[NUM_SCREENS - groups - 1] = std::string(" ") + currencySymbol + " ";
for (std::uint32_t i = 0; i < groups; i++)
{
ret[(NUM_SCREENS - groups + i)] = stringValue.substr(i * 3, 3).c_str();

View file

@ -68,7 +68,8 @@ std::string formatNumberWithSuffix(std::uint64_t num, int numCharacters)
}
else
{
sprintf(result, "%llu", (unsigned long long)num);
snprintf(result, sizeof(result), "%llu", (unsigned long long)num);
// sprintf(result, "%llu", (unsigned long long)num);
return result;
}