From: Alex Henrie alexhenrie24@gmail.com
--- dlls/gdi32/tests/bitmap.c | 72 ++++++++++++++--------------- dlls/gdi32/tests/dc.c | 18 ++++---- dlls/gdi32/tests/dib.c | 20 ++++---- dlls/gdi32/tests/font.c | 91 ++++++++++++++++++------------------- dlls/gdi32/tests/metafile.c | 40 ++++++++-------- dlls/gdi32/tests/path.c | 8 ++-- 6 files changed, 124 insertions(+), 125 deletions(-)
diff --git a/dlls/gdi32/tests/bitmap.c b/dlls/gdi32/tests/bitmap.c index e9b93d15fce..eb5ef0994d6 100644 --- a/dlls/gdi32/tests/bitmap.c +++ b/dlls/gdi32/tests/bitmap.c @@ -281,7 +281,7 @@ static void test_dib_info(HBITMAP hbm, const void *bits, const BITMAPINFOHEADER ok(bm.bmBitsPixel == bmih->biBitCount, "bm.bmBitsPixel %d != %d\n", bm.bmBitsPixel, bmih->biBitCount); ok(bm.bmBits == bits, "wrong bm.bmBits %p != %p\n", bm.bmBits, bits);
- buf = HeapAlloc(GetProcessHeap(), 0, bm.bmWidthBytes * bm.bmHeight + 4096); + buf = malloc(bm.bmWidthBytes * bm.bmHeight + 4096);
/* GetBitmapBits returns not 32-bit aligned data */ SetLastError(0xdeadbeef); @@ -293,7 +293,7 @@ static void test_dib_info(HBITMAP hbm, const void *bits, const BITMAPINFOHEADER ret = GetBitmapBits(hbm, bm.bmWidthBytes * bm.bmHeight + 4096, buf); ok(ret == bm_width_bytes * bm.bmHeight, "%d != %d\n", ret, bm_width_bytes * bm.bmHeight);
- HeapFree(GetProcessHeap(), 0, buf); + free(buf);
/* test various buffer sizes for GetObject */ memset(&ds, 0xAA, sizeof(ds)); @@ -920,7 +920,7 @@ static void test_dib_formats(void) UINT ret; BOOL format_ok, expect_ok;
- bi = HeapAlloc( GetProcessHeap(), 0, FIELD_OFFSET( BITMAPINFO, bmiColors[256] ) ); + bi = malloc( FIELD_OFFSET( BITMAPINFO, bmiColors[256] ) ); hdc = GetDC( 0 ); memdc = CreateCompatibleDC( 0 ); hbmp = CreateCompatibleBitmap( hdc, 10, 10 ); @@ -1292,7 +1292,7 @@ static void test_dib_formats(void) DeleteObject( hbmp ); DeleteObject( hbmp_mono ); ReleaseDC( 0, hdc ); - HeapFree( GetProcessHeap(), 0, bi ); + free( bi ); }
static void test_mono_dibsection(void) @@ -1807,8 +1807,8 @@ static void test_GetDIBits_selected_DIB(UINT bpp) UINT i; int res;
- info = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(BITMAPINFO, bmiColors[256])); - info2 = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(BITMAPINFO, bmiColors[256])); + info = malloc(FIELD_OFFSET(BITMAPINFO, bmiColors[256])); + info2 = malloc(FIELD_OFFSET(BITMAPINFO, bmiColors[256]));
/* Create a DIB section with a color table */
@@ -1846,7 +1846,7 @@ static void test_GetDIBits_selected_DIB(UINT bpp) dib_dc = CreateCompatibleDC(NULL); old_bmp = SelectObject(dib_dc, dib); dc = CreateCompatibleDC(NULL); - bits2 = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dib32_size); + bits2 = calloc(1, dib32_size);
/* Copy the DIB attributes but not the color table */ memcpy(info2, info, sizeof(BITMAPINFOHEADER)); @@ -1892,14 +1892,14 @@ static void test_GetDIBits_selected_DIB(UINT bpp) pixel = ((DWORD *)bits2)[info->bmiHeader.biWidth * info->bmiHeader.biHeight - 1]; ok(pixel != 0, "Pixel: 0x%08lx\n", pixel);
- HeapFree(GetProcessHeap(), 0, bits2); + free(bits2); DeleteDC(dc);
SelectObject(dib_dc, old_bmp); DeleteDC(dib_dc); DeleteObject(dib); - HeapFree(GetProcessHeap(), 0, info2); - HeapFree(GetProcessHeap(), 0, info); + free(info2); + free(info); }
static void test_GetDIBits_selected_DDB(BOOL monochrome) @@ -1916,8 +1916,8 @@ static void test_GetDIBits_selected_DDB(BOOL monochrome) UINT i, j; int res;
- info = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(BITMAPINFO, bmiColors[256])); - info2 = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(BITMAPINFO, bmiColors[256])); + info = malloc(FIELD_OFFSET(BITMAPINFO, bmiColors[256])); + info2 = malloc(FIELD_OFFSET(BITMAPINFO, bmiColors[256]));
width = height = 16;
@@ -1961,8 +1961,8 @@ static void test_GetDIBits_selected_DDB(BOOL monochrome) GetDIBits(dc, ddb, 0, height, NULL, info, DIB_RGB_COLORS); ok(info->bmiHeader.biSizeImage != 0, "GetDIBits failed to get the DIB attributes\n");
- bits = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, info->bmiHeader.biSizeImage); - bits2 = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, info->bmiHeader.biSizeImage); + bits = calloc(1, info->bmiHeader.biSizeImage); + bits2 = calloc(1, info->bmiHeader.biSizeImage);
/* Get the bits */ res = GetDIBits(dc, ddb, 0, height, bits, info, DIB_RGB_COLORS); @@ -2004,15 +2004,15 @@ static void test_GetDIBits_selected_DDB(BOOL monochrome) ok( colors[i] == i, "%d: got %d (bpp %d)\n", i, colors[i], bpp ); }
- HeapFree(GetProcessHeap(), 0, bits2); - HeapFree(GetProcessHeap(), 0, bits); + free(bits2); + free(bits); DeleteDC(dc);
SelectObject(ddb_dc, old_bmp); DeleteDC(ddb_dc); DeleteObject(ddb); - HeapFree(GetProcessHeap(), 0, info2); - HeapFree(GetProcessHeap(), 0, info); + free(info2); + free(info); }
static void test_GetDIBits(void) @@ -2983,7 +2983,7 @@ static void test_get16dibits(void) hbmp = CreateBitmap(2, 2, 1, 16, bits); ok(hbmp != NULL, "CreateBitmap failed\n");
- info = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, info_len); + info = calloc(1, info_len); assert(info);
memset(info, '!', info_len); @@ -3003,7 +3003,7 @@ static void test_get16dibits(void) overwritten_bytes++; ok(overwritten_bytes == 0, "GetDIBits wrote past the buffer given\n");
- HeapFree(GetProcessHeap(), 0, info); + free(info); DeleteObject(hbmp); ReleaseDC(NULL, screen_dc); } @@ -3655,7 +3655,7 @@ static void test_GdiAlphaBlend(void) bmpDst = CreateCompatibleBitmap(hdcNull, 100, 100); hdcSrc = CreateCompatibleDC(hdcNull);
- bmi = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, FIELD_OFFSET( BITMAPINFO, bmiColors[3] )); + bmi = calloc(1, FIELD_OFFSET(BITMAPINFO, bmiColors[3])); bmi->bmiHeader.biSize = sizeof(bmi->bmiHeader); bmi->bmiHeader.biHeight = 20; bmi->bmiHeader.biWidth = 20; @@ -3853,7 +3853,7 @@ static void test_GdiAlphaBlend(void) DeleteObject(bmpDst);
ReleaseDC(NULL, hdcNull); - HeapFree(GetProcessHeap(), 0, bmi); + free(bmi); }
static void test_GdiGradientFill(void) @@ -3876,7 +3876,7 @@ static void test_GdiGradientFill(void) }
hdc = CreateCompatibleDC( NULL ); - bmi = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, FIELD_OFFSET( BITMAPINFO, bmiColors[3] )); + bmi = calloc( 1, FIELD_OFFSET(BITMAPINFO, bmiColors[3]) ); bmi->bmiHeader.biSize = sizeof(bmi->bmiHeader); bmi->bmiHeader.biHeight = 20; bmi->bmiHeader.biWidth = 20; @@ -3966,7 +3966,7 @@ static void test_GdiGradientFill(void)
DeleteDC( hdc ); DeleteObject( bmp ); - HeapFree(GetProcessHeap(), 0, bmi); + free( bmi ); }
static void test_clipping(void) @@ -4288,7 +4288,7 @@ static void test_GetDIBits_scanlines(void) DWORD data[128], inverted_bits[64]; int i, ret;
- info = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, FIELD_OFFSET( BITMAPINFO, bmiColors[256] ) ); + info = calloc( 1, FIELD_OFFSET( BITMAPINFO, bmiColors[256] ) );
info->bmiHeader.biSize = sizeof(info->bmiHeader); info->bmiHeader.biWidth = 8; @@ -4594,7 +4594,7 @@ static void test_GetDIBits_scanlines(void) DeleteObject( dib );
ReleaseDC( NULL, hdc ); - HeapFree( GetProcessHeap(), 0, info ); + free( info ); }
@@ -4611,7 +4611,7 @@ static void test_SetDIBits(void) HBITMAP dib; int i, ret;
- info = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, FIELD_OFFSET( BITMAPINFO, bmiColors[256] ) ); + info = calloc( 1, FIELD_OFFSET( BITMAPINFO, bmiColors[256] ) );
info->bmiHeader.biSize = sizeof(info->bmiHeader); info->bmiHeader.biWidth = 8; @@ -4828,7 +4828,7 @@ static void test_SetDIBits(void) ReleaseDC( NULL, hdc ); DeleteObject( dib ); DeleteObject( palette ); - HeapFree( GetProcessHeap(), 0, info ); + free( info ); }
static void test_SetDIBits_RLE4(void) @@ -4852,7 +4852,7 @@ static void test_SetDIBits_RLE4(void) 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa };
- info = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, FIELD_OFFSET( BITMAPINFO, bmiColors[256] ) ); + info = calloc( 1, FIELD_OFFSET( BITMAPINFO, bmiColors[256] ) );
info->bmiHeader.biSize = sizeof(info->bmiHeader); info->bmiHeader.biWidth = 8; @@ -4883,7 +4883,7 @@ static void test_SetDIBits_RLE4(void)
DeleteObject( dib ); ReleaseDC( NULL, hdc ); - HeapFree( GetProcessHeap(), 0, info ); + free( info ); }
static void test_SetDIBits_RLE8(void) @@ -4914,7 +4914,7 @@ static void test_SetDIBits_RLE8(void) 0x00040404, 0x00050505, 0x00060606, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0x00020202, 0x00020202, 0x00020202, 0x00f0f0f0, 0x00f0f0f0, 0x00f0f0f0, 0x00f0f0f0, 0xaaaaaaaa };
- info = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, FIELD_OFFSET( BITMAPINFO, bmiColors[256] ) ); + info = calloc( 1, FIELD_OFFSET( BITMAPINFO, bmiColors[256] ) );
info->bmiHeader.biSize = sizeof(info->bmiHeader); info->bmiHeader.biWidth = 8; @@ -5033,7 +5033,7 @@ static void test_SetDIBits_RLE8(void)
DeleteObject( dib ); ReleaseDC( NULL, hdc ); - HeapFree( GetProcessHeap(), 0, info ); + free( info ); }
static void test_SetDIBitsToDevice(void) @@ -5049,7 +5049,7 @@ static void test_SetDIBitsToDevice(void) HBITMAP dib; int i, ret;
- info = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, FIELD_OFFSET( BITMAPINFO, bmiColors[256] ) ); + info = calloc( 1, FIELD_OFFSET( BITMAPINFO, bmiColors[256] ) );
info->bmiHeader.biSize = sizeof(info->bmiHeader); info->bmiHeader.biWidth = 8; @@ -5453,7 +5453,7 @@ static void test_SetDIBitsToDevice(void) DeleteDC( hdc ); DeleteObject( dib ); DeleteObject( palette ); - HeapFree( GetProcessHeap(), 0, info ); + free( info ); }
static void test_SetDIBitsToDevice_RLE8(void) @@ -5484,7 +5484,7 @@ static void test_SetDIBitsToDevice_RLE8(void) 0x00040404, 0x00050505, 0x00060606, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0x00020202, 0x00020202, 0x00020202, 0x00020202, 0x00f0f0f0, 0x00f0f0f0, 0x00f0f0f0, 0xaaaaaaaa };
- info = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, FIELD_OFFSET( BITMAPINFO, bmiColors[256] ) ); + info = calloc( 1, FIELD_OFFSET( BITMAPINFO, bmiColors[256] ) );
info->bmiHeader.biSize = sizeof(info->bmiHeader); info->bmiHeader.biWidth = 8; @@ -5684,7 +5684,7 @@ static void test_SetDIBitsToDevice_RLE8(void) cleanup: DeleteDC( hdc ); DeleteObject( dib ); - HeapFree( GetProcessHeap(), 0, info ); + free( info ); }
static void test_D3DKMTCreateDCFromMemory( void ) diff --git a/dlls/gdi32/tests/dc.c b/dlls/gdi32/tests/dc.c index ef121470dfe..69cd44107a0 100644 --- a/dlls/gdi32/tests/dc.c +++ b/dlls/gdi32/tests/dc.c @@ -285,13 +285,13 @@ static void test_GdiConvertToDevmodeW(void) dmW = pGdiConvertToDevmodeW(&dmA); ok(dmW->dmSize >= FIELD_OFFSET(DEVMODEW, dmICMMethod), "dmSize is too small: %04x\n", dmW->dmSize); ok(dmW->dmSize <= sizeof(DEVMODEW), "dmSize is too large: %04x\n", dmW->dmSize); - HeapFree(GetProcessHeap(), 0, dmW); + free(dmW);
dmA.dmSize = FIELD_OFFSET(DEVMODEA, dmFields) + sizeof(dmA.dmFields); dmW = pGdiConvertToDevmodeW(&dmA); ok(dmW->dmSize == FIELD_OFFSET(DEVMODEW, dmFields) + sizeof(dmW->dmFields), "wrong size %u\n", dmW->dmSize); - HeapFree(GetProcessHeap(), 0, dmW); + free(dmW);
dmA.dmICMMethod = DMICMMETHOD_NONE; dmA.dmSize = FIELD_OFFSET(DEVMODEA, dmICMMethod) + sizeof(dmA.dmICMMethod); @@ -300,13 +300,13 @@ static void test_GdiConvertToDevmodeW(void) "wrong size %u\n", dmW->dmSize); ok(dmW->dmICMMethod == DMICMMETHOD_NONE, "expected DMICMMETHOD_NONE, got %lu\n", dmW->dmICMMethod); - HeapFree(GetProcessHeap(), 0, dmW); + free(dmW);
dmA.dmSize = 1024; dmW = pGdiConvertToDevmodeW(&dmA); ok(dmW->dmSize == FIELD_OFFSET(DEVMODEW, dmPanningHeight) + sizeof(dmW->dmPanningHeight), "wrong size %u\n", dmW->dmSize); - HeapFree(GetProcessHeap(), 0, dmW); + free(dmW);
SetLastError(0xdeadbeef); dmA.dmSize = 0; @@ -319,7 +319,7 @@ static void test_GdiConvertToDevmodeW(void) dmW = pGdiConvertToDevmodeW(&dmA); ok(dmW->dmSize == FIELD_OFFSET(DEVMODEW, dmFields), "expected %04lx, got %04x\n", FIELD_OFFSET(DEVMODEW, dmFields), dmW->dmSize); - HeapFree(GetProcessHeap(), 0, dmW); + free(dmW); }
static void test_device_caps( HDC hdc, HDC ref_dc, const char *descr, int scale ) @@ -1361,11 +1361,11 @@ static HDC create_printer_dc(int scale, BOOL reset) if (!pOpenPrinterA( buffer, &hprn, NULL )) goto done;
pGetPrinterA( hprn, 2, NULL, 0, &len ); - pbuf = HeapAlloc( GetProcessHeap(), 0, len ); + pbuf = malloc( len ); if (!pGetPrinterA( hprn, 2, (LPBYTE)pbuf, len, &len )) goto done;
pGetPrinterDriverA( hprn, NULL, 3, NULL, 0, &len ); - dbuf = HeapAlloc( GetProcessHeap(), 0, len ); + dbuf = malloc( len ); if (!pGetPrinterDriverA( hprn, NULL, 3, (LPBYTE)dbuf, len, &len )) goto done;
pbuf->pDevMode->dmScale = scale; @@ -1378,8 +1378,8 @@ static HDC create_printer_dc(int scale, BOOL reset)
if (reset) ResetDCA( hdc, pbuf->pDevMode ); done: - HeapFree( GetProcessHeap(), 0, dbuf ); - HeapFree( GetProcessHeap(), 0, pbuf ); + free( dbuf ); + free( pbuf ); if (hprn) pClosePrinter( hprn ); if (winspool) FreeLibrary( winspool ); if (!hdc) skip( "could not create a DC for the default printer\n" ); diff --git a/dlls/gdi32/tests/dib.c b/dlls/gdi32/tests/dib.c index 94823e91364..14e8a9b384f 100644 --- a/dlls/gdi32/tests/dib.c +++ b/dlls/gdi32/tests/dib.c @@ -1354,10 +1354,10 @@ static void reset_bits( HDC hdc, const BITMAPINFO *bmi, BYTE *bits ) if (bits) memset( bits, 0xcc, size ); else { - void *ddb_bits = HeapAlloc( GetProcessHeap(), 0, size ); + void *ddb_bits = malloc( size ); memset( ddb_bits, 0xcc, size ); SetBitmapBits( GetCurrentObject(hdc, OBJ_BITMAP), size, ddb_bits ); - HeapFree( GetProcessHeap(), 0, ddb_bits ); + free( ddb_bits ); } }
@@ -1377,10 +1377,10 @@ static char *hash_dib(HDC hdc, const BITMAPINFO *bmi, const void *bits)
if (!bits) { - void *ddb_bits = HeapAlloc( GetProcessHeap(), 0, dib_size ); - GetBitmapBits( GetCurrentObject(hdc, OBJ_BITMAP), dib_size, ddb_bits ); + void *ddb_bits = malloc(dib_size); + GetBitmapBits(GetCurrentObject(hdc, OBJ_BITMAP), dib_size, ddb_bits); CryptHashData(hash, ddb_bits, dib_size, 0); - HeapFree( GetProcessHeap(), 0, ddb_bits ); + free(ddb_bits); } else CryptHashData(hash, bits, dib_size, 0);
@@ -1390,7 +1390,7 @@ static char *hash_dib(HDC hdc, const BITMAPINFO *bmi, const void *bits) CryptGetHashParam(hash, HP_HASHVAL, hash_buf, &hash_size, 0); CryptDestroyHash(hash);
- buf = HeapAlloc(GetProcessHeap(), 0, hash_size * 2 + 1); + buf = malloc(hash_size * 2 + 1);
for(i = 0; i < hash_size; i++) { @@ -1448,7 +1448,7 @@ static void compare_hash_broken_todo(HDC hdc, const BITMAPINFO *bmi, BYTE *bits, if(current_sha1[i] == NULL) { ok(current_sha1[i] != NULL, "missing hash, got "%s",\n", hash); - HeapFree(GetProcessHeap(), 0, hash); + free(hash); return; } } @@ -1464,7 +1464,7 @@ static void compare_hash_broken_todo(HDC hdc, const BITMAPINFO *bmi, BYTE *bits,
current_sha1 += num_broken + 1;
- HeapFree(GetProcessHeap(), 0, hash); + free( hash );
compare_bounds( hdc, info ); } @@ -3129,8 +3129,8 @@ static void draw_text_2( HDC hdc, const BITMAPINFO *bmi, BYTE *bits, BOOL aa )
SetBkColor( hdc, bk_color );
- HeapFree( GetProcessHeap(), 0, diy_hash ); - HeapFree( GetProcessHeap(), 0, eto_hash ); + free( diy_hash ); + free( eto_hash );
font = SelectObject( hdc, font ); DeleteObject( font ); diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c index 69000c8ca66..76ea0ac7de7 100644 --- a/dlls/gdi32/tests/font.c +++ b/dlls/gdi32/tests/font.c @@ -29,7 +29,6 @@ #include "winuser.h" #include "winnls.h"
-#include "wine/heap.h" #include "wine/test.h"
static inline BOOL match_off_by_n(int a, int b, unsigned int n) @@ -1443,7 +1442,7 @@ static void test_text_extents(void) ok(sz.cx == 0 && sz.cy == 0, "cx %ld, cy %ld\n", sz.cx, sz.cy);
len = lstrlenW(wt); - extents = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len * sizeof extents[0]); + extents = calloc(len, sizeof extents[0]); extents[0] = 1; /* So that the increasing sequence test will fail if the extents array is untouched. */ GetTextExtentExPointW(hdc, wt, len, 32767, &fit1, extents, &sz1); @@ -1533,7 +1532,7 @@ static void test_text_extents(void)
hfont = SelectObject(hdc, hfont); DeleteObject(hfont); - HeapFree(GetProcessHeap(), 0, extents); + free(extents); ReleaseDC(NULL, hdc); }
@@ -1843,7 +1842,7 @@ static void test_GetKerningPairs(void) kd[i].otmusMinimumPPEM, otm.otmusMinimumPPEM);
total_kern_pairs = GetKerningPairsW(hdc, 0, NULL); - kern_pair = HeapAlloc(GetProcessHeap(), 0, total_kern_pairs * sizeof(*kern_pair)); + kern_pair = malloc(total_kern_pairs * sizeof(*kern_pair));
/* Win98 (GetKerningPairsA) and XP behave differently here, the test * passes on XP. @@ -1886,7 +1885,7 @@ static void test_GetKerningPairs(void) ok(matches == kd[i].total_kern_pairs, "got matches %lu, expected %lu\n", matches, kd[i].total_kern_pairs);
- HeapFree(GetProcessHeap(), 0, kern_pair); + free(kern_pair);
SelectObject(hdc, hfont_old); DeleteObject(hfont); @@ -2100,7 +2099,7 @@ static void test_height_selection_vdmx( HDC hdc ) { res = get_res_data( "wine_vdmx.ttf", &size );
- copy = HeapAlloc( GetProcessHeap(), 0, size ); + copy = malloc( size ); memcpy( copy, res, size ); vdmx_header = find_ttf_table( copy, size, MS_MAKE_TAG('V','D','M','X') ); vdmx_header[0] = GET_BE_WORD( data[i].version ); @@ -2110,7 +2109,7 @@ static void test_height_selection_vdmx( HDC hdc ) ratio_rec[0] = data[i].bCharSet;
write_tmp_file( copy, &size, ttf_name ); - HeapFree( GetProcessHeap(), 0, copy ); + free( copy );
ok( !is_truetype_font_installed("wine_vdmx"), "Already installed\n" ); num = AddFontResourceExA( ttf_name, FR_PRIVATE, 0 ); @@ -2167,12 +2166,12 @@ static UINT get_font_fsselection(LOGFONTA *lf) hfont_old = SelectObject(hdc, hfont);
otm_size = GetOutlineTextMetricsA(hdc, 0, NULL); - otm = HeapAlloc(GetProcessHeap(), 0, otm_size); + otm = malloc(otm_size); otm->otmSize = sizeof(*otm); ret = GetOutlineTextMetricsA(hdc, otm->otmSize, otm); ok(ret == otm->otmSize, "expected %u, got %lu, error %ld\n", otm->otmSize, ret, GetLastError()); fsSelection = otm->otmfsSelection; - HeapFree(GetProcessHeap(), 0, otm); + free(otm); SelectObject(hdc, hfont_old); DeleteObject(hfont); ReleaseDC(0, hdc); @@ -2241,7 +2240,7 @@ static void test_GetOutlineTextMetrics(void) hfont_old = SelectObject(hdc, hfont); otm_size = GetOutlineTextMetricsA(hdc, 0, NULL);
- otm = HeapAlloc(GetProcessHeap(), 0, otm_size); + otm = malloc(otm_size);
memset(otm, 0xAA, otm_size); SetLastError(0xdeadbeef); @@ -2279,7 +2278,7 @@ static void test_GetOutlineTextMetrics(void) ret = GetOutlineTextMetricsA(hdc, otm_size, NULL); ok(ret == otm_size, "expected %lu, got %lu, error %ld\n", otm_size, ret, GetLastError());
- HeapFree(GetProcessHeap(), 0, otm); + free(otm);
SelectObject(hdc, hfont_old); DeleteObject(hfont); @@ -2822,13 +2821,13 @@ static void test_GetFontUnicodeRanges(void) size = GetFontUnicodeRanges(hdc, NULL); ok(size, "GetFontUnicodeRanges failed unexpectedly\n");
- gs = heap_alloc_zero(size); + gs = calloc(1, size);
size = GetFontUnicodeRanges(hdc, gs); ok(size, "GetFontUnicodeRanges failed\n"); ok(gs->cRanges, "Unexpected ranges count.\n");
- heap_free(gs); + free(gs);
SelectObject(hdc, hfont_old); DeleteObject(hfont); @@ -2873,7 +2872,7 @@ static INT CALLBACK arial_enum_proc(const LOGFONTA *lf, const TEXTMETRICA *tm, D if (efd->total >= efd->size) { efd->size = max( (efd->total + 1) * 2, 256 ); - efd->lf = heap_realloc( efd->lf, efd->size * sizeof(*efd->lf) ); + efd->lf = realloc( efd->lf, efd->size * sizeof(*efd->lf) ); if (!efd->lf) return 0; } efd->lf[efd->total++] = *lf; @@ -2895,7 +2894,7 @@ static INT CALLBACK arial_enum_procw(const LOGFONTW *lf, const TEXTMETRICW *tm, if (efd->total >= efd->size) { efd->size = max( (efd->total + 1) * 2, 256 ); - efd->lf = heap_realloc( efd->lf, efd->size * sizeof(*efd->lf) ); + efd->lf = realloc( efd->lf, efd->size * sizeof(*efd->lf) ); if (!efd->lf) return 0; } efd->lf[efd->total++] = *lf; @@ -3143,8 +3142,8 @@ static void test_EnumFontFamilies(const char *font_name, INT font_charset)
ReleaseDC(0, hdc);
- heap_free( efd.lf ); - heap_free( efdw.lf ); + free(efd.lf); + free(efdw.lf); }
static INT CALLBACK enum_multi_charset_font_proc(const LOGFONTA *lf, const TEXTMETRICA *tm, DWORD type, LPARAM lParam) @@ -3177,7 +3176,7 @@ static INT CALLBACK enum_font_data_proc(const LOGFONTA *lf, const TEXTMETRICA *n if (efd->total >= efd->size) { efd->size = max( (efd->total + 1) * 2, 256 ); - efd->lf = heap_realloc( efd->lf, efd->size * sizeof(*efd->lf) ); + efd->lf = realloc( efd->lf, efd->size * sizeof(*efd->lf) ); if (!efd->lf) return 0; } efd->lf[efd->total++] = *lf; @@ -3194,7 +3193,7 @@ static INT CALLBACK enum_fullname_data_proc(const LOGFONTA *lf, const TEXTMETRIC if (efnd->total >= efnd->size) { efnd->size = max( (efnd->total + 1) * 2, 256 ); - efnd->elf = heap_realloc( efnd->elf, efnd->size * sizeof(*efnd->elf) ); + efnd->elf = realloc( efnd->elf, efnd->size * sizeof(*efnd->elf) ); if (!efnd->elf) return 0; } efnd->elf[efnd->total++] = *(ENUMLOGFONTA *)lf; @@ -3211,7 +3210,7 @@ static INT CALLBACK enum_fullname_data_proc_w( const LOGFONTW *lf, const TEXTMET if (efnd->total >= efnd->size) { efnd->size = max( (efnd->total + 1) * 2, 256 ); - efnd->elf = heap_realloc( efnd->elf, efnd->size * sizeof(*efnd->elf) ); + efnd->elf = realloc( efnd->elf, efnd->size * sizeof(*efnd->elf) ); if (!efnd->elf) return 0; } efnd->elf[efnd->total++] = *(ENUMLOGFONTW *)lf; @@ -3262,7 +3261,7 @@ static void test_EnumFontFamiliesEx_default_charset(void) "(%s) got charset %d expected %d\n", efd.lf[0].lfFaceName, efd.lf[0].lfCharSet, target.lfCharSet);
- heap_free(efd.lf); + free(efd.lf); return; }
@@ -3529,7 +3528,7 @@ static BOOL get_first_last_from_cmap(HDC hdc, DWORD *first, DWORD *last, cmap_ty ok(size != GDI_ERROR, "no cmap table found\n"); if(size == GDI_ERROR) return FALSE;
- header = HeapAlloc(GetProcessHeap(), 0, size); + header = malloc(size); ret = GetFontData(hdc, MS_CMAP_TAG, 0, header, size); ok(ret == size, "GetFontData should return %lu not %lu\n", size, ret); ok(GET_BE_WORD(header->version) == 0, "got cmap version %d\n", GET_BE_WORD(header->version)); @@ -3563,7 +3562,7 @@ static BOOL get_first_last_from_cmap(HDC hdc, DWORD *first, DWORD *last, cmap_ty }
end: - HeapFree(GetProcessHeap(), 0, header); + free(header); return r; }
@@ -3790,7 +3789,7 @@ static BOOL get_ttf_nametable_entry(HDC hdc, WORD name_id, WCHAR *out_buf, SIZE_ ok(size != GDI_ERROR, "no name table found\n"); if(size == GDI_ERROR) return FALSE;
- data = HeapAlloc(GetProcessHeap(), 0, size); + data = malloc(size); ret = GetFontData(hdc, MS_NAME_TAG, 0, data, size); ok(ret == size, "GetFontData should return %lu not %lu\n", size, ret);
@@ -3847,7 +3846,7 @@ static BOOL get_ttf_nametable_entry(HDC hdc, WORD name_id, WCHAR *out_buf, SIZE_ r = TRUE;
out: - HeapFree(GetProcessHeap(), 0, data); + free(data); return r; }
@@ -5171,7 +5170,7 @@ static void test_realization_info(const char *name, DWORD size, BOOL is_memory_r }
size = file_info.size.LowPart; - data = HeapAlloc(GetProcessHeap(), 0, size + 16); + data = malloc(size + 16);
memset(data, 0xcc, size); ret = pGetFontFileData(info.instance_id, 0, 0, data, size); @@ -5205,7 +5204,7 @@ static void test_realization_info(const char *name, DWORD size, BOOL is_memory_r ok(ret == 0 && GetLastError() == ERROR_NOACCESS, "Unexpected return value %d, error %ld\n", ret, GetLastError()); ok(*(DWORD *)data == 0xcccccccc, "Unexpected buffer contents %#lx.\n", *(DWORD *)data);
- HeapFree(GetProcessHeap(), 0, data); + free(data);
SelectObject(hdc, hfont_prev); DeleteObject(hfont); @@ -5468,7 +5467,7 @@ static INT CALLBACK enum_ms_shell_dlg_proc(const LOGFONTA *lf, const TEXTMETRICA if (efnd->total >= efnd->size) { efnd->size = max( (efnd->total + 1) * 2, 256 ); - efnd->elf = heap_realloc( efnd->elf, efnd->size * sizeof(*efnd->elf) ); + efnd->elf = realloc( efnd->elf, efnd->size * sizeof(*efnd->elf) ); if (!efnd->elf) return 0; } efnd->elf[efnd->total++] = *(ENUMLOGFONTA *)lf; @@ -5489,7 +5488,7 @@ static INT CALLBACK enum_ms_shell_dlg2_proc(const LOGFONTA *lf, const TEXTMETRIC if (efnd->total >= efnd->size) { efnd->size = max( (efnd->total + 1) * 2, 256 ); - efnd->elf = heap_realloc( efnd->elf, efnd->size * sizeof(*efnd->elf) ); + efnd->elf = realloc( efnd->elf, efnd->size * sizeof(*efnd->elf) ); if (!efnd->elf) return 0; } efnd->elf[efnd->total++] = *(ENUMLOGFONTA *)lf; @@ -5554,7 +5553,7 @@ static void test_EnumFonts_subst(void) ok(ret, "did not expect MS Shell Dlg 2\n"); }
- heap_free(efnd.elf); + free(efnd.elf); DeleteDC(hdc); }
@@ -5688,11 +5687,11 @@ static void test_fullname2_helper(const char *Family) ok(buf_size != GDI_ERROR, "no name table found\n"); if (buf_size == GDI_ERROR) continue;
- bufW = HeapAlloc(GetProcessHeap(), 0, buf_size); - bufA = HeapAlloc(GetProcessHeap(), 0, buf_size); + bufW = malloc(buf_size); + bufA = malloc(buf_size);
otm_size = GetOutlineTextMetricsA(hdc, 0, NULL); - otm = HeapAlloc(GetProcessHeap(), 0, otm_size); + otm = malloc(otm_size); memset(otm, 0, otm_size); ret = GetOutlineTextMetricsA(hdc, otm_size, otm); ok(ret != 0, "GetOutlineTextMetrics fails!\n"); @@ -5742,11 +5741,11 @@ static void test_fullname2_helper(const char *Family) SelectObject(hdc, of); DeleteObject(hfont);
- HeapFree(GetProcessHeap(), 0, otm); - HeapFree(GetProcessHeap(), 0, bufW); - HeapFree(GetProcessHeap(), 0, bufA); + free(otm); + free(bufW); + free(bufA); } - heap_free(efnd.elf); + free(efnd.elf); DeleteDC(hdc); }
@@ -5951,7 +5950,7 @@ static void test_fstype_fixup(void) ok(hfont_prev != NULL, "SelectObject failed\n");
otm_size = GetOutlineTextMetricsA(hdc, 0, NULL); - otm = HeapAlloc(GetProcessHeap(), 0, otm_size); + otm = malloc(otm_size); otm->otmSize = sizeof(*otm); ret = GetOutlineTextMetricsA(hdc, otm->otmSize, otm); ok(ret == otm->otmSize, "expected %u, got %lu, error %ld\n", otm->otmSize, ret, GetLastError()); @@ -5960,7 +5959,7 @@ static void test_fstype_fixup(void) valid bits are 1, 2, 3, 8, 9. */ ok((otm->otmfsType & ~0x30e) == 0, "fsType %#x\n", otm->otmfsType);
- HeapFree(GetProcessHeap(), 0, otm); + free(otm);
SelectObject(hdc, hfont_prev); DeleteObject(hfont); @@ -6593,7 +6592,7 @@ static void test_vertical_order(void) } } } - heap_free( efd.lf ); + free( efd.lf ); DeleteDC( hdc ); }
@@ -6883,13 +6882,13 @@ static void test_bitmap_font_glyph_index(void) case 1: { int len = lstrlenW(text); - LPWORD indices = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WORD)); + WORD *indices = malloc(len * sizeof(WORD)); ret = GetGlyphIndicesW(hdc, text, len, indices, 0); ok(ret, "GetGlyphIndices failed\n"); ok(memcmp(indices, text, sizeof(WORD) * len) == 0, "Glyph indices and text are different for %s:%d\n", lf.lfFaceName, tm.tmCharSet); ret = ExtTextOutW(hdc, 0, 0, ETO_GLYPH_INDEX, NULL, indices, len, NULL); - HeapFree(GetProcessHeap(), 0, indices); + free(indices); break; } } @@ -7622,7 +7621,7 @@ static void test_GetCharacterPlacement_kerning(void) hfont_old = SelectObject(hdc, hfont);
count = GetKerningPairsW(hdc, 0, NULL); - kp = HeapAlloc(GetProcessHeap(), 0, count * sizeof(*kp)); + kp = malloc(count * sizeof(*kp));
ret = GetKerningPairsW(hdc, count, kp); ok(ret == count, "got %lu, expected %lu\n", ret, count); @@ -7643,7 +7642,7 @@ static void test_GetCharacterPlacement_kerning(void) } }
- HeapFree(GetProcessHeap(), 0, kp); + free(kp);
count = size;
@@ -7750,7 +7749,7 @@ static void test_GetOutlineTextMetrics_subst(void) ok(!lstrcmpiA(lf.lfFaceName, face_name), "expected %s, got %s\n", lf.lfFaceName, face_name);
ret = GetOutlineTextMetricsA(hdc, 0, NULL); - otm = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, ret); + otm = calloc(1, ret); ret = GetOutlineTextMetricsA(hdc, ret, otm); ok(ret != 0, "GetOutlineTextMetrics failed\n");
@@ -7758,7 +7757,7 @@ static void test_GetOutlineTextMetrics_subst(void) family_name = (const char*)otm + (UINT_PTR)otm->otmpFamilyName; ok(lstrcmpiA(lf.lfFaceName, family_name), "expected a real family name (e.g. Tahoma), got %s\n", family_name);
- HeapFree(GetProcessHeap(), 0, otm); + free(otm); SelectObject(hdc, hfont_old); DeleteObject(hfont);
diff --git a/dlls/gdi32/tests/metafile.c b/dlls/gdi32/tests/metafile.c index b013fe1f196..9abd98b0f92 100644 --- a/dlls/gdi32/tests/metafile.c +++ b/dlls/gdi32/tests/metafile.c @@ -2239,9 +2239,9 @@ static BOOL match_emf_record(const ENHMETARECORD *emr1, const ENHMETARECORD *emr { EMREXTTEXTOUTW *eto1, *eto2;
- eto1 = HeapAlloc(GetProcessHeap(), 0, emr1->nSize); + eto1 = malloc(emr1->nSize); memcpy(eto1, emr1, emr1->nSize); - eto2 = HeapAlloc(GetProcessHeap(), 0, emr2->nSize); + eto2 = malloc(emr2->nSize); memcpy(eto2, emr2, emr2->nSize);
/* different Windows versions setup DC scaling differently */ @@ -2254,8 +2254,8 @@ static BOOL match_emf_record(const ENHMETARECORD *emr1, const ENHMETARECORD *emr dump_EMREXTTEXTOUT(eto1); dump_EMREXTTEXTOUT(eto2); } - HeapFree(GetProcessHeap(), 0, eto1); - HeapFree(GetProcessHeap(), 0, eto2); + free(eto1); + free(eto2); } else if (emr1->iType == EMR_EXTSELECTCLIPRGN && !lstrcmpA(desc, "emf_clipping")) { @@ -4126,7 +4126,7 @@ static void test_mf_PatternBrush(void) BOOL ret; INT type;
- orig_lb = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(LOGBRUSH)); + orig_lb = calloc(1, sizeof(LOGBRUSH));
orig_lb->lbStyle = BS_PATTERN; orig_lb->lbColor = RGB(0, 0, 0); @@ -4180,7 +4180,7 @@ static void test_mf_PatternBrush(void) ret = DeleteObject((HBITMAP)orig_lb->lbHatch); ok( ret, "DeleteObject(HBITMAP) error %ld\n", GetLastError()); - HeapFree (GetProcessHeap(), 0, orig_lb); + free(orig_lb); }
static int CALLBACK pattern_brush_emf_enum_proc(HDC hdc, HANDLETABLE *htable, @@ -4227,7 +4227,7 @@ static void test_emf_pattern_brush(void) unsigned int i; BOOL ret;
- orig_lb = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(LOGBRUSH)); + orig_lb = calloc(1, sizeof(LOGBRUSH));
orig_lb->lbStyle = BS_PATTERN; orig_lb->lbColor = RGB(0, 0, 0); @@ -4275,7 +4275,7 @@ static void test_emf_pattern_brush(void) ok(ret, "DeleteObject failed\n"); ret = DeleteObject((HBITMAP)orig_lb->lbHatch); ok(ret, "DeleteObject failed\n"); - HeapFree(GetProcessHeap(), 0, orig_lb); + free(orig_lb);
ret = EnumEnhMetaFile(NULL, emf, pattern_brush_emf_enum_proc, NULL, NULL); ok(ret, "EnumEnhMetaFile error %ld\n", GetLastError()); @@ -8703,11 +8703,11 @@ static HENHMETAFILE create_converted_emf(const METAFILEPICT *mfp)
size = GetMetaFileBitsEx(hmf, 0, NULL); ok(size, "GetMetaFileBitsEx failed with error %ld\n", GetLastError()); - pBits = HeapAlloc(GetProcessHeap(), 0, size); + pBits = malloc(size); GetMetaFileBitsEx(hmf, size, pBits); DeleteMetaFile(hmf); hemf = SetWinMetaFileBits(size, pBits, NULL, mfp); - HeapFree(GetProcessHeap(), 0, pBits); + free(pBits); return hemf; }
@@ -8887,8 +8887,8 @@ static void test_SetWinMetaFileBits(void) return; }
- buffer = HeapAlloc(GetProcessHeap(), 0, buffer_size); - ok(buffer != NULL, "HeapAlloc failed\n"); + buffer = malloc(buffer_size); + ok(buffer != NULL, "malloc failed\n"); if (!buffer) { DeleteMetaFile(wmf); @@ -8900,7 +8900,7 @@ static void test_SetWinMetaFileBits(void) DeleteMetaFile(wmf); if (res != buffer_size) { - HeapFree(GetProcessHeap(), 0, buffer); + free(buffer); return; }
@@ -8996,7 +8996,7 @@ static void test_SetWinMetaFileBits(void) "SetWinMetaFileBits: xExt and yExt must be ignored for mapping modes other than MM_ANISOTROPIC and MM_ISOTROPIC\n"); }
- HeapFree(GetProcessHeap(), 0, buffer); + free(buffer); }
static BOOL near_match(int x, int y) @@ -9049,7 +9049,7 @@ static void getwinmetafilebits(UINT mode, int scale, RECT *rc) ok(emf != NULL, "emf is NULL\n");
emf_size = GetEnhMetaFileBits(emf, 0, NULL); - enh_header = HeapAlloc(GetProcessHeap(), 0, emf_size); + enh_header = malloc(emf_size); emf_size = GetEnhMetaFileBits(emf, emf_size, (BYTE*)enh_header); DeleteEnhMetaFile(emf); /* multiply szlDevice.cx by scale, when scale != 1 the recording and playback dcs @@ -9064,7 +9064,7 @@ static void getwinmetafilebits(UINT mode, int scale, RECT *rc) broken(size == 0), /* some versions of winxp fail for some reason */ "GetWinMetaFileBits returns 0\n"); if(!size) goto end; - mh = HeapAlloc(GetProcessHeap(), 0, size); + mh = malloc(size); GetWinMetaFileBits(emf, size, (BYTE*)mh, mode, display_dc);
for(i = 0; i < size / 2; i++) check += ((WORD*)mh)[i]; @@ -9172,16 +9172,16 @@ static void getwinmetafilebits(UINT mode, int scale, RECT *rc) emf2 = SetWinMetaFileBits( size, (BYTE*)mh, NULL, &mfp ); ok( !!emf2, "got NULL\n" ); emf2_size = GetEnhMetaFileBits( emf2, 0, NULL ); - enh2_header = HeapAlloc( GetProcessHeap(), 0, emf2_size ); + enh2_header = malloc( emf2_size ); emf2_size = GetEnhMetaFileBits( emf2, emf2_size, (BYTE*)enh2_header ); ok( emf_size == emf2_size, "%d %d\n", emf_size, emf2_size ); ok( !memcmp( enh_header, enh2_header, emf_size ), "mismatch\n" ); - HeapFree( GetProcessHeap(), 0, enh2_header ); + free( enh2_header ); DeleteEnhMetaFile( emf2 );
end: - HeapFree(GetProcessHeap(), 0, mh); - HeapFree(GetProcessHeap(), 0, enh_header); + free(mh); + free(enh_header); DeleteEnhMetaFile(emf);
ReleaseDC(NULL, display_dc); diff --git a/dlls/gdi32/tests/path.c b/dlls/gdi32/tests/path.c index 3c7c0ac1f87..c653c22edeb 100644 --- a/dlls/gdi32/tests/path.c +++ b/dlls/gdi32/tests/path.c @@ -413,9 +413,9 @@ static void ok_path(HDC hdc, const char *path_name, const path_test_t *expected, ok(size > 0, "GetPath returned size %d, last error %ld\n", size, GetLastError()); if (size <= 0) return;
- pnt = HeapAlloc(GetProcessHeap(), 0, size*sizeof(POINT)); + pnt = malloc(size * sizeof(POINT)); assert(pnt != 0); - types = HeapAlloc(GetProcessHeap(), 0, size*sizeof(BYTE)); + types = malloc(size); assert(types != 0); size = GetPath(hdc, pnt, types, size); assert(size > 0); @@ -448,8 +448,8 @@ static void ok_path(HDC hdc, const char *path_name, const path_test_t *expected, printf("};\n" ); }
- HeapFree(GetProcessHeap(), 0, types); - HeapFree(GetProcessHeap(), 0, pnt); + free(types); + free(pnt); }
static const path_test_t arcto_path[] =