Alexandre Julliard : gdi/tests: Don't use sizeof in ok() to avoid printf format warnings.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Jun 14 06:50:09 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: e19f31b682cc8d742df602ec88794be2f99c9ddb
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=e19f31b682cc8d742df602ec88794be2f99c9ddb

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Jun 13 14:02:13 2006 +0200

gdi/tests: Don't use sizeof in ok() to avoid printf format warnings.

---

 dlls/gdi/tests/bitmap.c |   22 +++++++++++-----------
 dlls/gdi/tests/font.c   |    3 +--
 2 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/dlls/gdi/tests/bitmap.c b/dlls/gdi/tests/bitmap.c
index 7409074..62a57eb 100644
--- a/dlls/gdi/tests/bitmap.c
+++ b/dlls/gdi/tests/bitmap.c
@@ -69,7 +69,7 @@ static void test_bitmap_info(HBITMAP hbm
     char buf[512], buf_cmp[512];
 
     ret = GetObject(hbm, sizeof(bm), &bm);
-    ok(ret == sizeof(bm), "GetObject returned %d instead of %d\n", ret, sizeof(bm));
+    ok(ret == sizeof(bm), "GetObject returned %d\n", ret);
 
     ok(bm.bmType == 0, "wrong bm.bmType %d\n", bm.bmType);
     ok(bm.bmWidth == bmih->biWidth, "wrong bm.bmWidth %d\n", bm.bmWidth);
@@ -96,10 +96,10 @@ static void test_bitmap_info(HBITMAP hbm
 
     /* test various buffer sizes for GetObject */
     ret = GetObject(hbm, 0, NULL);
-    ok(ret == sizeof(bm), "%d != %d\n", ret, sizeof(bm));
+    ok(ret == sizeof(bm), "wrong size %d\n", ret);
 
     ret = GetObject(hbm, sizeof(bm) * 2, &bm);
-    ok(ret == sizeof(bm), "%d != %d\n", ret, sizeof(bm));
+    ok(ret == sizeof(bm), "wrong size %d\n", ret);
 
     ret = GetObject(hbm, sizeof(bm) / 2, &bm);
     ok(ret == 0, "%d != 0\n", ret);
@@ -249,7 +249,7 @@ static void test_dib_info(HBITMAP hbm, c
     BYTE *buf;
 
     ret = GetObject(hbm, sizeof(bm), &bm);
-    ok(ret == sizeof(bm), "GetObject returned %d instead of %d\n", ret, sizeof(bm));
+    ok(ret == sizeof(bm), "GetObject returned %d\n", ret);
 
     ok(bm.bmType == 0, "wrong bm.bmType %d\n", bm.bmType);
     ok(bm.bmWidth == bmih->biWidth, "wrong bm.bmWidth %d\n", bm.bmWidth);
@@ -277,7 +277,7 @@ static void test_dib_info(HBITMAP hbm, c
     /* test various buffer sizes for GetObject */
     memset(&ds, 0xAA, sizeof(ds));
     ret = GetObject(hbm, sizeof(bm) * 2, &bm);
-    ok(ret == sizeof(bm), "%d != %d\n", ret, sizeof(bm));
+    ok(ret == sizeof(bm), "wrong size %d\n", ret);
     ok(bm.bmWidth == bmih->biWidth, "wrong bm.bmWidth %d\n", bm.bmWidth);
     ok(bm.bmHeight == bmih->biHeight, "wrong bm.bmHeight %d\n", bm.bmHeight);
     ok(bm.bmBits == bits, "wrong bm.bmBits %p != %p\n", bm.bmBits, bits);
@@ -293,11 +293,11 @@ static void test_dib_info(HBITMAP hbm, c
 
     /* test various buffer sizes for GetObject */
     ret = GetObject(hbm, 0, NULL);
-    ok(ret == sizeof(bm), "%d != %d\n", ret, sizeof(bm));
+    ok(ret == sizeof(bm), "wrong size %d\n", ret);
 
     memset(&ds, 0xAA, sizeof(ds));
     ret = GetObject(hbm, sizeof(ds) * 2, &ds);
-    ok(ret == sizeof(ds), "%d != %d\n", ret, sizeof(ds));
+    ok(ret == sizeof(ds), "wrong size %d\n", ret);
 
     ok(ds.dsBm.bmBits == bits, "wrong bm.bmBits %p != %p\n", ds.dsBm.bmBits, bits);
     ok(ds.dsBmih.biSizeImage == ds.dsBm.bmWidthBytes * ds.dsBm.bmHeight, "%lu != %u\n",
@@ -317,7 +317,7 @@ static void test_dib_info(HBITMAP hbm, c
 
     memset(&ds, 0xAA, sizeof(ds));
     ret = GetObject(hbm, sizeof(ds) - 4, &ds);
-    ok(ret == sizeof(ds.dsBm), "%d != %d\n", ret, sizeof(ds.dsBm));
+    ok(ret == sizeof(ds.dsBm), "wrong size %d\n", ret);
     ok(ds.dsBm.bmWidth == bmih->biWidth, "%lu != %lu\n", ds.dsBmih.biWidth, bmih->biWidth);
     ok(ds.dsBm.bmHeight == bmih->biHeight, "%lu != %lu\n", ds.dsBmih.biHeight, bmih->biHeight);
     ok(ds.dsBm.bmBits == bits, "%p != %p\n", ds.dsBm.bmBits, bits);
@@ -940,7 +940,7 @@ static void test_bitmap(void)
     assert(hbmp != NULL);
 
     ret = GetObject(hbmp, sizeof(bm), &bm);
-    ok(ret == sizeof(bm), "%d != %d\n", ret, sizeof(bm));
+    ok(ret == sizeof(bm), "wrong size %d\n", ret);
 
     ok(bm.bmType == 0, "wrong bm.bmType %d\n", bm.bmType);
     ok(bm.bmWidth == 15, "wrong bm.bmWidth %d\n", bm.bmWidth);
@@ -967,7 +967,7 @@ static void test_bitmap(void)
     hbmp_old = SelectObject(hdc, hbmp);
 
     ret = GetObject(hbmp, sizeof(bm), &bm);
-    ok(ret == sizeof(bm), "%d != %d\n", ret, sizeof(bm));
+    ok(ret == sizeof(bm), "wrong size %d\n", ret);
 
     ok(bm.bmType == 0, "wrong bm.bmType %d\n", bm.bmType);
     ok(bm.bmWidth == 15, "wrong bm.bmWidth %d\n", bm.bmWidth);
@@ -987,7 +987,7 @@ static void test_bitmap(void)
 
     /* test various buffer sizes for GetObject */
     ret = GetObject(hbmp, sizeof(bm) * 2, &bm);
-    ok(ret == sizeof(bm), "%d != %d\n", ret, sizeof(bm));
+    ok(ret == sizeof(bm), "wrong size %d\n", ret);
 
     ret = GetObject(hbmp, sizeof(bm) / 2, &bm);
     ok(ret == 0, "%d != 0\n", ret);
diff --git a/dlls/gdi/tests/font.c b/dlls/gdi/tests/font.c
index 1fefe56..393bc27 100644
--- a/dlls/gdi/tests/font.c
+++ b/dlls/gdi/tests/font.c
@@ -42,8 +42,7 @@ static void check_font(const char* test,
     while (lf->lfFaceName[minlen] && minlen < LF_FACESIZE-1)
         minlen++;
     minlen += FIELD_OFFSET(LOGFONTA, lfFaceName) + 1;
-    ok(ret == sizeof(LOGFONTA) || ret == minlen,
-       "%s: GetObject returned %d expected %d or %d\n", test, ret, sizeof(LOGFONTA), minlen);
+    ok(ret == sizeof(LOGFONTA) || ret == minlen, "%s: GetObject returned %d\n", test, ret);
     ok(!memcmp(&lf, &lf, FIELD_OFFSET(LOGFONTA, lfFaceName)), "%s: fonts don't match\n", test);
     ok(!lstrcmpA(lf->lfFaceName, getobj_lf.lfFaceName),
        "%s: font names don't match: %s != %s\n", test, lf->lfFaceName, getobj_lf.lfFaceName);




More information about the wine-cvs mailing list