Dmitry Timoshkov : gdi: Fix a couple of todos in the bitmap test.
Module: wine Branch: refs/heads/master Commit: e6f16250b29fbdddba7359fa68eb29df4471ad1e URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=e6f16250b29fbdddba7359fa... Author: Dmitry Timoshkov <dmitry(a)codeweavers.com> Date: Tue Mar 21 12:00:43 2006 +0800 gdi: Fix a couple of todos in the bitmap test. --- dlls/gdi/bitmap.c | 15 +++++++-------- dlls/gdi/tests/gdiobj.c | 4 ---- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/dlls/gdi/bitmap.c b/dlls/gdi/bitmap.c index a5b249b..2a562de 100644 --- a/dlls/gdi/bitmap.c +++ b/dlls/gdi/bitmap.c @@ -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 --git a/dlls/gdi/tests/gdiobj.c b/dlls/gdi/tests/gdiobj.c index 4de266c..35b19a3 100644 --- a/dlls/gdi/tests/gdiobj.c +++ b/dlls/gdi/tests/gdiobj.c @@ -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);
participants (1)
-
Alexandre Julliard