From dbab3dd7e316104681f2ef1e371d7634a7af384a Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Wed, 17 Aug 2016 09:01:27 +0200 Subject: [PATCH] Fixed tests and not intialized values. --- libfreerdp/gdi/bitmap.c | 2 +- libfreerdp/gdi/test/TestGdiBitBlt.c | 11 +++++++++-- libfreerdp/gdi/test/TestGdiEllipse.c | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/libfreerdp/gdi/bitmap.c b/libfreerdp/gdi/bitmap.c index 2ea0a74..db284e2 100644 --- a/libfreerdp/gdi/bitmap.c +++ b/libfreerdp/gdi/bitmap.c @@ -342,7 +342,7 @@ static BOOL BitBlt_process(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest, UINT32 nXSrc, UINT32 nYSrc, const char* rop, const gdiPalette* palette) { INT64 x, y; - UINT32 style; + UINT32 style = 0; BOOL useSrc = FALSE; BOOL usePat = FALSE; const char* iter = rop; diff --git a/libfreerdp/gdi/test/TestGdiBitBlt.c b/libfreerdp/gdi/test/TestGdiBitBlt.c index f3d5334..e8ed0b1 100644 --- a/libfreerdp/gdi/test/TestGdiBitBlt.c +++ b/libfreerdp/gdi/test/TestGdiBitBlt.c @@ -494,6 +494,7 @@ static BOOL test_gdi_BitBlt(UINT32 SrcFormat, UINT32 DstFormat) HGDI_BITMAP hBmpSrc; HGDI_BITMAP hBmpDst; HGDI_BITMAP hBmpDstOriginal; + HGDI_BRUSH brush; gdiPalette g; gdiPalette* hPalette = &g; g.format = DstFormat; @@ -543,6 +544,9 @@ static BOOL test_gdi_BitBlt(UINT32 SrcFormat, UINT32 DstFormat) goto fail; } + brush = gdi_CreateSolidBrush(0x123456); + gdi_SelectObject(hdcDst, (HGDIOBJECT)brush); + for (x = 0; x < number_tests; x++) { if (!test_rop(hdcDst, hdcSrc, hBmpSrc, hBmpDst, hBmpDstOriginal, tests[x].rop, @@ -550,6 +554,8 @@ static BOOL test_gdi_BitBlt(UINT32 SrcFormat, UINT32 DstFormat) failed = TRUE; } + gdi_SelectObject(hdcDst, NULL); + gdi_DeleteObject((HGDIOBJECT)brush); rc = !failed; fail: @@ -567,6 +573,7 @@ fail: int TestGdiBitBlt(int argc, char* argv[]) { + int rc = 0; UINT32 x, y; const UINT32 formatList[] = { @@ -600,10 +607,10 @@ int TestGdiBitBlt(int argc, char* argv[]) fprintf(stderr, "test_gdi_BitBlt(SrcFormat=%s, DstFormat=%s) failed!\n", GetColorFormatName(formatList[x]), GetColorFormatName(formatList[y])); - return -1; + rc = -y; } } } - return 0; + return rc; } diff --git a/libfreerdp/gdi/test/TestGdiEllipse.c b/libfreerdp/gdi/test/TestGdiEllipse.c index eaad347..39baf51 100644 --- a/libfreerdp/gdi/test/TestGdiEllipse.c +++ b/libfreerdp/gdi/test/TestGdiEllipse.c @@ -161,7 +161,7 @@ int TestGdiEllipse(int argc, char* argv[]) if (!gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS, hPalette)) { printf("gdi_BitBlt failed (line #%u)\n", __LINE__); - return -1; + goto fail; } if (!gdi_Ellipse(hdc, 0, 0, 16, 16)) -- 2.7.4