Remove decimal clip above 99999999999999999 in printf

This commit is contained in:
bzt 2021-11-28 18:15:10 +01:00
parent ce585de3cb
commit 55bb611ff4

View file

@ -497,7 +497,7 @@ int vsnprintf(char_t *dst, size_t maxlen, const char_t *fmt, __builtin_va_list a
uint8_t *mem; uint8_t *mem;
int64_t arg; int64_t arg;
int len, sign, i, j; int len, sign, i, j;
char_t *p, *orig=dst, *end = dst + maxlen - 1, tmpstr[19], pad, n; char_t *p, *orig=dst, *end = dst + maxlen - 1, tmpstr[24], pad, n;
#if !defined(USE_UTF8) || !USE_UTF8 #if !defined(USE_UTF8) || !USE_UTF8
char *c; char *c;
#endif #endif
@ -536,10 +536,7 @@ int vsnprintf(char_t *dst, size_t maxlen, const char_t *fmt, __builtin_va_list a
arg*=-1; arg*=-1;
sign++; sign++;
} }
if(arg>99999999999999999L) { i=23;
arg=99999999999999999L;
}
i=18;
tmpstr[i]=0; tmpstr[i]=0;
do { do {
tmpstr[--i]=CL('0')+(arg%10); tmpstr[--i]=CL('0')+(arg%10);
@ -548,8 +545,8 @@ int vsnprintf(char_t *dst, size_t maxlen, const char_t *fmt, __builtin_va_list a
if(sign) { if(sign) {
tmpstr[--i]=CL('-'); tmpstr[--i]=CL('-');
} }
if(len>0 && len<18) { if(len>0 && len<21) {
while(i>18-len) { while(i>21-len) {
tmpstr[--i]=pad; tmpstr[--i]=pad;
} }
} }