stdio: add void 'l' format string qualifier

Wformat requires uint32_t to be used in format string with the 'l'
qualifier (l = long = at least 32 bits).
this qualifier was not handled before.
since on ARM 32-bit int == long we can simply ignore it (stdio
already does not support 64-bit data).

Change-Id: Ib506a66f68712c6b3eeb5129a39abf47ec86a2a7
This commit is contained in:
Kévin Redon
2018-08-28 19:36:58 +02:00
parent 80d9476602
commit 29200c6223

View File

@@ -350,7 +350,10 @@ signed int vsnprintf(char *pStr, size_t length, const char *pFormat, va_list ap)
} }
// Parse type // Parse type
do {
num = 0;
switch (*pFormat) { switch (*pFormat) {
case 'l': num = -1; break; // ignore long qualifier since int == long (and long long is not supported)
case 'd': case 'd':
case 'i': num = PutSignedInt(pStr, fill, width, va_arg(ap, signed int)); break; case 'i': num = PutSignedInt(pStr, fill, width, va_arg(ap, signed int)); break;
case 'u': num = PutUnsignedInt(pStr, fill, width, va_arg(ap, unsigned int)); break; case 'u': num = PutUnsignedInt(pStr, fill, width, va_arg(ap, unsigned int)); break;
@@ -361,8 +364,8 @@ signed int vsnprintf(char *pStr, size_t length, const char *pFormat, va_list ap)
default: default:
return EOF; return EOF;
} }
pFormat++; pFormat++;
} while (num < 0);
pStr += num; pStr += num;
size += num; size += num;
} }