msvcrt: Don't add 0x prefix while printing 0 with printf.
This commit is contained in:
parent
b6db22da3b
commit
2693ce1a25
|
@ -265,9 +265,11 @@ static inline void FUNC_NAME(pf_integer_conv)(APICHAR *buf, int buf_len,
|
||||||
}
|
}
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
if(x==0 && flags->Precision)
|
if(x == 0) {
|
||||||
|
flags->Alternate = 0;
|
||||||
|
if(flags->Precision)
|
||||||
buf[i++] = '0';
|
buf[i++] = '0';
|
||||||
else {
|
} else {
|
||||||
while(x != 0) {
|
while(x != 0) {
|
||||||
j = (ULONGLONG)x%base;
|
j = (ULONGLONG)x%base;
|
||||||
x = (ULONGLONG)x/base;
|
x = (ULONGLONG)x/base;
|
||||||
|
|
|
@ -329,18 +329,52 @@ static void test_sprintf( void )
|
||||||
format = "%#012x";
|
format = "%#012x";
|
||||||
r = sprintf(buffer,format,1);
|
r = sprintf(buffer,format,1);
|
||||||
ok(!strcmp(buffer,"0x0000000001"),"Hexadecimal zero-padded \"%s\"\n",buffer);
|
ok(!strcmp(buffer,"0x0000000001"),"Hexadecimal zero-padded \"%s\"\n",buffer);
|
||||||
|
ok( r==12, "return count wrong\n");
|
||||||
|
|
||||||
|
r = sprintf(buffer,format,0);
|
||||||
|
ok(!strcmp(buffer,"000000000000"),"Hexadecimal zero-padded \"%s\"\n",buffer);
|
||||||
|
ok( r==12, "return count wrong\n");
|
||||||
|
|
||||||
format = "%#04.8x";
|
format = "%#04.8x";
|
||||||
r = sprintf(buffer,format,1);
|
r = sprintf(buffer,format,1);
|
||||||
ok(!strcmp(buffer,"0x00000001"), "Hexadecimal zero-padded precision \"%s\"\n",buffer);
|
ok(!strcmp(buffer,"0x00000001"), "Hexadecimal zero-padded precision \"%s\"\n",buffer);
|
||||||
|
ok( r==10, "return count wrong\n");
|
||||||
|
|
||||||
|
r = sprintf(buffer,format,0);
|
||||||
|
ok(!strcmp(buffer,"00000000"), "Hexadecimal zero-padded precision \"%s\"\n",buffer);
|
||||||
|
ok( r==8, "return count wrong\n");
|
||||||
|
|
||||||
format = "%#-08.2x";
|
format = "%#-08.2x";
|
||||||
r = sprintf(buffer,format,1);
|
r = sprintf(buffer,format,1);
|
||||||
ok(!strcmp(buffer,"0x01 "), "Hexadecimal zero-padded not left-adjusted \"%s\"\n",buffer);
|
ok(!strcmp(buffer,"0x01 "), "Hexadecimal zero-padded not left-adjusted \"%s\"\n",buffer);
|
||||||
|
ok( r==8, "return count wrong\n");
|
||||||
|
|
||||||
|
r = sprintf(buffer,format,0);
|
||||||
|
ok(!strcmp(buffer,"00 "), "Hexadecimal zero-padded not left-adjusted \"%s\"\n",buffer);
|
||||||
|
ok( r==8, "return count wrong\n");
|
||||||
|
|
||||||
|
format = "%#.0x";
|
||||||
|
r = sprintf(buffer,format,1);
|
||||||
|
ok(!strcmp(buffer,"0x1"), "Hexadecimal zero-padded zero-precision \"%s\"\n",buffer);
|
||||||
|
ok( r==3, "return count wrong\n");
|
||||||
|
|
||||||
|
r = sprintf(buffer,format,0);
|
||||||
|
ok(!strcmp(buffer,""), "Hexadecimal zero-padded zero-precision \"%s\"\n",buffer);
|
||||||
|
ok( r==0, "return count wrong\n");
|
||||||
|
|
||||||
format = "%#08o";
|
format = "%#08o";
|
||||||
r = sprintf(buffer,format,1);
|
r = sprintf(buffer,format,1);
|
||||||
ok(!strcmp(buffer,"00000001"), "Octal zero-padded \"%s\"\n",buffer);
|
ok(!strcmp(buffer,"00000001"), "Octal zero-padded \"%s\"\n",buffer);
|
||||||
|
ok( r==8, "return count wrong\n");
|
||||||
|
|
||||||
|
format = "%#o";
|
||||||
|
r = sprintf(buffer,format,1);
|
||||||
|
ok(!strcmp(buffer,"01"), "Octal zero-padded \"%s\"\n",buffer);
|
||||||
|
ok( r==2, "return count wrong\n");
|
||||||
|
|
||||||
|
r = sprintf(buffer,format,0);
|
||||||
|
ok(!strcmp(buffer,"0"), "Octal zero-padded \"%s\"\n",buffer);
|
||||||
|
ok( r==1, "return count wrong\n");
|
||||||
|
|
||||||
if (sizeof(void *) == 8)
|
if (sizeof(void *) == 8)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue