oleaut32/vartest was using a lot of sprintfs where none is needed since ok supports printf-style formats (without the risk of buffer overflow). Changelog: * dlls/oleaut32/tests/vartest.c Pass the printf-style format directly to ok`, remove the unnecessary sprintfs Index: dlls/oleaut32/tests/vartest.c =================================================================== RCS file: /home/wine/wine/dlls/oleaut32/tests/vartest.c,v retrieving revision 1.4 diff -u -r1.4 vartest.c --- dlls/oleaut32/tests/vartest.c 21 Jun 2002 19:02:44 -0000 1.4 +++ dlls/oleaut32/tests/vartest.c 23 Dec 2002 03:25:09 -0000 @@ -2317,14 +2304,18 @@ d += ((i%9)+1) * pow( 10, i ); ok(S_OK == VarBstrFromR8( d, 0, 0, &bstr ), XOK); - sprintf(msg,"d is %g, should be cvt. to %s, but return val is %s",d,strfromr8[off],WtoA(bstr)); sprintf(xval,"\"%s\"",strfromr8[off]); - ok(!strcmp(xval,WtoA(bstr)),msg);off++; + ok(!strcmp(xval,WtoA(bstr)), + "d is %g, should be cvt. to %s, but return val is %s", + d,strfromr8[off],WtoA(bstr)); + off++; ok(S_OK == VarBstrFromR8( -d, 0, 0, &bstr ), XOK); - sprintf(msg,"d is %g, should be cvt. to %s, but return val is %s",-d,strfromr8[off],WtoA(bstr)); sprintf(xval,"\"%s\"",strfromr8[off]); - ok(!strcmp(xval,WtoA(bstr)),msg);off++; + ok(!strcmp(xval,WtoA(bstr)), + "d is %g, should be cvt. to %s, but return val is %s", + -d,strfromr8[off],WtoA(bstr)); + off++; } d=0; for( i=0; i<20; i++ ) @@ -2334,17 +2325,23 @@ */ d += ((i%9)+1) * pow( 10, (i*-1) ); ok(S_OK == VarBstrFromR8( d, 0, 0, &bstr ), XOK); - sprintf(msg,"d is %g, should be cvt. to %s, but return val is %s",d,strfromr8[off],WtoA(bstr)); sprintf(xval,"\"%s\"",strfromr8[off]); - ok(!strcmp(xval,WtoA(bstr)),msg);off++; + ok(!strcmp(xval,WtoA(bstr)), + "d is %g, should be cvt. to %s, but return val is %s", + d,strfromr8[off],WtoA(bstr)); + off++; ok(S_OK == VarBstrFromR8( d-1, 0, 0, &bstr ), XOK); - sprintf(msg,"d is %g, should be cvt. to %s, but return val is %s",d-1,strfromr8[off],WtoA(bstr)); sprintf(xval,"\"%s\"",strfromr8[off]); - ok(!strcmp(xval,WtoA(bstr)),msg);off++; + ok(!strcmp(xval,WtoA(bstr)), + "d is %g, should be cvt. to %s, but return val is %s", + d-1,strfromr8[off],WtoA(bstr)); + off++; ok(S_OK == VarBstrFromR8( -d, 0, 0, &bstr ), XOK); - sprintf(msg,"d is %g, should be cvt. to %s, but return val is %s",-d,strfromr8[off],WtoA(bstr)); sprintf(xval,"\"%s\"",strfromr8[off]); - ok(!strcmp(xval,WtoA(bstr)),msg);off++; + ok(!strcmp(xval,WtoA(bstr)), + "d is %g, should be cvt. to %s, but return val is %s", + -d,strfromr8[off],WtoA(bstr)); + off++; } d=0; @@ -2358,13 +2355,17 @@ */ d += ((i%9)+1) * pow( 10, (i*-1) ); ok(S_OK == VarBstrFromR8( d, 0, 0, &bstr ), XOK); - sprintf(msg,"d is %g, should be cvt. to %s, but return val is %s",d,strfromr8[off],WtoA(bstr)); sprintf(xval,"\"%s\"",strfromr8[off]); - ok(!strcmp(xval,WtoA(bstr)),msg);off++; + ok(!strcmp(xval,WtoA(bstr)), + "d is %g, should be cvt. to %s, but return val is %s", + d,strfromr8[off],WtoA(bstr)); + off++; ok(S_OK == VarBstrFromR8( -d, 0, 0, &bstr ), XOK); - sprintf(msg,"d is %g, should be cvt. to %s, but return val is %s",-d,strfromr8[off],WtoA(bstr)); sprintf(xval,"\"%s\"",strfromr8[off]); - ok(!strcmp(xval,WtoA(bstr)),msg);off++; + ok(!strcmp(xval,WtoA(bstr)), + "d is %g, should be cvt. to %s, but return val is %s", + -d,strfromr8[off],WtoA(bstr)); + off++; } @@ -2377,13 +2378,17 @@ */ d += ((i%9)+1) * pow( 10, i ); ok(S_OK == VarBstrFromR4( (float)d, 0, 0, &bstr ), XOK); - sprintf(msg,"d is %g, should be cvt. to %s, but return val is %s",d,strfromr8[off],WtoA(bstr)); sprintf(xval,"\"%s\"",strfromr8[off]); - ok(!strcmp(xval,WtoA(bstr)),msg);off++; + ok(!strcmp(xval,WtoA(bstr)), + "d is %g, should be cvt. to %s, but return val is %s", + d,strfromr8[off],WtoA(bstr)); + off++; ok(S_OK == VarBstrFromR4( (float)-d, 0, 0, &bstr ), XOK); - sprintf(msg,"d is %g, should be cvt. to %s, but return val is %s",-d,strfromr8[off],WtoA(bstr)); sprintf(xval,"\"%s\"",strfromr8[off]); - ok(!strcmp(xval,WtoA(bstr)),msg);off++; + ok(!strcmp(xval,WtoA(bstr)), + "d is %g, should be cvt. to %s, but return val is %s", + -d,strfromr8[off],WtoA(bstr)); + off++; } d=0; for( i=0; i<10; i++ ) @@ -2393,17 +2398,23 @@ */ d += ((i%9)+1) * pow( 10, (i*-1) ); ok(S_OK == VarBstrFromR4( (float)d, 0, 0, &bstr ), XOK); - sprintf(msg,"d is %g, should be cvt. to %s, but return val is %s",d,strfromr8[off],WtoA(bstr)); sprintf(xval,"\"%s\"",strfromr8[off]); - ok(!strcmp(xval,WtoA(bstr)),msg);off++; + ok(!strcmp(xval,WtoA(bstr)), + "d is %g, should be cvt. to %s, but return val is %s", + d,strfromr8[off],WtoA(bstr)); + off++; ok(S_OK == VarBstrFromR4( (float)d-1, 0, 0, &bstr ), XOK); - sprintf(msg,"d is %g, should be cvt. to %s, but return val is %s",d-1,strfromr8[off],WtoA(bstr)); sprintf(xval,"\"%s\"",strfromr8[off]); - ok(!strcmp(xval,WtoA(bstr)),msg);off++; + ok(!strcmp(xval,WtoA(bstr)), + "d is %g, should be cvt. to %s, but return val is %s", + d-1,strfromr8[off],WtoA(bstr)); + off++; ok(S_OK == VarBstrFromR4( (float)-d, 0, 0, &bstr ), XOK); - sprintf(msg,"d is %g, should be cvt. to %s, but return val is %s",-d,strfromr8[off],WtoA(bstr)); sprintf(xval,"\"%s\"",strfromr8[off]); - ok(!strcmp(xval,WtoA(bstr)),msg);off++; + ok(!strcmp(xval,WtoA(bstr)), + "d is %g, should be cvt. to %s, but return val is %s", + -d,strfromr8[off],WtoA(bstr)); + off++; } d=0; @@ -2417,13 +2428,17 @@ */ d += ((i%9)+1) * pow( 10, (i*-1) ); ok(S_OK == VarBstrFromR4( (float)d, 0, 0, &bstr ), XOK); - sprintf(msg,"d is %g, should be cvt. to %s, but return val is %s",d,strfromr8[off],WtoA(bstr)); sprintf(xval,"\"%s\"",strfromr8[off]); - ok(!strcmp(xval,WtoA(bstr)),msg);off++; + ok(!strcmp(xval,WtoA(bstr)), + "d is %g, should be cvt. to %s, but return val is %s", + d,strfromr8[off],WtoA(bstr)); + off++; ok(S_OK == VarBstrFromR4( (float)-d, 0, 0, &bstr ), XOK); - sprintf(msg,"d is %g, should be cvt. to %s, but return val is %s",-d,strfromr8[off],WtoA(bstr)); sprintf(xval,"\"%s\"",strfromr8[off]); - ok(!strcmp(xval,WtoA(bstr)),msg);off++; + ok(!strcmp(xval,WtoA(bstr)), + "d is %g, should be cvt. to %s, but return val is %s", + -d,strfromr8[off],WtoA(bstr)); + off++; } ok(S_OK == VarBstrFromBool( 0x00, 0, 0, &bstr ), XOK); @@ -2433,44 +2448,44 @@ ok(S_OK == VarBstrFromDate( 0.0, 0, 0, &bstr ), XOK); todo_wine { - sprintf(msg,"should be '12:00:00 AM', but is %s\n",WtoA(bstr)); - ok(!strcmp(WtoA(bstr),"\"12:00:00 AM\""),msg); + ok(!strcmp(WtoA(bstr),"\"12:00:00 AM\""), + "should be '12:00:00 AM', but is %s\n",WtoA(bstr)); } ok(S_OK == VarBstrFromDate( 3.34, 0, 0, &bstr ), XOK); todo_wine { - sprintf(msg,"should be '1/2/1900 8:09:36 AM', but is %s\n",WtoA(bstr)); - ok(!strcmp(WtoA(bstr),"\"1/2/1900 8:09:36 AM\""),msg); + ok(!strcmp(WtoA(bstr),"\"1/2/1900 8:09:36 AM\""), + "should be '1/2/1900 8:09:36 AM', but is %s\n",WtoA(bstr)); } ok(S_OK == VarBstrFromDate( 3339.34, 0, 0, &bstr ), XOK); todo_wine { - sprintf(msg,"should be '2/20/1909 8:09:36 AM', but is %s\n",WtoA(bstr)); - ok(!strcmp(WtoA(bstr),"\"2/20/1909 8:09:36 AM\""),msg); + ok(!strcmp(WtoA(bstr),"\"2/20/1909 8:09:36 AM\""), + "should be '2/20/1909 8:09:36 AM', but is %s\n",WtoA(bstr)); } ok(S_OK == VarBstrFromDate( 365.00, 0, 0, &bstr ), XOK); todo_wine { - sprintf(msg,"should be '12/30/1900', but is %s\n",WtoA(bstr)); - ok(!strcmp(WtoA(bstr),"\"12/30/1900\""),msg); + ok(!strcmp(WtoA(bstr),"\"12/30/1900\""), + "should be '12/30/1900', but is %s\n",WtoA(bstr)); } ok(S_OK == VarBstrFromDate( 365.25, 0, 0, &bstr ), XOK); todo_wine { - sprintf(msg,"should be '12/30/1900 6:00:00 AM', but is %s\n",WtoA(bstr)); - ok(!strcmp(WtoA(bstr),"\"12/30/1900 6:00:00 AM\""),msg); + ok(!strcmp(WtoA(bstr),"\"12/30/1900 6:00:00 AM\""), + "should be '12/30/1900 6:00:00 AM', but is %s\n",WtoA(bstr)); } ok(S_OK == VarBstrFromDate( 1461.0, 0, 0, &bstr ), XOK); todo_wine { - sprintf(msg,"should be '12/31/1903', but is %s\n",WtoA(bstr)); - ok(!strcmp(WtoA(bstr),"\"12/31/1903\""),msg); + ok(!strcmp(WtoA(bstr),"\"12/31/1903\""), + "should be '12/31/1903', but is %s\n",WtoA(bstr)); } ok(S_OK == VarBstrFromDate( 1461.5, 0, 0, &bstr ), XOK); todo_wine { - sprintf(msg,"should be '12/31/1903 12:00:00 PM', but is %s\n",WtoA(bstr)); - ok(!strcmp(WtoA(bstr),"\"12/31/1903 12:00:00 PM\""),msg); + ok(!strcmp(WtoA(bstr),"\"12/31/1903 12:00:00 PM\""), + "should be '12/31/1903 12:00:00 PM', but is %s\n",WtoA(bstr)); } /* Test variant API... -- Francois Gouget fgouget@free.fr http://fgouget.free.fr/ Avoid the Gates of Hell - use Linux.