Fix a couple of todos in the bitmap test

Dmitry Timoshkov dmitry at codeweavers.com
Mon Mar 20 22:00:43 CST 2006


Hello,

Changelog:
    Fix a couple of todos in the bitmap test.

diff -up cvs/hq/wine/dlls/gdi/bitmap.c wine/dlls/gdi/bitmap.c
--- cvs/hq/wine/dlls/gdi/bitmap.c	2006-03-21 11:17:37.000000000 +0800
+++ wine/dlls/gdi/bitmap.c	2006-03-21 11:55:19.000000000 +0800
@@ -653,9 +653,9 @@ static INT BITMAP_GetObject16( HGDIOBJ h
 	bmp16.bmPlanes     = bmp->bitmap.bmPlanes;
 	bmp16.bmBitsPixel  = bmp->bitmap.bmBitsPixel;
 	bmp16.bmBits       = (SEGPTR)0;
-	if (count > sizeof(bmp16)) count = sizeof(bmp16);
-	memcpy( buffer, &bmp16, count );
-	return count;
+	if (count < sizeof(bmp16)) return 0;
+	memcpy( buffer, &bmp16, sizeof(bmp16) );
+	return sizeof(bmp16);
     }
 }
 
@@ -685,11 +685,10 @@ static INT BITMAP_GetObject( HGDIOBJ han
     }
     else
     {
-        if( !buffer )
-            return sizeof(BITMAP);
-	if (count > sizeof(BITMAP)) count = sizeof(BITMAP);
-	memcpy( buffer, &bmp->bitmap, count );
-	return count;
+        if( !buffer ) return sizeof(BITMAP);
+        if (count < sizeof(BITMAP)) return 0;
+        memcpy( buffer, &bmp->bitmap, sizeof(BITMAP) );
+        return sizeof(BITMAP);
     }
 }
 
diff -up cvs/hq/wine/dlls/gdi/tests/gdiobj.c wine/dlls/gdi/tests/gdiobj.c
--- cvs/hq/wine/dlls/gdi/tests/gdiobj.c	2006-03-21 11:17:37.000000000 +0800
+++ wine/dlls/gdi/tests/gdiobj.c	2006-03-21 11:39:39.000000000 +0800
@@ -1044,17 +1044,13 @@ static void test_bitmap(void)
     ok(ret == sizeof(bm), "%d != %d\n", ret, sizeof(bm));
 
     ret = GetObject(hbmp, sizeof(bm) / 2, &bm);
-todo_wine {
     ok(ret == 0, "%d != 0\n", ret);
-}
 
     ret = GetObject(hbmp, 0, &bm);
     ok(ret == 0, "%d != 0\n", ret);
 
     ret = GetObject(hbmp, 1, &bm);
-todo_wine {
     ok(ret == 0, "%d != 0\n", ret);
-}
 
     DeleteObject(hbmp);
     DeleteDC(hdc);





More information about the wine-patches mailing list