mirror of
https://gitlab.com/bztsrc/posix-uefi.git
synced 2025-01-01 03:25:52 +01:00
Remove decimal clip above 99999999999999999 in printf
This commit is contained in:
parent
ce585de3cb
commit
55bb611ff4
1 changed files with 4 additions and 7 deletions
11
uefi/stdio.c
11
uefi/stdio.c
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue