Skip to content
Snippets Groups Projects
Commit 68e49672 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Fix 4-digit bug in separat_thousand() used for 'T' @-code format modifier

I noticed while testing the previous commit that 4 digit values weren't
thousands-separated, while larger values were. I'm not sure why this
non-zero index check was in this loop, but appears to be a bug.
parent 413c3387
No related branches found
No related tags found
No related merge requests found
...@@ -46,7 +46,7 @@ static char* separate_thousands(const char* src, char *dest, size_t maxlen, char ...@@ -46,7 +46,7 @@ static char* separate_thousands(const char* src, char *dest, size_t maxlen, char
char* d = dest; char* d = dest;
for(size_t i = 0; i < digits; d++, i++) { for(size_t i = 0; i < digits; d++, i++) {
*d = src[i]; *d = src[i];
if(i && i + 3 < digits && (digits - (i + 1)) % 3 == 0) if(i + 3 < digits && (digits - (i + 1)) % 3 == 0)
*(++d) = sep; *(++d) = sep;
} }
*d = 0; *d = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment