Commit 6ea18f66 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

gdi32: Use native memory allocators in Unix library.

parent 4adb1606
...@@ -165,7 +165,7 @@ static BOOL get_vis_rectangles( DC *dc_dst, struct bitblt_coords *dst, ...@@ -165,7 +165,7 @@ static BOOL get_vis_rectangles( DC *dc_dst, struct bitblt_coords *dst,
void CDECL free_heap_bits( struct gdi_image_bits *bits ) void CDECL free_heap_bits( struct gdi_image_bits *bits )
{ {
HeapFree( GetProcessHeap(), 0, bits->ptr ); free( bits->ptr );
} }
DWORD convert_bits( const BITMAPINFO *src_info, struct bitblt_coords *src, DWORD convert_bits( const BITMAPINFO *src_info, struct bitblt_coords *src,
...@@ -180,7 +180,7 @@ DWORD convert_bits( const BITMAPINFO *src_info, struct bitblt_coords *src, ...@@ -180,7 +180,7 @@ DWORD convert_bits( const BITMAPINFO *src_info, struct bitblt_coords *src,
dst_info->bmiHeader.biSizeImage = get_dib_image_size( dst_info ); dst_info->bmiHeader.biSizeImage = get_dib_image_size( dst_info );
if (top_down) dst_info->bmiHeader.biHeight = -dst_info->bmiHeader.biHeight; if (top_down) dst_info->bmiHeader.biHeight = -dst_info->bmiHeader.biHeight;
if (!(ptr = HeapAlloc( GetProcessHeap(), 0, dst_info->bmiHeader.biSizeImage ))) if (!(ptr = malloc( dst_info->bmiHeader.biSizeImage )))
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
err = convert_bitmapinfo( src_info, bits->ptr, src, dst_info, ptr ); err = convert_bitmapinfo( src_info, bits->ptr, src, dst_info, ptr );
...@@ -203,7 +203,7 @@ DWORD stretch_bits( const BITMAPINFO *src_info, struct bitblt_coords *src, ...@@ -203,7 +203,7 @@ DWORD stretch_bits( const BITMAPINFO *src_info, struct bitblt_coords *src,
dst_info->bmiHeader.biSizeImage = get_dib_image_size( dst_info ); dst_info->bmiHeader.biSizeImage = get_dib_image_size( dst_info );
if (src_info->bmiHeader.biHeight < 0) dst_info->bmiHeader.biHeight = -dst_info->bmiHeader.biHeight; if (src_info->bmiHeader.biHeight < 0) dst_info->bmiHeader.biHeight = -dst_info->bmiHeader.biHeight;
if (!(ptr = HeapAlloc( GetProcessHeap(), 0, dst_info->bmiHeader.biSizeImage ))) if (!(ptr = malloc( dst_info->bmiHeader.biSizeImage )))
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
err = stretch_bitmapinfo( src_info, bits->ptr, src, dst_info, ptr, dst, mode ); err = stretch_bitmapinfo( src_info, bits->ptr, src, dst_info, ptr, dst, mode );
...@@ -221,7 +221,7 @@ static DWORD blend_bits( const BITMAPINFO *src_info, const struct gdi_image_bits ...@@ -221,7 +221,7 @@ static DWORD blend_bits( const BITMAPINFO *src_info, const struct gdi_image_bits
if (!dst_bits->is_copy) if (!dst_bits->is_copy)
{ {
int size = dst_info->bmiHeader.biSizeImage; int size = dst_info->bmiHeader.biSizeImage;
void *ptr = HeapAlloc( GetProcessHeap(), 0, size ); void *ptr = malloc( size );
if (!ptr) return ERROR_OUTOFMEMORY; if (!ptr) return ERROR_OUTOFMEMORY;
memcpy( ptr, dst_bits->ptr, size ); memcpy( ptr, dst_bits->ptr, size );
if (dst_bits->free) dst_bits->free( dst_bits ); if (dst_bits->free) dst_bits->free( dst_bits );
...@@ -428,7 +428,7 @@ BOOL CDECL nulldrv_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert ...@@ -428,7 +428,7 @@ BOOL CDECL nulldrv_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert
DWORD err; DWORD err;
HRGN rgn; HRGN rgn;
if (!(pts = HeapAlloc( GetProcessHeap(), 0, nvert * sizeof(*pts) ))) return FALSE; if (!(pts = malloc( nvert * sizeof(*pts) ))) return FALSE;
for (i = 0; i < nvert; i++) for (i = 0; i < nvert; i++)
{ {
pts[i].x = vert_array[i].x; pts[i].x = vert_array[i].x;
...@@ -470,7 +470,7 @@ BOOL CDECL nulldrv_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert ...@@ -470,7 +470,7 @@ BOOL CDECL nulldrv_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert
if (err && err != ERROR_BAD_FORMAT) goto done; if (err && err != ERROR_BAD_FORMAT) goto done;
info->bmiHeader.biSizeImage = get_dib_image_size( info ); info->bmiHeader.biSizeImage = get_dib_image_size( info );
if (!(bits.ptr = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, info->bmiHeader.biSizeImage ))) if (!(bits.ptr = calloc( 1, info->bmiHeader.biSizeImage )))
goto done; goto done;
bits.is_copy = TRUE; bits.is_copy = TRUE;
bits.free = free_heap_bits; bits.free = free_heap_bits;
...@@ -495,7 +495,7 @@ BOOL CDECL nulldrv_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert ...@@ -495,7 +495,7 @@ BOOL CDECL nulldrv_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert
NtGdiDeleteObjectApp( rgn ); NtGdiDeleteObjectApp( rgn );
done: done:
HeapFree( GetProcessHeap(), 0, pts ); free( pts );
return ret; return ret;
} }
......
...@@ -147,7 +147,7 @@ HBITMAP WINAPI NtGdiCreateBitmap( INT width, INT height, UINT planes, ...@@ -147,7 +147,7 @@ HBITMAP WINAPI NtGdiCreateBitmap( INT width, INT height, UINT planes,
} }
/* Create the BITMAPOBJ */ /* Create the BITMAPOBJ */
if (!(bmpobj = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*bmpobj) ))) if (!(bmpobj = calloc( 1, sizeof(*bmpobj) )))
{ {
SetLastError( ERROR_NOT_ENOUGH_MEMORY ); SetLastError( ERROR_NOT_ENOUGH_MEMORY );
return 0; return 0;
...@@ -159,18 +159,18 @@ HBITMAP WINAPI NtGdiCreateBitmap( INT width, INT height, UINT planes, ...@@ -159,18 +159,18 @@ HBITMAP WINAPI NtGdiCreateBitmap( INT width, INT height, UINT planes,
bmpobj->dib.dsBm.bmWidthBytes = get_bitmap_stride( width, bpp ); bmpobj->dib.dsBm.bmWidthBytes = get_bitmap_stride( width, bpp );
bmpobj->dib.dsBm.bmPlanes = planes; bmpobj->dib.dsBm.bmPlanes = planes;
bmpobj->dib.dsBm.bmBitsPixel = bpp; bmpobj->dib.dsBm.bmBitsPixel = bpp;
bmpobj->dib.dsBm.bmBits = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, size ); bmpobj->dib.dsBm.bmBits = calloc( 1, size );
if (!bmpobj->dib.dsBm.bmBits) if (!bmpobj->dib.dsBm.bmBits)
{ {
HeapFree( GetProcessHeap(), 0, bmpobj ); free( bmpobj );
SetLastError( ERROR_NOT_ENOUGH_MEMORY ); SetLastError( ERROR_NOT_ENOUGH_MEMORY );
return 0; return 0;
} }
if (!(hbitmap = alloc_gdi_handle( &bmpobj->obj, NTGDI_OBJ_BITMAP, &bitmap_funcs ))) if (!(hbitmap = alloc_gdi_handle( &bmpobj->obj, NTGDI_OBJ_BITMAP, &bitmap_funcs )))
{ {
HeapFree( GetProcessHeap(), 0, bmpobj->dib.dsBm.bmBits ); free( bmpobj->dib.dsBm.bmBits );
HeapFree( GetProcessHeap(), 0, bmpobj ); free( bmpobj );
return 0; return 0;
} }
...@@ -322,7 +322,7 @@ LONG WINAPI NtGdiSetBitmapBits( ...@@ -322,7 +322,7 @@ LONG WINAPI NtGdiSetBitmapBits(
} }
else else
{ {
if (!(src_bits.ptr = HeapAlloc( GetProcessHeap(), 0, dst.height * dst_stride ))) if (!(src_bits.ptr = malloc( dst.height * dst_stride )))
{ {
GDI_ReleaseObj( hbitmap ); GDI_ReleaseObj( hbitmap );
return 0; return 0;
...@@ -444,8 +444,8 @@ static BOOL BITMAP_DeleteObject( HGDIOBJ handle ) ...@@ -444,8 +444,8 @@ static BOOL BITMAP_DeleteObject( HGDIOBJ handle )
BITMAPOBJ *bmp = free_gdi_handle( handle ); BITMAPOBJ *bmp = free_gdi_handle( handle );
if (!bmp) return FALSE; if (!bmp) return FALSE;
HeapFree( GetProcessHeap(), 0, bmp->dib.dsBm.bmBits ); free( bmp->dib.dsBm.bmBits );
HeapFree( GetProcessHeap(), 0, bmp ); free( bmp );
return TRUE; return TRUE;
} }
......
...@@ -73,12 +73,12 @@ static BOOL copy_bitmap( struct brush_pattern *brush, HBITMAP bitmap ) ...@@ -73,12 +73,12 @@ static BOOL copy_bitmap( struct brush_pattern *brush, HBITMAP bitmap )
brush->bits = bits; brush->bits = bits;
if (!bits.free) if (!bits.free)
{ {
if (!(brush->bits.ptr = HeapAlloc( GetProcessHeap(), 0, info->bmiHeader.biSizeImage ))) goto done; if (!(brush->bits.ptr = malloc( info->bmiHeader.biSizeImage ))) goto done;
memcpy( brush->bits.ptr, bits.ptr, info->bmiHeader.biSizeImage ); memcpy( brush->bits.ptr, bits.ptr, info->bmiHeader.biSizeImage );
brush->bits.free = free_heap_bits; brush->bits.free = free_heap_bits;
} }
if (!(brush->info = HeapAlloc( GetProcessHeap(), 0, get_dib_info_size( info, DIB_RGB_COLORS )))) if (!(brush->info = malloc( get_dib_info_size( info, DIB_RGB_COLORS ))))
{ {
if (brush->bits.free) brush->bits.free( &brush->bits ); if (brush->bits.free) brush->bits.free( &brush->bits );
goto done; goto done;
...@@ -141,7 +141,7 @@ BOOL store_brush_pattern( LOGBRUSH *brush, struct brush_pattern *pattern ) ...@@ -141,7 +141,7 @@ BOOL store_brush_pattern( LOGBRUSH *brush, struct brush_pattern *pattern )
void free_brush_pattern( struct brush_pattern *pattern ) void free_brush_pattern( struct brush_pattern *pattern )
{ {
if (pattern->bits.free) pattern->bits.free( &pattern->bits ); if (pattern->bits.free) pattern->bits.free( &pattern->bits );
HeapFree( GetProcessHeap(), 0, pattern->info ); free( pattern->info );
} }
BOOL CDECL get_brush_bitmap_info( HBRUSH handle, BITMAPINFO *info, void *bits, UINT *usage ) BOOL CDECL get_brush_bitmap_info( HBRUSH handle, BITMAPINFO *info, void *bits, UINT *usage )
...@@ -193,7 +193,7 @@ HBRUSH create_brush( const LOGBRUSH *brush ) ...@@ -193,7 +193,7 @@ HBRUSH create_brush( const LOGBRUSH *brush )
BRUSHOBJ * ptr; BRUSHOBJ * ptr;
HBRUSH hbrush; HBRUSH hbrush;
if (!(ptr = HeapAlloc( GetProcessHeap(), 0, sizeof(*ptr) ))) return 0; if (!(ptr = malloc( sizeof(*ptr) ))) return 0;
ptr->logbrush = *brush; ptr->logbrush = *brush;
...@@ -205,7 +205,7 @@ HBRUSH create_brush( const LOGBRUSH *brush ) ...@@ -205,7 +205,7 @@ HBRUSH create_brush( const LOGBRUSH *brush )
} }
free_brush_pattern( &ptr->pattern ); free_brush_pattern( &ptr->pattern );
HeapFree( GetProcessHeap(), 0, ptr ); free( ptr );
return 0; return 0;
} }
...@@ -335,7 +335,7 @@ static BOOL BRUSH_DeleteObject( HGDIOBJ handle ) ...@@ -335,7 +335,7 @@ static BOOL BRUSH_DeleteObject( HGDIOBJ handle )
if (!brush) return FALSE; if (!brush) return FALSE;
free_brush_pattern( &brush->pattern ); free_brush_pattern( &brush->pattern );
HeapFree( GetProcessHeap(), 0, brush ); free( brush );
return TRUE; return TRUE;
} }
......
...@@ -132,10 +132,10 @@ DC *alloc_dc_ptr( DWORD magic ) ...@@ -132,10 +132,10 @@ DC *alloc_dc_ptr( DWORD magic )
{ {
DC *dc; DC *dc;
if (!(dc = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*dc) ))) return NULL; if (!(dc = calloc( 1, sizeof(*dc) ))) return NULL;
if (!(dc->attr = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*dc->attr)))) if (!(dc->attr = RtlAllocateHeap( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*dc->attr) )))
{ {
HeapFree( GetProcessHeap(), 0, dc ); free( dc );
return NULL; return NULL;
} }
...@@ -152,8 +152,8 @@ DC *alloc_dc_ptr( DWORD magic ) ...@@ -152,8 +152,8 @@ DC *alloc_dc_ptr( DWORD magic )
if (!(dc->hSelf = alloc_gdi_handle( &dc->obj, magic, &dc_funcs ))) if (!(dc->hSelf = alloc_gdi_handle( &dc->obj, magic, &dc_funcs )))
{ {
HeapFree( GetProcessHeap(), 0, dc->attr ); RtlFreeHeap( GetProcessHeap(), 0, dc->attr );
HeapFree( GetProcessHeap(), 0, dc ); free( dc );
return NULL; return NULL;
} }
dc->attr->hdc = dc->nulldrv.hdc = dc->hSelf; dc->attr->hdc = dc->nulldrv.hdc = dc->hSelf;
...@@ -179,8 +179,8 @@ static void free_dc_state( DC *dc ) ...@@ -179,8 +179,8 @@ static void free_dc_state( DC *dc )
if (dc->hVisRgn) NtGdiDeleteObjectApp( dc->hVisRgn ); if (dc->hVisRgn) NtGdiDeleteObjectApp( dc->hVisRgn );
if (dc->region) NtGdiDeleteObjectApp( dc->region ); if (dc->region) NtGdiDeleteObjectApp( dc->region );
if (dc->path) free_gdi_path( dc->path ); if (dc->path) free_gdi_path( dc->path );
HeapFree( GetProcessHeap(), 0, dc->attr ); RtlFreeHeap( GetProcessHeap(), 0, dc->attr );
HeapFree( GetProcessHeap(), 0, dc ); free( dc );
} }
...@@ -472,14 +472,14 @@ INT WINAPI NtGdiSaveDC( HDC hdc ) ...@@ -472,14 +472,14 @@ INT WINAPI NtGdiSaveDC( HDC hdc )
if (!(dc = get_dc_ptr( hdc ))) return 0; if (!(dc = get_dc_ptr( hdc ))) return 0;
if (!(newdc = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*newdc )))) if (!(newdc = calloc( 1, sizeof(*newdc ))))
{ {
release_dc_ptr( dc ); release_dc_ptr( dc );
return 0; return 0;
} }
if (!(newdc->attr = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*newdc->attr) ))) if (!(newdc->attr = calloc( 1, sizeof(*newdc->attr) )))
{ {
HeapFree( GetProcessHeap(), 0, newdc ); free( newdc );
release_dc_ptr( dc ); release_dc_ptr( dc );
return 0; return 0;
} }
......
...@@ -329,7 +329,7 @@ static BOOL build_rle_bitmap( BITMAPINFO *info, struct gdi_image_bits *bits, HRG ...@@ -329,7 +329,7 @@ static BOOL build_rle_bitmap( BITMAPINFO *info, struct gdi_image_bits *bits, HRG
assert( info->bmiHeader.biBitCount == 4 || info->bmiHeader.biBitCount == 8 ); assert( info->bmiHeader.biBitCount == 4 || info->bmiHeader.biBitCount == 8 );
out_bits = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, get_dib_image_size( info ) ); out_bits = calloc( 1, get_dib_image_size( info ) );
if (!out_bits) goto fail; if (!out_bits) goto fail;
if (clip) if (clip)
...@@ -456,7 +456,7 @@ done: ...@@ -456,7 +456,7 @@ done:
fail: fail:
if (run) NtGdiDeleteObjectApp( run ); if (run) NtGdiDeleteObjectApp( run );
if (clip && *clip) NtGdiDeleteObjectApp( *clip ); if (clip && *clip) NtGdiDeleteObjectApp( *clip );
HeapFree( GetProcessHeap(), 0, out_bits ); free( out_bits );
return FALSE; return FALSE;
} }
...@@ -1185,7 +1185,7 @@ BITMAPINFO *copy_packed_dib( const BITMAPINFO *src_info, UINT usage ) ...@@ -1185,7 +1185,7 @@ BITMAPINFO *copy_packed_dib( const BITMAPINFO *src_info, UINT usage )
if (!bitmapinfo_from_user_bitmapinfo( info, src_info, usage, FALSE )) return NULL; if (!bitmapinfo_from_user_bitmapinfo( info, src_info, usage, FALSE )) return NULL;
info_size = get_dib_info_size( info, usage ); info_size = get_dib_info_size( info, usage );
if ((ret = HeapAlloc( GetProcessHeap(), 0, info_size + info->bmiHeader.biSizeImage ))) if ((ret = malloc( info_size + info->bmiHeader.biSizeImage )))
{ {
memcpy( ret, info, info_size ); memcpy( ret, info, info_size );
memcpy( (char *)ret + info_size, (char *)src_info + bitmap_info_size( src_info, usage ), memcpy( (char *)ret + info_size, (char *)src_info + bitmap_info_size( src_info, usage ),
...@@ -1486,7 +1486,7 @@ HBITMAP WINAPI NtGdiCreateDIBSection( HDC hdc, HANDLE section, DWORD offset, con ...@@ -1486,7 +1486,7 @@ HBITMAP WINAPI NtGdiCreateDIBSection( HDC hdc, HANDLE section, DWORD offset, con
WARN( "%u planes not properly supported\n", info->bmiHeader.biPlanes ); WARN( "%u planes not properly supported\n", info->bmiHeader.biPlanes );
} }
if (!(bmp = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*bmp) ))) return 0; if (!(bmp = calloc( 1, sizeof(*bmp) ))) return 0;
TRACE("format (%d,%d), planes %d, bpp %d, %s, size %d %s\n", TRACE("format (%d,%d), planes %d, bpp %d, %s, size %d %s\n",
info->bmiHeader.biWidth, info->bmiHeader.biHeight, info->bmiHeader.biWidth, info->bmiHeader.biHeight,
...@@ -1507,8 +1507,7 @@ HBITMAP WINAPI NtGdiCreateDIBSection( HDC hdc, HANDLE section, DWORD offset, con ...@@ -1507,8 +1507,7 @@ HBITMAP WINAPI NtGdiCreateDIBSection( HDC hdc, HANDLE section, DWORD offset, con
if (usage == DIB_PAL_COLORS && !fill_color_table_from_pal_colors( info, hdc )) if (usage == DIB_PAL_COLORS && !fill_color_table_from_pal_colors( info, hdc ))
goto error; goto error;
bmp->dib.dsBmih.biClrUsed = info->bmiHeader.biClrUsed; bmp->dib.dsBmih.biClrUsed = info->bmiHeader.biClrUsed;
if (!(bmp->color_table = HeapAlloc( GetProcessHeap(), 0, if (!(bmp->color_table = malloc( bmp->dib.dsBmih.biClrUsed * sizeof(RGBQUAD) )))
bmp->dib.dsBmih.biClrUsed * sizeof(RGBQUAD) )))
goto error; goto error;
memcpy( bmp->color_table, info->bmiColors, bmp->dib.dsBmih.biClrUsed * sizeof(RGBQUAD) ); memcpy( bmp->color_table, info->bmiColors, bmp->dib.dsBmih.biClrUsed * sizeof(RGBQUAD) );
} }
...@@ -1569,8 +1568,8 @@ HBITMAP WINAPI NtGdiCreateDIBSection( HDC hdc, HANDLE section, DWORD offset, con ...@@ -1569,8 +1568,8 @@ HBITMAP WINAPI NtGdiCreateDIBSection( HDC hdc, HANDLE section, DWORD offset, con
NtFreeVirtualMemory( GetCurrentProcess(), &bmp->dib.dsBm.bmBits, &size, MEM_RELEASE ); NtFreeVirtualMemory( GetCurrentProcess(), &bmp->dib.dsBm.bmBits, &size, MEM_RELEASE );
} }
error: error:
HeapFree( GetProcessHeap(), 0, bmp->color_table ); free( bmp->color_table );
HeapFree( GetProcessHeap(), 0, bmp ); free( bmp );
return 0; return 0;
} }
...@@ -1631,7 +1630,7 @@ NTSTATUS WINAPI NtGdiDdDDICreateDCFromMemory( D3DKMT_CREATEDCFROMMEMORY *desc ) ...@@ -1631,7 +1630,7 @@ NTSTATUS WINAPI NtGdiDdDDICreateDCFromMemory( D3DKMT_CREATEDCFROMMEMORY *desc )
if (!desc->hDeviceDc || !(dc = NtGdiCreateCompatibleDC( desc->hDeviceDc ))) if (!desc->hDeviceDc || !(dc = NtGdiCreateCompatibleDC( desc->hDeviceDc )))
return STATUS_INVALID_PARAMETER; return STATUS_INVALID_PARAMETER;
if (!(bmp = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*bmp) ))) goto error; if (!(bmp = calloc( 1, sizeof(*bmp) ))) goto error;
bmp->dib.dsBm.bmWidth = desc->Width; bmp->dib.dsBm.bmWidth = desc->Width;
bmp->dib.dsBm.bmHeight = desc->Height; bmp->dib.dsBm.bmHeight = desc->Height;
...@@ -1655,7 +1654,7 @@ NTSTATUS WINAPI NtGdiDdDDICreateDCFromMemory( D3DKMT_CREATEDCFROMMEMORY *desc ) ...@@ -1655,7 +1654,7 @@ NTSTATUS WINAPI NtGdiDdDDICreateDCFromMemory( D3DKMT_CREATEDCFROMMEMORY *desc )
if (format->palette_size) if (format->palette_size)
{ {
if (!(bmp->color_table = HeapAlloc( GetProcessHeap(), 0, format->palette_size * sizeof(*bmp->color_table) ))) if (!(bmp->color_table = malloc( format->palette_size * sizeof(*bmp->color_table) )))
goto error; goto error;
if (desc->pColorTable) if (desc->pColorTable)
{ {
...@@ -1682,8 +1681,8 @@ NTSTATUS WINAPI NtGdiDdDDICreateDCFromMemory( D3DKMT_CREATEDCFROMMEMORY *desc ) ...@@ -1682,8 +1681,8 @@ NTSTATUS WINAPI NtGdiDdDDICreateDCFromMemory( D3DKMT_CREATEDCFROMMEMORY *desc )
return STATUS_SUCCESS; return STATUS_SUCCESS;
error: error:
if (bmp) HeapFree( GetProcessHeap(), 0, bmp->color_table ); if (bmp) free( bmp->color_table );
HeapFree( GetProcessHeap(), 0, bmp ); free( bmp );
NtGdiDeleteObjectApp( dc ); NtGdiDeleteObjectApp( dc );
return STATUS_INVALID_PARAMETER; return STATUS_INVALID_PARAMETER;
} }
...@@ -1759,7 +1758,7 @@ static BOOL DIB_DeleteObject( HGDIOBJ handle ) ...@@ -1759,7 +1758,7 @@ static BOOL DIB_DeleteObject( HGDIOBJ handle )
NtFreeVirtualMemory( GetCurrentProcess(), &bmp->dib.dsBm.bmBits, &size, MEM_RELEASE ); NtFreeVirtualMemory( GetCurrentProcess(), &bmp->dib.dsBm.bmBits, &size, MEM_RELEASE );
} }
HeapFree(GetProcessHeap(), 0, bmp->color_table); free( bmp->color_table );
HeapFree( GetProcessHeap(), 0, bmp ); free( bmp );
return TRUE; return TRUE;
} }
...@@ -699,7 +699,7 @@ static DWORD copy_src_bits( dib_info *src, RECT *src_rect ) ...@@ -699,7 +699,7 @@ static DWORD copy_src_bits( dib_info *src, RECT *src_rect )
{ {
int y, stride = get_dib_stride( src->width, src->bit_count ); int y, stride = get_dib_stride( src->width, src->bit_count );
int height = src_rect->bottom - src_rect->top; int height = src_rect->bottom - src_rect->top;
void *ptr = HeapAlloc( GetProcessHeap(), 0, stride * height ); void *ptr = malloc( stride * height );
if (!ptr) return ERROR_OUTOFMEMORY; if (!ptr) return ERROR_OUTOFMEMORY;
...@@ -730,7 +730,7 @@ static DWORD create_tmp_dib( const dib_info *copy, int width, int height, dib_in ...@@ -730,7 +730,7 @@ static DWORD create_tmp_dib( const dib_info *copy, int width, int height, dib_in
ret->rect.top = 0; ret->rect.top = 0;
ret->rect.right = width; ret->rect.right = width;
ret->rect.bottom = height; ret->rect.bottom = height;
ret->bits.ptr = HeapAlloc( GetProcessHeap(), 0, ret->height * ret->stride ); ret->bits.ptr = malloc( ret->height * ret->stride );
ret->bits.is_copy = TRUE; ret->bits.is_copy = TRUE;
ret->bits.free = free_heap_bits; ret->bits.free = free_heap_bits;
ret->bits.param = NULL; ret->bits.param = NULL;
...@@ -1442,7 +1442,7 @@ BOOL CDECL dibdrv_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert, ...@@ -1442,7 +1442,7 @@ BOOL CDECL dibdrv_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert,
RECT bounds; RECT bounds;
BOOL ret = TRUE; BOOL ret = TRUE;
if (!(pts = HeapAlloc( GetProcessHeap(), 0, nvert * sizeof(*pts) ))) return FALSE; if (!(pts = malloc( nvert * sizeof(*pts) ))) return FALSE;
for (i = 0; i < nvert; i++) for (i = 0; i < nvert; i++)
{ {
pts[i].x = vert_array[i].x; pts[i].x = vert_array[i].x;
...@@ -1489,6 +1489,6 @@ BOOL CDECL dibdrv_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert, ...@@ -1489,6 +1489,6 @@ BOOL CDECL dibdrv_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert,
break; break;
} }
HeapFree( GetProcessHeap(), 0, pts ); free( pts );
return ret; return ret;
} }
...@@ -291,7 +291,7 @@ int get_clipped_rects( const dib_info *dib, const RECT *rc, HRGN clip, struct cl ...@@ -291,7 +291,7 @@ int get_clipped_rects( const dib_info *dib, const RECT *rc, HRGN clip, struct cl
out++; out++;
if (out == &clip_rects->buffer[ARRAY_SIZE( clip_rects->buffer )]) if (out == &clip_rects->buffer[ARRAY_SIZE( clip_rects->buffer )])
{ {
clip_rects->rects = HeapAlloc( GetProcessHeap(), 0, region->numRects * sizeof(RECT) ); clip_rects->rects = malloc( region->numRects * sizeof(RECT) );
if (!clip_rects->rects) return 0; if (!clip_rects->rects) return 0;
memcpy( clip_rects->rects, clip_rects->buffer, (out - clip_rects->buffer) * sizeof(RECT) ); memcpy( clip_rects->rects, clip_rects->buffer, (out - clip_rects->buffer) * sizeof(RECT) );
out = clip_rects->rects + (out - clip_rects->buffer); out = clip_rects->rects + (out - clip_rects->buffer);
...@@ -328,7 +328,7 @@ void add_clipped_bounds( dibdrv_physdev *dev, const RECT *rect, HRGN clip ) ...@@ -328,7 +328,7 @@ void add_clipped_bounds( dibdrv_physdev *dev, const RECT *rect, HRGN clip )
static BOOL CDECL dibdrv_CreateDC( PHYSDEV *dev, LPCWSTR device, LPCWSTR output, static BOOL CDECL dibdrv_CreateDC( PHYSDEV *dev, LPCWSTR device, LPCWSTR output,
const DEVMODEW *data ) const DEVMODEW *data )
{ {
dibdrv_physdev *pdev = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*pdev) ); dibdrv_physdev *pdev = calloc( 1, sizeof(*pdev) );
if (!pdev) return FALSE; if (!pdev) return FALSE;
clear_dib_info(&pdev->dib); clear_dib_info(&pdev->dib);
...@@ -348,7 +348,7 @@ static BOOL CDECL dibdrv_DeleteDC( PHYSDEV dev ) ...@@ -348,7 +348,7 @@ static BOOL CDECL dibdrv_DeleteDC( PHYSDEV dev )
free_pattern_brush( &pdev->brush ); free_pattern_brush( &pdev->brush );
free_pattern_brush( &pdev->pen_brush ); free_pattern_brush( &pdev->pen_brush );
release_cached_font( pdev->font ); release_cached_font( pdev->font );
HeapFree( GetProcessHeap(), 0, pdev ); free( pdev );
return TRUE; return TRUE;
} }
...@@ -875,13 +875,13 @@ static BOOL CDECL windrv_Chord( PHYSDEV dev, INT left, INT top, INT right, INT b ...@@ -875,13 +875,13 @@ static BOOL CDECL windrv_Chord( PHYSDEV dev, INT left, INT top, INT right, INT b
static BOOL CDECL windrv_CreateDC( PHYSDEV *dev, LPCWSTR device, LPCWSTR output, static BOOL CDECL windrv_CreateDC( PHYSDEV *dev, LPCWSTR device, LPCWSTR output,
const DEVMODEW *devmode ) const DEVMODEW *devmode )
{ {
struct windrv_physdev *physdev = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*physdev) ); struct windrv_physdev *physdev = calloc( 1, sizeof(*physdev) );
if (!physdev) return FALSE; if (!physdev) return FALSE;
if (!dib_driver.pCreateDC( dev, NULL, NULL, NULL )) if (!dib_driver.pCreateDC( dev, NULL, NULL, NULL ))
{ {
HeapFree( GetProcessHeap(), 0, physdev ); free( physdev );
return FALSE; return FALSE;
} }
physdev->dibdrv = get_dibdrv_pdev( *dev ); physdev->dibdrv = get_dibdrv_pdev( *dev );
...@@ -894,7 +894,7 @@ static BOOL CDECL windrv_DeleteDC( PHYSDEV dev ) ...@@ -894,7 +894,7 @@ static BOOL CDECL windrv_DeleteDC( PHYSDEV dev )
struct windrv_physdev *physdev = get_windrv_physdev( dev ); struct windrv_physdev *physdev = get_windrv_physdev( dev );
window_surface_release( physdev->surface ); window_surface_release( physdev->surface );
HeapFree( GetProcessHeap(), 0, physdev ); free( physdev );
return TRUE; return TRUE;
} }
......
...@@ -273,7 +273,7 @@ static inline void init_clipped_rects( struct clipped_rects *clip_rects ) ...@@ -273,7 +273,7 @@ static inline void init_clipped_rects( struct clipped_rects *clip_rects )
static inline void free_clipped_rects( struct clipped_rects *clip_rects ) static inline void free_clipped_rects( struct clipped_rects *clip_rects )
{ {
if (clip_rects->rects != clip_rects->buffer) HeapFree( GetProcessHeap(), 0, clip_rects->rects ); if (clip_rects->rects != clip_rects->buffer) free( clip_rects->rects );
} }
/* compute the x coordinate corresponding to y on the specified edge */ /* compute the x coordinate corresponding to y on the specified edge */
......
...@@ -344,7 +344,7 @@ static BOOL draw_arc( PHYSDEV dev, INT left, INT top, INT right, INT bottom, ...@@ -344,7 +344,7 @@ static BOOL draw_arc( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
pt[1].x -= rect.left + width / 2; pt[1].x -= rect.left + width / 2;
pt[1].y -= rect.top + height / 2; pt[1].y -= rect.top + height / 2;
points = HeapAlloc( GetProcessHeap(), 0, (width + height) * 3 * sizeof(*points) ); points = malloc( (width + height) * 3 * sizeof(*points) );
if (!points) return FALSE; if (!points) return FALSE;
if (extra_lines == -1) if (extra_lines == -1)
...@@ -363,13 +363,13 @@ static BOOL draw_arc( PHYSDEV dev, INT left, INT top, INT right, INT bottom, ...@@ -363,13 +363,13 @@ static BOOL draw_arc( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
} }
if (count < 2) if (count < 2)
{ {
HeapFree( GetProcessHeap(), 0, points ); free( points );
return TRUE; return TRUE;
} }
if (pdev->pen_uses_region && !(outline = NtGdiCreateRectRgn( 0, 0, 0, 0 ))) if (pdev->pen_uses_region && !(outline = NtGdiCreateRectRgn( 0, 0, 0, 0 )))
{ {
HeapFree( GetProcessHeap(), 0, points ); free( points );
return FALSE; return FALSE;
} }
...@@ -378,7 +378,7 @@ static BOOL draw_arc( PHYSDEV dev, INT left, INT top, INT right, INT bottom, ...@@ -378,7 +378,7 @@ static BOOL draw_arc( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
get_dib_rect( &pdev->dib, &rc ) && get_dib_rect( &pdev->dib, &rc ) &&
!(interior = create_polypolygon_region( points, &count, 1, WINDING, &rc ))) !(interior = create_polypolygon_region( points, &count, 1, WINDING, &rc )))
{ {
HeapFree( GetProcessHeap(), 0, points ); free( points );
if (outline) NtGdiDeleteObjectApp( outline ); if (outline) NtGdiDeleteObjectApp( outline );
return FALSE; return FALSE;
} }
...@@ -406,7 +406,7 @@ static BOOL draw_arc( PHYSDEV dev, INT left, INT top, INT right, INT bottom, ...@@ -406,7 +406,7 @@ static BOOL draw_arc( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
if (ret) ret = pen_region( pdev, outline ); if (ret) ret = pen_region( pdev, outline );
NtGdiDeleteObjectApp( outline ); NtGdiDeleteObjectApp( outline );
} }
HeapFree( GetProcessHeap(), 0, points ); free( points );
return ret; return ret;
} }
...@@ -600,13 +600,13 @@ static struct cached_font *add_cached_font( DC *dc, HFONT hfont, UINT aa_flags ) ...@@ -600,13 +600,13 @@ static struct cached_font *add_cached_font( DC *dc, HFONT hfont, UINT aa_flags )
{ {
if (!ptr->glyphs[i][j]) continue; if (!ptr->glyphs[i][j]) continue;
for (k = 0; k < GLYPH_CACHE_PAGE_SIZE; k++) for (k = 0; k < GLYPH_CACHE_PAGE_SIZE; k++)
HeapFree( GetProcessHeap(), 0, ptr->glyphs[i][j][k] ); free( ptr->glyphs[i][j][k] );
HeapFree( GetProcessHeap(), 0, ptr->glyphs[i][j] ); free( ptr->glyphs[i][j] );
} }
} }
list_remove( &ptr->entry ); list_remove( &ptr->entry );
} }
else if (!(ptr = HeapAlloc( GetProcessHeap(), 0, sizeof(*ptr) ))) else if (!(ptr = malloc( sizeof(*ptr) )))
{ {
LeaveCriticalSection( &font_cache_cs ); LeaveCriticalSection( &font_cache_cs );
return NULL; return NULL;
...@@ -639,18 +639,18 @@ static struct cached_glyph *add_cached_glyph( struct cached_font *font, UINT ind ...@@ -639,18 +639,18 @@ static struct cached_glyph *add_cached_glyph( struct cached_font *font, UINT ind
{ {
struct cached_glyph **ptr; struct cached_glyph **ptr;
ptr = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, GLYPH_CACHE_PAGE_SIZE * sizeof(*ptr) ); ptr = calloc( 1, GLYPH_CACHE_PAGE_SIZE * sizeof(*ptr) );
if (!ptr) if (!ptr)
{ {
HeapFree( GetProcessHeap(), 0, glyph ); free( glyph );
return NULL; return NULL;
} }
if (InterlockedCompareExchangePointer( (void **)&font->glyphs[type][page], ptr, NULL )) if (InterlockedCompareExchangePointer( (void **)&font->glyphs[type][page], ptr, NULL ))
HeapFree( GetProcessHeap(), 0, ptr ); free( ptr );
} }
ret = InterlockedCompareExchangePointer( (void **)&font->glyphs[type][page][entry], glyph, NULL ); ret = InterlockedCompareExchangePointer( (void **)&font->glyphs[type][page][entry], glyph, NULL );
if (!ret) ret = glyph; if (!ret) ret = glyph;
else HeapFree( GetProcessHeap(), 0, glyph ); else free( glyph );
return ret; return ret;
} }
...@@ -775,7 +775,7 @@ static struct cached_glyph *cache_glyph_bitmap( DC *dc, struct cached_font *font ...@@ -775,7 +775,7 @@ static struct cached_glyph *cache_glyph_bitmap( DC *dc, struct cached_font *font
bit_count = get_glyph_depth( font->aa_flags ); bit_count = get_glyph_depth( font->aa_flags );
stride = get_dib_stride( metrics.gmBlackBoxX, bit_count ); stride = get_dib_stride( metrics.gmBlackBoxX, bit_count );
size = metrics.gmBlackBoxY * stride; size = metrics.gmBlackBoxY * stride;
glyph = HeapAlloc( GetProcessHeap(), 0, FIELD_OFFSET( struct cached_glyph, bits[size] )); glyph = malloc( FIELD_OFFSET( struct cached_glyph, bits[size] ));
if (!glyph) return NULL; if (!glyph) return NULL;
if (!size) goto done; /* empty glyph */ if (!size) goto done; /* empty glyph */
...@@ -785,7 +785,7 @@ static struct cached_glyph *cache_glyph_bitmap( DC *dc, struct cached_font *font ...@@ -785,7 +785,7 @@ static struct cached_glyph *cache_glyph_bitmap( DC *dc, struct cached_font *font
&identity, FALSE ); &identity, FALSE );
if (ret == GDI_ERROR) if (ret == GDI_ERROR)
{ {
HeapFree( GetProcessHeap(), 0, glyph ); free( glyph );
return NULL; return NULL;
} }
assert( ret <= size ); assert( ret <= size );
...@@ -1269,7 +1269,7 @@ BOOL CDECL dibdrv_PolyPolygon( PHYSDEV dev, const POINT *pt, const INT *counts, ...@@ -1269,7 +1269,7 @@ BOOL CDECL dibdrv_PolyPolygon( PHYSDEV dev, const POINT *pt, const INT *counts,
if (total > ARRAY_SIZE( pt_buf )) if (total > ARRAY_SIZE( pt_buf ))
{ {
points = HeapAlloc( GetProcessHeap(), 0, total * sizeof(*pt) ); points = malloc( total * sizeof(*pt) );
if (!points) return FALSE; if (!points) return FALSE;
} }
memcpy( points, pt, total * sizeof(*pt) ); memcpy( points, pt, total * sizeof(*pt) );
...@@ -1315,7 +1315,7 @@ BOOL CDECL dibdrv_PolyPolygon( PHYSDEV dev, const POINT *pt, const INT *counts, ...@@ -1315,7 +1315,7 @@ BOOL CDECL dibdrv_PolyPolygon( PHYSDEV dev, const POINT *pt, const INT *counts,
} }
done: done:
if (points != pt_buf) HeapFree( GetProcessHeap(), 0, points ); if (points != pt_buf) free( points );
return ret; return ret;
} }
...@@ -1340,7 +1340,7 @@ BOOL CDECL dibdrv_PolyPolyline( PHYSDEV dev, const POINT* pt, const DWORD* count ...@@ -1340,7 +1340,7 @@ BOOL CDECL dibdrv_PolyPolyline( PHYSDEV dev, const POINT* pt, const DWORD* count
if (total > ARRAY_SIZE( pt_buf )) if (total > ARRAY_SIZE( pt_buf ))
{ {
points = HeapAlloc( GetProcessHeap(), 0, total * sizeof(*pt) ); points = malloc( total * sizeof(*pt) );
if (!points) return FALSE; if (!points) return FALSE;
} }
memcpy( points, pt, total * sizeof(*pt) ); memcpy( points, pt, total * sizeof(*pt) );
...@@ -1367,7 +1367,7 @@ BOOL CDECL dibdrv_PolyPolyline( PHYSDEV dev, const POINT* pt, const DWORD* count ...@@ -1367,7 +1367,7 @@ BOOL CDECL dibdrv_PolyPolyline( PHYSDEV dev, const POINT* pt, const DWORD* count
} }
done: done:
if (points != pt_buf) HeapFree( GetProcessHeap(), 0, points ); if (points != pt_buf) free( points );
return ret; return ret;
} }
...@@ -1472,12 +1472,12 @@ BOOL CDECL dibdrv_RoundRect( PHYSDEV dev, INT left, INT top, INT right, INT bott ...@@ -1472,12 +1472,12 @@ BOOL CDECL dibdrv_RoundRect( PHYSDEV dev, INT left, INT top, INT right, INT bott
if (ellipse_width <= 2|| ellipse_height <= 2) if (ellipse_width <= 2|| ellipse_height <= 2)
return dibdrv_Rectangle( dev, left, top, right, bottom ); return dibdrv_Rectangle( dev, left, top, right, bottom );
points = HeapAlloc( GetProcessHeap(), 0, (ellipse_width + ellipse_height) * 2 * sizeof(*points) ); points = malloc( (ellipse_width + ellipse_height) * 2 * sizeof(*points) );
if (!points) return FALSE; if (!points) return FALSE;
if (pdev->pen_uses_region && !(outline = NtGdiCreateRectRgn( 0, 0, 0, 0 ))) if (pdev->pen_uses_region && !(outline = NtGdiCreateRectRgn( 0, 0, 0, 0 )))
{ {
HeapFree( GetProcessHeap(), 0, points ); free( points );
return FALSE; return FALSE;
} }
...@@ -1485,7 +1485,7 @@ BOOL CDECL dibdrv_RoundRect( PHYSDEV dev, INT left, INT top, INT right, INT bott ...@@ -1485,7 +1485,7 @@ BOOL CDECL dibdrv_RoundRect( PHYSDEV dev, INT left, INT top, INT right, INT bott
!(interior = NtGdiCreateRoundRectRgn( rect.left, rect.top, rect.right + 1, rect.bottom + 1, !(interior = NtGdiCreateRoundRectRgn( rect.left, rect.top, rect.right + 1, rect.bottom + 1,
ellipse_width, ellipse_height ))) ellipse_width, ellipse_height )))
{ {
HeapFree( GetProcessHeap(), 0, points ); free( points );
if (outline) NtGdiDeleteObjectApp( outline ); if (outline) NtGdiDeleteObjectApp( outline );
return FALSE; return FALSE;
} }
...@@ -1556,7 +1556,7 @@ BOOL CDECL dibdrv_RoundRect( PHYSDEV dev, INT left, INT top, INT right, INT bott ...@@ -1556,7 +1556,7 @@ BOOL CDECL dibdrv_RoundRect( PHYSDEV dev, INT left, INT top, INT right, INT bott
if (ret) ret = pen_region( pdev, outline ); if (ret) ret = pen_region( pdev, outline );
NtGdiDeleteObjectApp( outline ); NtGdiDeleteObjectApp( outline );
} }
HeapFree( GetProcessHeap(), 0, points ); free( points );
return ret; return ret;
} }
......
...@@ -1821,14 +1821,14 @@ static BOOL alloc_brush_mask_bits( dib_brush *brush ) ...@@ -1821,14 +1821,14 @@ static BOOL alloc_brush_mask_bits( dib_brush *brush )
assert(brush->masks.xor == NULL); assert(brush->masks.xor == NULL);
assert(brush->dib.stride > 0); assert(brush->dib.stride > 0);
if (!(brush->masks.xor = HeapAlloc(GetProcessHeap(), 0, 2 * size))) return FALSE; if (!(brush->masks.xor = malloc( 2 * size ))) return FALSE;
brush->masks.and = (char *)brush->masks.xor + size; brush->masks.and = (char *)brush->masks.xor + size;
return TRUE; return TRUE;
} }
static void free_brush_mask_bits( dib_brush *brush ) static void free_brush_mask_bits( dib_brush *brush )
{ {
if (brush->masks.xor != brush->dib.bits.ptr) HeapFree(GetProcessHeap(), 0, brush->masks.xor); if (brush->masks.xor != brush->dib.bits.ptr) free( brush->masks.xor );
brush->masks.and = brush->masks.xor = NULL; brush->masks.and = brush->masks.xor = NULL;
} }
...@@ -2022,7 +2022,7 @@ static BOOL select_pattern_brush( dibdrv_physdev *pdev, dib_brush *brush, BOOL * ...@@ -2022,7 +2022,7 @@ static BOOL select_pattern_brush( dibdrv_physdev *pdev, dib_brush *brush, BOOL *
} }
else else
{ {
brush->dib.bits.ptr = HeapAlloc( GetProcessHeap(), 0, brush->dib.height * brush->dib.stride ); brush->dib.bits.ptr = malloc( brush->dib.height * brush->dib.stride );
brush->dib.bits.is_copy = TRUE; brush->dib.bits.is_copy = TRUE;
brush->dib.bits.free = free_heap_bits; brush->dib.bits.free = free_heap_bits;
brush->dib.funcs->convert_to(&brush->dib, &pattern, &pattern.rect, dither); brush->dib.funcs->convert_to(&brush->dib, &pattern, &pattern.rect, dither);
...@@ -2173,7 +2173,7 @@ HPEN CDECL dibdrv_SelectPen( PHYSDEV dev, HPEN hpen, const struct brush_pattern ...@@ -2173,7 +2173,7 @@ HPEN CDECL dibdrv_SelectPen( PHYSDEV dev, HPEN hpen, const struct brush_pattern
if (!size) return 0; if (!size) return 0;
elp = HeapAlloc( GetProcessHeap(), 0, size ); elp = malloc( size );
NtGdiExtGetObjectW( hpen, size, elp ); NtGdiExtGetObjectW( hpen, size, elp );
logpen.lopnStyle = elp->elpPenStyle; logpen.lopnStyle = elp->elpPenStyle;
...@@ -2253,7 +2253,7 @@ HPEN CDECL dibdrv_SelectPen( PHYSDEV dev, HPEN hpen, const struct brush_pattern ...@@ -2253,7 +2253,7 @@ HPEN CDECL dibdrv_SelectPen( PHYSDEV dev, HPEN hpen, const struct brush_pattern
pdev->pen_uses_region = (logpen.lopnStyle & PS_GEOMETRIC || pdev->pen_width > 1); pdev->pen_uses_region = (logpen.lopnStyle & PS_GEOMETRIC || pdev->pen_width > 1);
pdev->pen_is_ext = (elp != NULL); pdev->pen_is_ext = (elp != NULL);
HeapFree( GetProcessHeap(), 0, elp ); free( elp );
return hpen; return hpen;
} }
......
...@@ -148,12 +148,12 @@ static struct wgl_context * CDECL osmesa_create_context( HDC hdc, const PIXELFOR ...@@ -148,12 +148,12 @@ static struct wgl_context * CDECL osmesa_create_context( HDC hdc, const PIXELFOR
default: default:
return NULL; return NULL;
} }
if (!(context = RtlAllocateHeap( GetProcessHeap(), 0, sizeof( *context )))) return NULL; if (!(context = malloc( sizeof( *context )))) return NULL;
context->format = gl_format; context->format = gl_format;
if (!(context->context = pOSMesaCreateContextExt( gl_format, descr->cDepthBits, descr->cStencilBits, if (!(context->context = pOSMesaCreateContextExt( gl_format, descr->cDepthBits, descr->cStencilBits,
descr->cAccumBits, 0 ))) descr->cAccumBits, 0 )))
{ {
RtlFreeHeap( GetProcessHeap(), 0, context ); free( context );
return NULL; return NULL;
} }
return context; return context;
...@@ -165,7 +165,7 @@ static struct wgl_context * CDECL osmesa_create_context( HDC hdc, const PIXELFOR ...@@ -165,7 +165,7 @@ static struct wgl_context * CDECL osmesa_create_context( HDC hdc, const PIXELFOR
static BOOL CDECL osmesa_delete_context( struct wgl_context *context ) static BOOL CDECL osmesa_delete_context( struct wgl_context *context )
{ {
pOSMesaDestroyContext( context->context ); pOSMesaDestroyContext( context->context );
RtlFreeHeap( GetProcessHeap(), 0, context ); free( context );
return TRUE; return TRUE;
} }
......
...@@ -39,7 +39,6 @@ ...@@ -39,7 +39,6 @@
#include "ntgdi_private.h" #include "ntgdi_private.h"
#include "wine/list.h" #include "wine/list.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(driver); WINE_DEFAULT_DEBUG_CHANNEL(driver);
...@@ -809,7 +808,7 @@ NTSTATUS WINAPI NtGdiDdDDICloseAdapter( const D3DKMT_CLOSEADAPTER *desc ) ...@@ -809,7 +808,7 @@ NTSTATUS WINAPI NtGdiDdDDICloseAdapter( const D3DKMT_CLOSEADAPTER *desc )
if (adapter->handle == desc->hAdapter) if (adapter->handle == desc->hAdapter)
{ {
list_remove( &adapter->entry ); list_remove( &adapter->entry );
heap_free( adapter ); free( adapter );
status = STATUS_SUCCESS; status = STATUS_SUCCESS;
break; break;
} }
...@@ -847,7 +846,7 @@ NTSTATUS WINAPI NtGdiDdDDIOpenAdapterFromLuid( D3DKMT_OPENADAPTERFROMLUID *desc ...@@ -847,7 +846,7 @@ NTSTATUS WINAPI NtGdiDdDDIOpenAdapterFromLuid( D3DKMT_OPENADAPTERFROMLUID *desc
static D3DKMT_HANDLE handle_start = 0; static D3DKMT_HANDLE handle_start = 0;
struct d3dkmt_adapter *adapter; struct d3dkmt_adapter *adapter;
if (!(adapter = heap_alloc( sizeof( *adapter ) ))) return STATUS_NO_MEMORY; if (!(adapter = malloc( sizeof( *adapter ) ))) return STATUS_NO_MEMORY;
EnterCriticalSection( &driver_section ); EnterCriticalSection( &driver_section );
desc->hAdapter = adapter->handle = ++handle_start; desc->hAdapter = adapter->handle = ++handle_start;
...@@ -888,7 +887,7 @@ NTSTATUS WINAPI NtGdiDdDDICreateDevice( D3DKMT_CREATEDEVICE *desc ) ...@@ -888,7 +887,7 @@ NTSTATUS WINAPI NtGdiDdDDICreateDevice( D3DKMT_CREATEDEVICE *desc )
if (desc->Flags.LegacyMode || desc->Flags.RequestVSync || desc->Flags.DisableGpuTimeout) if (desc->Flags.LegacyMode || desc->Flags.RequestVSync || desc->Flags.DisableGpuTimeout)
FIXME("Flags unsupported.\n"); FIXME("Flags unsupported.\n");
device = heap_alloc_zero( sizeof( *device ) ); device = calloc( 1, sizeof( *device ) );
if (!device) if (!device)
return STATUS_NO_MEMORY; return STATUS_NO_MEMORY;
...@@ -924,7 +923,7 @@ NTSTATUS WINAPI NtGdiDdDDIDestroyDevice( const D3DKMT_DESTROYDEVICE *desc ) ...@@ -924,7 +923,7 @@ NTSTATUS WINAPI NtGdiDdDDIDestroyDevice( const D3DKMT_DESTROYDEVICE *desc )
set_owner_desc.hDevice = desc->hDevice; set_owner_desc.hDevice = desc->hDevice;
NtGdiDdDDISetVidPnSourceOwner( &set_owner_desc ); NtGdiDdDDISetVidPnSourceOwner( &set_owner_desc );
list_remove( &device->entry ); list_remove( &device->entry );
heap_free( device ); free( device );
status = STATUS_SUCCESS; status = STATUS_SUCCESS;
break; break;
} }
......
...@@ -445,7 +445,7 @@ static INT CDECL EMFDRV_GetDeviceCaps( PHYSDEV dev, INT cap ) ...@@ -445,7 +445,7 @@ static INT CDECL EMFDRV_GetDeviceCaps( PHYSDEV dev, INT cap )
static BOOL CDECL EMFDRV_DeleteDC( PHYSDEV dev ) static BOOL CDECL EMFDRV_DeleteDC( PHYSDEV dev )
{ {
EMFDRV_PDEVICE *physDev = get_emf_physdev( dev ); EMFDRV_PDEVICE *physDev = get_emf_physdev( dev );
HeapFree( GetProcessHeap(), 0, physDev ); free( physDev );
return TRUE; return TRUE;
} }
...@@ -577,7 +577,7 @@ HDC WINAPI NtGdiCreateMetafileDC( HDC hdc ) ...@@ -577,7 +577,7 @@ HDC WINAPI NtGdiCreateMetafileDC( HDC hdc )
if (!(dc = alloc_dc_ptr( NTGDI_OBJ_ENHMETADC ))) return 0; if (!(dc = alloc_dc_ptr( NTGDI_OBJ_ENHMETADC ))) return 0;
physDev = HeapAlloc( GetProcessHeap(), 0, sizeof(*physDev) ); physDev = malloc( sizeof(*physDev) );
if (!physDev) if (!physDev)
{ {
free_dc_ptr( dc ); free_dc_ptr( dc );
......
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
#include "winreg.h" #include "winreg.h"
#include "ntgdi_private.h" #include "ntgdi_private.h"
#include "wine/exception.h" #include "wine/exception.h"
#include "wine/heap.h"
#include "wine/rbtree.h" #include "wine/rbtree.h"
#include "wine/debug.h" #include "wine/debug.h"
...@@ -293,7 +292,7 @@ static inline WCHAR *strdupW( const WCHAR *p ) ...@@ -293,7 +292,7 @@ static inline WCHAR *strdupW( const WCHAR *p )
{ {
WCHAR *ret; WCHAR *ret;
DWORD len = (lstrlenW(p) + 1) * sizeof(WCHAR); DWORD len = (lstrlenW(p) + 1) * sizeof(WCHAR);
ret = HeapAlloc(GetProcessHeap(), 0, len); ret = malloc( len );
memcpy(ret, p, len); memcpy(ret, p, len);
return ret; return ret;
} }
...@@ -720,8 +719,7 @@ static BOOL add_gdi_font_subst( const WCHAR *from_name, int from_charset, const ...@@ -720,8 +719,7 @@ static BOOL add_gdi_font_subst( const WCHAR *from_name, int from_charset, const
if (get_gdi_font_subst( from_name, from_charset, NULL )) return FALSE; /* already exists */ if (get_gdi_font_subst( from_name, from_charset, NULL )) return FALSE; /* already exists */
if (!(subst = HeapAlloc( GetProcessHeap(), 0, if (!(subst = malloc( offsetof( struct gdi_font_subst, names[len] ) )))
offsetof( struct gdi_font_subst, names[len] ))))
return FALSE; return FALSE;
lstrcpyW( subst->names, from_name ); lstrcpyW( subst->names, from_name );
lstrcpyW( get_subst_to_name(subst), to_name ); lstrcpyW( get_subst_to_name(subst), to_name );
...@@ -819,7 +817,7 @@ static int face_is_in_full_name_tree( const struct gdi_font_face *face ) ...@@ -819,7 +817,7 @@ static int face_is_in_full_name_tree( const struct gdi_font_face *face )
static struct gdi_font_family *create_family( const WCHAR *name, const WCHAR *second_name ) static struct gdi_font_family *create_family( const WCHAR *name, const WCHAR *second_name )
{ {
struct gdi_font_family *family = HeapAlloc( GetProcessHeap(), 0, sizeof(*family) ); struct gdi_font_family *family = malloc( sizeof(*family) );
family->refcount = 1; family->refcount = 1;
lstrcpynW( family->family_name, name, LF_FACESIZE ); lstrcpynW( family->family_name, name, LF_FACESIZE );
...@@ -843,7 +841,7 @@ static void release_family( struct gdi_font_family *family ) ...@@ -843,7 +841,7 @@ static void release_family( struct gdi_font_family *family )
wine_rb_remove( &family_name_tree, &family->name_entry ); wine_rb_remove( &family_name_tree, &family->name_entry );
if (family->second_name[0]) wine_rb_remove( &family_second_name_tree, &family->second_name_entry ); if (family->second_name[0]) wine_rb_remove( &family_second_name_tree, &family->second_name_entry );
if (family->replacement) release_family( family->replacement ); if (family->replacement) release_family( family->replacement );
HeapFree( GetProcessHeap(), 0, family ); free( family );
} }
static struct gdi_font_family *find_family_from_name( const WCHAR *name ) static struct gdi_font_family *find_family_from_name( const WCHAR *name )
...@@ -1057,11 +1055,11 @@ static void release_face( struct gdi_font_face *face ) ...@@ -1057,11 +1055,11 @@ static void release_face( struct gdi_font_face *face )
release_family( face->family ); release_family( face->family );
} }
if (face_is_in_full_name_tree( face )) wine_rb_remove( &face_full_name_tree, &face->full_name_entry ); if (face_is_in_full_name_tree( face )) wine_rb_remove( &face_full_name_tree, &face->full_name_entry );
HeapFree( GetProcessHeap(), 0, face->file ); free( face->file );
HeapFree( GetProcessHeap(), 0, face->style_name ); free( face->style_name );
HeapFree( GetProcessHeap(), 0, face->full_name ); free( face->full_name );
HeapFree( GetProcessHeap(), 0, face->cached_enum_data ); free( face->cached_enum_data );
HeapFree( GetProcessHeap(), 0, face ); free( face );
} }
static int remove_font( const WCHAR *file, DWORD flags ) static int remove_font( const WCHAR *file, DWORD flags )
...@@ -1179,7 +1177,7 @@ static struct gdi_font_face *create_face( struct gdi_font_family *family, const ...@@ -1179,7 +1177,7 @@ static struct gdi_font_face *create_face( struct gdi_font_family *family, const
DWORD ntmflags, DWORD version, DWORD flags, DWORD ntmflags, DWORD version, DWORD flags,
const struct bitmap_font_size *size ) const struct bitmap_font_size *size )
{ {
struct gdi_font_face *face = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*face) ); struct gdi_font_face *face = calloc( 1, sizeof(*face) );
face->refcount = 1; face->refcount = 1;
face->style_name = strdupW( style ); face->style_name = strdupW( style );
...@@ -1484,7 +1482,7 @@ static struct gdi_font_link *add_gdi_font_link( const WCHAR *name ) ...@@ -1484,7 +1482,7 @@ static struct gdi_font_link *add_gdi_font_link( const WCHAR *name )
struct gdi_font_link *link = find_gdi_font_link( name ); struct gdi_font_link *link = find_gdi_font_link( name );
if (link) return link; if (link) return link;
if ((link = HeapAlloc( GetProcessHeap(), 0, sizeof(*link) ))) if ((link = malloc( sizeof(*link) )))
{ {
lstrcpynW( link->name, name, LF_FACESIZE ); lstrcpynW( link->name, name, LF_FACESIZE );
memset( &link->fs, 0, sizeof(link->fs) ); memset( &link->fs, 0, sizeof(link->fs) );
...@@ -1498,7 +1496,7 @@ static void add_gdi_font_link_entry( struct gdi_font_link *link, const WCHAR *fa ...@@ -1498,7 +1496,7 @@ static void add_gdi_font_link_entry( struct gdi_font_link *link, const WCHAR *fa
{ {
struct gdi_font_link_entry *entry; struct gdi_font_link_entry *entry;
entry = HeapAlloc( GetProcessHeap(), 0, sizeof(*entry) ); entry = malloc( sizeof(*entry) );
lstrcpynW( entry->family_name, family_name, LF_FACESIZE ); lstrcpynW( entry->family_name, family_name, LF_FACESIZE );
entry->fs = fs; entry->fs = fs;
link->fs.fsCsb[0] |= fs.fsCsb[0]; link->fs.fsCsb[0] |= fs.fsCsb[0];
...@@ -1966,8 +1964,7 @@ static void free_font_handle( DWORD handle ) ...@@ -1966,8 +1964,7 @@ static void free_font_handle( DWORD handle )
static struct gdi_font *alloc_gdi_font( const WCHAR *file, void *data_ptr, SIZE_T data_size ) static struct gdi_font *alloc_gdi_font( const WCHAR *file, void *data_ptr, SIZE_T data_size )
{ {
UINT len = file ? lstrlenW(file) : 0; UINT len = file ? lstrlenW(file) : 0;
struct gdi_font *font = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, struct gdi_font *font = calloc( 1, offsetof( struct gdi_font, file[len + 1] ));
offsetof( struct gdi_font, file[len + 1] ));
font->refcount = 1; font->refcount = 1;
font->matrix.eM11 = font->matrix.eM22 = 1.0; font->matrix.eM11 = font->matrix.eM22 = 1.0;
...@@ -2021,15 +2018,15 @@ static void free_gdi_font( struct gdi_font *font ) ...@@ -2021,15 +2018,15 @@ static void free_gdi_font( struct gdi_font *font )
list_remove( &child->entry ); list_remove( &child->entry );
free_gdi_font( child ); free_gdi_font( child );
} }
for (i = 0; i < font->gm_size; i++) HeapFree( GetProcessHeap(), 0, font->gm[i] ); for (i = 0; i < font->gm_size; i++) free( font->gm[i] );
HeapFree( GetProcessHeap(), 0, font->otm.otmpFamilyName ); free( font->otm.otmpFamilyName );
HeapFree( GetProcessHeap(), 0, font->otm.otmpStyleName ); free( font->otm.otmpStyleName );
HeapFree( GetProcessHeap(), 0, font->otm.otmpFaceName ); free( font->otm.otmpFaceName );
HeapFree( GetProcessHeap(), 0, font->otm.otmpFullName ); free( font->otm.otmpFullName );
HeapFree( GetProcessHeap(), 0, font->gm ); free( font->gm );
HeapFree( GetProcessHeap(), 0, font->kern_pairs ); free( font->kern_pairs );
HeapFree( GetProcessHeap(), 0, font->gsub_table ); free( font->gsub_table );
HeapFree( GetProcessHeap(), 0, font ); free( font );
} }
static inline const WCHAR *get_gdi_font_name( struct gdi_font *font ) static inline const WCHAR *get_gdi_font_name( struct gdi_font *font )
...@@ -2097,17 +2094,14 @@ static void set_gdi_font_glyph_metrics( struct gdi_font *font, UINT index, ...@@ -2097,17 +2094,14 @@ static void set_gdi_font_glyph_metrics( struct gdi_font *font, UINT index,
{ {
struct glyph_metrics **ptr; struct glyph_metrics **ptr;
if (font->gm) if (!(ptr = realloc( font->gm, (block + 1) * sizeof(*ptr) ))) return;
ptr = HeapReAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, font->gm, (block + 1) * sizeof(*ptr) ); memset( ptr + font->gm_size, 0, (block + 1 - font->gm_size) * sizeof(*ptr) );
else
ptr = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, (block + 1) * sizeof(*ptr) );
if (!ptr) return;
font->gm_size = block + 1; font->gm_size = block + 1;
font->gm = ptr; font->gm = ptr;
} }
if (!font->gm[block]) if (!font->gm[block])
{ {
font->gm[block] = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(**font->gm) * GM_BLOCK_SIZE ); font->gm[block] = calloc( sizeof(**font->gm), GM_BLOCK_SIZE );
if (!font->gm[block]) return; if (!font->gm[block]) return;
} }
font->gm[block][entry].gm = *gm; font->gm[block][entry].gm = *gm;
...@@ -2316,7 +2310,7 @@ static void *get_GSUB_vert_feature( struct gdi_font *font ) ...@@ -2316,7 +2310,7 @@ static void *get_GSUB_vert_feature( struct gdi_font *font )
if (length == GDI_ERROR) return NULL; if (length == GDI_ERROR) return NULL;
header = HeapAlloc( GetProcessHeap(), 0, length ); header = malloc( length );
font_funcs->get_font_data( font, MS_GSUB_TAG, 0, header, length ); font_funcs->get_font_data( font, MS_GSUB_TAG, 0, header, length );
TRACE( "Loaded GSUB table of %i bytes\n", length ); TRACE( "Loaded GSUB table of %i bytes\n", length );
...@@ -2337,7 +2331,7 @@ static void *get_GSUB_vert_feature( struct gdi_font *font ) ...@@ -2337,7 +2331,7 @@ static void *get_GSUB_vert_feature( struct gdi_font *font )
} }
else TRACE("Script not found\n"); else TRACE("Script not found\n");
HeapFree( GetProcessHeap(), 0, header ); free( header );
return NULL; return NULL;
} }
...@@ -2848,7 +2842,7 @@ static BOOL CDECL font_CreateDC( PHYSDEV *dev, LPCWSTR device, LPCWSTR output, ...@@ -2848,7 +2842,7 @@ static BOOL CDECL font_CreateDC( PHYSDEV *dev, LPCWSTR device, LPCWSTR output,
struct font_physdev *physdev; struct font_physdev *physdev;
if (!font_funcs) return TRUE; if (!font_funcs) return TRUE;
if (!(physdev = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*physdev) ))) return FALSE; if (!(physdev = calloc( 1, sizeof(*physdev) ))) return FALSE;
push_dc_driver( dev, &physdev->dev, &font_driver ); push_dc_driver( dev, &physdev->dev, &font_driver );
return TRUE; return TRUE;
} }
...@@ -2862,7 +2856,7 @@ static BOOL CDECL font_DeleteDC( PHYSDEV dev ) ...@@ -2862,7 +2856,7 @@ static BOOL CDECL font_DeleteDC( PHYSDEV dev )
struct font_physdev *physdev = get_font_dev( dev ); struct font_physdev *physdev = get_font_dev( dev );
release_gdi_font( physdev->font ); release_gdi_font( physdev->font );
HeapFree( GetProcessHeap(), 0, physdev ); free( physdev );
return TRUE; return TRUE;
} }
...@@ -3076,10 +3070,10 @@ static BOOL enum_face_charsets( const struct gdi_font_family *family, struct gdi ...@@ -3076,10 +3070,10 @@ static BOOL enum_face_charsets( const struct gdi_font_family *family, struct gdi
{ {
struct gdi_font_enum_data *data; struct gdi_font_enum_data *data;
if (!(data = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*data) )) || if (!(data = calloc( 1, sizeof(*data) )) ||
!get_face_enum_data( face, &data->elf, &data->ntm )) !get_face_enum_data( face, &data->elf, &data->ntm ))
{ {
HeapFree( GetProcessHeap(), 0, data ); free( data );
return TRUE; return TRUE;
} }
face->cached_enum_data = data; face->cached_enum_data = data;
...@@ -4466,13 +4460,13 @@ HFONT WINAPI NtGdiHfontCreate( const ENUMLOGFONTEXDVW *penumex, ULONG size, ULON ...@@ -4466,13 +4460,13 @@ HFONT WINAPI NtGdiHfontCreate( const ENUMLOGFONTEXDVW *penumex, ULONG size, ULON
} }
plf = &penumex->elfEnumLogfontEx.elfLogFont; plf = &penumex->elfEnumLogfontEx.elfLogFont;
if (!(fontPtr = HeapAlloc( GetProcessHeap(), 0, sizeof(*fontPtr) ))) return 0; if (!(fontPtr = malloc( sizeof(*fontPtr) ))) return 0;
fontPtr->logfont = *plf; fontPtr->logfont = *plf;
if (!(hFont = alloc_gdi_handle( &fontPtr->obj, NTGDI_OBJ_FONT, &fontobj_funcs ))) if (!(hFont = alloc_gdi_handle( &fontPtr->obj, NTGDI_OBJ_FONT, &fontobj_funcs )))
{ {
HeapFree( GetProcessHeap(), 0, fontPtr ); free( fontPtr );
return 0; return 0;
} }
...@@ -4647,7 +4641,7 @@ static BOOL FONT_DeleteObject( HGDIOBJ handle ) ...@@ -4647,7 +4641,7 @@ static BOOL FONT_DeleteObject( HGDIOBJ handle )
FONTOBJ *obj; FONTOBJ *obj;
if (!(obj = free_gdi_handle( handle ))) return FALSE; if (!(obj = free_gdi_handle( handle ))) return FALSE;
HeapFree( GetProcessHeap(), 0, obj ); free( obj );
return TRUE; return TRUE;
} }
...@@ -4782,7 +4776,7 @@ BOOL WINAPI NtGdiGetTextExtentExW( HDC hdc, const WCHAR *str, INT count, INT max ...@@ -4782,7 +4776,7 @@ BOOL WINAPI NtGdiGetTextExtentExW( HDC hdc, const WCHAR *str, INT count, INT max
if (!dxs) if (!dxs)
{ {
pos = buffer; pos = buffer;
if (count > 256 && !(pos = HeapAlloc( GetProcessHeap(), 0, count * sizeof(*pos) ))) if (count > 256 && !(pos = malloc( count * sizeof(*pos) )))
{ {
release_dc_ptr( dc ); release_dc_ptr( dc );
return FALSE; return FALSE;
...@@ -4812,7 +4806,7 @@ BOOL WINAPI NtGdiGetTextExtentExW( HDC hdc, const WCHAR *str, INT count, INT max ...@@ -4812,7 +4806,7 @@ BOOL WINAPI NtGdiGetTextExtentExW( HDC hdc, const WCHAR *str, INT count, INT max
size->cy = abs( INTERNAL_YDSTOWS( dc, size->cy )); size->cy = abs( INTERNAL_YDSTOWS( dc, size->cy ));
} }
if (pos != buffer && pos != dxs) HeapFree( GetProcessHeap(), 0, pos ); if (pos != buffer && pos != dxs) free( pos );
release_dc_ptr( dc ); release_dc_ptr( dc );
TRACE("(%p, %s, %d) returning %dx%d\n", hdc, debugstr_wn(str,count), max_ext, size->cx, size->cy ); TRACE("(%p, %s, %d) returning %dx%d\n", hdc, debugstr_wn(str,count), max_ext, size->cx, size->cy );
...@@ -4894,7 +4888,7 @@ UINT WINAPI NtGdiGetOutlineTextMetricsInternalW( HDC hdc, UINT cbData, ...@@ -4894,7 +4888,7 @@ UINT WINAPI NtGdiGetOutlineTextMetricsInternalW( HDC hdc, UINT cbData,
if (lpOTM && ret > cbData) if (lpOTM && ret > cbData)
{ {
output = HeapAlloc(GetProcessHeap(), 0, ret); output = malloc( ret );
ret = dev->funcs->pGetOutlineTextMetrics( dev, ret, output ); ret = dev->funcs->pGetOutlineTextMetrics( dev, ret, output );
} }
...@@ -4938,7 +4932,7 @@ UINT WINAPI NtGdiGetOutlineTextMetricsInternalW( HDC hdc, UINT cbData, ...@@ -4938,7 +4932,7 @@ UINT WINAPI NtGdiGetOutlineTextMetricsInternalW( HDC hdc, UINT cbData,
if(output != lpOTM) if(output != lpOTM)
{ {
memcpy(lpOTM, output, cbData); memcpy(lpOTM, output, cbData);
HeapFree(GetProcessHeap(), 0, output); free( output );
ret = cbData; ret = cbData;
} }
} }
...@@ -4962,21 +4956,21 @@ BOOL WINAPI NtGdiGetCharWidthW( HDC hdc, UINT first, UINT last, WCHAR *chars, ...@@ -4962,21 +4956,21 @@ BOOL WINAPI NtGdiGetCharWidthW( HDC hdc, UINT first, UINT last, WCHAR *chars,
ABC *abc; ABC *abc;
unsigned int i; unsigned int i;
if (!(abc = HeapAlloc(GetProcessHeap(), 0, count * sizeof(ABC)))) if (!(abc = malloc( count * sizeof(ABC) )))
return FALSE; return FALSE;
if (!NtGdiGetCharABCWidthsW( hdc, first, last, chars, if (!NtGdiGetCharABCWidthsW( hdc, first, last, chars,
NTGDI_GETCHARABCWIDTHS_INT | NTGDI_GETCHARABCWIDTHS_INDICES, NTGDI_GETCHARABCWIDTHS_INT | NTGDI_GETCHARABCWIDTHS_INDICES,
abc )) abc ))
{ {
HeapFree( GetProcessHeap(), 0, abc ); free( abc );
return FALSE; return FALSE;
} }
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
((INT *)buf)[i] = abc[i].abcA + abc[i].abcB + abc[i].abcC; ((INT *)buf)[i] = abc[i].abcA + abc[i].abcB + abc[i].abcC;
HeapFree(GetProcessHeap(), 0, abc); free( abc );
return TRUE; return TRUE;
} }
...@@ -5040,7 +5034,7 @@ static DWORD get_glyph_bitmap( HDC hdc, UINT index, UINT flags, UINT aa_flags, ...@@ -5040,7 +5034,7 @@ static DWORD get_glyph_bitmap( HDC hdc, UINT index, UINT flags, UINT aa_flags,
stride = get_dib_stride( metrics->gmBlackBoxX, 1 ); stride = get_dib_stride( metrics->gmBlackBoxX, 1 );
size = metrics->gmBlackBoxY * stride; size = metrics->gmBlackBoxY * stride;
if (!(image->ptr = HeapAlloc( GetProcessHeap(), 0, size ))) return ERROR_OUTOFMEMORY; if (!(image->ptr = malloc( size ))) return ERROR_OUTOFMEMORY;
image->is_copy = TRUE; image->is_copy = TRUE;
image->free = free_heap_bits; image->free = free_heap_bits;
...@@ -5048,7 +5042,7 @@ static DWORD get_glyph_bitmap( HDC hdc, UINT index, UINT flags, UINT aa_flags, ...@@ -5048,7 +5042,7 @@ static DWORD get_glyph_bitmap( HDC hdc, UINT index, UINT flags, UINT aa_flags,
&identity, FALSE ); &identity, FALSE );
if (ret == GDI_ERROR) if (ret == GDI_ERROR)
{ {
HeapFree( GetProcessHeap(), 0, image->ptr ); free( image->ptr );
return ERROR_NOT_FOUND; return ERROR_NOT_FOUND;
} }
return ERROR_SUCCESS; return ERROR_SUCCESS;
...@@ -5112,7 +5106,7 @@ static void draw_glyph( DC *dc, INT origin_x, INT origin_y, const GLYPHMETRICS * ...@@ -5112,7 +5106,7 @@ static void draw_glyph( DC *dc, INT origin_x, INT origin_y, const GLYPHMETRICS *
else if (!intersect_rect( &clipped_rect, &rect, clip )) return; else if (!intersect_rect( &clipped_rect, &rect, clip )) return;
max_count = (metrics->gmBlackBoxX + 1) * metrics->gmBlackBoxY; max_count = (metrics->gmBlackBoxX + 1) * metrics->gmBlackBoxY;
pts = HeapAlloc( GetProcessHeap(), 0, max_count * sizeof(*pts) ); pts = malloc( max_count * sizeof(*pts) );
if (!pts) return; if (!pts) return;
count = 0; count = 0;
...@@ -5139,7 +5133,7 @@ static void draw_glyph( DC *dc, INT origin_x, INT origin_y, const GLYPHMETRICS * ...@@ -5139,7 +5133,7 @@ static void draw_glyph( DC *dc, INT origin_x, INT origin_y, const GLYPHMETRICS *
const UINT pts_count = 2; const UINT pts_count = 2;
NtGdiPolyPolyDraw( dc->hSelf, pts + i, &pts_count, 1, NtGdiPolyPolyline ); NtGdiPolyPolyDraw( dc->hSelf, pts + i, &pts_count, 1, NtGdiPolyPolyline );
} }
HeapFree( GetProcessHeap(), 0, pts ); free( pts );
} }
/*********************************************************************** /***********************************************************************
...@@ -5211,7 +5205,7 @@ BOOL CDECL nulldrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT ...@@ -5211,7 +5205,7 @@ BOOL CDECL nulldrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT
src.visrect.right = src.width; src.visrect.right = src.width;
src.visrect.bottom = src.height; src.visrect.bottom = src.height;
bits.ptr = HeapAlloc( GetProcessHeap(), 0, info->bmiHeader.biSizeImage ); bits.ptr = malloc( info->bmiHeader.biSizeImage );
if (!bits.ptr) return ERROR_OUTOFMEMORY; if (!bits.ptr) return ERROR_OUTOFMEMORY;
bits.is_copy = TRUE; bits.is_copy = TRUE;
bits.free = free_heap_bits; bits.free = free_heap_bits;
...@@ -5224,7 +5218,7 @@ BOOL CDECL nulldrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT ...@@ -5224,7 +5218,7 @@ BOOL CDECL nulldrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT
err = src_dev->funcs->pGetImage( src_dev, info, &bits, &src ); err = src_dev->funcs->pGetImage( src_dev, info, &bits, &src );
if (!err && !bits.is_copy) if (!err && !bits.is_copy)
{ {
void *ptr = HeapAlloc( GetProcessHeap(), 0, info->bmiHeader.biSizeImage ); void *ptr = malloc( info->bmiHeader.biSizeImage );
if (!ptr) if (!ptr)
{ {
if (bits.free) bits.free( &bits ); if (bits.free) bits.free( &bits );
...@@ -5436,7 +5430,7 @@ BOOL WINAPI NtGdiExtTextOutW( HDC hdc, INT x, INT y, UINT flags, const RECT *lpr ...@@ -5436,7 +5430,7 @@ BOOL WINAPI NtGdiExtTextOutW( HDC hdc, INT x, INT y, UINT flags, const RECT *lpr
UINT i; UINT i;
POINT total = {0, 0}, desired[2]; POINT total = {0, 0}, desired[2];
deltas = HeapAlloc(GetProcessHeap(), 0, count * sizeof(*deltas)); deltas = malloc( count * sizeof(*deltas) );
if (lpDx) if (lpDx)
{ {
if (flags & ETO_PDY) if (flags & ETO_PDY)
...@@ -5458,7 +5452,7 @@ BOOL WINAPI NtGdiExtTextOutW( HDC hdc, INT x, INT y, UINT flags, const RECT *lpr ...@@ -5458,7 +5452,7 @@ BOOL WINAPI NtGdiExtTextOutW( HDC hdc, INT x, INT y, UINT flags, const RECT *lpr
} }
else else
{ {
INT *dx = HeapAlloc( GetProcessHeap(), 0, count * sizeof(*dx) ); INT *dx = malloc( count * sizeof(*dx) );
NtGdiGetTextExtentExW( hdc, str, count, -1, NULL, dx, &sz, !!(flags & ETO_GLYPH_INDEX) ); NtGdiGetTextExtentExW( hdc, str, count, -1, NULL, dx, &sz, !!(flags & ETO_GLYPH_INDEX) );
...@@ -5469,7 +5463,7 @@ BOOL WINAPI NtGdiExtTextOutW( HDC hdc, INT x, INT y, UINT flags, const RECT *lpr ...@@ -5469,7 +5463,7 @@ BOOL WINAPI NtGdiExtTextOutW( HDC hdc, INT x, INT y, UINT flags, const RECT *lpr
deltas[i].x = dx[i] - dx[i - 1]; deltas[i].x = dx[i] - dx[i - 1];
deltas[i].y = 0; deltas[i].y = 0;
} }
HeapFree( GetProcessHeap(), 0, dx ); free( dx );
} }
for(i = 0; i < count; i++) for(i = 0; i < count; i++)
...@@ -5596,7 +5590,7 @@ BOOL WINAPI NtGdiExtTextOutW( HDC hdc, INT x, INT y, UINT flags, const RECT *lpr ...@@ -5596,7 +5590,7 @@ BOOL WINAPI NtGdiExtTextOutW( HDC hdc, INT x, INT y, UINT flags, const RECT *lpr
str, count, (INT*)deltas ); str, count, (INT*)deltas );
done: done:
HeapFree(GetProcessHeap(), 0, deltas); free( deltas );
if (ret && (lf.lfUnderline || lf.lfStrikeOut)) if (ret && (lf.lfUnderline || lf.lfStrikeOut))
{ {
...@@ -5619,7 +5613,7 @@ done: ...@@ -5619,7 +5613,7 @@ done:
} }
else else
{ {
otm = HeapAlloc(GetProcessHeap(), 0, size); otm = malloc( size );
NtGdiGetOutlineTextMetricsInternalW( hdc, size, otm, 0 ); NtGdiGetOutlineTextMetricsInternalW( hdc, size, otm, 0 );
underlinePos = abs( INTERNAL_YWSTODS( dc, otm->otmsUnderscorePosition )); underlinePos = abs( INTERNAL_YWSTODS( dc, otm->otmsUnderscorePosition ));
if (otm->otmsUnderscorePosition < 0) underlinePos = -underlinePos; if (otm->otmsUnderscorePosition < 0) underlinePos = -underlinePos;
...@@ -5627,7 +5621,7 @@ done: ...@@ -5627,7 +5621,7 @@ done:
strikeoutPos = abs( INTERNAL_YWSTODS( dc, otm->otmsStrikeoutPosition )); strikeoutPos = abs( INTERNAL_YWSTODS( dc, otm->otmsStrikeoutPosition ));
if (otm->otmsStrikeoutPosition < 0) strikeoutPos = -strikeoutPos; if (otm->otmsStrikeoutPosition < 0) strikeoutPos = -strikeoutPos;
strikeoutWidth = get_line_width( dc, otm->otmsStrikeoutSize ); strikeoutWidth = get_line_width( dc, otm->otmsStrikeoutSize );
HeapFree(GetProcessHeap(), 0, otm); free( otm );
} }
...@@ -6111,7 +6105,7 @@ static void update_external_font_keys(void) ...@@ -6111,7 +6105,7 @@ static void update_external_font_keys(void)
continue; continue;
} }
if (tmp && !*tmp) *tmp = ' '; if (tmp && !*tmp) *tmp = ' ';
if (!(key = HeapAlloc( GetProcessHeap(), 0, sizeof(*key) ))) break; if (!(key = malloc( sizeof(*key) ))) break;
lstrcpyW( key->value, value ); lstrcpyW( key->value, value );
list_add_tail( &external_keys, &key->entry ); list_add_tail( &external_keys, &key->entry );
} }
...@@ -6148,7 +6142,7 @@ static void update_external_font_keys(void) ...@@ -6148,7 +6142,7 @@ static void update_external_font_keys(void)
reg_delete_value( winnt_key, key->value ); reg_delete_value( winnt_key, key->value );
reg_delete_value( hkey, key->value ); reg_delete_value( hkey, key->value );
list_remove( &key->entry ); list_remove( &key->entry );
HeapFree( GetProcessHeap(), 0, key ); free( key );
} }
NtClose( win9x_key ); NtClose( win9x_key );
NtClose( winnt_key ); NtClose( winnt_key );
...@@ -6299,7 +6293,7 @@ HANDLE WINAPI NtGdiAddFontMemResourceEx( void *ptr, DWORD size, void *dv, ULONG ...@@ -6299,7 +6293,7 @@ HANDLE WINAPI NtGdiAddFontMemResourceEx( void *ptr, DWORD size, void *dv, ULONG
return NULL; return NULL;
} }
if (!font_funcs) return NULL; if (!font_funcs) return NULL;
if (!(copy = HeapAlloc( GetProcessHeap(), 0, size ))) return NULL; if (!(copy = malloc( size ))) return NULL;
memcpy( copy, ptr, size ); memcpy( copy, ptr, size );
EnterCriticalSection( &font_cs ); EnterCriticalSection( &font_cs );
...@@ -6308,7 +6302,7 @@ HANDLE WINAPI NtGdiAddFontMemResourceEx( void *ptr, DWORD size, void *dv, ULONG ...@@ -6308,7 +6302,7 @@ HANDLE WINAPI NtGdiAddFontMemResourceEx( void *ptr, DWORD size, void *dv, ULONG
if (!num_fonts) if (!num_fonts)
{ {
HeapFree( GetProcessHeap(), 0, copy ); free( copy );
return NULL; return NULL;
} }
......
...@@ -425,7 +425,7 @@ static char **expand_mac_font(const char *path) ...@@ -425,7 +425,7 @@ static char **expand_mac_font(const char *path)
ret.size = 0; ret.size = 0;
ret.max_size = 10; ret.max_size = 10;
ret.array = RtlAllocateHeap(GetProcessHeap(), HEAP_ZERO_MEMORY, ret.max_size * sizeof(*ret.array)); ret.array = calloc( ret.max_size, sizeof(*ret.array) );
if(!ret.array) if(!ret.array)
{ {
CloseResFile(res_ref); CloseResFile(res_ref);
...@@ -485,7 +485,7 @@ static char **expand_mac_font(const char *path) ...@@ -485,7 +485,7 @@ static char **expand_mac_font(const char *path)
continue; continue;
} }
output = RtlAllocateHeap(GetProcessHeap(), 0, output_len); output = malloc( output_len);
if(output) if(output)
{ {
int fd; int fd;
...@@ -507,15 +507,16 @@ static char **expand_mac_font(const char *path) ...@@ -507,15 +507,16 @@ static char **expand_mac_font(const char *path)
} }
if(ret.size >= ret.max_size - 1) /* Always want the last element to be NULL */ if(ret.size >= ret.max_size - 1) /* Always want the last element to be NULL */
{ {
ret.array = realloc( ret.array, ret.max_size * sizeof(*ret.array) * 2 );
memset( ret.array + ret.max_size, 0, ret.max_size * sizeof(*ret.array) );
ret.max_size *= 2; ret.max_size *= 2;
ret.array = RtlReAllocateHeap(GetProcessHeap(), HEAP_ZERO_MEMORY, ret.array, ret.max_size * sizeof(*ret.array));
} }
ret.array[ret.size++] = output; ret.array[ret.size++] = output;
} }
else else
{ {
WARN("unable to create %s\n", output); WARN("unable to create %s\n", output);
RtlFreeHeap(GetProcessHeap(), 0, output); free( output );
} }
} }
ReleaseResource(sfnt); ReleaseResource(sfnt);
...@@ -592,7 +593,7 @@ static LPWSTR strdupW(LPCWSTR p) ...@@ -592,7 +593,7 @@ static LPWSTR strdupW(LPCWSTR p)
{ {
LPWSTR ret; LPWSTR ret;
DWORD len = (lstrlenW(p) + 1) * sizeof(WCHAR); DWORD len = (lstrlenW(p) + 1) * sizeof(WCHAR);
ret = RtlAllocateHeap(GetProcessHeap(), 0, len); ret = malloc( len );
memcpy(ret, p, len); memcpy(ret, p, len);
return ret; return ret;
} }
...@@ -600,7 +601,7 @@ static LPWSTR strdupW(LPCWSTR p) ...@@ -600,7 +601,7 @@ static LPWSTR strdupW(LPCWSTR p)
static WCHAR *towstr(const char *str) static WCHAR *towstr(const char *str)
{ {
DWORD len = strlen(str) + 1; DWORD len = strlen(str) + 1;
WCHAR *wstr = RtlAllocateHeap( GetProcessHeap(), 0, len * sizeof(WCHAR) ); WCHAR *wstr = malloc( len * sizeof(WCHAR) );
RtlMultiByteToUnicodeN( wstr, len * sizeof(WCHAR), &len, str, len ); RtlMultiByteToUnicodeN( wstr, len * sizeof(WCHAR), &len, str, len );
return wstr; return wstr;
} }
...@@ -796,14 +797,14 @@ static WCHAR *copy_name_table_string( const FT_SfntName *name ) ...@@ -796,14 +797,14 @@ static WCHAR *copy_name_table_string( const FT_SfntName *name )
{ {
case TT_PLATFORM_APPLE_UNICODE: case TT_PLATFORM_APPLE_UNICODE:
case TT_PLATFORM_MICROSOFT: case TT_PLATFORM_MICROSOFT:
ret = RtlAllocateHeap( GetProcessHeap(), 0, name->string_len + sizeof(WCHAR) ); ret = malloc( name->string_len + sizeof(WCHAR) );
for (i = 0; i < name->string_len / 2; i++) for (i = 0; i < name->string_len / 2; i++)
ret[i] = (name->string[i * 2] << 8) | name->string[i * 2 + 1]; ret[i] = (name->string[i * 2] << 8) | name->string[i * 2 + 1];
ret[i] = 0; ret[i] = 0;
return ret; return ret;
case TT_PLATFORM_MACINTOSH: case TT_PLATFORM_MACINTOSH:
if (!(cp = get_mac_code_page( name ))) return NULL; if (!(cp = get_mac_code_page( name ))) return NULL;
ret = RtlAllocateHeap( GetProcessHeap(), 0, (name->string_len + 1) * sizeof(WCHAR) ); ret = malloc( (name->string_len + 1) * sizeof(WCHAR) );
RtlCustomCPToUnicodeN( cp, ret, name->string_len * sizeof(WCHAR), &i, RtlCustomCPToUnicodeN( cp, ret, name->string_len * sizeof(WCHAR), &i,
(char *)name->string, name->string_len ); (char *)name->string, name->string_len );
ret[i / sizeof(WCHAR)] = 0; ret[i / sizeof(WCHAR)] = 0;
...@@ -877,11 +878,11 @@ static WCHAR *ft_face_get_full_name( FT_Face ft_face, LANGID langid ) ...@@ -877,11 +878,11 @@ static WCHAR *ft_face_get_full_name( FT_Face ft_face, LANGID langid )
style_name = ft_face_get_style_name( ft_face, langid ); style_name = ft_face_get_style_name( ft_face, langid );
length = lstrlenW( full_name ) + lstrlenW( space_w ) + lstrlenW( style_name ) + 1; length = lstrlenW( full_name ) + lstrlenW( space_w ) + lstrlenW( style_name ) + 1;
full_name = RtlReAllocateHeap( GetProcessHeap(), 0, full_name, length * sizeof(WCHAR) ); full_name = realloc( full_name, length * sizeof(WCHAR) );
lstrcatW( full_name, space_w ); lstrcatW( full_name, space_w );
lstrcatW( full_name, style_name ); lstrcatW( full_name, style_name );
RtlFreeHeap( GetProcessHeap(), 0, style_name ); free( style_name );
WARN( "full name not found, using %s instead\n", debugstr_w(full_name) ); WARN( "full name not found, using %s instead\n", debugstr_w(full_name) );
return full_name; return full_name;
...@@ -1219,7 +1220,7 @@ static struct unix_face *unix_face_create( const char *unix_name, void *data_ptr ...@@ -1219,7 +1220,7 @@ static struct unix_face *unix_face_create( const char *unix_name, void *data_ptr
if (data_ptr == MAP_FAILED) return NULL; if (data_ptr == MAP_FAILED) return NULL;
} }
if (!(This = RtlAllocateHeap( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*This) ))) goto done; if (!(This = calloc( 1, sizeof(*This) ))) goto done;
if (opentype_get_ttc_sfnt_v1( data_ptr, data_size, face_index, &face_count, &ttc_sfnt_v1 ) && if (opentype_get_ttc_sfnt_v1( data_ptr, data_size, face_index, &face_count, &ttc_sfnt_v1 ) &&
opentype_get_tt_name_v0( data_ptr, data_size, ttc_sfnt_v1, &tt_name_v0 ) && opentype_get_tt_name_v0( data_ptr, data_size, ttc_sfnt_v1, &tt_name_v0 ) &&
...@@ -1259,7 +1260,7 @@ static struct unix_face *unix_face_create( const char *unix_name, void *data_ptr ...@@ -1259,7 +1260,7 @@ static struct unix_face *unix_face_create( const char *unix_name, void *data_ptr
if (!This->full_name && This->family_name && This->style_name) if (!This->full_name && This->family_name && This->style_name)
{ {
length = lstrlenW( This->family_name ) + lstrlenW( space_w ) + lstrlenW( This->style_name ) + 1; length = lstrlenW( This->family_name ) + lstrlenW( space_w ) + lstrlenW( This->style_name ) + 1;
This->full_name = RtlAllocateHeap( GetProcessHeap(), 0, length * sizeof(WCHAR) ); This->full_name = malloc( length * sizeof(WCHAR) );
lstrcpyW( This->full_name, This->family_name ); lstrcpyW( This->full_name, This->family_name );
lstrcatW( This->full_name, space_w ); lstrcatW( This->full_name, space_w );
lstrcatW( This->full_name, This->style_name ); lstrcatW( This->full_name, This->style_name );
...@@ -1279,12 +1280,12 @@ static struct unix_face *unix_face_create( const char *unix_name, void *data_ptr ...@@ -1279,12 +1280,12 @@ static struct unix_face *unix_face_create( const char *unix_name, void *data_ptr
if (!RtlCompareUnicodeStrings( This->family_name, lstrlenW( This->family_name ), if (!RtlCompareUnicodeStrings( This->family_name, lstrlenW( This->family_name ),
This->second_name, lstrlenW( This->second_name ), TRUE )) This->second_name, lstrlenW( This->second_name ), TRUE ))
{ {
RtlFreeHeap( GetProcessHeap(), 0, This->second_name ); free( This->second_name );
This->second_name = ft_face_get_family_name( This->ft_face, MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL) ); This->second_name = ft_face_get_family_name( This->ft_face, MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL) );
if (!RtlCompareUnicodeStrings( This->family_name, lstrlenW( This->family_name ), if (!RtlCompareUnicodeStrings( This->family_name, lstrlenW( This->family_name ),
This->second_name, lstrlenW( This->second_name ), TRUE )) This->second_name, lstrlenW( This->second_name ), TRUE ))
{ {
RtlFreeHeap( GetProcessHeap(), 0, This->second_name ); free( This->second_name );
This->second_name = NULL; This->second_name = NULL;
} }
} }
...@@ -1299,7 +1300,7 @@ static struct unix_face *unix_face_create( const char *unix_name, void *data_ptr ...@@ -1299,7 +1300,7 @@ static struct unix_face *unix_face_create( const char *unix_name, void *data_ptr
} }
else else
{ {
RtlFreeHeap( GetProcessHeap(), 0, This ); free( This );
This = NULL; This = NULL;
} }
...@@ -1311,11 +1312,11 @@ done: ...@@ -1311,11 +1312,11 @@ done:
static void unix_face_destroy( struct unix_face *This ) static void unix_face_destroy( struct unix_face *This )
{ {
if (This->ft_face) pFT_Done_Face( This->ft_face ); if (This->ft_face) pFT_Done_Face( This->ft_face );
RtlFreeHeap( GetProcessHeap(), 0, This->full_name ); free( This->full_name );
RtlFreeHeap( GetProcessHeap(), 0, This->style_name ); free( This->style_name );
RtlFreeHeap( GetProcessHeap(), 0, This->second_name ); free( This->second_name );
RtlFreeHeap( GetProcessHeap(), 0, This->family_name ); free( This->family_name );
RtlFreeHeap( GetProcessHeap(), 0, This ); free( This );
} }
static int add_unix_face( const char *unix_name, const WCHAR *file, void *data_ptr, SIZE_T data_size, static int add_unix_face( const char *unix_name, const WCHAR *file, void *data_ptr, SIZE_T data_size,
...@@ -1356,10 +1357,10 @@ static WCHAR *get_dos_file_name( LPCSTR str ) ...@@ -1356,10 +1357,10 @@ static WCHAR *get_dos_file_name( LPCSTR str )
ULONG len = strlen(str) + 1; ULONG len = strlen(str) + 1;
len += 8; /* \??\unix prefix */ len += 8; /* \??\unix prefix */
if (!(buffer = RtlAllocateHeap( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return NULL; if (!(buffer = malloc( len * sizeof(WCHAR) ))) return NULL;
if (wine_unix_to_nt_file_name( str, buffer, &len )) if (wine_unix_to_nt_file_name( str, buffer, &len ))
{ {
RtlFreeHeap( GetProcessHeap(), 0, buffer ); free( buffer );
return NULL; return NULL;
} }
return buffer; return buffer;
...@@ -1377,19 +1378,19 @@ static char *get_unix_file_name( LPCWSTR dosW ) ...@@ -1377,19 +1378,19 @@ static char *get_unix_file_name( LPCWSTR dosW )
InitializeObjectAttributes( &attr, &nt_name, 0, 0, NULL ); InitializeObjectAttributes( &attr, &nt_name, 0, 0, NULL );
for (;;) for (;;)
{ {
if (!(buffer = RtlAllocateHeap( GetProcessHeap(), 0, size ))) if (!(buffer = malloc( size )))
{ {
RtlFreeUnicodeString( &nt_name ); RtlFreeUnicodeString( &nt_name );
return NULL; return NULL;
} }
status = wine_nt_to_unix_file_name( &attr, buffer, &size, FILE_OPEN_IF ); status = wine_nt_to_unix_file_name( &attr, buffer, &size, FILE_OPEN_IF );
if (status != STATUS_BUFFER_TOO_SMALL) break; if (status != STATUS_BUFFER_TOO_SMALL) break;
RtlFreeHeap( GetProcessHeap(), 0, buffer ); free( buffer );
} }
RtlFreeUnicodeString( &nt_name ); RtlFreeUnicodeString( &nt_name );
if (status && status != STATUS_NO_SUCH_FILE) if (status && status != STATUS_NO_SUCH_FILE)
{ {
RtlFreeHeap( GetProcessHeap(), 0, buffer ); free( buffer );
RtlSetLastWin32ErrorAndNtStatusFromNtStatus( status ); RtlSetLastWin32ErrorAndNtStatusFromNtStatus( status );
return NULL; return NULL;
} }
...@@ -1418,9 +1419,9 @@ static INT AddFontToList(const WCHAR *dos_name, const char *unix_name, void *fon ...@@ -1418,9 +1419,9 @@ static INT AddFontToList(const WCHAR *dos_name, const char *unix_name, void *fon
{ {
had_one = TRUE; had_one = TRUE;
AddFontToList(NULL, *cursor, NULL, 0, flags); AddFontToList(NULL, *cursor, NULL, 0, flags);
RtlFreeHeap(GetProcessHeap(), 0, *cursor); free( *cursor );
} }
RtlFreeHeap(GetProcessHeap(), 0, mac_list); free( mac_list );
if(had_one) if(had_one)
return 1; return 1;
} }
...@@ -1433,7 +1434,7 @@ static INT AddFontToList(const WCHAR *dos_name, const char *unix_name, void *fon ...@@ -1433,7 +1434,7 @@ static INT AddFontToList(const WCHAR *dos_name, const char *unix_name, void *fon
ret += add_unix_face( unix_name, dos_name, font_data_ptr, font_data_size, face_index, flags, &num_faces ); ret += add_unix_face( unix_name, dos_name, font_data_ptr, font_data_size, face_index, flags, &num_faces );
while (num_faces > ++face_index); while (num_faces > ++face_index);
RtlFreeHeap( GetProcessHeap(), 0, filename ); free( filename );
return ret; return ret;
} }
...@@ -1448,7 +1449,7 @@ static INT CDECL freetype_add_font( const WCHAR *file, DWORD flags ) ...@@ -1448,7 +1449,7 @@ static INT CDECL freetype_add_font( const WCHAR *file, DWORD flags )
if (unixname) if (unixname)
{ {
ret = AddFontToList( file, unixname, NULL, 0, flags ); ret = AddFontToList( file, unixname, NULL, 0, flags );
RtlFreeHeap( GetProcessHeap(), 0, unixname ); free( unixname );
} }
return ret; return ret;
} }
...@@ -1595,7 +1596,7 @@ static void fontconfig_add_font( FcPattern *pattern, DWORD flags ) ...@@ -1595,7 +1596,7 @@ static void fontconfig_add_font( FcPattern *pattern, DWORD flags )
dos_name = get_dos_file_name( unix_name ); dos_name = get_dos_file_name( unix_name );
add_unix_face( unix_name, dos_name, NULL, 0, face_index, flags, NULL ); add_unix_face( unix_name, dos_name, NULL, 0, face_index, flags, NULL );
RtlFreeHeap( GetProcessHeap(), 0, dos_name ); free( dos_name );
} }
static void init_fontconfig(void) static void init_fontconfig(void)
...@@ -1729,13 +1730,13 @@ static void load_mac_font_callback(const void *value, void *context) ...@@ -1729,13 +1730,13 @@ static void load_mac_font_callback(const void *value, void *context)
char* path; char* path;
len = CFStringGetMaximumSizeOfFileSystemRepresentation(pathStr); len = CFStringGetMaximumSizeOfFileSystemRepresentation(pathStr);
path = RtlAllocateHeap(GetProcessHeap(), 0, len); path = malloc( len );
if (path && CFStringGetFileSystemRepresentation(pathStr, path, len)) if (path && CFStringGetFileSystemRepresentation(pathStr, path, len))
{ {
TRACE("font file %s\n", path); TRACE("font file %s\n", path);
AddFontToList(NULL, path, NULL, 0, ADDFONT_EXTERNAL_FONT); AddFontToList(NULL, path, NULL, 0, ADDFONT_EXTERNAL_FONT);
} }
RtlFreeHeap(GetProcessHeap(), 0, path); free( path );
} }
static void load_mac_fonts(void) static void load_mac_fonts(void)
...@@ -2023,7 +2024,7 @@ static struct font_mapping *map_font_file( const char *name ) ...@@ -2023,7 +2024,7 @@ static struct font_mapping *map_font_file( const char *name )
return mapping; return mapping;
} }
} }
if (!(mapping = RtlAllocateHeap( GetProcessHeap(), 0, sizeof(*mapping) ))) if (!(mapping = malloc( sizeof(*mapping) )))
goto error; goto error;
mapping->data = mmap( NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0 ); mapping->data = mmap( NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0 );
...@@ -2031,7 +2032,7 @@ static struct font_mapping *map_font_file( const char *name ) ...@@ -2031,7 +2032,7 @@ static struct font_mapping *map_font_file( const char *name )
if (mapping->data == MAP_FAILED) if (mapping->data == MAP_FAILED)
{ {
RtlFreeHeap( GetProcessHeap(), 0, mapping ); free( mapping );
return NULL; return NULL;
} }
mapping->refcount = 1; mapping->refcount = 1;
...@@ -2052,7 +2053,7 @@ static void unmap_font_file( struct font_mapping *mapping ) ...@@ -2052,7 +2053,7 @@ static void unmap_font_file( struct font_mapping *mapping )
{ {
list_remove( &mapping->entry ); list_remove( &mapping->entry );
munmap( mapping->data, mapping->size ); munmap( mapping->data, mapping->size );
RtlFreeHeap( GetProcessHeap(), 0, mapping ); free( mapping );
} }
} }
...@@ -2067,7 +2068,7 @@ static void CDECL freetype_destroy_font( struct gdi_font *font ) ...@@ -2067,7 +2068,7 @@ static void CDECL freetype_destroy_font( struct gdi_font *font )
if (data->ft_face) pFT_Done_Face( data->ft_face ); if (data->ft_face) pFT_Done_Face( data->ft_face );
if (data->mapping) unmap_font_file( data->mapping ); if (data->mapping) unmap_font_file( data->mapping );
RtlFreeHeap( GetProcessHeap(), 0, data ); free( data );
} }
/************************************************************* /*************************************************************
...@@ -2209,7 +2210,7 @@ static LONG load_VDMX(struct gdi_font *font, LONG height) ...@@ -2209,7 +2210,7 @@ static LONG load_VDMX(struct gdi_font *font, LONG height)
TRACE("recs=%d startsz=%d endsz=%d\n", recs, startsz, endsz); TRACE("recs=%d startsz=%d endsz=%d\n", recs, startsz, endsz);
vTable = RtlAllocateHeap(GetProcessHeap(), 0, recs * sizeof(VDMX_vTable)); vTable = malloc( recs * sizeof(VDMX_vTable) );
result = freetype_get_font_data(font, MS_VDMX_TAG, offset + sizeof(group), vTable, recs * sizeof(VDMX_vTable)); result = freetype_get_font_data(font, MS_VDMX_TAG, offset + sizeof(group), vTable, recs * sizeof(VDMX_vTable));
if(result == GDI_ERROR) { if(result == GDI_ERROR) {
FIXME("Failed to retrieve vTable\n"); FIXME("Failed to retrieve vTable\n");
...@@ -2271,7 +2272,7 @@ static LONG load_VDMX(struct gdi_font *font, LONG height) ...@@ -2271,7 +2272,7 @@ static LONG load_VDMX(struct gdi_font *font, LONG height)
} }
} }
end: end:
RtlFreeHeap(GetProcessHeap(), 0, vTable); free( vTable );
} }
return ppem; return ppem;
...@@ -2366,7 +2367,7 @@ static BOOL get_gasp_flags( struct gdi_font *font, WORD *flags ) ...@@ -2366,7 +2367,7 @@ static BOOL get_gasp_flags( struct gdi_font *font, WORD *flags )
if (size < 4 * sizeof(WORD)) return FALSE; if (size < 4 * sizeof(WORD)) return FALSE;
if (size > sizeof(buf)) if (size > sizeof(buf))
{ {
ptr = alloced = RtlAllocateHeap( GetProcessHeap(), 0, size ); ptr = alloced = malloc( size );
if (!ptr) return FALSE; if (!ptr) return FALSE;
} }
...@@ -2391,7 +2392,7 @@ static BOOL get_gasp_flags( struct gdi_font *font, WORD *flags ) ...@@ -2391,7 +2392,7 @@ static BOOL get_gasp_flags( struct gdi_font *font, WORD *flags )
ret = TRUE; ret = TRUE;
done: done:
RtlFreeHeap( GetProcessHeap(), 0, alloced ); free( alloced );
return ret; return ret;
} }
...@@ -2447,14 +2448,14 @@ static BOOL CDECL freetype_load_font( struct gdi_font *font ) ...@@ -2447,14 +2448,14 @@ static BOOL CDECL freetype_load_font( struct gdi_font *font )
void *data_ptr; void *data_ptr;
SIZE_T data_size; SIZE_T data_size;
if (!(data = RtlAllocateHeap( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*data) ))) return FALSE; if (!(data = calloc( 1, sizeof(*data) ))) return FALSE;
font->private = data; font->private = data;
if (font->file[0]) if (font->file[0])
{ {
char *filename = get_unix_file_name( font->file ); char *filename = get_unix_file_name( font->file );
data->mapping = map_font_file( filename ); data->mapping = map_font_file( filename );
RtlFreeHeap( GetProcessHeap(), 0, filename ); free( filename );
if (!data->mapping) if (!data->mapping)
{ {
WARN("failed to map %s\n", debugstr_w(font->file)); WARN("failed to map %s\n", debugstr_w(font->file));
...@@ -4182,16 +4183,16 @@ static DWORD CDECL freetype_get_kerning_pairs( struct gdi_font *font, KERNINGPAI ...@@ -4182,16 +4183,16 @@ static DWORD CDECL freetype_get_kerning_pairs( struct gdi_font *font, KERNINGPAI
return 0; return 0;
} }
buf = RtlAllocateHeap(GetProcessHeap(), 0, length); buf = malloc( length );
if (!buf) return 0; if (!buf) return 0;
freetype_get_font_data(font, MS_KERN_TAG, 0, buf, length); freetype_get_font_data(font, MS_KERN_TAG, 0, buf, length);
/* build a glyph index to char code map */ /* build a glyph index to char code map */
glyph_to_char = RtlAllocateHeap(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(USHORT) * 65536); glyph_to_char = calloc( sizeof(USHORT), 65536 );
if (!glyph_to_char) if (!glyph_to_char)
{ {
RtlFreeHeap(GetProcessHeap(), 0, buf); free( buf );
return 0; return 0;
} }
...@@ -4260,10 +4261,7 @@ static DWORD CDECL freetype_get_kerning_pairs( struct gdi_font *font, KERNINGPAI ...@@ -4260,10 +4261,7 @@ static DWORD CDECL freetype_get_kerning_pairs( struct gdi_font *font, KERNINGPAI
glyph_to_char, NULL, 0); glyph_to_char, NULL, 0);
count += new_chunk; count += new_chunk;
if (!*pairs) *pairs = realloc( *pairs, count * sizeof(**pairs));
*pairs = RtlAllocateHeap(GetProcessHeap(), 0, count * sizeof(**pairs));
else
*pairs = RtlReAllocateHeap(GetProcessHeap(), 0, *pairs, count * sizeof(**pairs));
parse_format0_kern_subtable(font, (const struct TT_format0_kern_subtable *)(tt_kern_subtable + 1), parse_format0_kern_subtable(font, (const struct TT_format0_kern_subtable *)(tt_kern_subtable + 1),
glyph_to_char, *pairs + old_total, new_chunk); glyph_to_char, *pairs + old_total, new_chunk);
...@@ -4274,8 +4272,8 @@ static DWORD CDECL freetype_get_kerning_pairs( struct gdi_font *font, KERNINGPAI ...@@ -4274,8 +4272,8 @@ static DWORD CDECL freetype_get_kerning_pairs( struct gdi_font *font, KERNINGPAI
tt_kern_subtable = (const struct TT_kern_subtable *)((const char *)tt_kern_subtable + tt_kern_subtable_copy.length); tt_kern_subtable = (const struct TT_kern_subtable *)((const char *)tt_kern_subtable + tt_kern_subtable_copy.length);
} }
RtlFreeHeap(GetProcessHeap(), 0, glyph_to_char); free( glyph_to_char );
RtlFreeHeap(GetProcessHeap(), 0, buf); free( buf );
return count; return count;
} }
......
...@@ -947,11 +947,11 @@ HANDLE WINAPI NtGdiCreateClientObj( ULONG type ) ...@@ -947,11 +947,11 @@ HANDLE WINAPI NtGdiCreateClientObj( ULONG type )
struct gdi_obj_header *obj; struct gdi_obj_header *obj;
HGDIOBJ handle; HGDIOBJ handle;
if (!(obj = HeapAlloc( GetProcessHeap(), 0, sizeof(*obj) ))) if (!(obj = malloc( sizeof(*obj) )))
return 0; return 0;
handle = alloc_gdi_handle( obj, type, NULL ); handle = alloc_gdi_handle( obj, type, NULL );
if (!handle) HeapFree( GetProcessHeap(), 0, obj ); if (!handle) free( obj );
return handle; return handle;
} }
...@@ -962,7 +962,7 @@ BOOL WINAPI NtGdiDeleteClientObj( HGDIOBJ handle ) ...@@ -962,7 +962,7 @@ BOOL WINAPI NtGdiDeleteClientObj( HGDIOBJ handle )
{ {
void *obj; void *obj;
if (!(obj = free_gdi_handle( handle ))) return FALSE; if (!(obj = free_gdi_handle( handle ))) return FALSE;
HeapFree( GetProcessHeap(), 0, obj ); free( obj );
return TRUE; return TRUE;
} }
......
...@@ -131,7 +131,7 @@ BOOL CDECL nulldrv_PolyBezier( PHYSDEV dev, const POINT *points, DWORD count ) ...@@ -131,7 +131,7 @@ BOOL CDECL nulldrv_PolyBezier( PHYSDEV dev, const POINT *points, DWORD count )
if ((pts = GDI_Bezier( points, count, &n ))) if ((pts = GDI_Bezier( points, count, &n )))
{ {
ret = polyline( dev->hdc, pts, n ); ret = polyline( dev->hdc, pts, n );
HeapFree( GetProcessHeap(), 0, pts ); free( pts );
} }
return ret; return ret;
} }
...@@ -140,7 +140,7 @@ BOOL CDECL nulldrv_PolyBezierTo( PHYSDEV dev, const POINT *points, DWORD count ) ...@@ -140,7 +140,7 @@ BOOL CDECL nulldrv_PolyBezierTo( PHYSDEV dev, const POINT *points, DWORD count )
{ {
DC *dc = get_nulldrv_dc( dev ); DC *dc = get_nulldrv_dc( dev );
BOOL ret = FALSE; BOOL ret = FALSE;
POINT *pts = HeapAlloc( GetProcessHeap(), 0, sizeof(POINT) * (count + 1) ); POINT *pts = malloc( sizeof(POINT) * (count + 1) );
if (pts) if (pts)
{ {
...@@ -148,7 +148,7 @@ BOOL CDECL nulldrv_PolyBezierTo( PHYSDEV dev, const POINT *points, DWORD count ) ...@@ -148,7 +148,7 @@ BOOL CDECL nulldrv_PolyBezierTo( PHYSDEV dev, const POINT *points, DWORD count )
memcpy( pts + 1, points, sizeof(POINT) * count ); memcpy( pts + 1, points, sizeof(POINT) * count );
count++; count++;
ret = NtGdiPolyPolyDraw( dev->hdc, pts, &count, 1, NtGdiPolyBezier ); ret = NtGdiPolyPolyDraw( dev->hdc, pts, &count, 1, NtGdiPolyBezier );
HeapFree( GetProcessHeap(), 0, pts ); free( pts );
} }
return ret; return ret;
} }
...@@ -181,7 +181,7 @@ BOOL CDECL nulldrv_PolyDraw( PHYSDEV dev, const POINT *points, const BYTE *types ...@@ -181,7 +181,7 @@ BOOL CDECL nulldrv_PolyDraw( PHYSDEV dev, const POINT *points, const BYTE *types
} }
space = count + 300; space = count + 300;
line_pts = HeapAlloc( GetProcessHeap(), 0, space * sizeof(POINT) ); line_pts = malloc( space * sizeof(POINT) );
num_pts = 1; num_pts = 1;
line_pts[0] = dc->attr->cur_pos; line_pts[0] = dc->attr->cur_pos;
...@@ -209,11 +209,11 @@ BOOL CDECL nulldrv_PolyDraw( PHYSDEV dev, const POINT *points, const BYTE *types ...@@ -209,11 +209,11 @@ BOOL CDECL nulldrv_PolyDraw( PHYSDEV dev, const POINT *points, const BYTE *types
if (space < size) if (space < size)
{ {
space = size * 2; space = size * 2;
line_pts = HeapReAlloc( GetProcessHeap(), 0, line_pts, space * sizeof(POINT) ); line_pts = realloc( line_pts, space * sizeof(POINT) );
} }
memcpy( &line_pts[num_pts], &bzr_pts[1], (num_bzr_pts - 1) * sizeof(POINT) ); memcpy( &line_pts[num_pts], &bzr_pts[1], (num_bzr_pts - 1) * sizeof(POINT) );
num_pts += num_bzr_pts - 1; num_pts += num_bzr_pts - 1;
HeapFree( GetProcessHeap(), 0, bzr_pts ); free( bzr_pts );
} }
i += 2; i += 2;
break; break;
...@@ -222,7 +222,7 @@ BOOL CDECL nulldrv_PolyDraw( PHYSDEV dev, const POINT *points, const BYTE *types ...@@ -222,7 +222,7 @@ BOOL CDECL nulldrv_PolyDraw( PHYSDEV dev, const POINT *points, const BYTE *types
} }
if (num_pts >= 2) polyline( dev->hdc, line_pts, num_pts ); if (num_pts >= 2) polyline( dev->hdc, line_pts, num_pts );
HeapFree( GetProcessHeap(), 0, line_pts ); free( line_pts );
return TRUE; return TRUE;
} }
...@@ -233,12 +233,12 @@ BOOL CDECL nulldrv_PolylineTo( PHYSDEV dev, const POINT *points, INT count ) ...@@ -233,12 +233,12 @@ BOOL CDECL nulldrv_PolylineTo( PHYSDEV dev, const POINT *points, INT count )
POINT *pts; POINT *pts;
if (!count) return FALSE; if (!count) return FALSE;
if ((pts = HeapAlloc( GetProcessHeap(), 0, sizeof(POINT) * (count + 1) ))) if ((pts = malloc( sizeof(POINT) * (count + 1) )))
{ {
pts[0] = dc->attr->cur_pos; pts[0] = dc->attr->cur_pos;
memcpy( pts + 1, points, sizeof(POINT) * count ); memcpy( pts + 1, points, sizeof(POINT) * count );
ret = polyline( dev->hdc, pts, count + 1 ); ret = polyline( dev->hdc, pts, count + 1 );
HeapFree( GetProcessHeap(), 0, pts ); free( pts );
} }
return ret; return ret;
} }
...@@ -789,8 +789,7 @@ static void GDI_InternalBezier( POINT *Points, POINT **PtsOut, INT *dwOut, ...@@ -789,8 +789,7 @@ static void GDI_InternalBezier( POINT *Points, POINT **PtsOut, INT *dwOut,
{ {
if(*nPtsOut == *dwOut) { if(*nPtsOut == *dwOut) {
*dwOut *= 2; *dwOut *= 2;
*PtsOut = HeapReAlloc( GetProcessHeap(), 0, *PtsOut, *PtsOut = realloc( *PtsOut, *dwOut * sizeof(POINT) );
*dwOut * sizeof(POINT) );
} }
if(!level || BezierCheck(level, Points)) { if(!level || BezierCheck(level, Points)) {
...@@ -842,7 +841,7 @@ static void GDI_InternalBezier( POINT *Points, POINT **PtsOut, INT *dwOut, ...@@ -842,7 +841,7 @@ static void GDI_InternalBezier( POINT *Points, POINT **PtsOut, INT *dwOut,
* *
* Ptr to an array of POINTs that contain the lines that approximate the * Ptr to an array of POINTs that contain the lines that approximate the
* Beziers. The array is allocated on the process heap and it is the caller's * Beziers. The array is allocated on the process heap and it is the caller's
* responsibility to HeapFree it. [this is not a particularly nice interface * responsibility to free it. [this is not a particularly nice interface
* but since we can't know in advance how many points we will generate, the * but since we can't know in advance how many points we will generate, the
* alternative would be to call the function twice, once to determine the size * alternative would be to call the function twice, once to determine the size
* and a second time to do the work - I decided this was too much of a pain]. * and a second time to do the work - I decided this was too much of a pain].
...@@ -857,7 +856,7 @@ POINT *GDI_Bezier( const POINT *Points, INT count, INT *nPtsOut ) ...@@ -857,7 +856,7 @@ POINT *GDI_Bezier( const POINT *Points, INT count, INT *nPtsOut )
return NULL; return NULL;
} }
*nPtsOut = 0; *nPtsOut = 0;
out = HeapAlloc( GetProcessHeap(), 0, dwOut * sizeof(POINT)); out = malloc( dwOut * sizeof(POINT) );
for(Bezier = 0; Bezier < (count-1)/3; Bezier++) { for(Bezier = 0; Bezier < (count-1)/3; Bezier++) {
POINT ptBuf[4]; POINT ptBuf[4];
memcpy(ptBuf, Points + Bezier * 3, sizeof(POINT) * 4); memcpy(ptBuf, Points + Bezier * 3, sizeof(POINT) * 4);
......
...@@ -111,21 +111,21 @@ HPALETTE WINAPI NtGdiCreatePaletteInternal( const LOGPALETTE *palette, UINT coun ...@@ -111,21 +111,21 @@ HPALETTE WINAPI NtGdiCreatePaletteInternal( const LOGPALETTE *palette, UINT coun
if (!palette) return 0; if (!palette) return 0;
TRACE( "entries=%u\n", count ); TRACE( "entries=%u\n", count );
if (!(palettePtr = HeapAlloc( GetProcessHeap(), 0, sizeof(*palettePtr) ))) return 0; if (!(palettePtr = malloc( sizeof(*palettePtr) ))) return 0;
palettePtr->unrealize = NULL; palettePtr->unrealize = NULL;
palettePtr->version = palette->palVersion; palettePtr->version = palette->palVersion;
palettePtr->count = count; palettePtr->count = count;
size = palettePtr->count * sizeof(*palettePtr->entries); size = palettePtr->count * sizeof(*palettePtr->entries);
if (!(palettePtr->entries = HeapAlloc( GetProcessHeap(), 0, size ))) if (!(palettePtr->entries = malloc( size )))
{ {
HeapFree( GetProcessHeap(), 0, palettePtr ); free( palettePtr );
return 0; return 0;
} }
memcpy( palettePtr->entries, palette->palPalEntry, size ); memcpy( palettePtr->entries, palette->palPalEntry, size );
if (!(hpalette = alloc_gdi_handle( &palettePtr->obj, NTGDI_OBJ_PAL, &palette_funcs ))) if (!(hpalette = alloc_gdi_handle( &palettePtr->obj, NTGDI_OBJ_PAL, &palette_funcs )))
{ {
HeapFree( GetProcessHeap(), 0, palettePtr->entries ); free( palettePtr->entries );
HeapFree( GetProcessHeap(), 0, palettePtr ); free( palettePtr );
} }
TRACE(" returning %p\n", hpalette); TRACE(" returning %p\n", hpalette);
return hpalette; return hpalette;
...@@ -228,22 +228,23 @@ static UINT set_palette_entries( HPALETTE hpalette, UINT start, UINT count, ...@@ -228,22 +228,23 @@ static UINT set_palette_entries( HPALETTE hpalette, UINT start, UINT count,
* *
* Resizes logical palette. * Resizes logical palette.
*/ */
BOOL WINAPI NtGdiResizePalette( HPALETTE hPal, UINT cEntries ) BOOL WINAPI NtGdiResizePalette( HPALETTE hPal, UINT count )
{ {
PALETTEOBJ * palPtr = GDI_GetObjPtr( hPal, NTGDI_OBJ_PAL ); PALETTEOBJ * palPtr = GDI_GetObjPtr( hPal, NTGDI_OBJ_PAL );
PALETTEENTRY *entries; PALETTEENTRY *entries;
if( !palPtr ) return FALSE; if( !palPtr ) return FALSE;
TRACE("hpal = %p, prev = %i, new = %i\n", hPal, palPtr->count, cEntries ); TRACE("hpal = %p, prev = %i, new = %i\n", hPal, palPtr->count, count );
if (!(entries = HeapReAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, if (!(entries = realloc( palPtr->entries, count * sizeof(*palPtr->entries) )))
palPtr->entries, cEntries * sizeof(*palPtr->entries) )))
{ {
GDI_ReleaseObj( hPal ); GDI_ReleaseObj( hPal );
return FALSE; return FALSE;
} }
if (count > palPtr->count)
memset( entries + palPtr->count, 0, (count - palPtr->count) * sizeof(*palPtr->entries) );
palPtr->entries = entries; palPtr->entries = entries;
palPtr->count = cEntries; palPtr->count = count;
GDI_ReleaseObj( hPal ); GDI_ReleaseObj( hPal );
PALETTE_UnrealizeObject( hPal ); PALETTE_UnrealizeObject( hPal );
...@@ -505,8 +506,8 @@ static BOOL PALETTE_DeleteObject( HGDIOBJ handle ) ...@@ -505,8 +506,8 @@ static BOOL PALETTE_DeleteObject( HGDIOBJ handle )
PALETTE_UnrealizeObject( handle ); PALETTE_UnrealizeObject( handle );
if (!(obj = free_gdi_handle( handle ))) return FALSE; if (!(obj = free_gdi_handle( handle ))) return FALSE;
HeapFree( GetProcessHeap(), 0, obj->entries ); free( obj->entries );
HeapFree( GetProcessHeap(), 0, obj ); free( obj );
return TRUE; return TRUE;
} }
......
...@@ -106,13 +106,13 @@ static inline struct path_physdev *get_path_physdev( PHYSDEV dev ) ...@@ -106,13 +106,13 @@ static inline struct path_physdev *get_path_physdev( PHYSDEV dev )
void free_gdi_path( struct gdi_path *path ) void free_gdi_path( struct gdi_path *path )
{ {
if (path->points != path->points_buf) if (path->points != path->points_buf)
HeapFree( GetProcessHeap(), 0, path->points ); free( path->points );
HeapFree( GetProcessHeap(), 0, path ); free( path );
} }
static struct gdi_path *alloc_gdi_path( int count ) static struct gdi_path *alloc_gdi_path( int count )
{ {
struct gdi_path *path = HeapAlloc( GetProcessHeap(), 0, sizeof(*path) ); struct gdi_path *path = malloc( sizeof(*path) );
if (!path) if (!path)
{ {
...@@ -122,11 +122,10 @@ static struct gdi_path *alloc_gdi_path( int count ) ...@@ -122,11 +122,10 @@ static struct gdi_path *alloc_gdi_path( int count )
count = max( NUM_ENTRIES_INITIAL, count ); count = max( NUM_ENTRIES_INITIAL, count );
if (count > NUM_ENTRIES_INITIAL) if (count > NUM_ENTRIES_INITIAL)
{ {
path->points = HeapAlloc( GetProcessHeap(), 0, path->points = malloc( count * (sizeof(path->points[0]) + sizeof(path->flags[0])) );
count * (sizeof(path->points[0]) + sizeof(path->flags[0])) );
if (!path->points) if (!path->points)
{ {
HeapFree( GetProcessHeap(), 0, path ); free( path );
SetLastError( ERROR_NOT_ENOUGH_MEMORY ); SetLastError( ERROR_NOT_ENOUGH_MEMORY );
return NULL; return NULL;
} }
...@@ -205,14 +204,14 @@ static BOOL PATH_ReserveEntries(struct gdi_path *path, INT count) ...@@ -205,14 +204,14 @@ static BOOL PATH_ReserveEntries(struct gdi_path *path, INT count)
if (path->points == path->points_buf) if (path->points == path->points_buf)
{ {
pts_new = HeapAlloc( GetProcessHeap(), 0, size ); pts_new = malloc( size );
if (!pts_new) return FALSE; if (!pts_new) return FALSE;
memcpy( pts_new, path->points, path->count * sizeof(path->points[0]) ); memcpy( pts_new, path->points, path->count * sizeof(path->points[0]) );
memcpy( pts_new + count, path->flags, path->count * sizeof(path->flags[0]) ); memcpy( pts_new + count, path->flags, path->count * sizeof(path->flags[0]) );
} }
else else
{ {
pts_new = HeapReAlloc( GetProcessHeap(), 0, path->points, size ); pts_new = realloc( path->points, size );
if (!pts_new) return FALSE; if (!pts_new) return FALSE;
memmove( pts_new + count, pts_new + path->allocated, path->count * sizeof(path->flags[0]) ); memmove( pts_new + count, pts_new + path->allocated, path->count * sizeof(path->flags[0]) );
} }
...@@ -339,7 +338,7 @@ static HRGN path_to_region( const struct gdi_path *path, int mode ) ...@@ -339,7 +338,7 @@ static HRGN path_to_region( const struct gdi_path *path, int mode )
if (!path->count) return 0; if (!path->count) return 0;
if (!(counts = HeapAlloc( GetProcessHeap(), 0, (path->count / 2) * sizeof(*counts) ))) return 0; if (!(counts = malloc( (path->count / 2) * sizeof(*counts) ))) return 0;
pos = polygons = 0; pos = polygons = 0;
assert( path->flags[0] == PT_MOVETO ); assert( path->flags[0] == PT_MOVETO );
...@@ -353,7 +352,7 @@ static HRGN path_to_region( const struct gdi_path *path, int mode ) ...@@ -353,7 +352,7 @@ static HRGN path_to_region( const struct gdi_path *path, int mode )
assert( polygons <= path->count / 2 ); assert( polygons <= path->count / 2 );
hrgn = create_polypolygon_region( path->points, counts, polygons, mode, NULL ); hrgn = create_polypolygon_region( path->points, counts, polygons, mode, NULL );
HeapFree( GetProcessHeap(), 0, counts ); free( counts );
return hrgn; return hrgn;
} }
...@@ -410,7 +409,7 @@ static BOOL PATH_AddFlatBezier(struct gdi_path *pPath, POINT *pt, BOOL closed) ...@@ -410,7 +409,7 @@ static BOOL PATH_AddFlatBezier(struct gdi_path *pPath, POINT *pt, BOOL closed)
ret = (add_points( pPath, pts + 1, no - 1, PT_LINETO ) != NULL); ret = (add_points( pPath, pts + 1, no - 1, PT_LINETO ) != NULL);
if (ret && closed) close_figure( pPath ); if (ret && closed) close_figure( pPath );
HeapFree( GetProcessHeap(), 0, pts ); free( pts );
return ret; return ret;
} }
...@@ -763,7 +762,7 @@ static BOOL CDECL pathdrv_EndPath( PHYSDEV dev ) ...@@ -763,7 +762,7 @@ static BOOL CDECL pathdrv_EndPath( PHYSDEV dev )
dc->path = physdev->path; dc->path = physdev->path;
pop_dc_driver( dc, &path_driver ); pop_dc_driver( dc, &path_driver );
HeapFree( GetProcessHeap(), 0, physdev ); free( physdev );
return TRUE; return TRUE;
} }
...@@ -774,7 +773,7 @@ static BOOL CDECL pathdrv_EndPath( PHYSDEV dev ) ...@@ -774,7 +773,7 @@ static BOOL CDECL pathdrv_EndPath( PHYSDEV dev )
static BOOL CDECL pathdrv_CreateDC( PHYSDEV *dev, LPCWSTR device, LPCWSTR output, static BOOL CDECL pathdrv_CreateDC( PHYSDEV *dev, LPCWSTR device, LPCWSTR output,
const DEVMODEW *devmode ) const DEVMODEW *devmode )
{ {
struct path_physdev *physdev = HeapAlloc( GetProcessHeap(), 0, sizeof(*physdev) ); struct path_physdev *physdev = malloc( sizeof(*physdev) );
if (!physdev) return FALSE; if (!physdev) return FALSE;
push_dc_driver( dev, &physdev->dev, &path_driver ); push_dc_driver( dev, &physdev->dev, &path_driver );
...@@ -790,7 +789,7 @@ static BOOL CDECL pathdrv_DeleteDC( PHYSDEV dev ) ...@@ -790,7 +789,7 @@ static BOOL CDECL pathdrv_DeleteDC( PHYSDEV dev )
struct path_physdev *physdev = get_path_physdev( dev ); struct path_physdev *physdev = get_path_physdev( dev );
free_gdi_path( physdev->path ); free_gdi_path( physdev->path );
HeapFree( GetProcessHeap(), 0, physdev ); free( physdev );
return TRUE; return TRUE;
} }
...@@ -822,7 +821,7 @@ BOOL PATH_RestorePath( DC *dst, DC *src ) ...@@ -822,7 +821,7 @@ BOOL PATH_RestorePath( DC *dst, DC *src )
{ {
physdev = get_path_physdev( dev ); physdev = get_path_physdev( dev );
free_gdi_path( physdev->path ); free_gdi_path( physdev->path );
HeapFree( GetProcessHeap(), 0, physdev ); free( physdev );
} }
if (src->path && src->path_open) if (src->path && src->path_open)
...@@ -1483,7 +1482,7 @@ static BOOL PATH_add_outline(struct path_physdev *physdev, INT x, INT y, ...@@ -1483,7 +1482,7 @@ static BOOL PATH_add_outline(struct path_physdev *physdev, INT x, INT y,
{ {
WORD i; WORD i;
POINTFX ptfx; POINTFX ptfx;
POINT *pts = HeapAlloc(GetProcessHeap(), 0, (curve->cpfx + 1) * sizeof(POINT)); POINT *pts = malloc( (curve->cpfx + 1) * sizeof(POINT) );
if (!pts) return FALSE; if (!pts) return FALSE;
...@@ -1500,7 +1499,7 @@ static BOOL PATH_add_outline(struct path_physdev *physdev, INT x, INT y, ...@@ -1500,7 +1499,7 @@ static BOOL PATH_add_outline(struct path_physdev *physdev, INT x, INT y,
PATH_BezierTo(physdev->path, pts, curve->cpfx + 1); PATH_BezierTo(physdev->path, pts, curve->cpfx + 1);
HeapFree(GetProcessHeap(), 0, pts); free( pts );
break; break;
} }
...@@ -1545,13 +1544,13 @@ static BOOL CDECL pathdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, con ...@@ -1545,13 +1544,13 @@ static BOOL CDECL pathdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, con
/* add outline only if char is printable */ /* add outline only if char is printable */
if(dwSize) if(dwSize)
{ {
outline = HeapAlloc(GetProcessHeap(), 0, dwSize); outline = malloc( dwSize );
if (!outline) return FALSE; if (!outline) return FALSE;
NtGdiGetGlyphOutline( dev->hdc, str[idx], ggo_flags, &gm, dwSize, outline, &identity, FALSE ); NtGdiGetGlyphOutline( dev->hdc, str[idx], ggo_flags, &gm, dwSize, outline, &identity, FALSE );
PATH_add_outline(physdev, x + offset.x, y + offset.y, outline, dwSize); PATH_add_outline(physdev, x + offset.x, y + offset.y, outline, dwSize);
HeapFree(GetProcessHeap(), 0, outline); free( outline );
} }
if (dx) if (dx)
...@@ -1628,7 +1627,7 @@ static struct gdi_path *PATH_WidenPath(DC *dc) ...@@ -1628,7 +1627,7 @@ static struct gdi_path *PATH_WidenPath(DC *dc)
return NULL; return NULL;
} }
elp = HeapAlloc( GetProcessHeap(), 0, size ); elp = malloc( size );
NtGdiExtGetObjectW( dc->hPen, size, elp ); NtGdiExtGetObjectW( dc->hPen, size, elp );
obj_type = get_gdi_object_type(dc->hPen); obj_type = get_gdi_object_type(dc->hPen);
...@@ -1642,12 +1641,12 @@ static struct gdi_path *PATH_WidenPath(DC *dc) ...@@ -1642,12 +1641,12 @@ static struct gdi_path *PATH_WidenPath(DC *dc)
break; break;
default: default:
SetLastError(ERROR_CAN_NOT_COMPLETE); SetLastError(ERROR_CAN_NOT_COMPLETE);
HeapFree( GetProcessHeap(), 0, elp ); free( elp );
return NULL; return NULL;
} }
penWidth = elp->elpWidth; penWidth = elp->elpWidth;
HeapFree( GetProcessHeap(), 0, elp ); free( elp );
endcap = (PS_ENDCAP_MASK & penStyle); endcap = (PS_ENDCAP_MASK & penStyle);
joint = (PS_JOIN_MASK & penStyle); joint = (PS_JOIN_MASK & penStyle);
...@@ -1682,10 +1681,7 @@ static struct gdi_path *PATH_WidenPath(DC *dc) ...@@ -1682,10 +1681,7 @@ static struct gdi_path *PATH_WidenPath(DC *dc)
case PT_MOVETO: case PT_MOVETO:
numStrokes++; numStrokes++;
j = 0; j = 0;
if(numStrokes == 1) pStrokes = realloc( pStrokes, numStrokes * sizeof(*pStrokes) );
pStrokes = HeapAlloc(GetProcessHeap(), 0, sizeof(*pStrokes));
else
pStrokes = HeapReAlloc(GetProcessHeap(), 0, pStrokes, numStrokes * sizeof(*pStrokes));
if(!pStrokes) if(!pStrokes)
{ {
free_gdi_path(flat_path); free_gdi_path(flat_path);
...@@ -1706,7 +1702,7 @@ static struct gdi_path *PATH_WidenPath(DC *dc) ...@@ -1706,7 +1702,7 @@ static struct gdi_path *PATH_WidenPath(DC *dc)
default: default:
ERR("Got path flag %c\n", flat_path->flags[i]); ERR("Got path flag %c\n", flat_path->flags[i]);
for(i = 0; i < numStrokes; i++) free_gdi_path(pStrokes[i]); for(i = 0; i < numStrokes; i++) free_gdi_path(pStrokes[i]);
HeapFree(GetProcessHeap(), 0, pStrokes); free( pStrokes );
free_gdi_path(flat_path); free_gdi_path(flat_path);
return NULL; return NULL;
} }
...@@ -1897,7 +1893,7 @@ static struct gdi_path *PATH_WidenPath(DC *dc) ...@@ -1897,7 +1893,7 @@ static struct gdi_path *PATH_WidenPath(DC *dc)
free_gdi_path( pUpPath ); free_gdi_path( pUpPath );
free_gdi_path( pDownPath ); free_gdi_path( pDownPath );
} }
HeapFree(GetProcessHeap(), 0, pStrokes); free( pStrokes );
free_gdi_path( flat_path ); free_gdi_path( flat_path );
return pNewPath; return pNewPath;
} }
......
...@@ -78,7 +78,7 @@ HPEN create_pen( INT style, INT width, COLORREF color ) ...@@ -78,7 +78,7 @@ HPEN create_pen( INT style, INT width, COLORREF color )
return 0; return 0;
} }
if (!(penPtr = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*penPtr) ))) return 0; if (!(penPtr = calloc( 1, sizeof(*penPtr) ))) return 0;
penPtr->logpen.elpPenStyle = style; penPtr->logpen.elpPenStyle = style;
penPtr->logpen.elpWidth = abs(width); penPtr->logpen.elpWidth = abs(width);
...@@ -86,7 +86,7 @@ HPEN create_pen( INT style, INT width, COLORREF color ) ...@@ -86,7 +86,7 @@ HPEN create_pen( INT style, INT width, COLORREF color )
penPtr->logpen.elpBrushStyle = BS_SOLID; penPtr->logpen.elpBrushStyle = BS_SOLID;
if (!(hpen = alloc_gdi_handle( &penPtr->obj, NTGDI_OBJ_PEN, &pen_funcs ))) if (!(hpen = alloc_gdi_handle( &penPtr->obj, NTGDI_OBJ_PEN, &pen_funcs )))
HeapFree( GetProcessHeap(), 0, penPtr ); free( penPtr );
return hpen; return hpen;
} }
...@@ -170,7 +170,7 @@ HPEN WINAPI NtGdiExtCreatePen( DWORD style, DWORD width, ULONG brush_style, ULON ...@@ -170,7 +170,7 @@ HPEN WINAPI NtGdiExtCreatePen( DWORD style, DWORD width, ULONG brush_style, ULON
if (brush_style != BS_SOLID) goto invalid; if (brush_style != BS_SOLID) goto invalid;
} }
if (!(penPtr = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(PENOBJ,logpen.elpStyleEntry[style_count])))) if (!(penPtr = malloc( FIELD_OFFSET(PENOBJ,logpen.elpStyleEntry[style_count]) )))
return 0; return 0;
logbrush.lbStyle = brush_style; logbrush.lbStyle = brush_style;
...@@ -190,12 +190,12 @@ HPEN WINAPI NtGdiExtCreatePen( DWORD style, DWORD width, ULONG brush_style, ULON ...@@ -190,12 +190,12 @@ HPEN WINAPI NtGdiExtCreatePen( DWORD style, DWORD width, ULONG brush_style, ULON
if (!(hpen = alloc_gdi_handle( &penPtr->obj, NTGDI_OBJ_EXTPEN, &pen_funcs ))) if (!(hpen = alloc_gdi_handle( &penPtr->obj, NTGDI_OBJ_EXTPEN, &pen_funcs )))
{ {
free_brush_pattern( &penPtr->pattern ); free_brush_pattern( &penPtr->pattern );
HeapFree( GetProcessHeap(), 0, penPtr ); free( penPtr );
} }
return hpen; return hpen;
invalid: invalid:
HeapFree( GetProcessHeap(), 0, penPtr ); free( penPtr );
SetLastError( ERROR_INVALID_PARAMETER ); SetLastError( ERROR_INVALID_PARAMETER );
return 0; return 0;
} }
...@@ -260,7 +260,7 @@ static BOOL PEN_DeleteObject( HGDIOBJ handle ) ...@@ -260,7 +260,7 @@ static BOOL PEN_DeleteObject( HGDIOBJ handle )
if (!pen) return FALSE; if (!pen) return FALSE;
free_brush_pattern( &pen->pattern ); free_brush_pattern( &pen->pattern );
HeapFree( GetProcessHeap(), 0, pen ); free( pen );
return TRUE; return TRUE;
} }
......
...@@ -135,13 +135,13 @@ static BOOL grow_region( WINEREGION *rgn, int size ) ...@@ -135,13 +135,13 @@ static BOOL grow_region( WINEREGION *rgn, int size )
if (rgn->rects == rgn->rects_buf) if (rgn->rects == rgn->rects_buf)
{ {
new_rects = HeapAlloc( GetProcessHeap(), 0, size * sizeof(RECT) ); new_rects = malloc( size * sizeof(RECT) );
if (!new_rects) return FALSE; if (!new_rects) return FALSE;
memcpy( new_rects, rgn->rects, rgn->numRects * sizeof(RECT) ); memcpy( new_rects, rgn->rects, rgn->numRects * sizeof(RECT) );
} }
else else
{ {
new_rects = HeapReAlloc( GetProcessHeap(), 0, rgn->rects, size * sizeof(RECT) ); new_rects = realloc( rgn->rects, size * sizeof(RECT) );
if (!new_rects) return FALSE; if (!new_rects) return FALSE;
} }
rgn->rects = new_rects; rgn->rects = new_rects;
...@@ -413,7 +413,7 @@ static BOOL init_region( WINEREGION *pReg, INT n ) ...@@ -413,7 +413,7 @@ static BOOL init_region( WINEREGION *pReg, INT n )
if (n > RGN_DEFAULT_RECTS) if (n > RGN_DEFAULT_RECTS)
{ {
if (n > INT_MAX / sizeof(RECT)) return FALSE; if (n > INT_MAX / sizeof(RECT)) return FALSE;
if (!(pReg->rects = HeapAlloc( GetProcessHeap(), 0, n * sizeof( RECT ) ))) if (!(pReg->rects = malloc( n * sizeof( RECT ) )))
return FALSE; return FALSE;
} }
else else
...@@ -430,7 +430,7 @@ static BOOL init_region( WINEREGION *pReg, INT n ) ...@@ -430,7 +430,7 @@ static BOOL init_region( WINEREGION *pReg, INT n )
static void destroy_region( WINEREGION *pReg ) static void destroy_region( WINEREGION *pReg )
{ {
if (pReg->rects != pReg->rects_buf) if (pReg->rects != pReg->rects_buf)
HeapFree( GetProcessHeap(), 0, pReg->rects ); free( pReg->rects );
} }
/*********************************************************************** /***********************************************************************
...@@ -439,7 +439,7 @@ static void destroy_region( WINEREGION *pReg ) ...@@ -439,7 +439,7 @@ static void destroy_region( WINEREGION *pReg )
static void free_region( WINEREGION *rgn ) static void free_region( WINEREGION *rgn )
{ {
destroy_region( rgn ); destroy_region( rgn );
HeapFree( GetProcessHeap(), 0, rgn ); free( rgn );
} }
/*********************************************************************** /***********************************************************************
...@@ -447,7 +447,7 @@ static void free_region( WINEREGION *rgn ) ...@@ -447,7 +447,7 @@ static void free_region( WINEREGION *rgn )
*/ */
static WINEREGION *alloc_region( INT n ) static WINEREGION *alloc_region( INT n )
{ {
WINEREGION *rgn = HeapAlloc( GetProcessHeap(), 0, sizeof(*rgn) ); WINEREGION *rgn = malloc( sizeof(*rgn) );
if (rgn && !init_region( rgn, n )) if (rgn && !init_region( rgn, n ))
{ {
...@@ -1537,7 +1537,7 @@ static void REGION_compact( WINEREGION *reg ) ...@@ -1537,7 +1537,7 @@ static void REGION_compact( WINEREGION *reg )
{ {
if ((reg->numRects < reg->size / 2) && (reg->numRects > RGN_DEFAULT_RECTS)) if ((reg->numRects < reg->size / 2) && (reg->numRects > RGN_DEFAULT_RECTS))
{ {
RECT *new_rects = HeapReAlloc( GetProcessHeap(), 0, reg->rects, reg->numRects * sizeof(RECT) ); RECT *new_rects = realloc( reg->rects, reg->numRects * sizeof(RECT) );
if (new_rects) if (new_rects)
{ {
reg->rects = new_rects; reg->rects = new_rects;
...@@ -2266,7 +2266,7 @@ static void REGION_InsertEdgeInET(EdgeTable *ET, EdgeTableEntry *ETE, ...@@ -2266,7 +2266,7 @@ static void REGION_InsertEdgeInET(EdgeTable *ET, EdgeTableEntry *ETE,
{ {
if (*iSLLBlock > SLLSPERBLOCK-1) if (*iSLLBlock > SLLSPERBLOCK-1)
{ {
tmpSLLBlock = HeapAlloc( GetProcessHeap(), 0, sizeof(ScanLineListBlock)); tmpSLLBlock = malloc( sizeof(ScanLineListBlock) );
if(!tmpSLLBlock) if(!tmpSLLBlock)
{ {
WARN("Can't alloc SLLB\n"); WARN("Can't alloc SLLB\n");
...@@ -2512,7 +2512,7 @@ static void REGION_FreeStorage(ScanLineListBlock *pSLLBlock) ...@@ -2512,7 +2512,7 @@ static void REGION_FreeStorage(ScanLineListBlock *pSLLBlock)
while (pSLLBlock) while (pSLLBlock)
{ {
tmpSLLBlock = pSLLBlock->next; tmpSLLBlock = pSLLBlock->next;
HeapFree( GetProcessHeap(), 0, pSLLBlock ); free( pSLLBlock );
pSLLBlock = tmpSLLBlock; pSLLBlock = tmpSLLBlock;
} }
} }
...@@ -2673,7 +2673,7 @@ HRGN create_polypolygon_region( const POINT *Pts, const INT *Count, INT nbpolygo ...@@ -2673,7 +2673,7 @@ HRGN create_polypolygon_region( const POINT *Pts, const INT *Count, INT nbpolygo
for(poly = total = 0; poly < nbpolygons; poly++) for(poly = total = 0; poly < nbpolygons; poly++)
total += Count[poly]; total += Count[poly];
if (! (pETEs = HeapAlloc( GetProcessHeap(), 0, sizeof(EdgeTableEntry) * total ))) if (! (pETEs = malloc( sizeof(EdgeTableEntry) * total )))
return 0; return 0;
nb_points = REGION_CreateEdgeTable( Count, nbpolygons, Pts, &ET, pETEs, &SLLBlock, clip_rect ); nb_points = REGION_CreateEdgeTable( Count, nbpolygons, Pts, &ET, pETEs, &SLLBlock, clip_rect );
...@@ -2686,6 +2686,6 @@ HRGN create_polypolygon_region( const POINT *Pts, const INT *Count, INT nbpolygo ...@@ -2686,6 +2686,6 @@ HRGN create_polypolygon_region( const POINT *Pts, const INT *Count, INT nbpolygo
} }
REGION_FreeStorage(SLLBlock.next); REGION_FreeStorage(SLLBlock.next);
HeapFree( GetProcessHeap(), 0, pETEs ); free( pETEs );
return hrgn; return hrgn;
} }
...@@ -395,9 +395,6 @@ static inline LONG win32u_wcstol( LPCWSTR s, LPWSTR *end, INT base ) ...@@ -395,9 +395,6 @@ static inline LONG win32u_wcstol( LPCWSTR s, LPWSTR *end, INT base )
#define wcsrchr(s,c) win32u_wcsrchr(s,c) #define wcsrchr(s,c) win32u_wcsrchr(s,c)
#define wcstol(s,e,b) win32u_wcstol(s,e,b) #define wcstol(s,e,b) win32u_wcstol(s,e,b)
#define HeapAlloc RtlAllocateHeap
#define HeapFree RtlFreeHeap
#define HeapReAlloc RtlReAllocateHeap
#define EnterCriticalSection RtlEnterCriticalSection #define EnterCriticalSection RtlEnterCriticalSection
#define LeaveCriticalSection RtlLeaveCriticalSection #define LeaveCriticalSection RtlLeaveCriticalSection
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment