Commit aa70a90c authored by Sebastian Lackner's avatar Sebastian Lackner Committed by Alexandre Julliard

gdiplus: Do not use GdipAlloc and GdipFree in internal functions.

parent d548639d
...@@ -38,18 +38,18 @@ GpStatus WINGDIPAPI GdipCloneCustomLineCap(GpCustomLineCap* from, ...@@ -38,18 +38,18 @@ GpStatus WINGDIPAPI GdipCloneCustomLineCap(GpCustomLineCap* from,
if(!from || !to) if(!from || !to)
return InvalidParameter; return InvalidParameter;
*to = GdipAlloc(sizeof(GpCustomLineCap)); *to = heap_alloc_zero(sizeof(GpCustomLineCap));
if(!*to) return OutOfMemory; if(!*to) return OutOfMemory;
memcpy(*to, from, sizeof(GpCustomLineCap)); memcpy(*to, from, sizeof(GpCustomLineCap));
(*to)->pathdata.Points = GdipAlloc(from->pathdata.Count * sizeof(PointF)); (*to)->pathdata.Points = heap_alloc_zero(from->pathdata.Count * sizeof(PointF));
(*to)->pathdata.Types = GdipAlloc(from->pathdata.Count); (*to)->pathdata.Types = heap_alloc_zero(from->pathdata.Count);
if((!(*to)->pathdata.Types || !(*to)->pathdata.Points) && (*to)->pathdata.Count){ if((!(*to)->pathdata.Types || !(*to)->pathdata.Points) && (*to)->pathdata.Count){
GdipFree((*to)->pathdata.Points); heap_free((*to)->pathdata.Points);
GdipFree((*to)->pathdata.Types); heap_free((*to)->pathdata.Types);
GdipFree(*to); heap_free(*to);
return OutOfMemory; return OutOfMemory;
} }
...@@ -74,7 +74,7 @@ GpStatus WINGDIPAPI GdipCreateCustomLineCap(GpPath* fillPath, GpPath* strokePath ...@@ -74,7 +74,7 @@ GpStatus WINGDIPAPI GdipCreateCustomLineCap(GpPath* fillPath, GpPath* strokePath
if(!customCap || !(fillPath || strokePath)) if(!customCap || !(fillPath || strokePath))
return InvalidParameter; return InvalidParameter;
*customCap = GdipAlloc(sizeof(GpCustomLineCap)); *customCap = heap_alloc_zero(sizeof(GpCustomLineCap));
if(!*customCap) return OutOfMemory; if(!*customCap) return OutOfMemory;
if(strokePath){ if(strokePath){
...@@ -86,14 +86,14 @@ GpStatus WINGDIPAPI GdipCreateCustomLineCap(GpPath* fillPath, GpPath* strokePath ...@@ -86,14 +86,14 @@ GpStatus WINGDIPAPI GdipCreateCustomLineCap(GpPath* fillPath, GpPath* strokePath
pathdata = &fillPath->pathdata; pathdata = &fillPath->pathdata;
} }
(*customCap)->pathdata.Points = GdipAlloc(pathdata->Count * sizeof(PointF)); (*customCap)->pathdata.Points = heap_alloc_zero(pathdata->Count * sizeof(PointF));
(*customCap)->pathdata.Types = GdipAlloc(pathdata->Count); (*customCap)->pathdata.Types = heap_alloc_zero(pathdata->Count);
if((!(*customCap)->pathdata.Types || !(*customCap)->pathdata.Points) && if((!(*customCap)->pathdata.Types || !(*customCap)->pathdata.Points) &&
pathdata->Count){ pathdata->Count){
GdipFree((*customCap)->pathdata.Points); heap_free((*customCap)->pathdata.Points);
GdipFree((*customCap)->pathdata.Types); heap_free((*customCap)->pathdata.Types);
GdipFree(*customCap); heap_free(*customCap);
return OutOfMemory; return OutOfMemory;
} }
...@@ -119,9 +119,9 @@ GpStatus WINGDIPAPI GdipDeleteCustomLineCap(GpCustomLineCap *customCap) ...@@ -119,9 +119,9 @@ GpStatus WINGDIPAPI GdipDeleteCustomLineCap(GpCustomLineCap *customCap)
if(!customCap) if(!customCap)
return InvalidParameter; return InvalidParameter;
GdipFree(customCap->pathdata.Points); heap_free(customCap->pathdata.Points);
GdipFree(customCap->pathdata.Types); heap_free(customCap->pathdata.Types);
GdipFree(customCap); heap_free(customCap);
return Ok; return Ok;
} }
......
...@@ -178,7 +178,7 @@ GpStatus WINGDIPAPI GdipCreateFont(GDIPCONST GpFontFamily *fontFamily, ...@@ -178,7 +178,7 @@ GpStatus WINGDIPAPI GdipCreateFont(GDIPCONST GpFontFamily *fontFamily,
if (!ret) return NotTrueTypeFont; if (!ret) return NotTrueTypeFont;
*font = GdipAlloc(sizeof(GpFont)); *font = heap_alloc_zero(sizeof(GpFont));
if (!*font) return OutOfMemory; if (!*font) return OutOfMemory;
(*font)->unit = unit; (*font)->unit = unit;
...@@ -188,7 +188,7 @@ GpStatus WINGDIPAPI GdipCreateFont(GDIPCONST GpFontFamily *fontFamily, ...@@ -188,7 +188,7 @@ GpStatus WINGDIPAPI GdipCreateFont(GDIPCONST GpFontFamily *fontFamily,
stat = clone_font_family(fontFamily, &(*font)->family); stat = clone_font_family(fontFamily, &(*font)->family);
if (stat != Ok) if (stat != Ok)
{ {
GdipFree(*font); heap_free(*font);
return stat; return stat;
} }
...@@ -224,7 +224,7 @@ GpStatus WINGDIPAPI GdipCreateFontFromLogfontW(HDC hdc, ...@@ -224,7 +224,7 @@ GpStatus WINGDIPAPI GdipCreateFontFromLogfontW(HDC hdc,
if (!ret) return NotTrueTypeFont; if (!ret) return NotTrueTypeFont;
*font = GdipAlloc(sizeof(GpFont)); *font = heap_alloc_zero(sizeof(GpFont));
if (!*font) return OutOfMemory; if (!*font) return OutOfMemory;
(*font)->unit = UnitWorld; (*font)->unit = UnitWorld;
...@@ -234,7 +234,7 @@ GpStatus WINGDIPAPI GdipCreateFontFromLogfontW(HDC hdc, ...@@ -234,7 +234,7 @@ GpStatus WINGDIPAPI GdipCreateFontFromLogfontW(HDC hdc,
stat = GdipCreateFontFamilyFromName(facename, NULL, &(*font)->family); stat = GdipCreateFontFamilyFromName(facename, NULL, &(*font)->family);
if (stat != Ok) if (stat != Ok)
{ {
GdipFree(*font); heap_free(*font);
return NotTrueTypeFont; return NotTrueTypeFont;
} }
...@@ -275,7 +275,7 @@ GpStatus WINGDIPAPI GdipDeleteFont(GpFont* font) ...@@ -275,7 +275,7 @@ GpStatus WINGDIPAPI GdipDeleteFont(GpFont* font)
return InvalidParameter; return InvalidParameter;
GdipDeleteFontFamily(font->family); GdipDeleteFontFamily(font->family);
GdipFree(font); heap_free(font);
return Ok; return Ok;
} }
...@@ -526,12 +526,12 @@ GpStatus WINGDIPAPI GdipCloneFont(GpFont *font, GpFont **cloneFont) ...@@ -526,12 +526,12 @@ GpStatus WINGDIPAPI GdipCloneFont(GpFont *font, GpFont **cloneFont)
if(!font || !cloneFont) if(!font || !cloneFont)
return InvalidParameter; return InvalidParameter;
*cloneFont = GdipAlloc(sizeof(GpFont)); *cloneFont = heap_alloc_zero(sizeof(GpFont));
if(!*cloneFont) return OutOfMemory; if(!*cloneFont) return OutOfMemory;
**cloneFont = *font; **cloneFont = *font;
stat = GdipCloneFontFamily(font->family, &(*cloneFont)->family); stat = GdipCloneFontFamily(font->family, &(*cloneFont)->family);
if (stat != Ok) GdipFree(*cloneFont); if (stat != Ok) heap_free(*cloneFont);
return stat; return stat;
} }
...@@ -759,7 +759,7 @@ GpStatus WINGDIPAPI GdipCreateFontFamilyFromName(GDIPCONST WCHAR *name, ...@@ -759,7 +759,7 @@ GpStatus WINGDIPAPI GdipCreateFontFamilyFromName(GDIPCONST WCHAR *name,
stat = find_installed_font(name, &fm); stat = find_installed_font(name, &fm);
if (stat != Ok) return stat; if (stat != Ok) return stat;
ffamily = GdipAlloc(sizeof (GpFontFamily)); ffamily = heap_alloc_zero(sizeof (GpFontFamily));
if (!ffamily) return OutOfMemory; if (!ffamily) return OutOfMemory;
lstrcpyW(ffamily->FamilyName, fm.facename); lstrcpyW(ffamily->FamilyName, fm.facename);
...@@ -778,7 +778,7 @@ GpStatus WINGDIPAPI GdipCreateFontFamilyFromName(GDIPCONST WCHAR *name, ...@@ -778,7 +778,7 @@ GpStatus WINGDIPAPI GdipCreateFontFamilyFromName(GDIPCONST WCHAR *name,
static GpStatus clone_font_family(const GpFontFamily *family, GpFontFamily **clone) static GpStatus clone_font_family(const GpFontFamily *family, GpFontFamily **clone)
{ {
*clone = GdipAlloc(sizeof(GpFontFamily)); *clone = heap_alloc_zero(sizeof(GpFontFamily));
if (!*clone) return OutOfMemory; if (!*clone) return OutOfMemory;
**clone = *family; **clone = *family;
...@@ -870,7 +870,7 @@ GpStatus WINGDIPAPI GdipDeleteFontFamily(GpFontFamily *FontFamily) ...@@ -870,7 +870,7 @@ GpStatus WINGDIPAPI GdipDeleteFontFamily(GpFontFamily *FontFamily)
return InvalidParameter; return InvalidParameter;
TRACE("Deleting %p (%s)\n", FontFamily, debugstr_w(FontFamily->FamilyName)); TRACE("Deleting %p (%s)\n", FontFamily, debugstr_w(FontFamily->FamilyName));
GdipFree (FontFamily); heap_free (FontFamily);
return Ok; return Ok;
} }
...@@ -1098,7 +1098,7 @@ GpStatus WINGDIPAPI GdipNewPrivateFontCollection(GpFontCollection** fontCollecti ...@@ -1098,7 +1098,7 @@ GpStatus WINGDIPAPI GdipNewPrivateFontCollection(GpFontCollection** fontCollecti
if (!fontCollection) if (!fontCollection)
return InvalidParameter; return InvalidParameter;
*fontCollection = GdipAlloc(sizeof(GpFontCollection)); *fontCollection = heap_alloc_zero(sizeof(GpFontCollection));
if (!*fontCollection) return OutOfMemory; if (!*fontCollection) return OutOfMemory;
(*fontCollection)->FontFamilies = NULL; (*fontCollection)->FontFamilies = NULL;
...@@ -1122,8 +1122,8 @@ GpStatus WINGDIPAPI GdipDeletePrivateFontCollection(GpFontCollection **fontColle ...@@ -1122,8 +1122,8 @@ GpStatus WINGDIPAPI GdipDeletePrivateFontCollection(GpFontCollection **fontColle
if (!fontCollection) if (!fontCollection)
return InvalidParameter; return InvalidParameter;
for (i = 0; i < (*fontCollection)->count; i++) GdipFree((*fontCollection)->FontFamilies[i]); for (i = 0; i < (*fontCollection)->count; i++) heap_free((*fontCollection)->FontFamilies[i]);
GdipFree(*fontCollection); heap_free(*fontCollection);
return Ok; return Ok;
} }
......
...@@ -406,12 +406,12 @@ BOOL lengthen_path(GpPath *path, INT len) ...@@ -406,12 +406,12 @@ BOOL lengthen_path(GpPath *path, INT len)
if(path->datalen == 0){ if(path->datalen == 0){
path->datalen = len * 2; path->datalen = len * 2;
path->pathdata.Points = GdipAlloc(path->datalen * sizeof(PointF)); path->pathdata.Points = heap_alloc_zero(path->datalen * sizeof(PointF));
if(!path->pathdata.Points) return FALSE; if(!path->pathdata.Points) return FALSE;
path->pathdata.Types = GdipAlloc(path->datalen); path->pathdata.Types = heap_alloc_zero(path->datalen);
if(!path->pathdata.Types){ if(!path->pathdata.Types){
GdipFree(path->pathdata.Points); heap_free(path->pathdata.Points);
return FALSE; return FALSE;
} }
} }
...@@ -467,8 +467,8 @@ void delete_element(region_element* element) ...@@ -467,8 +467,8 @@ void delete_element(region_element* element)
default: default:
delete_element(element->elementdata.combine.left); delete_element(element->elementdata.combine.left);
delete_element(element->elementdata.combine.right); delete_element(element->elementdata.combine.right);
GdipFree(element->elementdata.combine.left); heap_free(element->elementdata.combine.left);
GdipFree(element->elementdata.combine.right); heap_free(element->elementdata.combine.right);
break; break;
} }
} }
......
...@@ -48,6 +48,17 @@ ...@@ -48,6 +48,17 @@
#define GIF_DISPOSE_RESTORE_TO_BKGND 2 #define GIF_DISPOSE_RESTORE_TO_BKGND 2
#define GIF_DISPOSE_RESTORE_TO_PREV 3 #define GIF_DISPOSE_RESTORE_TO_PREV 3
static void *heap_alloc_zero(size_t len) __WINE_ALLOC_SIZE(1);
static inline void *heap_alloc_zero(size_t len)
{
return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
}
static inline BOOL heap_free(void *mem)
{
return HeapFree(GetProcessHeap(), 0, mem);
}
COLORREF ARGB2COLORREF(ARGB color) DECLSPEC_HIDDEN; COLORREF ARGB2COLORREF(ARGB color) DECLSPEC_HIDDEN;
HBITMAP ARGB2BMP(ARGB color) DECLSPEC_HIDDEN; HBITMAP ARGB2BMP(ARGB color) DECLSPEC_HIDDEN;
extern INT arc2polybezier(GpPointF * points, REAL x1, REAL y1, REAL x2, REAL y2, extern INT arc2polybezier(GpPointF * points, REAL x1, REAL y1, REAL x2, REAL y2,
......
...@@ -50,7 +50,7 @@ GpStatus WINGDIPAPI GdipCreateImageAttributes(GpImageAttributes **imageattr) ...@@ -50,7 +50,7 @@ GpStatus WINGDIPAPI GdipCreateImageAttributes(GpImageAttributes **imageattr)
if(!imageattr) if(!imageattr)
return InvalidParameter; return InvalidParameter;
*imageattr = GdipAlloc(sizeof(GpImageAttributes)); *imageattr = heap_alloc_zero(sizeof(GpImageAttributes));
if(!*imageattr) return OutOfMemory; if(!*imageattr) return OutOfMemory;
(*imageattr)->wrap = WrapModeClamp; (*imageattr)->wrap = WrapModeClamp;
...@@ -70,9 +70,9 @@ GpStatus WINGDIPAPI GdipDisposeImageAttributes(GpImageAttributes *imageattr) ...@@ -70,9 +70,9 @@ GpStatus WINGDIPAPI GdipDisposeImageAttributes(GpImageAttributes *imageattr)
return InvalidParameter; return InvalidParameter;
for (i=0; i<ColorAdjustTypeCount; i++) for (i=0; i<ColorAdjustTypeCount; i++)
GdipFree(imageattr->colorremaptables[i].colormap); heap_free(imageattr->colorremaptables[i].colormap);
GdipFree(imageattr); heap_free(imageattr);
return Ok; return Ok;
} }
...@@ -222,21 +222,21 @@ GpStatus WINGDIPAPI GdipSetImageAttributesRemapTable(GpImageAttributes *imageAtt ...@@ -222,21 +222,21 @@ GpStatus WINGDIPAPI GdipSetImageAttributesRemapTable(GpImageAttributes *imageAtt
if(!map || !mapSize) if(!map || !mapSize)
return InvalidParameter; return InvalidParameter;
new_map = GdipAlloc(sizeof(*map) * mapSize); new_map = heap_alloc_zero(sizeof(*map) * mapSize);
if (!new_map) if (!new_map)
return OutOfMemory; return OutOfMemory;
memcpy(new_map, map, sizeof(*map) * mapSize); memcpy(new_map, map, sizeof(*map) * mapSize);
GdipFree(imageAttr->colorremaptables[type].colormap); heap_free(imageAttr->colorremaptables[type].colormap);
imageAttr->colorremaptables[type].mapsize = mapSize; imageAttr->colorremaptables[type].mapsize = mapSize;
imageAttr->colorremaptables[type].colormap = new_map; imageAttr->colorremaptables[type].colormap = new_map;
} }
else else
{ {
GdipFree(imageAttr->colorremaptables[type].colormap); heap_free(imageAttr->colorremaptables[type].colormap);
imageAttr->colorremaptables[type].colormap = NULL; imageAttr->colorremaptables[type].colormap = NULL;
} }
......
...@@ -66,7 +66,7 @@ GpStatus WINGDIPAPI GdipCreateMatrix2(REAL m11, REAL m12, REAL m21, REAL m22, ...@@ -66,7 +66,7 @@ GpStatus WINGDIPAPI GdipCreateMatrix2(REAL m11, REAL m12, REAL m21, REAL m22,
if(!matrix) if(!matrix)
return InvalidParameter; return InvalidParameter;
*matrix = GdipAlloc(sizeof(GpMatrix)); *matrix = heap_alloc_zero(sizeof(GpMatrix));
if(!*matrix) return OutOfMemory; if(!*matrix) return OutOfMemory;
/* first row */ /* first row */
...@@ -129,7 +129,7 @@ GpStatus WINGDIPAPI GdipCloneMatrix(GpMatrix *matrix, GpMatrix **clone) ...@@ -129,7 +129,7 @@ GpStatus WINGDIPAPI GdipCloneMatrix(GpMatrix *matrix, GpMatrix **clone)
if(!matrix || !clone) if(!matrix || !clone)
return InvalidParameter; return InvalidParameter;
*clone = GdipAlloc(sizeof(GpMatrix)); *clone = heap_alloc_zero(sizeof(GpMatrix));
if(!*clone) return OutOfMemory; if(!*clone) return OutOfMemory;
**clone = *matrix; **clone = *matrix;
...@@ -144,7 +144,7 @@ GpStatus WINGDIPAPI GdipCreateMatrix(GpMatrix **matrix) ...@@ -144,7 +144,7 @@ GpStatus WINGDIPAPI GdipCreateMatrix(GpMatrix **matrix)
if(!matrix) if(!matrix)
return InvalidParameter; return InvalidParameter;
*matrix = GdipAlloc(sizeof(GpMatrix)); *matrix = heap_alloc_zero(sizeof(GpMatrix));
if(!*matrix) return OutOfMemory; if(!*matrix) return OutOfMemory;
(*matrix)->matrix[0] = 1.0; (*matrix)->matrix[0] = 1.0;
...@@ -164,7 +164,7 @@ GpStatus WINGDIPAPI GdipDeleteMatrix(GpMatrix *matrix) ...@@ -164,7 +164,7 @@ GpStatus WINGDIPAPI GdipDeleteMatrix(GpMatrix *matrix)
if(!matrix) if(!matrix)
return InvalidParameter; return InvalidParameter;
GdipFree(matrix); heap_free(matrix);
return Ok; return Ok;
} }
...@@ -380,7 +380,7 @@ GpStatus WINGDIPAPI GdipTransformMatrixPointsI(GpMatrix *matrix, GpPoint *pts, I ...@@ -380,7 +380,7 @@ GpStatus WINGDIPAPI GdipTransformMatrixPointsI(GpMatrix *matrix, GpPoint *pts, I
if(count <= 0) if(count <= 0)
return InvalidParameter; return InvalidParameter;
ptsF = GdipAlloc(sizeof(GpPointF) * count); ptsF = heap_alloc_zero(sizeof(GpPointF) * count);
if(!ptsF) if(!ptsF)
return OutOfMemory; return OutOfMemory;
...@@ -396,7 +396,7 @@ GpStatus WINGDIPAPI GdipTransformMatrixPointsI(GpMatrix *matrix, GpPoint *pts, I ...@@ -396,7 +396,7 @@ GpStatus WINGDIPAPI GdipTransformMatrixPointsI(GpMatrix *matrix, GpPoint *pts, I
pts[i].X = gdip_round(ptsF[i].X); pts[i].X = gdip_round(ptsF[i].X);
pts[i].Y = gdip_round(ptsF[i].Y); pts[i].Y = gdip_round(ptsF[i].Y);
} }
GdipFree(ptsF); heap_free(ptsF);
return ret; return ret;
} }
...@@ -461,7 +461,7 @@ GpStatus WINGDIPAPI GdipVectorTransformMatrixPointsI(GpMatrix *matrix, GpPoint * ...@@ -461,7 +461,7 @@ GpStatus WINGDIPAPI GdipVectorTransformMatrixPointsI(GpMatrix *matrix, GpPoint *
if(count <= 0) if(count <= 0)
return InvalidParameter; return InvalidParameter;
ptsF = GdipAlloc(sizeof(GpPointF) * count); ptsF = heap_alloc_zero(sizeof(GpPointF) * count);
if(!ptsF) if(!ptsF)
return OutOfMemory; return OutOfMemory;
...@@ -477,7 +477,7 @@ GpStatus WINGDIPAPI GdipVectorTransformMatrixPointsI(GpMatrix *matrix, GpPoint * ...@@ -477,7 +477,7 @@ GpStatus WINGDIPAPI GdipVectorTransformMatrixPointsI(GpMatrix *matrix, GpPoint *
pts[i].X = gdip_round(ptsF[i].X); pts[i].X = gdip_round(ptsF[i].X);
pts[i].Y = gdip_round(ptsF[i].Y); pts[i].Y = gdip_round(ptsF[i].Y);
} }
GdipFree(ptsF); heap_free(ptsF);
return ret; return ret;
} }
...@@ -513,7 +513,7 @@ GpStatus WINGDIPAPI GdipIsMatrixIdentity(GDIPCONST GpMatrix *matrix, BOOL *resul ...@@ -513,7 +513,7 @@ GpStatus WINGDIPAPI GdipIsMatrixIdentity(GDIPCONST GpMatrix *matrix, BOOL *resul
if(ret == Ok) if(ret == Ok)
*result = isIdentity; *result = isIdentity;
GdipFree(e); heap_free(e);
return ret; return ret;
} }
...@@ -86,7 +86,7 @@ static GpStatus METAFILE_AllocateRecord(GpMetafile *metafile, DWORD size, void * ...@@ -86,7 +86,7 @@ static GpStatus METAFILE_AllocateRecord(GpMetafile *metafile, DWORD size, void *
if (!metafile->comment_data_size) if (!metafile->comment_data_size)
{ {
DWORD data_size = max(256, size * 2 + 4); DWORD data_size = max(256, size * 2 + 4);
metafile->comment_data = GdipAlloc(data_size); metafile->comment_data = heap_alloc_zero(data_size);
if (!metafile->comment_data) if (!metafile->comment_data)
return OutOfMemory; return OutOfMemory;
...@@ -102,7 +102,7 @@ static GpStatus METAFILE_AllocateRecord(GpMetafile *metafile, DWORD size, void * ...@@ -102,7 +102,7 @@ static GpStatus METAFILE_AllocateRecord(GpMetafile *metafile, DWORD size, void *
if (size_needed > metafile->comment_data_size) if (size_needed > metafile->comment_data_size)
{ {
DWORD data_size = size_needed * 2; DWORD data_size = size_needed * 2;
BYTE *new_data = GdipAlloc(data_size); BYTE *new_data = heap_alloc_zero(data_size);
if (!new_data) if (!new_data)
return OutOfMemory; return OutOfMemory;
...@@ -110,7 +110,7 @@ static GpStatus METAFILE_AllocateRecord(GpMetafile *metafile, DWORD size, void * ...@@ -110,7 +110,7 @@ static GpStatus METAFILE_AllocateRecord(GpMetafile *metafile, DWORD size, void *
memcpy(new_data, metafile->comment_data, metafile->comment_data_length); memcpy(new_data, metafile->comment_data, metafile->comment_data_length);
metafile->comment_data_size = data_size; metafile->comment_data_size = data_size;
GdipFree(metafile->comment_data); heap_free(metafile->comment_data);
metafile->comment_data = new_data; metafile->comment_data = new_data;
} }
...@@ -243,7 +243,7 @@ GpStatus WINGDIPAPI GdipRecordMetafile(HDC hdc, EmfType type, GDIPCONST GpRectF ...@@ -243,7 +243,7 @@ GpStatus WINGDIPAPI GdipRecordMetafile(HDC hdc, EmfType type, GDIPCONST GpRectF
if (!record_dc) if (!record_dc)
return GenericError; return GenericError;
*metafile = GdipAlloc(sizeof(GpMetafile)); *metafile = heap_alloc_zero(sizeof(GpMetafile));
if(!*metafile) if(!*metafile)
{ {
DeleteEnhMetaFile(CloseEnhMetaFile(record_dc)); DeleteEnhMetaFile(CloseEnhMetaFile(record_dc));
...@@ -270,7 +270,7 @@ GpStatus WINGDIPAPI GdipRecordMetafile(HDC hdc, EmfType type, GDIPCONST GpRectF ...@@ -270,7 +270,7 @@ GpStatus WINGDIPAPI GdipRecordMetafile(HDC hdc, EmfType type, GDIPCONST GpRectF
if (stat != Ok) if (stat != Ok)
{ {
DeleteEnhMetaFile(CloseEnhMetaFile(record_dc)); DeleteEnhMetaFile(CloseEnhMetaFile(record_dc));
GdipFree(*metafile); heap_free(*metafile);
*metafile = NULL; *metafile = NULL;
return OutOfMemory; return OutOfMemory;
} }
...@@ -463,7 +463,7 @@ GpStatus METAFILE_GraphicsDeleted(GpMetafile* metafile) ...@@ -463,7 +463,7 @@ GpStatus METAFILE_GraphicsDeleted(GpMetafile* metafile)
metafile->hemf = CloseEnhMetaFile(metafile->record_dc); metafile->hemf = CloseEnhMetaFile(metafile->record_dc);
metafile->record_dc = NULL; metafile->record_dc = NULL;
GdipFree(metafile->comment_data); heap_free(metafile->comment_data);
metafile->comment_data = NULL; metafile->comment_data = NULL;
metafile->comment_data_size = 0; metafile->comment_data_size = 0;
...@@ -565,7 +565,7 @@ GpStatus WINGDIPAPI GdipPlayMetafileRecord(GDIPCONST GpMetafile *metafile, ...@@ -565,7 +565,7 @@ GpStatus WINGDIPAPI GdipPlayMetafileRecord(GDIPCONST GpMetafile *metafile,
{ {
ENHMETARECORD *record; ENHMETARECORD *record;
record = GdipAlloc(dataSize + 8); record = heap_alloc_zero(dataSize + 8);
if (record) if (record)
{ {
...@@ -576,7 +576,7 @@ GpStatus WINGDIPAPI GdipPlayMetafileRecord(GDIPCONST GpMetafile *metafile, ...@@ -576,7 +576,7 @@ GpStatus WINGDIPAPI GdipPlayMetafileRecord(GDIPCONST GpMetafile *metafile,
PlayEnhMetaFileRecord(metafile->playback_dc, metafile->handle_table, PlayEnhMetaFileRecord(metafile->playback_dc, metafile->handle_table,
record, metafile->handle_count); record, metafile->handle_count);
GdipFree(record); heap_free(record);
} }
else else
return OutOfMemory; return OutOfMemory;
...@@ -634,7 +634,7 @@ GpStatus WINGDIPAPI GdipPlayMetafileRecord(GDIPCONST GpMetafile *metafile, ...@@ -634,7 +634,7 @@ GpStatus WINGDIPAPI GdipPlayMetafileRecord(GDIPCONST GpMetafile *metafile,
EmfPlusRect *int_rects = (EmfPlusRect*)(record+1); EmfPlusRect *int_rects = (EmfPlusRect*)(record+1);
int i; int i;
rects = temp_rects = GdipAlloc(sizeof(GpRectF) * record->Count); rects = temp_rects = heap_alloc_zero(sizeof(GpRectF) * record->Count);
if (rects) if (rects)
{ {
for (i=0; i<record->Count; i++) for (i=0; i<record->Count; i++)
...@@ -658,7 +658,7 @@ GpStatus WINGDIPAPI GdipPlayMetafileRecord(GDIPCONST GpMetafile *metafile, ...@@ -658,7 +658,7 @@ GpStatus WINGDIPAPI GdipPlayMetafileRecord(GDIPCONST GpMetafile *metafile,
} }
GdipDeleteBrush(temp_brush); GdipDeleteBrush(temp_brush);
GdipFree(temp_rects); heap_free(temp_rects);
return stat; return stat;
} }
...@@ -1010,7 +1010,7 @@ GpStatus WINGDIPAPI GdipCreateMetafileFromEmf(HENHMETAFILE hemf, BOOL delete, ...@@ -1010,7 +1010,7 @@ GpStatus WINGDIPAPI GdipCreateMetafileFromEmf(HENHMETAFILE hemf, BOOL delete,
if (metafile_type == MetafileTypeInvalid) if (metafile_type == MetafileTypeInvalid)
return GenericError; return GenericError;
*metafile = GdipAlloc(sizeof(GpMetafile)); *metafile = heap_alloc_zero(sizeof(GpMetafile));
if (!*metafile) if (!*metafile)
return OutOfMemory; return OutOfMemory;
...@@ -1050,11 +1050,11 @@ GpStatus WINGDIPAPI GdipCreateMetafileFromWmf(HMETAFILE hwmf, BOOL delete, ...@@ -1050,11 +1050,11 @@ GpStatus WINGDIPAPI GdipCreateMetafileFromWmf(HMETAFILE hwmf, BOOL delete,
read = GetMetaFileBitsEx(hwmf, 0, NULL); read = GetMetaFileBitsEx(hwmf, 0, NULL);
if(!read) if(!read)
return GenericError; return GenericError;
copy = GdipAlloc(read); copy = heap_alloc_zero(read);
GetMetaFileBitsEx(hwmf, read, copy); GetMetaFileBitsEx(hwmf, read, copy);
hemf = SetWinMetaFileBits(read, copy, NULL, NULL); hemf = SetWinMetaFileBits(read, copy, NULL, NULL);
GdipFree(copy); heap_free(copy);
/* FIXME: We should store and use hwmf instead of converting to hemf */ /* FIXME: We should store and use hwmf instead of converting to hemf */
retval = GdipCreateMetafileFromEmf(hemf, TRUE, metafile); retval = GdipCreateMetafileFromEmf(hemf, TRUE, metafile);
......
...@@ -40,14 +40,14 @@ GpStatus WINGDIPAPI GdipCreatePathIter(GpPathIterator **iterator, GpPath* path) ...@@ -40,14 +40,14 @@ GpStatus WINGDIPAPI GdipCreatePathIter(GpPathIterator **iterator, GpPath* path)
if(!iterator) if(!iterator)
return InvalidParameter; return InvalidParameter;
*iterator = GdipAlloc(sizeof(GpPathIterator)); *iterator = heap_alloc_zero(sizeof(GpPathIterator));
if(!*iterator) return OutOfMemory; if(!*iterator) return OutOfMemory;
if(path){ if(path){
size = path->pathdata.Count; size = path->pathdata.Count;
(*iterator)->pathdata.Types = GdipAlloc(size); (*iterator)->pathdata.Types = heap_alloc_zero(size);
(*iterator)->pathdata.Points = GdipAlloc(size * sizeof(PointF)); (*iterator)->pathdata.Points = heap_alloc_zero(size * sizeof(PointF));
memcpy((*iterator)->pathdata.Types, path->pathdata.Types, size); memcpy((*iterator)->pathdata.Types, path->pathdata.Types, size);
memcpy((*iterator)->pathdata.Points, path->pathdata.Points,size * sizeof(PointF)); memcpy((*iterator)->pathdata.Points, path->pathdata.Points,size * sizeof(PointF));
...@@ -73,9 +73,9 @@ GpStatus WINGDIPAPI GdipDeletePathIter(GpPathIterator *iter) ...@@ -73,9 +73,9 @@ GpStatus WINGDIPAPI GdipDeletePathIter(GpPathIterator *iter)
if(!iter) if(!iter)
return InvalidParameter; return InvalidParameter;
GdipFree(iter->pathdata.Types); heap_free(iter->pathdata.Types);
GdipFree(iter->pathdata.Points); heap_free(iter->pathdata.Points);
GdipFree(iter); heap_free(iter);
return Ok; return Ok;
} }
......
...@@ -94,7 +94,7 @@ GpStatus WINGDIPAPI GdipClonePen(GpPen *pen, GpPen **clonepen) ...@@ -94,7 +94,7 @@ GpStatus WINGDIPAPI GdipClonePen(GpPen *pen, GpPen **clonepen)
if(!pen || !clonepen) if(!pen || !clonepen)
return InvalidParameter; return InvalidParameter;
*clonepen = GdipAlloc(sizeof(GpPen)); *clonepen = heap_alloc_zero(sizeof(GpPen));
if(!*clonepen) return OutOfMemory; if(!*clonepen) return OutOfMemory;
**clonepen = *pen; **clonepen = *pen;
...@@ -114,7 +114,7 @@ GpStatus WINGDIPAPI GdipClonePen(GpPen *pen, GpPen **clonepen) ...@@ -114,7 +114,7 @@ GpStatus WINGDIPAPI GdipClonePen(GpPen *pen, GpPen **clonepen)
if (stat == Ok && pen->dashes) if (stat == Ok && pen->dashes)
{ {
(*clonepen)->dashes = GdipAlloc(pen->numdashes * sizeof(REAL)); (*clonepen)->dashes = heap_alloc_zero(pen->numdashes * sizeof(REAL));
if ((*clonepen)->dashes) if ((*clonepen)->dashes)
memcpy((*clonepen)->dashes, pen->dashes, pen->numdashes * sizeof(REAL)); memcpy((*clonepen)->dashes, pen->dashes, pen->numdashes * sizeof(REAL));
else else
...@@ -158,7 +158,7 @@ GpStatus WINGDIPAPI GdipCreatePen2(GpBrush *brush, REAL width, GpUnit unit, ...@@ -158,7 +158,7 @@ GpStatus WINGDIPAPI GdipCreatePen2(GpBrush *brush, REAL width, GpUnit unit,
if(!pen || !brush) if(!pen || !brush)
return InvalidParameter; return InvalidParameter;
gp_pen = GdipAlloc(sizeof(GpPen)); gp_pen = heap_alloc_zero(sizeof(GpPen));
if(!gp_pen) return OutOfMemory; if(!gp_pen) return OutOfMemory;
gp_pen->style = GP_DEFAULT_PENSTYLE; gp_pen->style = GP_DEFAULT_PENSTYLE;
...@@ -174,7 +174,7 @@ GpStatus WINGDIPAPI GdipCreatePen2(GpBrush *brush, REAL width, GpUnit unit, ...@@ -174,7 +174,7 @@ GpStatus WINGDIPAPI GdipCreatePen2(GpBrush *brush, REAL width, GpUnit unit,
if(!((gp_pen->unit == UnitWorld) || (gp_pen->unit == UnitPixel))) { if(!((gp_pen->unit == UnitWorld) || (gp_pen->unit == UnitPixel))) {
FIXME("UnitWorld, UnitPixel only supported units\n"); FIXME("UnitWorld, UnitPixel only supported units\n");
GdipFree(gp_pen); heap_free(gp_pen);
return NotImplemented; return NotImplemented;
} }
...@@ -197,8 +197,8 @@ GpStatus WINGDIPAPI GdipDeletePen(GpPen *pen) ...@@ -197,8 +197,8 @@ GpStatus WINGDIPAPI GdipDeletePen(GpPen *pen)
GdipDeleteBrush(pen->brush); GdipDeleteBrush(pen->brush);
GdipDeleteCustomLineCap(pen->customstart); GdipDeleteCustomLineCap(pen->customstart);
GdipDeleteCustomLineCap(pen->customend); GdipDeleteCustomLineCap(pen->customend);
GdipFree(pen->dashes); heap_free(pen->dashes);
GdipFree(pen); heap_free(pen);
return Ok; return Ok;
} }
...@@ -628,11 +628,11 @@ GpStatus WINGDIPAPI GdipSetPenDashArray(GpPen *pen, GDIPCONST REAL *dash, ...@@ -628,11 +628,11 @@ GpStatus WINGDIPAPI GdipSetPenDashArray(GpPen *pen, GDIPCONST REAL *dash,
if(sum == 0.0 && count) if(sum == 0.0 && count)
return InvalidParameter; return InvalidParameter;
GdipFree(pen->dashes); heap_free(pen->dashes);
pen->dashes = NULL; pen->dashes = NULL;
if(count > 0) if(count > 0)
pen->dashes = GdipAlloc(count * sizeof(REAL)); pen->dashes = heap_alloc_zero(count * sizeof(REAL));
if(!pen->dashes){ if(!pen->dashes){
pen->numdashes = 0; pen->numdashes = 0;
return OutOfMemory; return OutOfMemory;
...@@ -678,7 +678,7 @@ GpStatus WINGDIPAPI GdipSetPenDashStyle(GpPen *pen, GpDashStyle dash) ...@@ -678,7 +678,7 @@ GpStatus WINGDIPAPI GdipSetPenDashStyle(GpPen *pen, GpDashStyle dash)
return InvalidParameter; return InvalidParameter;
if(dash != DashStyleCustom){ if(dash != DashStyleCustom){
GdipFree(pen->dashes); heap_free(pen->dashes);
pen->dashes = NULL; pen->dashes = NULL;
pen->numdashes = 0; pen->numdashes = 0;
} }
......
...@@ -189,7 +189,7 @@ static inline GpStatus clone_element(const region_element* element, ...@@ -189,7 +189,7 @@ static inline GpStatus clone_element(const region_element* element,
/* root node is allocated with GpRegion */ /* root node is allocated with GpRegion */
if(!*element2){ if(!*element2){
*element2 = GdipAlloc(sizeof(region_element)); *element2 = heap_alloc_zero(sizeof(region_element));
if (!*element2) if (!*element2)
return OutOfMemory; return OutOfMemory;
} }
...@@ -262,7 +262,7 @@ GpStatus WINGDIPAPI GdipCloneRegion(GpRegion *region, GpRegion **clone) ...@@ -262,7 +262,7 @@ GpStatus WINGDIPAPI GdipCloneRegion(GpRegion *region, GpRegion **clone)
if (!(region && clone)) if (!(region && clone))
return InvalidParameter; return InvalidParameter;
*clone = GdipAlloc(sizeof(GpRegion)); *clone = heap_alloc_zero(sizeof(GpRegion));
if (!*clone) if (!*clone)
return OutOfMemory; return OutOfMemory;
element = &(*clone)->node; element = &(*clone)->node;
...@@ -293,11 +293,11 @@ GpStatus WINGDIPAPI GdipCombineRegionPath(GpRegion *region, GpPath *path, Combin ...@@ -293,11 +293,11 @@ GpStatus WINGDIPAPI GdipCombineRegionPath(GpRegion *region, GpPath *path, Combin
if(mode == CombineModeReplace){ if(mode == CombineModeReplace){
delete_element(&region->node); delete_element(&region->node);
memcpy(region, path_region, sizeof(GpRegion)); memcpy(region, path_region, sizeof(GpRegion));
GdipFree(path_region); heap_free(path_region);
return Ok; return Ok;
} }
left = GdipAlloc(sizeof(region_element)); left = heap_alloc_zero(sizeof(region_element));
if (left) if (left)
{ {
*left = region->node; *left = region->node;
...@@ -312,7 +312,7 @@ GpStatus WINGDIPAPI GdipCombineRegionPath(GpRegion *region, GpPath *path, Combin ...@@ -312,7 +312,7 @@ GpStatus WINGDIPAPI GdipCombineRegionPath(GpRegion *region, GpPath *path, Combin
else else
stat = OutOfMemory; stat = OutOfMemory;
GdipFree(left); heap_free(left);
GdipDeleteRegion(path_region); GdipDeleteRegion(path_region);
return stat; return stat;
} }
...@@ -340,11 +340,11 @@ GpStatus WINGDIPAPI GdipCombineRegionRect(GpRegion *region, ...@@ -340,11 +340,11 @@ GpStatus WINGDIPAPI GdipCombineRegionRect(GpRegion *region,
if(mode == CombineModeReplace){ if(mode == CombineModeReplace){
delete_element(&region->node); delete_element(&region->node);
memcpy(region, rect_region, sizeof(GpRegion)); memcpy(region, rect_region, sizeof(GpRegion));
GdipFree(rect_region); heap_free(rect_region);
return Ok; return Ok;
} }
left = GdipAlloc(sizeof(region_element)); left = heap_alloc_zero(sizeof(region_element));
if (left) if (left)
{ {
memcpy(left, &region->node, sizeof(region_element)); memcpy(left, &region->node, sizeof(region_element));
...@@ -359,7 +359,7 @@ GpStatus WINGDIPAPI GdipCombineRegionRect(GpRegion *region, ...@@ -359,7 +359,7 @@ GpStatus WINGDIPAPI GdipCombineRegionRect(GpRegion *region,
else else
stat = OutOfMemory; stat = OutOfMemory;
GdipFree(left); heap_free(left);
GdipDeleteRegion(rect_region); GdipDeleteRegion(rect_region);
return stat; return stat;
} }
...@@ -407,11 +407,11 @@ GpStatus WINGDIPAPI GdipCombineRegionRegion(GpRegion *region1, ...@@ -407,11 +407,11 @@ GpStatus WINGDIPAPI GdipCombineRegionRegion(GpRegion *region1,
delete_element(&region1->node); delete_element(&region1->node);
memcpy(region1, reg2copy, sizeof(GpRegion)); memcpy(region1, reg2copy, sizeof(GpRegion));
GdipFree(reg2copy); heap_free(reg2copy);
return Ok; return Ok;
} }
left = GdipAlloc(sizeof(region_element)); left = heap_alloc_zero(sizeof(region_element));
if (!left) if (!left)
return OutOfMemory; return OutOfMemory;
...@@ -419,7 +419,7 @@ GpStatus WINGDIPAPI GdipCombineRegionRegion(GpRegion *region1, ...@@ -419,7 +419,7 @@ GpStatus WINGDIPAPI GdipCombineRegionRegion(GpRegion *region1,
stat = clone_element(&region2->node, &right); stat = clone_element(&region2->node, &right);
if (stat != Ok) if (stat != Ok)
{ {
GdipFree(left); heap_free(left);
return OutOfMemory; return OutOfMemory;
} }
...@@ -439,7 +439,7 @@ GpStatus WINGDIPAPI GdipCreateRegion(GpRegion **region) ...@@ -439,7 +439,7 @@ GpStatus WINGDIPAPI GdipCreateRegion(GpRegion **region)
if(!region) if(!region)
return InvalidParameter; return InvalidParameter;
*region = GdipAlloc(sizeof(GpRegion)); *region = heap_alloc_zero(sizeof(GpRegion));
if(!*region) if(!*region)
return OutOfMemory; return OutOfMemory;
...@@ -477,7 +477,7 @@ GpStatus WINGDIPAPI GdipCreateRegionPath(GpPath *path, GpRegion **region) ...@@ -477,7 +477,7 @@ GpStatus WINGDIPAPI GdipCreateRegionPath(GpPath *path, GpRegion **region)
if (!(path && region)) if (!(path && region))
return InvalidParameter; return InvalidParameter;
*region = GdipAlloc(sizeof(GpRegion)); *region = heap_alloc_zero(sizeof(GpRegion));
if(!*region) if(!*region)
return OutOfMemory; return OutOfMemory;
stat = init_region(*region, RegionDataPath); stat = init_region(*region, RegionDataPath);
...@@ -511,7 +511,7 @@ GpStatus WINGDIPAPI GdipCreateRegionRect(GDIPCONST GpRectF *rect, ...@@ -511,7 +511,7 @@ GpStatus WINGDIPAPI GdipCreateRegionRect(GDIPCONST GpRectF *rect,
if (!(rect && region)) if (!(rect && region))
return InvalidParameter; return InvalidParameter;
*region = GdipAlloc(sizeof(GpRegion)); *region = heap_alloc_zero(sizeof(GpRegion));
stat = init_region(*region, RegionDataRect); stat = init_region(*region, RegionDataRect);
if(stat != Ok) if(stat != Ok)
{ {
...@@ -563,32 +563,32 @@ GpStatus WINGDIPAPI GdipCreateRegionHrgn(HRGN hrgn, GpRegion **region) ...@@ -563,32 +563,32 @@ GpStatus WINGDIPAPI GdipCreateRegionHrgn(HRGN hrgn, GpRegion **region)
if(!region || !(size = GetRegionData(hrgn, 0, NULL))) if(!region || !(size = GetRegionData(hrgn, 0, NULL)))
return InvalidParameter; return InvalidParameter;
buf = GdipAlloc(size); buf = heap_alloc_zero(size);
if(!buf) if(!buf)
return OutOfMemory; return OutOfMemory;
if(!GetRegionData(hrgn, size, buf)){ if(!GetRegionData(hrgn, size, buf)){
GdipFree(buf); heap_free(buf);
return GenericError; return GenericError;
} }
if(buf->rdh.nCount == 0){ if(buf->rdh.nCount == 0){
if((stat = GdipCreateRegion(&local)) != Ok){ if((stat = GdipCreateRegion(&local)) != Ok){
GdipFree(buf); heap_free(buf);
return stat; return stat;
} }
if((stat = GdipSetEmpty(local)) != Ok){ if((stat = GdipSetEmpty(local)) != Ok){
GdipFree(buf); heap_free(buf);
GdipDeleteRegion(local); GdipDeleteRegion(local);
return stat; return stat;
} }
*region = local; *region = local;
GdipFree(buf); heap_free(buf);
return Ok; return Ok;
} }
if((stat = GdipCreatePath(FillModeAlternate, &path)) != Ok){ if((stat = GdipCreatePath(FillModeAlternate, &path)) != Ok){
GdipFree(buf); heap_free(buf);
return stat; return stat;
} }
...@@ -596,7 +596,7 @@ GpStatus WINGDIPAPI GdipCreateRegionHrgn(HRGN hrgn, GpRegion **region) ...@@ -596,7 +596,7 @@ GpStatus WINGDIPAPI GdipCreateRegionHrgn(HRGN hrgn, GpRegion **region)
for(i = 0; i < buf->rdh.nCount; i++){ for(i = 0; i < buf->rdh.nCount; i++){
if((stat = GdipAddPathRectangle(path, (REAL)rect->left, (REAL)rect->top, if((stat = GdipAddPathRectangle(path, (REAL)rect->left, (REAL)rect->top,
(REAL)(rect->right - rect->left), (REAL)(rect->bottom - rect->top))) != Ok){ (REAL)(rect->right - rect->left), (REAL)(rect->bottom - rect->top))) != Ok){
GdipFree(buf); heap_free(buf);
GdipDeletePath(path); GdipDeletePath(path);
return stat; return stat;
} }
...@@ -605,7 +605,7 @@ GpStatus WINGDIPAPI GdipCreateRegionHrgn(HRGN hrgn, GpRegion **region) ...@@ -605,7 +605,7 @@ GpStatus WINGDIPAPI GdipCreateRegionHrgn(HRGN hrgn, GpRegion **region)
stat = GdipCreateRegionPath(path, region); stat = GdipCreateRegionPath(path, region);
GdipFree(buf); heap_free(buf);
GdipDeletePath(path); GdipDeletePath(path);
return stat; return stat;
} }
...@@ -621,7 +621,7 @@ GpStatus WINGDIPAPI GdipDeleteRegion(GpRegion *region) ...@@ -621,7 +621,7 @@ GpStatus WINGDIPAPI GdipDeleteRegion(GpRegion *region)
return InvalidParameter; return InvalidParameter;
delete_element(&region->node); delete_element(&region->node);
GdipFree(region); heap_free(region);
return Ok; return Ok;
} }
...@@ -906,12 +906,12 @@ static GpStatus read_element(struct memory_buffer *mbuf, GpRegion *region, regio ...@@ -906,12 +906,12 @@ static GpStatus read_element(struct memory_buffer *mbuf, GpRegion *region, regio
{ {
region_element *left, *right; region_element *left, *right;
left = GdipAlloc(sizeof(region_element)); left = heap_alloc_zero(sizeof(region_element));
if (!left) return OutOfMemory; if (!left) return OutOfMemory;
right = GdipAlloc(sizeof(region_element)); right = heap_alloc_zero(sizeof(region_element));
if (!right) if (!right)
{ {
GdipFree(left); heap_free(left);
return OutOfMemory; return OutOfMemory;
} }
...@@ -928,8 +928,8 @@ static GpStatus read_element(struct memory_buffer *mbuf, GpRegion *region, regio ...@@ -928,8 +928,8 @@ static GpStatus read_element(struct memory_buffer *mbuf, GpRegion *region, regio
} }
} }
GdipFree(left); heap_free(left);
GdipFree(right); heap_free(right);
return status; return status;
} }
...@@ -1525,7 +1525,7 @@ static GpStatus transform_region_element(region_element* element, GpMatrix *matr ...@@ -1525,7 +1525,7 @@ static GpStatus transform_region_element(region_element* element, GpMatrix *matr
{ {
/* Steal the element from the created region. */ /* Steal the element from the created region. */
memcpy(element, &new_region->node, sizeof(region_element)); memcpy(element, &new_region->node, sizeof(region_element));
GdipFree(new_region); heap_free(new_region);
} }
else else
return stat; return stat;
...@@ -1631,7 +1631,7 @@ static GpStatus get_region_scans_data(GpRegion *region, GpMatrix *matrix, LPRGND ...@@ -1631,7 +1631,7 @@ static GpStatus get_region_scans_data(GpRegion *region, GpMatrix *matrix, LPRGND
{ {
data_size = GetRegionData(hrgn, 0, NULL); data_size = GetRegionData(hrgn, 0, NULL);
*data = GdipAlloc(data_size); *data = heap_alloc_zero(data_size);
if (*data) if (*data)
GetRegionData(hrgn, data_size, *data); GetRegionData(hrgn, data_size, *data);
...@@ -1644,7 +1644,7 @@ static GpStatus get_region_scans_data(GpRegion *region, GpMatrix *matrix, LPRGND ...@@ -1644,7 +1644,7 @@ static GpStatus get_region_scans_data(GpRegion *region, GpMatrix *matrix, LPRGND
{ {
data_size = sizeof(RGNDATAHEADER) + sizeof(RECT); data_size = sizeof(RGNDATAHEADER) + sizeof(RECT);
*data = GdipAlloc(data_size); *data = heap_alloc_zero(data_size);
if (*data) if (*data)
{ {
...@@ -1683,7 +1683,7 @@ GpStatus WINGDIPAPI GdipGetRegionScansCount(GpRegion *region, UINT *count, GpMat ...@@ -1683,7 +1683,7 @@ GpStatus WINGDIPAPI GdipGetRegionScansCount(GpRegion *region, UINT *count, GpMat
if (stat == Ok) if (stat == Ok)
{ {
*count = data->rdh.nCount; *count = data->rdh.nCount;
GdipFree(data); heap_free(data);
} }
return stat; return stat;
...@@ -1717,7 +1717,7 @@ GpStatus WINGDIPAPI GdipGetRegionScansI(GpRegion *region, GpRect *scans, INT *co ...@@ -1717,7 +1717,7 @@ GpStatus WINGDIPAPI GdipGetRegionScansI(GpRegion *region, GpRect *scans, INT *co
} }
} }
GdipFree(data); heap_free(data);
} }
return Ok; return Ok;
...@@ -1751,7 +1751,7 @@ GpStatus WINGDIPAPI GdipGetRegionScans(GpRegion *region, GpRectF *scans, INT *co ...@@ -1751,7 +1751,7 @@ GpStatus WINGDIPAPI GdipGetRegionScans(GpRegion *region, GpRectF *scans, INT *co
} }
} }
GdipFree(data); heap_free(data);
} }
return Ok; return Ok;
......
...@@ -40,7 +40,7 @@ GpStatus WINGDIPAPI GdipCreateStringFormat(INT attr, LANGID lang, ...@@ -40,7 +40,7 @@ GpStatus WINGDIPAPI GdipCreateStringFormat(INT attr, LANGID lang,
if(!format) if(!format)
return InvalidParameter; return InvalidParameter;
*format = GdipAlloc(sizeof(GpStringFormat)); *format = heap_alloc_zero(sizeof(GpStringFormat));
if(!*format) return OutOfMemory; if(!*format) return OutOfMemory;
(*format)->attr = attr; (*format)->attr = attr;
...@@ -66,9 +66,9 @@ GpStatus WINGDIPAPI GdipDeleteStringFormat(GpStringFormat *format) ...@@ -66,9 +66,9 @@ GpStatus WINGDIPAPI GdipDeleteStringFormat(GpStringFormat *format)
if(!format) if(!format)
return InvalidParameter; return InvalidParameter;
GdipFree(format->character_ranges); heap_free(format->character_ranges);
GdipFree(format->tabs); heap_free(format->tabs);
GdipFree(format); heap_free(format);
return Ok; return Ok;
} }
...@@ -260,11 +260,11 @@ GpStatus WINGDIPAPI GdipSetStringFormatMeasurableCharacterRanges( ...@@ -260,11 +260,11 @@ GpStatus WINGDIPAPI GdipSetStringFormatMeasurableCharacterRanges(
TRACE("%p, %d, %p\n", format, rangeCount, ranges); TRACE("%p, %d, %p\n", format, rangeCount, ranges);
new_ranges = GdipAlloc(rangeCount * sizeof(CharacterRange)); new_ranges = heap_alloc_zero(rangeCount * sizeof(CharacterRange));
if (!new_ranges) if (!new_ranges)
return OutOfMemory; return OutOfMemory;
GdipFree(format->character_ranges); heap_free(format->character_ranges);
format->character_ranges = new_ranges; format->character_ranges = new_ranges;
memcpy(format->character_ranges, ranges, sizeof(CharacterRange) * rangeCount); memcpy(format->character_ranges, ranges, sizeof(CharacterRange) * rangeCount);
format->range_count = rangeCount; format->range_count = rangeCount;
...@@ -284,7 +284,7 @@ GpStatus WINGDIPAPI GdipSetStringFormatTabStops(GpStringFormat *format, REAL fir ...@@ -284,7 +284,7 @@ GpStatus WINGDIPAPI GdipSetStringFormatTabStops(GpStringFormat *format, REAL fir
if(firsttab < 0.0) return NotImplemented; if(firsttab < 0.0) return NotImplemented;
/* first time allocation */ /* first time allocation */
if(format->tabcount == 0){ if(format->tabcount == 0){
format->tabs = GdipAlloc(sizeof(REAL)*count); format->tabs = heap_alloc_zero(sizeof(REAL)*count);
if(!format->tabs) if(!format->tabs)
return OutOfMemory; return OutOfMemory;
} }
...@@ -334,15 +334,15 @@ GpStatus WINGDIPAPI GdipCloneStringFormat(GDIPCONST GpStringFormat *format, GpSt ...@@ -334,15 +334,15 @@ GpStatus WINGDIPAPI GdipCloneStringFormat(GDIPCONST GpStringFormat *format, GpSt
if(!format || !newFormat) if(!format || !newFormat)
return InvalidParameter; return InvalidParameter;
*newFormat = GdipAlloc(sizeof(GpStringFormat)); *newFormat = heap_alloc_zero(sizeof(GpStringFormat));
if(!*newFormat) return OutOfMemory; if(!*newFormat) return OutOfMemory;
**newFormat = *format; **newFormat = *format;
if(format->tabcount > 0){ if(format->tabcount > 0){
(*newFormat)->tabs = GdipAlloc(sizeof(REAL) * format->tabcount); (*newFormat)->tabs = heap_alloc_zero(sizeof(REAL) * format->tabcount);
if(!(*newFormat)->tabs){ if(!(*newFormat)->tabs){
GdipFree(*newFormat); heap_free(*newFormat);
return OutOfMemory; return OutOfMemory;
} }
memcpy((*newFormat)->tabs, format->tabs, sizeof(REAL) * format->tabcount); memcpy((*newFormat)->tabs, format->tabs, sizeof(REAL) * format->tabcount);
...@@ -351,10 +351,10 @@ GpStatus WINGDIPAPI GdipCloneStringFormat(GDIPCONST GpStringFormat *format, GpSt ...@@ -351,10 +351,10 @@ GpStatus WINGDIPAPI GdipCloneStringFormat(GDIPCONST GpStringFormat *format, GpSt
(*newFormat)->tabs = NULL; (*newFormat)->tabs = NULL;
if(format->range_count > 0){ if(format->range_count > 0){
(*newFormat)->character_ranges = GdipAlloc(sizeof(CharacterRange) * format->range_count); (*newFormat)->character_ranges = heap_alloc_zero(sizeof(CharacterRange) * format->range_count);
if(!(*newFormat)->character_ranges){ if(!(*newFormat)->character_ranges){
GdipFree((*newFormat)->tabs); heap_free((*newFormat)->tabs);
GdipFree(*newFormat); heap_free(*newFormat);
return OutOfMemory; return OutOfMemory;
} }
memcpy((*newFormat)->character_ranges, format->character_ranges, memcpy((*newFormat)->character_ranges, format->character_ranges,
......
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