1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 20:37:34 +00:00

printf: %w, %b, and %p should be zero-padded but not left-padded

This fixes the goofy issue with %p coming out as "     0x123" instead
of "0x00000123".
This commit is contained in:
Andreas Kling 2019-09-11 20:08:11 +02:00
parent 292b89b2e8
commit 81caf95136

View file

@ -331,11 +331,11 @@ template<typename PutChFunc>
break; break;
case 'w': case 'w':
ret += print_hex(putch, bufptr, va_arg(ap, int), false, alternate_form, true, true, 4); ret += print_hex(putch, bufptr, va_arg(ap, int), false, alternate_form, false, true, 4);
break; break;
case 'b': case 'b':
ret += print_hex(putch, bufptr, va_arg(ap, int), false, alternate_form, true, true, 2); ret += print_hex(putch, bufptr, va_arg(ap, int), false, alternate_form, false, true, 2);
break; break;
case 'c': case 'c':
@ -350,7 +350,7 @@ template<typename PutChFunc>
case 'P': case 'P':
case 'p': case 'p':
ret += print_hex(putch, bufptr, va_arg(ap, u32), *p == 'P', true, true, true, 8); ret += print_hex(putch, bufptr, va_arg(ap, u32), *p == 'P', true, false, true, 8);
break; break;
default: default:
dbg() << "printf_internal: Unimplemented format specifier " << *p; dbg() << "printf_internal: Unimplemented format specifier " << *p;