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,
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,
......@@ -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 );
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;
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,
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 (!(ptr = HeapAlloc( GetProcessHeap(), 0, dst_info->bmiHeader.biSizeImage )))
if (!(ptr = malloc( dst_info->bmiHeader.biSizeImage )))
return ERROR_OUTOFMEMORY;
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
if (!dst_bits->is_copy)
{
int size = dst_info->bmiHeader.biSizeImage;
void *ptr = HeapAlloc( GetProcessHeap(), 0, size );
void *ptr = malloc( size );
if (!ptr) return ERROR_OUTOFMEMORY;
memcpy( ptr, dst_bits->ptr, size );
if (dst_bits->free) dst_bits->free( dst_bits );
......@@ -428,7 +428,7 @@ BOOL CDECL nulldrv_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert
DWORD err;
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++)
{
pts[i].x = vert_array[i].x;
......@@ -470,7 +470,7 @@ BOOL CDECL nulldrv_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert
if (err && err != ERROR_BAD_FORMAT) goto done;
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;
bits.is_copy = TRUE;
bits.free = free_heap_bits;
......@@ -495,7 +495,7 @@ BOOL CDECL nulldrv_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert
NtGdiDeleteObjectApp( rgn );
done:
HeapFree( GetProcessHeap(), 0, pts );
free( pts );
return ret;
}
......
......@@ -147,7 +147,7 @@ HBITMAP WINAPI NtGdiCreateBitmap( INT width, INT height, UINT planes,
}
/* Create the BITMAPOBJ */
if (!(bmpobj = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*bmpobj) )))
if (!(bmpobj = calloc( 1, sizeof(*bmpobj) )))
{
SetLastError( ERROR_NOT_ENOUGH_MEMORY );
return 0;
......@@ -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.bmPlanes = planes;
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)
{
HeapFree( GetProcessHeap(), 0, bmpobj );
free( bmpobj );
SetLastError( ERROR_NOT_ENOUGH_MEMORY );
return 0;
}
if (!(hbitmap = alloc_gdi_handle( &bmpobj->obj, NTGDI_OBJ_BITMAP, &bitmap_funcs )))
{
HeapFree( GetProcessHeap(), 0, bmpobj->dib.dsBm.bmBits );
HeapFree( GetProcessHeap(), 0, bmpobj );
free( bmpobj->dib.dsBm.bmBits );
free( bmpobj );
return 0;
}
......@@ -322,7 +322,7 @@ LONG WINAPI NtGdiSetBitmapBits(
}
else
{
if (!(src_bits.ptr = HeapAlloc( GetProcessHeap(), 0, dst.height * dst_stride )))
if (!(src_bits.ptr = malloc( dst.height * dst_stride )))
{
GDI_ReleaseObj( hbitmap );
return 0;
......@@ -444,8 +444,8 @@ static BOOL BITMAP_DeleteObject( HGDIOBJ handle )
BITMAPOBJ *bmp = free_gdi_handle( handle );
if (!bmp) return FALSE;
HeapFree( GetProcessHeap(), 0, bmp->dib.dsBm.bmBits );
HeapFree( GetProcessHeap(), 0, bmp );
free( bmp->dib.dsBm.bmBits );
free( bmp );
return TRUE;
}
......
......@@ -73,12 +73,12 @@ static BOOL copy_bitmap( struct brush_pattern *brush, HBITMAP bitmap )
brush->bits = bits;
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 );
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 );
goto done;
......@@ -141,7 +141,7 @@ BOOL store_brush_pattern( LOGBRUSH *brush, struct brush_pattern *pattern )
void free_brush_pattern( struct brush_pattern *pattern )
{
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 )
......@@ -193,7 +193,7 @@ HBRUSH create_brush( const LOGBRUSH *brush )
BRUSHOBJ * ptr;
HBRUSH hbrush;
if (!(ptr = HeapAlloc( GetProcessHeap(), 0, sizeof(*ptr) ))) return 0;
if (!(ptr = malloc( sizeof(*ptr) ))) return 0;
ptr->logbrush = *brush;
......@@ -205,7 +205,7 @@ HBRUSH create_brush( const LOGBRUSH *brush )
}
free_brush_pattern( &ptr->pattern );
HeapFree( GetProcessHeap(), 0, ptr );
free( ptr );
return 0;
}
......@@ -335,7 +335,7 @@ static BOOL BRUSH_DeleteObject( HGDIOBJ handle )
if (!brush) return FALSE;
free_brush_pattern( &brush->pattern );
HeapFree( GetProcessHeap(), 0, brush );
free( brush );
return TRUE;
}
......
......@@ -132,10 +132,10 @@ DC *alloc_dc_ptr( DWORD magic )
{
DC *dc;
if (!(dc = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*dc) ))) return NULL;
if (!(dc->attr = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*dc->attr))))
if (!(dc = calloc( 1, sizeof(*dc) ))) return NULL;
if (!(dc->attr = RtlAllocateHeap( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*dc->attr) )))
{
HeapFree( GetProcessHeap(), 0, dc );
free( dc );
return NULL;
}
......@@ -152,8 +152,8 @@ DC *alloc_dc_ptr( DWORD magic )
if (!(dc->hSelf = alloc_gdi_handle( &dc->obj, magic, &dc_funcs )))
{
HeapFree( GetProcessHeap(), 0, dc->attr );
HeapFree( GetProcessHeap(), 0, dc );
RtlFreeHeap( GetProcessHeap(), 0, dc->attr );
free( dc );
return NULL;
}
dc->attr->hdc = dc->nulldrv.hdc = dc->hSelf;
......@@ -179,8 +179,8 @@ static void free_dc_state( DC *dc )
if (dc->hVisRgn) NtGdiDeleteObjectApp( dc->hVisRgn );
if (dc->region) NtGdiDeleteObjectApp( dc->region );
if (dc->path) free_gdi_path( dc->path );
HeapFree( GetProcessHeap(), 0, dc->attr );
HeapFree( GetProcessHeap(), 0, dc );
RtlFreeHeap( GetProcessHeap(), 0, dc->attr );
free( dc );
}
......@@ -472,14 +472,14 @@ INT WINAPI NtGdiSaveDC( HDC hdc )
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 );
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 );
return 0;
}
......
......@@ -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 );
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 (clip)
......@@ -456,7 +456,7 @@ done:
fail:
if (run) NtGdiDeleteObjectApp( run );
if (clip && *clip) NtGdiDeleteObjectApp( *clip );
HeapFree( GetProcessHeap(), 0, out_bits );
free( out_bits );
return FALSE;
}
......@@ -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;
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( (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
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",
info->bmiHeader.biWidth, info->bmiHeader.biHeight,
......@@ -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 ))
goto error;
bmp->dib.dsBmih.biClrUsed = info->bmiHeader.biClrUsed;
if (!(bmp->color_table = HeapAlloc( GetProcessHeap(), 0,
bmp->dib.dsBmih.biClrUsed * sizeof(RGBQUAD) )))
if (!(bmp->color_table = malloc( bmp->dib.dsBmih.biClrUsed * sizeof(RGBQUAD) )))
goto error;
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
NtFreeVirtualMemory( GetCurrentProcess(), &bmp->dib.dsBm.bmBits, &size, MEM_RELEASE );
}
error:
HeapFree( GetProcessHeap(), 0, bmp->color_table );
HeapFree( GetProcessHeap(), 0, bmp );
free( bmp->color_table );
free( bmp );
return 0;
}
......@@ -1631,7 +1630,7 @@ NTSTATUS WINAPI NtGdiDdDDICreateDCFromMemory( D3DKMT_CREATEDCFROMMEMORY *desc )
if (!desc->hDeviceDc || !(dc = NtGdiCreateCompatibleDC( desc->hDeviceDc )))
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.bmHeight = desc->Height;
......@@ -1655,7 +1654,7 @@ NTSTATUS WINAPI NtGdiDdDDICreateDCFromMemory( D3DKMT_CREATEDCFROMMEMORY *desc )
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;
if (desc->pColorTable)
{
......@@ -1682,8 +1681,8 @@ NTSTATUS WINAPI NtGdiDdDDICreateDCFromMemory( D3DKMT_CREATEDCFROMMEMORY *desc )
return STATUS_SUCCESS;
error:
if (bmp) HeapFree( GetProcessHeap(), 0, bmp->color_table );
HeapFree( GetProcessHeap(), 0, bmp );
if (bmp) free( bmp->color_table );
free( bmp );
NtGdiDeleteObjectApp( dc );
return STATUS_INVALID_PARAMETER;
}
......@@ -1759,7 +1758,7 @@ static BOOL DIB_DeleteObject( HGDIOBJ handle )
NtFreeVirtualMemory( GetCurrentProcess(), &bmp->dib.dsBm.bmBits, &size, MEM_RELEASE );
}
HeapFree(GetProcessHeap(), 0, bmp->color_table);
HeapFree( GetProcessHeap(), 0, bmp );
free( bmp->color_table );
free( bmp );
return TRUE;
}
......@@ -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 height = src_rect->bottom - src_rect->top;
void *ptr = HeapAlloc( GetProcessHeap(), 0, stride * height );
void *ptr = malloc( stride * height );
if (!ptr) return ERROR_OUTOFMEMORY;
......@@ -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.right = width;
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.free = free_heap_bits;
ret->bits.param = NULL;
......@@ -1442,7 +1442,7 @@ BOOL CDECL dibdrv_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert,
RECT bounds;
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++)
{
pts[i].x = vert_array[i].x;
......@@ -1489,6 +1489,6 @@ BOOL CDECL dibdrv_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert,
break;
}
HeapFree( GetProcessHeap(), 0, pts );
free( pts );
return ret;
}
......@@ -291,7 +291,7 @@ int get_clipped_rects( const dib_info *dib, const RECT *rc, HRGN clip, struct cl
out++;
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;
memcpy( clip_rects->rects, clip_rects->buffer, (out - clip_rects->buffer) * sizeof(RECT) );
out = clip_rects->rects + (out - clip_rects->buffer);
......@@ -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,
const DEVMODEW *data )
{
dibdrv_physdev *pdev = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*pdev) );
dibdrv_physdev *pdev = calloc( 1, sizeof(*pdev) );
if (!pdev) return FALSE;
clear_dib_info(&pdev->dib);
......@@ -348,7 +348,7 @@ static BOOL CDECL dibdrv_DeleteDC( PHYSDEV dev )
free_pattern_brush( &pdev->brush );
free_pattern_brush( &pdev->pen_brush );
release_cached_font( pdev->font );
HeapFree( GetProcessHeap(), 0, pdev );
free( pdev );
return TRUE;
}
......@@ -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,
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 (!dib_driver.pCreateDC( dev, NULL, NULL, NULL ))
{
HeapFree( GetProcessHeap(), 0, physdev );
free( physdev );
return FALSE;
}
physdev->dibdrv = get_dibdrv_pdev( *dev );
......@@ -894,7 +894,7 @@ static BOOL CDECL windrv_DeleteDC( PHYSDEV dev )
struct windrv_physdev *physdev = get_windrv_physdev( dev );
window_surface_release( physdev->surface );
HeapFree( GetProcessHeap(), 0, physdev );
free( physdev );
return TRUE;
}
......
......@@ -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 )
{
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 */
......
......@@ -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].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 (extra_lines == -1)
......@@ -363,13 +363,13 @@ static BOOL draw_arc( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
}
if (count < 2)
{
HeapFree( GetProcessHeap(), 0, points );
free( points );
return TRUE;
}
if (pdev->pen_uses_region && !(outline = NtGdiCreateRectRgn( 0, 0, 0, 0 )))
{
HeapFree( GetProcessHeap(), 0, points );
free( points );
return FALSE;
}
......@@ -378,7 +378,7 @@ static BOOL draw_arc( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
get_dib_rect( &pdev->dib, &rc ) &&
!(interior = create_polypolygon_region( points, &count, 1, WINDING, &rc )))
{
HeapFree( GetProcessHeap(), 0, points );
free( points );
if (outline) NtGdiDeleteObjectApp( outline );
return FALSE;
}
......@@ -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 );
NtGdiDeleteObjectApp( outline );
}
HeapFree( GetProcessHeap(), 0, points );
free( points );
return ret;
}
......@@ -600,13 +600,13 @@ static struct cached_font *add_cached_font( DC *dc, HFONT hfont, UINT aa_flags )
{
if (!ptr->glyphs[i][j]) continue;
for (k = 0; k < GLYPH_CACHE_PAGE_SIZE; k++)
HeapFree( GetProcessHeap(), 0, ptr->glyphs[i][j][k] );
HeapFree( GetProcessHeap(), 0, ptr->glyphs[i][j] );
free( ptr->glyphs[i][j][k] );
free( ptr->glyphs[i][j] );
}
}
list_remove( &ptr->entry );
}
else if (!(ptr = HeapAlloc( GetProcessHeap(), 0, sizeof(*ptr) )))
else if (!(ptr = malloc( sizeof(*ptr) )))
{
LeaveCriticalSection( &font_cache_cs );
return NULL;
......@@ -639,18 +639,18 @@ static struct cached_glyph *add_cached_glyph( struct cached_font *font, UINT ind
{
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)
{
HeapFree( GetProcessHeap(), 0, glyph );
free( glyph );
return 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 );
if (!ret) ret = glyph;
else HeapFree( GetProcessHeap(), 0, glyph );
else free( glyph );
return ret;
}
......@@ -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 );
stride = get_dib_stride( metrics.gmBlackBoxX, bit_count );
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 (!size) goto done; /* empty glyph */
......@@ -785,7 +785,7 @@ static struct cached_glyph *cache_glyph_bitmap( DC *dc, struct cached_font *font
&identity, FALSE );
if (ret == GDI_ERROR)
{
HeapFree( GetProcessHeap(), 0, glyph );
free( glyph );
return NULL;
}
assert( ret <= size );
......@@ -1269,7 +1269,7 @@ BOOL CDECL dibdrv_PolyPolygon( PHYSDEV dev, const POINT *pt, const INT *counts,
if (total > ARRAY_SIZE( pt_buf ))
{
points = HeapAlloc( GetProcessHeap(), 0, total * sizeof(*pt) );
points = malloc( total * sizeof(*pt) );
if (!points) return FALSE;
}
memcpy( points, pt, total * sizeof(*pt) );
......@@ -1315,7 +1315,7 @@ BOOL CDECL dibdrv_PolyPolygon( PHYSDEV dev, const POINT *pt, const INT *counts,
}
done:
if (points != pt_buf) HeapFree( GetProcessHeap(), 0, points );
if (points != pt_buf) free( points );
return ret;
}
......@@ -1340,7 +1340,7 @@ BOOL CDECL dibdrv_PolyPolyline( PHYSDEV dev, const POINT* pt, const DWORD* count
if (total > ARRAY_SIZE( pt_buf ))
{
points = HeapAlloc( GetProcessHeap(), 0, total * sizeof(*pt) );
points = malloc( total * sizeof(*pt) );
if (!points) return FALSE;
}
memcpy( points, pt, total * sizeof(*pt) );
......@@ -1367,7 +1367,7 @@ BOOL CDECL dibdrv_PolyPolyline( PHYSDEV dev, const POINT* pt, const DWORD* count
}
done:
if (points != pt_buf) HeapFree( GetProcessHeap(), 0, points );
if (points != pt_buf) free( points );
return ret;
}
......@@ -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)
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 (pdev->pen_uses_region && !(outline = NtGdiCreateRectRgn( 0, 0, 0, 0 )))
{
HeapFree( GetProcessHeap(), 0, points );
free( points );
return FALSE;
}
......@@ -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,
ellipse_width, ellipse_height )))
{
HeapFree( GetProcessHeap(), 0, points );
free( points );
if (outline) NtGdiDeleteObjectApp( outline );
return FALSE;
}
......@@ -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 );
NtGdiDeleteObjectApp( outline );
}
HeapFree( GetProcessHeap(), 0, points );
free( points );
return ret;
}
......
......@@ -1821,14 +1821,14 @@ static BOOL alloc_brush_mask_bits( dib_brush *brush )
assert(brush->masks.xor == NULL);
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;
return TRUE;
}
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;
}
......@@ -2022,7 +2022,7 @@ static BOOL select_pattern_brush( dibdrv_physdev *pdev, dib_brush *brush, BOOL *
}
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.free = free_heap_bits;
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
if (!size) return 0;
elp = HeapAlloc( GetProcessHeap(), 0, size );
elp = malloc( size );
NtGdiExtGetObjectW( hpen, size, elp );
logpen.lopnStyle = elp->elpPenStyle;
......@@ -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_is_ext = (elp != NULL);
HeapFree( GetProcessHeap(), 0, elp );
free( elp );
return hpen;
}
......
......@@ -148,12 +148,12 @@ static struct wgl_context * CDECL osmesa_create_context( HDC hdc, const PIXELFOR
default:
return NULL;
}
if (!(context = RtlAllocateHeap( GetProcessHeap(), 0, sizeof( *context )))) return NULL;
if (!(context = malloc( sizeof( *context )))) return NULL;
context->format = gl_format;
if (!(context->context = pOSMesaCreateContextExt( gl_format, descr->cDepthBits, descr->cStencilBits,
descr->cAccumBits, 0 )))
{
RtlFreeHeap( GetProcessHeap(), 0, context );
free( context );
return NULL;
}
return context;
......@@ -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 )
{
pOSMesaDestroyContext( context->context );
RtlFreeHeap( GetProcessHeap(), 0, context );
free( context );
return TRUE;
}
......
......@@ -39,7 +39,6 @@
#include "ntgdi_private.h"
#include "wine/list.h"
#include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(driver);
......@@ -809,7 +808,7 @@ NTSTATUS WINAPI NtGdiDdDDICloseAdapter( const D3DKMT_CLOSEADAPTER *desc )
if (adapter->handle == desc->hAdapter)
{
list_remove( &adapter->entry );
heap_free( adapter );
free( adapter );
status = STATUS_SUCCESS;
break;
}
......@@ -847,7 +846,7 @@ NTSTATUS WINAPI NtGdiDdDDIOpenAdapterFromLuid( D3DKMT_OPENADAPTERFROMLUID *desc
static D3DKMT_HANDLE handle_start = 0;
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 );
desc->hAdapter = adapter->handle = ++handle_start;
......@@ -888,7 +887,7 @@ NTSTATUS WINAPI NtGdiDdDDICreateDevice( D3DKMT_CREATEDEVICE *desc )
if (desc->Flags.LegacyMode || desc->Flags.RequestVSync || desc->Flags.DisableGpuTimeout)
FIXME("Flags unsupported.\n");
device = heap_alloc_zero( sizeof( *device ) );
device = calloc( 1, sizeof( *device ) );
if (!device)
return STATUS_NO_MEMORY;
......@@ -924,7 +923,7 @@ NTSTATUS WINAPI NtGdiDdDDIDestroyDevice( const D3DKMT_DESTROYDEVICE *desc )
set_owner_desc.hDevice = desc->hDevice;
NtGdiDdDDISetVidPnSourceOwner( &set_owner_desc );
list_remove( &device->entry );
heap_free( device );
free( device );
status = STATUS_SUCCESS;
break;
}
......
......@@ -445,7 +445,7 @@ static INT CDECL EMFDRV_GetDeviceCaps( PHYSDEV dev, INT cap )
static BOOL CDECL EMFDRV_DeleteDC( PHYSDEV dev )
{
EMFDRV_PDEVICE *physDev = get_emf_physdev( dev );
HeapFree( GetProcessHeap(), 0, physDev );
free( physDev );
return TRUE;
}
......@@ -577,7 +577,7 @@ HDC WINAPI NtGdiCreateMetafileDC( HDC hdc )
if (!(dc = alloc_dc_ptr( NTGDI_OBJ_ENHMETADC ))) return 0;
physDev = HeapAlloc( GetProcessHeap(), 0, sizeof(*physDev) );
physDev = malloc( sizeof(*physDev) );
if (!physDev)
{
free_dc_ptr( dc );
......
......@@ -947,11 +947,11 @@ HANDLE WINAPI NtGdiCreateClientObj( ULONG type )
struct gdi_obj_header *obj;
HGDIOBJ handle;
if (!(obj = HeapAlloc( GetProcessHeap(), 0, sizeof(*obj) )))
if (!(obj = malloc( sizeof(*obj) )))
return 0;
handle = alloc_gdi_handle( obj, type, NULL );
if (!handle) HeapFree( GetProcessHeap(), 0, obj );
if (!handle) free( obj );
return handle;
}
......@@ -962,7 +962,7 @@ BOOL WINAPI NtGdiDeleteClientObj( HGDIOBJ handle )
{
void *obj;
if (!(obj = free_gdi_handle( handle ))) return FALSE;
HeapFree( GetProcessHeap(), 0, obj );
free( obj );
return TRUE;
}
......
......@@ -131,7 +131,7 @@ BOOL CDECL nulldrv_PolyBezier( PHYSDEV dev, const POINT *points, DWORD count )
if ((pts = GDI_Bezier( points, count, &n )))
{
ret = polyline( dev->hdc, pts, n );
HeapFree( GetProcessHeap(), 0, pts );
free( pts );
}
return ret;
}
......@@ -140,7 +140,7 @@ BOOL CDECL nulldrv_PolyBezierTo( PHYSDEV dev, const POINT *points, DWORD count )
{
DC *dc = get_nulldrv_dc( dev );
BOOL ret = FALSE;
POINT *pts = HeapAlloc( GetProcessHeap(), 0, sizeof(POINT) * (count + 1) );
POINT *pts = malloc( sizeof(POINT) * (count + 1) );
if (pts)
{
......@@ -148,7 +148,7 @@ BOOL CDECL nulldrv_PolyBezierTo( PHYSDEV dev, const POINT *points, DWORD count )
memcpy( pts + 1, points, sizeof(POINT) * count );
count++;
ret = NtGdiPolyPolyDraw( dev->hdc, pts, &count, 1, NtGdiPolyBezier );
HeapFree( GetProcessHeap(), 0, pts );
free( pts );
}
return ret;
}
......@@ -181,7 +181,7 @@ BOOL CDECL nulldrv_PolyDraw( PHYSDEV dev, const POINT *points, const BYTE *types
}
space = count + 300;
line_pts = HeapAlloc( GetProcessHeap(), 0, space * sizeof(POINT) );
line_pts = malloc( space * sizeof(POINT) );
num_pts = 1;
line_pts[0] = dc->attr->cur_pos;
......@@ -209,11 +209,11 @@ BOOL CDECL nulldrv_PolyDraw( PHYSDEV dev, const POINT *points, const BYTE *types
if (space < size)
{
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) );
num_pts += num_bzr_pts - 1;
HeapFree( GetProcessHeap(), 0, bzr_pts );
free( bzr_pts );
}
i += 2;
break;
......@@ -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 );
HeapFree( GetProcessHeap(), 0, line_pts );
free( line_pts );
return TRUE;
}
......@@ -233,12 +233,12 @@ BOOL CDECL nulldrv_PolylineTo( PHYSDEV dev, const POINT *points, INT count )
POINT *pts;
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;
memcpy( pts + 1, points, sizeof(POINT) * count );
ret = polyline( dev->hdc, pts, count + 1 );
HeapFree( GetProcessHeap(), 0, pts );
free( pts );
}
return ret;
}
......@@ -789,8 +789,7 @@ static void GDI_InternalBezier( POINT *Points, POINT **PtsOut, INT *dwOut,
{
if(*nPtsOut == *dwOut) {
*dwOut *= 2;
*PtsOut = HeapReAlloc( GetProcessHeap(), 0, *PtsOut,
*dwOut * sizeof(POINT) );
*PtsOut = realloc( *PtsOut, *dwOut * sizeof(POINT) );
}
if(!level || BezierCheck(level, Points)) {
......@@ -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
* 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
* 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].
......@@ -857,7 +856,7 @@ POINT *GDI_Bezier( const POINT *Points, INT count, INT *nPtsOut )
return NULL;
}
*nPtsOut = 0;
out = HeapAlloc( GetProcessHeap(), 0, dwOut * sizeof(POINT));
out = malloc( dwOut * sizeof(POINT) );
for(Bezier = 0; Bezier < (count-1)/3; Bezier++) {
POINT ptBuf[4];
memcpy(ptBuf, Points + Bezier * 3, sizeof(POINT) * 4);
......
......@@ -111,21 +111,21 @@ HPALETTE WINAPI NtGdiCreatePaletteInternal( const LOGPALETTE *palette, UINT coun
if (!palette) return 0;
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->version = palette->palVersion;
palettePtr->count = count;
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;
}
memcpy( palettePtr->entries, palette->palPalEntry, size );
if (!(hpalette = alloc_gdi_handle( &palettePtr->obj, NTGDI_OBJ_PAL, &palette_funcs )))
{
HeapFree( GetProcessHeap(), 0, palettePtr->entries );
HeapFree( GetProcessHeap(), 0, palettePtr );
free( palettePtr->entries );
free( palettePtr );
}
TRACE(" returning %p\n", hpalette);
return hpalette;
......@@ -228,22 +228,23 @@ static UINT set_palette_entries( HPALETTE hpalette, UINT start, UINT count,
*
* 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 );
PALETTEENTRY *entries;
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,
palPtr->entries, cEntries * sizeof(*palPtr->entries) )))
if (!(entries = realloc( palPtr->entries, count * sizeof(*palPtr->entries) )))
{
GDI_ReleaseObj( hPal );
return FALSE;
}
if (count > palPtr->count)
memset( entries + palPtr->count, 0, (count - palPtr->count) * sizeof(*palPtr->entries) );
palPtr->entries = entries;
palPtr->count = cEntries;
palPtr->count = count;
GDI_ReleaseObj( hPal );
PALETTE_UnrealizeObject( hPal );
......@@ -505,8 +506,8 @@ static BOOL PALETTE_DeleteObject( HGDIOBJ handle )
PALETTE_UnrealizeObject( handle );
if (!(obj = free_gdi_handle( handle ))) return FALSE;
HeapFree( GetProcessHeap(), 0, obj->entries );
HeapFree( GetProcessHeap(), 0, obj );
free( obj->entries );
free( obj );
return TRUE;
}
......
......@@ -106,13 +106,13 @@ static inline struct path_physdev *get_path_physdev( PHYSDEV dev )
void free_gdi_path( struct gdi_path *path )
{
if (path->points != path->points_buf)
HeapFree( GetProcessHeap(), 0, path->points );
HeapFree( GetProcessHeap(), 0, path );
free( path->points );
free( path );
}
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)
{
......@@ -122,11 +122,10 @@ static struct gdi_path *alloc_gdi_path( int count )
count = max( NUM_ENTRIES_INITIAL, count );
if (count > NUM_ENTRIES_INITIAL)
{
path->points = HeapAlloc( GetProcessHeap(), 0,
count * (sizeof(path->points[0]) + sizeof(path->flags[0])) );
path->points = malloc( count * (sizeof(path->points[0]) + sizeof(path->flags[0])) );
if (!path->points)
{
HeapFree( GetProcessHeap(), 0, path );
free( path );
SetLastError( ERROR_NOT_ENOUGH_MEMORY );
return NULL;
}
......@@ -205,14 +204,14 @@ static BOOL PATH_ReserveEntries(struct gdi_path *path, INT count)
if (path->points == path->points_buf)
{
pts_new = HeapAlloc( GetProcessHeap(), 0, size );
pts_new = malloc( size );
if (!pts_new) return FALSE;
memcpy( pts_new, path->points, path->count * sizeof(path->points[0]) );
memcpy( pts_new + count, path->flags, path->count * sizeof(path->flags[0]) );
}
else
{
pts_new = HeapReAlloc( GetProcessHeap(), 0, path->points, size );
pts_new = realloc( path->points, size );
if (!pts_new) return FALSE;
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 )
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;
assert( path->flags[0] == PT_MOVETO );
......@@ -353,7 +352,7 @@ static HRGN path_to_region( const struct gdi_path *path, int mode )
assert( polygons <= path->count / 2 );
hrgn = create_polypolygon_region( path->points, counts, polygons, mode, NULL );
HeapFree( GetProcessHeap(), 0, counts );
free( counts );
return hrgn;
}
......@@ -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);
if (ret && closed) close_figure( pPath );
HeapFree( GetProcessHeap(), 0, pts );
free( pts );
return ret;
}
......@@ -763,7 +762,7 @@ static BOOL CDECL pathdrv_EndPath( PHYSDEV dev )
dc->path = physdev->path;
pop_dc_driver( dc, &path_driver );
HeapFree( GetProcessHeap(), 0, physdev );
free( physdev );
return TRUE;
}
......@@ -774,7 +773,7 @@ static BOOL CDECL pathdrv_EndPath( PHYSDEV dev )
static BOOL CDECL pathdrv_CreateDC( PHYSDEV *dev, LPCWSTR device, LPCWSTR output,
const DEVMODEW *devmode )
{
struct path_physdev *physdev = HeapAlloc( GetProcessHeap(), 0, sizeof(*physdev) );
struct path_physdev *physdev = malloc( sizeof(*physdev) );
if (!physdev) return FALSE;
push_dc_driver( dev, &physdev->dev, &path_driver );
......@@ -790,7 +789,7 @@ static BOOL CDECL pathdrv_DeleteDC( PHYSDEV dev )
struct path_physdev *physdev = get_path_physdev( dev );
free_gdi_path( physdev->path );
HeapFree( GetProcessHeap(), 0, physdev );
free( physdev );
return TRUE;
}
......@@ -822,7 +821,7 @@ BOOL PATH_RestorePath( DC *dst, DC *src )
{
physdev = get_path_physdev( dev );
free_gdi_path( physdev->path );
HeapFree( GetProcessHeap(), 0, physdev );
free( physdev );
}
if (src->path && src->path_open)
......@@ -1483,7 +1482,7 @@ static BOOL PATH_add_outline(struct path_physdev *physdev, INT x, INT y,
{
WORD i;
POINTFX ptfx;
POINT *pts = HeapAlloc(GetProcessHeap(), 0, (curve->cpfx + 1) * sizeof(POINT));
POINT *pts = malloc( (curve->cpfx + 1) * sizeof(POINT) );
if (!pts) return FALSE;
......@@ -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);
HeapFree(GetProcessHeap(), 0, pts);
free( pts );
break;
}
......@@ -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 */
if(dwSize)
{
outline = HeapAlloc(GetProcessHeap(), 0, dwSize);
outline = malloc( dwSize );
if (!outline) return 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);
HeapFree(GetProcessHeap(), 0, outline);
free( outline );
}
if (dx)
......@@ -1628,7 +1627,7 @@ static struct gdi_path *PATH_WidenPath(DC *dc)
return NULL;
}
elp = HeapAlloc( GetProcessHeap(), 0, size );
elp = malloc( size );
NtGdiExtGetObjectW( dc->hPen, size, elp );
obj_type = get_gdi_object_type(dc->hPen);
......@@ -1642,12 +1641,12 @@ static struct gdi_path *PATH_WidenPath(DC *dc)
break;
default:
SetLastError(ERROR_CAN_NOT_COMPLETE);
HeapFree( GetProcessHeap(), 0, elp );
free( elp );
return NULL;
}
penWidth = elp->elpWidth;
HeapFree( GetProcessHeap(), 0, elp );
free( elp );
endcap = (PS_ENDCAP_MASK & penStyle);
joint = (PS_JOIN_MASK & penStyle);
......@@ -1682,10 +1681,7 @@ static struct gdi_path *PATH_WidenPath(DC *dc)
case PT_MOVETO:
numStrokes++;
j = 0;
if(numStrokes == 1)
pStrokes = HeapAlloc(GetProcessHeap(), 0, sizeof(*pStrokes));
else
pStrokes = HeapReAlloc(GetProcessHeap(), 0, pStrokes, numStrokes * sizeof(*pStrokes));
pStrokes = realloc( pStrokes, numStrokes * sizeof(*pStrokes) );
if(!pStrokes)
{
free_gdi_path(flat_path);
......@@ -1706,7 +1702,7 @@ static struct gdi_path *PATH_WidenPath(DC *dc)
default:
ERR("Got path flag %c\n", flat_path->flags[i]);
for(i = 0; i < numStrokes; i++) free_gdi_path(pStrokes[i]);
HeapFree(GetProcessHeap(), 0, pStrokes);
free( pStrokes );
free_gdi_path(flat_path);
return NULL;
}
......@@ -1897,7 +1893,7 @@ static struct gdi_path *PATH_WidenPath(DC *dc)
free_gdi_path( pUpPath );
free_gdi_path( pDownPath );
}
HeapFree(GetProcessHeap(), 0, pStrokes);
free( pStrokes );
free_gdi_path( flat_path );
return pNewPath;
}
......
......@@ -78,7 +78,7 @@ HPEN create_pen( INT style, INT width, COLORREF color )
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.elpWidth = abs(width);
......@@ -86,7 +86,7 @@ HPEN create_pen( INT style, INT width, COLORREF color )
penPtr->logpen.elpBrushStyle = BS_SOLID;
if (!(hpen = alloc_gdi_handle( &penPtr->obj, NTGDI_OBJ_PEN, &pen_funcs )))
HeapFree( GetProcessHeap(), 0, penPtr );
free( penPtr );
return hpen;
}
......@@ -170,7 +170,7 @@ HPEN WINAPI NtGdiExtCreatePen( DWORD style, DWORD width, ULONG brush_style, ULON
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;
logbrush.lbStyle = brush_style;
......@@ -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 )))
{
free_brush_pattern( &penPtr->pattern );
HeapFree( GetProcessHeap(), 0, penPtr );
free( penPtr );
}
return hpen;
invalid:
HeapFree( GetProcessHeap(), 0, penPtr );
free( penPtr );
SetLastError( ERROR_INVALID_PARAMETER );
return 0;
}
......@@ -260,7 +260,7 @@ static BOOL PEN_DeleteObject( HGDIOBJ handle )
if (!pen) return FALSE;
free_brush_pattern( &pen->pattern );
HeapFree( GetProcessHeap(), 0, pen );
free( pen );
return TRUE;
}
......
......@@ -135,13 +135,13 @@ static BOOL grow_region( WINEREGION *rgn, int size )
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;
memcpy( new_rects, rgn->rects, rgn->numRects * sizeof(RECT) );
}
else
{
new_rects = HeapReAlloc( GetProcessHeap(), 0, rgn->rects, size * sizeof(RECT) );
new_rects = realloc( rgn->rects, size * sizeof(RECT) );
if (!new_rects) return FALSE;
}
rgn->rects = new_rects;
......@@ -413,7 +413,7 @@ static BOOL init_region( WINEREGION *pReg, INT n )
if (n > RGN_DEFAULT_RECTS)
{
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;
}
else
......@@ -430,7 +430,7 @@ static BOOL init_region( WINEREGION *pReg, INT n )
static void destroy_region( WINEREGION *pReg )
{
if (pReg->rects != pReg->rects_buf)
HeapFree( GetProcessHeap(), 0, pReg->rects );
free( pReg->rects );
}
/***********************************************************************
......@@ -439,7 +439,7 @@ static void destroy_region( WINEREGION *pReg )
static void free_region( WINEREGION *rgn )
{
destroy_region( rgn );
HeapFree( GetProcessHeap(), 0, rgn );
free( rgn );
}
/***********************************************************************
......@@ -447,7 +447,7 @@ static void free_region( WINEREGION *rgn )
*/
static WINEREGION *alloc_region( INT n )
{
WINEREGION *rgn = HeapAlloc( GetProcessHeap(), 0, sizeof(*rgn) );
WINEREGION *rgn = malloc( sizeof(*rgn) );
if (rgn && !init_region( rgn, n ))
{
......@@ -1537,7 +1537,7 @@ static void REGION_compact( WINEREGION *reg )
{
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)
{
reg->rects = new_rects;
......@@ -2266,7 +2266,7 @@ static void REGION_InsertEdgeInET(EdgeTable *ET, EdgeTableEntry *ETE,
{
if (*iSLLBlock > SLLSPERBLOCK-1)
{
tmpSLLBlock = HeapAlloc( GetProcessHeap(), 0, sizeof(ScanLineListBlock));
tmpSLLBlock = malloc( sizeof(ScanLineListBlock) );
if(!tmpSLLBlock)
{
WARN("Can't alloc SLLB\n");
......@@ -2512,7 +2512,7 @@ static void REGION_FreeStorage(ScanLineListBlock *pSLLBlock)
while (pSLLBlock)
{
tmpSLLBlock = pSLLBlock->next;
HeapFree( GetProcessHeap(), 0, pSLLBlock );
free( pSLLBlock );
pSLLBlock = tmpSLLBlock;
}
}
......@@ -2673,7 +2673,7 @@ HRGN create_polypolygon_region( const POINT *Pts, const INT *Count, INT nbpolygo
for(poly = total = 0; poly < nbpolygons; poly++)
total += Count[poly];
if (! (pETEs = HeapAlloc( GetProcessHeap(), 0, sizeof(EdgeTableEntry) * total )))
if (! (pETEs = malloc( sizeof(EdgeTableEntry) * total )))
return 0;
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
}
REGION_FreeStorage(SLLBlock.next);
HeapFree( GetProcessHeap(), 0, pETEs );
free( pETEs );
return hrgn;
}
......@@ -395,9 +395,6 @@ static inline LONG win32u_wcstol( LPCWSTR s, LPWSTR *end, INT base )
#define wcsrchr(s,c) win32u_wcsrchr(s,c)
#define wcstol(s,e,b) win32u_wcstol(s,e,b)
#define HeapAlloc RtlAllocateHeap
#define HeapFree RtlFreeHeap
#define HeapReAlloc RtlReAllocateHeap
#define EnterCriticalSection RtlEnterCriticalSection
#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