Cast the integer read as the first argument for %b to an unsigned integer

so it's value is not sign extended when assigned to the uintmax_t variable
used internally by printf.  For example, if bit 31 is set in the cpuid
feature word, then %b would print out the initial value as a 16 character
hexadecimal value.  Now it only prints out an 8 character value.

Reviewed by:	bde
This commit is contained in:
John Baldwin 2003-01-07 18:17:18 +00:00
parent d1dd69d35d
commit 377a66bc40

View File

@ -560,7 +560,7 @@ reswitch: switch (ch = (u_char)*fmt++) {
width = n;
goto reswitch;
case 'b':
num = va_arg(ap, int);
num = (u_int)va_arg(ap, int);
p = va_arg(ap, char *);
for (q = ksprintn(nbuf, num, *p++, NULL); *q;)
PCHAR(*q--);