Fix printing long hex

This commit is contained in:
Mathieu Maret 2024-02-11 23:56:45 +01:00 committed by Mathieu Maret
parent cb5e408525
commit f8b1b2c5a7

View File

@ -425,7 +425,8 @@ int vsnprintf(char *str, size_t size, const char *format, va_list ap)
case 'x': { case 'x': {
char val[sizeof(long long int) * 2]; char val[sizeof(long long int) * 2];
unsigned int valIdx = 0; unsigned int valIdx = 0;
long long int d = va_arg(ap, long long int); unsigned long long int d =
va_arg(ap, unsigned long long int);
itoa(d, val, 16); itoa(d, val, 16);
if (str) { if (str) {
while (val[valIdx]) { while (val[valIdx]) {
@ -453,7 +454,7 @@ int vsnprintf(char *str, size_t size, const char *format, va_list ap)
case 'x': { case 'x': {
char val[sizeof(int) * 2]; char val[sizeof(int) * 2];
unsigned int valIdx = 0; unsigned int valIdx = 0;
long int d = va_arg(ap, long int); unsigned long int d = va_arg(ap, unsigned long int);
itoa(d, val, 16); itoa(d, val, 16);
if (str) { if (str) {
while (val[valIdx]) { while (val[valIdx]) {