gdiplus: Use CRT allocation functions.
This commit is contained in:
parent
a3f4878f52
commit
69d815407d
15 changed files with 530 additions and 538 deletions
|
@ -48,7 +48,7 @@ GpStatus WINGDIPAPI GdipCloneBrush(GpBrush *brush, GpBrush **clone)
|
|||
switch(brush->bt){
|
||||
case BrushTypeSolidColor:
|
||||
{
|
||||
*clone = heap_alloc_zero(sizeof(GpSolidFill));
|
||||
*clone = malloc(sizeof(GpSolidFill));
|
||||
if (!*clone) return OutOfMemory;
|
||||
memcpy(*clone, brush, sizeof(GpSolidFill));
|
||||
break;
|
||||
|
@ -64,7 +64,7 @@ GpStatus WINGDIPAPI GdipCloneBrush(GpBrush *brush, GpBrush **clone)
|
|||
INT count, pcount;
|
||||
GpStatus stat;
|
||||
|
||||
*clone = heap_alloc_zero(sizeof(GpPathGradient));
|
||||
*clone = malloc(sizeof(GpPathGradient));
|
||||
if (!*clone) return OutOfMemory;
|
||||
|
||||
src = (GpPathGradient*) brush;
|
||||
|
@ -75,7 +75,7 @@ GpStatus WINGDIPAPI GdipCloneBrush(GpBrush *brush, GpBrush **clone)
|
|||
stat = GdipClonePath(src->path, &dest->path);
|
||||
|
||||
if(stat != Ok){
|
||||
heap_free(dest);
|
||||
free(dest);
|
||||
return stat;
|
||||
}
|
||||
|
||||
|
@ -84,25 +84,25 @@ GpStatus WINGDIPAPI GdipCloneBrush(GpBrush *brush, GpBrush **clone)
|
|||
/* blending */
|
||||
count = src->blendcount;
|
||||
dest->blendcount = count;
|
||||
dest->blendfac = heap_alloc_zero(count * sizeof(REAL));
|
||||
dest->blendpos = heap_alloc_zero(count * sizeof(REAL));
|
||||
dest->surroundcolors = heap_alloc_zero(dest->surroundcolorcount * sizeof(ARGB));
|
||||
dest->blendfac = malloc(count * sizeof(REAL));
|
||||
dest->blendpos = malloc(count * sizeof(REAL));
|
||||
dest->surroundcolors = malloc(dest->surroundcolorcount * sizeof(ARGB));
|
||||
pcount = dest->pblendcount;
|
||||
if (pcount)
|
||||
{
|
||||
dest->pblendcolor = heap_alloc_zero(pcount * sizeof(ARGB));
|
||||
dest->pblendpos = heap_alloc_zero(pcount * sizeof(REAL));
|
||||
dest->pblendcolor = malloc(pcount * sizeof(ARGB));
|
||||
dest->pblendpos = malloc(pcount * sizeof(REAL));
|
||||
}
|
||||
|
||||
if(!dest->blendfac || !dest->blendpos || !dest->surroundcolors ||
|
||||
(pcount && (!dest->pblendcolor || !dest->pblendpos))){
|
||||
GdipDeletePath(dest->path);
|
||||
heap_free(dest->blendfac);
|
||||
heap_free(dest->blendpos);
|
||||
heap_free(dest->surroundcolors);
|
||||
heap_free(dest->pblendcolor);
|
||||
heap_free(dest->pblendpos);
|
||||
heap_free(dest);
|
||||
free(dest->blendfac);
|
||||
free(dest->blendpos);
|
||||
free(dest->surroundcolors);
|
||||
free(dest->pblendcolor);
|
||||
free(dest->pblendpos);
|
||||
free(dest);
|
||||
return OutOfMemory;
|
||||
}
|
||||
|
||||
|
@ -122,31 +122,31 @@ GpStatus WINGDIPAPI GdipCloneBrush(GpBrush *brush, GpBrush **clone)
|
|||
GpLineGradient *dest, *src;
|
||||
INT count, pcount;
|
||||
|
||||
dest = heap_alloc_zero(sizeof(GpLineGradient));
|
||||
if(!dest) return OutOfMemory;
|
||||
dest = malloc(sizeof(GpLineGradient));
|
||||
if(!dest) return OutOfMemory;
|
||||
|
||||
src = (GpLineGradient*)brush;
|
||||
|
||||
memcpy(dest, src, sizeof(GpLineGradient));
|
||||
|
||||
count = dest->blendcount;
|
||||
dest->blendfac = heap_alloc_zero(count * sizeof(REAL));
|
||||
dest->blendpos = heap_alloc_zero(count * sizeof(REAL));
|
||||
dest->blendfac = malloc(count * sizeof(REAL));
|
||||
dest->blendpos = malloc(count * sizeof(REAL));
|
||||
pcount = dest->pblendcount;
|
||||
if (pcount)
|
||||
{
|
||||
dest->pblendcolor = heap_alloc_zero(pcount * sizeof(ARGB));
|
||||
dest->pblendpos = heap_alloc_zero(pcount * sizeof(REAL));
|
||||
dest->pblendcolor = malloc(pcount * sizeof(ARGB));
|
||||
dest->pblendpos = malloc(pcount * sizeof(REAL));
|
||||
}
|
||||
|
||||
if (!dest->blendfac || !dest->blendpos ||
|
||||
(pcount && (!dest->pblendcolor || !dest->pblendpos)))
|
||||
{
|
||||
heap_free(dest->blendfac);
|
||||
heap_free(dest->blendpos);
|
||||
heap_free(dest->pblendcolor);
|
||||
heap_free(dest->pblendpos);
|
||||
heap_free(dest);
|
||||
free(dest->blendfac);
|
||||
free(dest->blendpos);
|
||||
free(dest->pblendcolor);
|
||||
free(dest->pblendpos);
|
||||
free(dest);
|
||||
return OutOfMemory;
|
||||
}
|
||||
|
||||
|
@ -278,7 +278,7 @@ GpStatus WINGDIPAPI GdipCreateHatchBrush(GpHatchStyle hatchstyle, ARGB forecol,
|
|||
if(hatchstyle < HatchStyleMin || hatchstyle > HatchStyleMax)
|
||||
return InvalidParameter;
|
||||
|
||||
*brush = heap_alloc_zero(sizeof(GpHatch));
|
||||
*brush = calloc(1, sizeof(GpHatch));
|
||||
if (!*brush) return OutOfMemory;
|
||||
|
||||
(*brush)->brush.bt = BrushTypeHatchFill;
|
||||
|
@ -293,7 +293,7 @@ GpStatus WINGDIPAPI GdipCreateHatchBrush(GpHatchStyle hatchstyle, ARGB forecol,
|
|||
static GpStatus create_line_brush(const GpRectF *rect, ARGB startcolor, ARGB endcolor,
|
||||
GpWrapMode wrap, GpLineGradient **line)
|
||||
{
|
||||
*line = heap_alloc_zero(sizeof(GpLineGradient));
|
||||
*line = calloc(1, sizeof(GpLineGradient));
|
||||
if(!*line) return OutOfMemory;
|
||||
|
||||
(*line)->brush.bt = BrushTypeLinearGradient;
|
||||
|
@ -303,14 +303,14 @@ static GpStatus create_line_brush(const GpRectF *rect, ARGB startcolor, ARGB end
|
|||
(*line)->gamma = FALSE;
|
||||
(*line)->rect = *rect;
|
||||
(*line)->blendcount = 1;
|
||||
(*line)->blendfac = heap_alloc_zero(sizeof(REAL));
|
||||
(*line)->blendpos = heap_alloc_zero(sizeof(REAL));
|
||||
(*line)->blendfac = malloc(sizeof(REAL));
|
||||
(*line)->blendpos = malloc(sizeof(REAL));
|
||||
|
||||
if (!(*line)->blendfac || !(*line)->blendpos)
|
||||
{
|
||||
heap_free((*line)->blendfac);
|
||||
heap_free((*line)->blendpos);
|
||||
heap_free(*line);
|
||||
free((*line)->blendfac);
|
||||
free((*line)->blendpos);
|
||||
free(*line);
|
||||
*line = NULL;
|
||||
return OutOfMemory;
|
||||
}
|
||||
|
@ -604,7 +604,7 @@ static GpStatus create_path_gradient(GpPath *path, ARGB centercolor, GpPathGradi
|
|||
if (path->pathdata.Count < 2)
|
||||
return OutOfMemory;
|
||||
|
||||
*grad = heap_alloc_zero(sizeof(GpPathGradient));
|
||||
*grad = calloc(1, sizeof(GpPathGradient));
|
||||
if (!*grad)
|
||||
{
|
||||
return OutOfMemory;
|
||||
|
@ -612,14 +612,14 @@ static GpStatus create_path_gradient(GpPath *path, ARGB centercolor, GpPathGradi
|
|||
|
||||
GdipSetMatrixElements(&(*grad)->transform, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
|
||||
|
||||
(*grad)->blendfac = heap_alloc_zero(sizeof(REAL));
|
||||
(*grad)->blendpos = heap_alloc_zero(sizeof(REAL));
|
||||
(*grad)->surroundcolors = heap_alloc_zero(sizeof(ARGB));
|
||||
(*grad)->blendfac = malloc(sizeof(REAL));
|
||||
(*grad)->blendpos = malloc(sizeof(REAL));
|
||||
(*grad)->surroundcolors = malloc(sizeof(ARGB));
|
||||
if(!(*grad)->blendfac || !(*grad)->blendpos || !(*grad)->surroundcolors){
|
||||
heap_free((*grad)->blendfac);
|
||||
heap_free((*grad)->blendpos);
|
||||
heap_free((*grad)->surroundcolors);
|
||||
heap_free(*grad);
|
||||
free((*grad)->blendfac);
|
||||
free((*grad)->blendpos);
|
||||
free((*grad)->surroundcolors);
|
||||
free(*grad);
|
||||
*grad = NULL;
|
||||
return OutOfMemory;
|
||||
}
|
||||
|
@ -756,7 +756,7 @@ GpStatus WINGDIPAPI GdipCreateSolidFill(ARGB color, GpSolidFill **sf)
|
|||
|
||||
if(!sf) return InvalidParameter;
|
||||
|
||||
*sf = heap_alloc_zero(sizeof(GpSolidFill));
|
||||
*sf = calloc(1, sizeof(GpSolidFill));
|
||||
if (!*sf) return OutOfMemory;
|
||||
|
||||
(*sf)->brush.bt = BrushTypeSolidColor;
|
||||
|
@ -865,7 +865,7 @@ GpStatus WINGDIPAPI GdipCreateTextureIA(GpImage *image,
|
|||
if (status != Ok)
|
||||
return status;
|
||||
|
||||
*texture = heap_alloc_zero(sizeof(GpTexture));
|
||||
*texture = calloc(1, sizeof(GpTexture));
|
||||
if (!*texture){
|
||||
status = OutOfMemory;
|
||||
goto exit;
|
||||
|
@ -899,7 +899,7 @@ exit:
|
|||
if (*texture)
|
||||
{
|
||||
GdipDisposeImageAttributes((*texture)->imageattributes);
|
||||
heap_free(*texture);
|
||||
free(*texture);
|
||||
*texture = NULL;
|
||||
}
|
||||
GdipDisposeImage(new_image);
|
||||
|
@ -996,29 +996,29 @@ GpStatus WINGDIPAPI GdipDeleteBrush(GpBrush *brush)
|
|||
switch(brush->bt)
|
||||
{
|
||||
case BrushTypePathGradient:
|
||||
GdipDeletePath(((GpPathGradient*) brush)->path);
|
||||
heap_free(((GpPathGradient*) brush)->blendfac);
|
||||
heap_free(((GpPathGradient*) brush)->blendpos);
|
||||
heap_free(((GpPathGradient*) brush)->surroundcolors);
|
||||
heap_free(((GpPathGradient*) brush)->pblendcolor);
|
||||
heap_free(((GpPathGradient*) brush)->pblendpos);
|
||||
GdipDeletePath(((GpPathGradient*)brush)->path);
|
||||
free(((GpPathGradient*)brush)->blendfac);
|
||||
free(((GpPathGradient*)brush)->blendpos);
|
||||
free(((GpPathGradient*)brush)->surroundcolors);
|
||||
free(((GpPathGradient*)brush)->pblendcolor);
|
||||
free(((GpPathGradient*)brush)->pblendpos);
|
||||
break;
|
||||
case BrushTypeLinearGradient:
|
||||
heap_free(((GpLineGradient*)brush)->blendfac);
|
||||
heap_free(((GpLineGradient*)brush)->blendpos);
|
||||
heap_free(((GpLineGradient*)brush)->pblendcolor);
|
||||
heap_free(((GpLineGradient*)brush)->pblendpos);
|
||||
free(((GpLineGradient*)brush)->blendfac);
|
||||
free(((GpLineGradient*)brush)->blendpos);
|
||||
free(((GpLineGradient*)brush)->pblendcolor);
|
||||
free(((GpLineGradient*)brush)->pblendpos);
|
||||
break;
|
||||
case BrushTypeTextureFill:
|
||||
GdipDisposeImage(((GpTexture*)brush)->image);
|
||||
GdipDisposeImageAttributes(((GpTexture*)brush)->imageattributes);
|
||||
heap_free(((GpTexture*)brush)->bitmap_bits);
|
||||
free(((GpTexture*)brush)->bitmap_bits);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
heap_free(brush);
|
||||
free(brush);
|
||||
|
||||
return Ok;
|
||||
}
|
||||
|
@ -1373,21 +1373,21 @@ GpStatus WINGDIPAPI GdipSetLineBlend(GpLineGradient *brush,
|
|||
(count >= 2 && (positions[0] != 0.0f || positions[count-1] != 1.0f)))
|
||||
return InvalidParameter;
|
||||
|
||||
new_blendfac = heap_alloc_zero(count * sizeof(REAL));
|
||||
new_blendpos = heap_alloc_zero(count * sizeof(REAL));
|
||||
new_blendfac = malloc(count * sizeof(REAL));
|
||||
new_blendpos = malloc(count * sizeof(REAL));
|
||||
|
||||
if (!new_blendfac || !new_blendpos)
|
||||
{
|
||||
heap_free(new_blendfac);
|
||||
heap_free(new_blendpos);
|
||||
free(new_blendfac);
|
||||
free(new_blendpos);
|
||||
return OutOfMemory;
|
||||
}
|
||||
|
||||
memcpy(new_blendfac, factors, count * sizeof(REAL));
|
||||
memcpy(new_blendpos, positions, count * sizeof(REAL));
|
||||
|
||||
heap_free(brush->blendfac);
|
||||
heap_free(brush->blendpos);
|
||||
free(brush->blendfac);
|
||||
free(brush->blendpos);
|
||||
|
||||
brush->blendcount = count;
|
||||
brush->blendfac = new_blendfac;
|
||||
|
@ -1518,21 +1518,21 @@ GpStatus WINGDIPAPI GdipSetPathGradientBlend(GpPathGradient *brush, GDIPCONST RE
|
|||
(count >= 2 && (pos[0] != 0.0f || pos[count-1] != 1.0f)))
|
||||
return InvalidParameter;
|
||||
|
||||
new_blendfac = heap_alloc_zero(count * sizeof(REAL));
|
||||
new_blendpos = heap_alloc_zero(count * sizeof(REAL));
|
||||
new_blendfac = malloc(count * sizeof(REAL));
|
||||
new_blendpos = malloc(count * sizeof(REAL));
|
||||
|
||||
if (!new_blendfac || !new_blendpos)
|
||||
{
|
||||
heap_free(new_blendfac);
|
||||
heap_free(new_blendpos);
|
||||
free(new_blendfac);
|
||||
free(new_blendpos);
|
||||
return OutOfMemory;
|
||||
}
|
||||
|
||||
memcpy(new_blendfac, blend, count * sizeof(REAL));
|
||||
memcpy(new_blendpos, pos, count * sizeof(REAL));
|
||||
|
||||
heap_free(brush->blendfac);
|
||||
heap_free(brush->blendpos);
|
||||
free(brush->blendfac);
|
||||
free(brush->blendpos);
|
||||
|
||||
brush->blendcount = count;
|
||||
brush->blendfac = new_blendfac;
|
||||
|
@ -1587,20 +1587,20 @@ GpStatus WINGDIPAPI GdipSetPathGradientPresetBlend(GpPathGradient *brush,
|
|||
return InvalidParameter;
|
||||
}
|
||||
|
||||
new_color = heap_alloc_zero(count * sizeof(ARGB));
|
||||
new_pos = heap_alloc_zero(count * sizeof(REAL));
|
||||
new_color = malloc(count * sizeof(ARGB));
|
||||
new_pos = malloc(count * sizeof(REAL));
|
||||
if (!new_color || !new_pos)
|
||||
{
|
||||
heap_free(new_color);
|
||||
heap_free(new_pos);
|
||||
free(new_color);
|
||||
free(new_pos);
|
||||
return OutOfMemory;
|
||||
}
|
||||
|
||||
memcpy(new_color, blend, sizeof(ARGB) * count);
|
||||
memcpy(new_pos, pos, sizeof(REAL) * count);
|
||||
|
||||
heap_free(brush->pblendcolor);
|
||||
heap_free(brush->pblendpos);
|
||||
free(brush->pblendcolor);
|
||||
free(brush->pblendpos);
|
||||
|
||||
brush->pblendcolor = new_color;
|
||||
brush->pblendpos = new_pos;
|
||||
|
@ -1811,13 +1811,13 @@ GpStatus WINGDIPAPI GdipSetPathGradientSurroundColorsWithCount(GpPathGradient
|
|||
num_colors = 1;
|
||||
}
|
||||
|
||||
new_surroundcolors = heap_alloc_zero(num_colors * sizeof(ARGB));
|
||||
new_surroundcolors = malloc(num_colors * sizeof(ARGB));
|
||||
if (!new_surroundcolors)
|
||||
return OutOfMemory;
|
||||
|
||||
memcpy(new_surroundcolors, argb, num_colors * sizeof(ARGB));
|
||||
|
||||
heap_free(grad->surroundcolors);
|
||||
free(grad->surroundcolors);
|
||||
|
||||
grad->surroundcolors = new_surroundcolors;
|
||||
grad->surroundcolorcount = num_colors;
|
||||
|
@ -2048,20 +2048,20 @@ GpStatus WINGDIPAPI GdipSetLinePresetBlend(GpLineGradient *brush,
|
|||
return InvalidParameter;
|
||||
}
|
||||
|
||||
new_color = heap_alloc_zero(count * sizeof(ARGB));
|
||||
new_pos = heap_alloc_zero(count * sizeof(REAL));
|
||||
new_color = malloc(count * sizeof(ARGB));
|
||||
new_pos = malloc(count * sizeof(REAL));
|
||||
if (!new_color || !new_pos)
|
||||
{
|
||||
heap_free(new_color);
|
||||
heap_free(new_pos);
|
||||
free(new_color);
|
||||
free(new_pos);
|
||||
return OutOfMemory;
|
||||
}
|
||||
|
||||
memcpy(new_color, blend, sizeof(ARGB) * count);
|
||||
memcpy(new_pos, positions, sizeof(REAL) * count);
|
||||
|
||||
heap_free(brush->pblendcolor);
|
||||
heap_free(brush->pblendpos);
|
||||
free(brush->pblendcolor);
|
||||
free(brush->pblendpos);
|
||||
|
||||
brush->pblendcolor = new_color;
|
||||
brush->pblendpos = new_pos;
|
||||
|
|
|
@ -40,9 +40,9 @@ GpStatus WINGDIPAPI GdipCloneCustomLineCap(GpCustomLineCap* from,
|
|||
return InvalidParameter;
|
||||
|
||||
if (from->type == CustomLineCapTypeDefault)
|
||||
*to = heap_alloc_zero(sizeof(GpCustomLineCap));
|
||||
*to = malloc(sizeof(GpCustomLineCap));
|
||||
else
|
||||
*to = heap_alloc_zero(sizeof(GpAdjustableArrowCap));
|
||||
*to = malloc(sizeof(GpAdjustableArrowCap));
|
||||
|
||||
if (!*to)
|
||||
return OutOfMemory;
|
||||
|
@ -53,13 +53,13 @@ GpStatus WINGDIPAPI GdipCloneCustomLineCap(GpCustomLineCap* from,
|
|||
*(GpAdjustableArrowCap *)*to = *(GpAdjustableArrowCap *)from;
|
||||
|
||||
/* Duplicate path data */
|
||||
(*to)->pathdata.Points = heap_alloc_zero(from->pathdata.Count * sizeof(PointF));
|
||||
(*to)->pathdata.Types = heap_alloc_zero(from->pathdata.Count);
|
||||
(*to)->pathdata.Points = malloc(from->pathdata.Count * sizeof(PointF));
|
||||
(*to)->pathdata.Types = malloc(from->pathdata.Count);
|
||||
|
||||
if((!(*to)->pathdata.Types || !(*to)->pathdata.Points) && (*to)->pathdata.Count){
|
||||
heap_free((*to)->pathdata.Points);
|
||||
heap_free((*to)->pathdata.Types);
|
||||
heap_free(*to);
|
||||
free((*to)->pathdata.Points);
|
||||
free((*to)->pathdata.Types);
|
||||
free(*to);
|
||||
return OutOfMemory;
|
||||
}
|
||||
|
||||
|
@ -77,13 +77,13 @@ static GpStatus init_custom_linecap(GpCustomLineCap *cap, GpPathData *pathdata,
|
|||
{
|
||||
cap->fill = fill;
|
||||
|
||||
cap->pathdata.Points = heap_alloc_zero(pathdata->Count * sizeof(PointF));
|
||||
cap->pathdata.Types = heap_alloc_zero(pathdata->Count);
|
||||
cap->pathdata.Points = malloc(pathdata->Count * sizeof(PointF));
|
||||
cap->pathdata.Types = malloc(pathdata->Count);
|
||||
|
||||
if ((!cap->pathdata.Types || !cap->pathdata.Points) && pathdata->Count)
|
||||
{
|
||||
heap_free(cap->pathdata.Points);
|
||||
heap_free(cap->pathdata.Types);
|
||||
free(cap->pathdata.Points);
|
||||
free(cap->pathdata.Types);
|
||||
cap->pathdata.Points = NULL;
|
||||
cap->pathdata.Types = NULL;
|
||||
return OutOfMemory;
|
||||
|
@ -119,8 +119,8 @@ GpStatus WINGDIPAPI GdipCreateCustomLineCap(GpPath* fillPath, GpPath* strokePath
|
|||
if(!customCap || !(fillPath || strokePath))
|
||||
return InvalidParameter;
|
||||
|
||||
*customCap = heap_alloc_zero(sizeof(GpCustomLineCap));
|
||||
if(!*customCap) return OutOfMemory;
|
||||
*customCap = calloc(1, sizeof(GpCustomLineCap));
|
||||
if(!*customCap) return OutOfMemory;
|
||||
|
||||
if (strokePath)
|
||||
pathdata = &strokePath->pathdata;
|
||||
|
@ -130,7 +130,7 @@ GpStatus WINGDIPAPI GdipCreateCustomLineCap(GpPath* fillPath, GpPath* strokePath
|
|||
stat = init_custom_linecap(*customCap, pathdata, fillPath != NULL, baseCap, baseInset);
|
||||
if (stat != Ok)
|
||||
{
|
||||
heap_free(*customCap);
|
||||
free(*customCap);
|
||||
return stat;
|
||||
}
|
||||
|
||||
|
@ -146,9 +146,9 @@ GpStatus WINGDIPAPI GdipDeleteCustomLineCap(GpCustomLineCap *customCap)
|
|||
if(!customCap)
|
||||
return InvalidParameter;
|
||||
|
||||
heap_free(customCap->pathdata.Points);
|
||||
heap_free(customCap->pathdata.Types);
|
||||
heap_free(customCap);
|
||||
free(customCap->pathdata.Points);
|
||||
free(customCap->pathdata.Types);
|
||||
free(customCap);
|
||||
|
||||
return Ok;
|
||||
}
|
||||
|
@ -337,7 +337,7 @@ GpStatus WINGDIPAPI GdipCreateAdjustableArrowCap(REAL height, REAL width, BOOL f
|
|||
if (!cap)
|
||||
return InvalidParameter;
|
||||
|
||||
*cap = heap_alloc_zero(sizeof(**cap));
|
||||
*cap = calloc(1, sizeof(**cap));
|
||||
if (!*cap)
|
||||
return OutOfMemory;
|
||||
|
||||
|
@ -348,7 +348,7 @@ GpStatus WINGDIPAPI GdipCreateAdjustableArrowCap(REAL height, REAL width, BOOL f
|
|||
stat = init_custom_linecap(&(*cap)->cap, &pathdata, fill, LineCapTriangle, width != 0.0 ? height / width : 0.0);
|
||||
if (stat != Ok)
|
||||
{
|
||||
heap_free(*cap);
|
||||
free(*cap);
|
||||
return stat;
|
||||
}
|
||||
|
||||
|
|
|
@ -185,7 +185,7 @@ GpStatus WINGDIPAPI GdipCreateFont(GDIPCONST GpFontFamily *fontFamily,
|
|||
|
||||
if (!ret) return NotTrueTypeFont;
|
||||
|
||||
*font = heap_alloc_zero(sizeof(GpFont));
|
||||
*font = calloc(1, sizeof(GpFont));
|
||||
if (!*font) return OutOfMemory;
|
||||
|
||||
(*font)->unit = unit;
|
||||
|
@ -225,7 +225,7 @@ GpStatus WINGDIPAPI GdipCreateFontFromLogfontW(HDC hdc,
|
|||
|
||||
if (!ret) return NotTrueTypeFont;
|
||||
|
||||
*font = heap_alloc_zero(sizeof(GpFont));
|
||||
*font = calloc(1, sizeof(GpFont));
|
||||
if (!*font) return OutOfMemory;
|
||||
|
||||
(*font)->unit = UnitWorld;
|
||||
|
@ -235,7 +235,7 @@ GpStatus WINGDIPAPI GdipCreateFontFromLogfontW(HDC hdc,
|
|||
stat = GdipCreateFontFamilyFromName(facename, NULL, &(*font)->family);
|
||||
if (stat != Ok)
|
||||
{
|
||||
heap_free(*font);
|
||||
free(*font);
|
||||
return NotTrueTypeFont;
|
||||
}
|
||||
|
||||
|
@ -276,7 +276,7 @@ GpStatus WINGDIPAPI GdipDeleteFont(GpFont* font)
|
|||
return InvalidParameter;
|
||||
|
||||
GdipDeleteFontFamily(font->family);
|
||||
heap_free(font);
|
||||
free(font);
|
||||
|
||||
return Ok;
|
||||
}
|
||||
|
@ -506,8 +506,8 @@ GpStatus WINGDIPAPI GdipCloneFont(GpFont *font, GpFont **cloneFont)
|
|||
if(!font || !cloneFont)
|
||||
return InvalidParameter;
|
||||
|
||||
*cloneFont = heap_alloc_zero(sizeof(GpFont));
|
||||
if(!*cloneFont) return OutOfMemory;
|
||||
*cloneFont = calloc(1, sizeof(GpFont));
|
||||
if(!*cloneFont) return OutOfMemory;
|
||||
|
||||
**cloneFont = *font;
|
||||
return Ok;
|
||||
|
@ -824,7 +824,7 @@ GpStatus WINGDIPAPI GdipDeleteFontFamily(GpFontFamily *FontFamily)
|
|||
|
||||
if (!FontFamily->installed && !InterlockedDecrement(&FontFamily->ref))
|
||||
{
|
||||
heap_free(FontFamily);
|
||||
free(FontFamily);
|
||||
}
|
||||
|
||||
return Ok;
|
||||
|
@ -1057,7 +1057,7 @@ GpStatus WINGDIPAPI GdipNewPrivateFontCollection(GpFontCollection** fontCollecti
|
|||
if (!fontCollection)
|
||||
return InvalidParameter;
|
||||
|
||||
*fontCollection = heap_alloc_zero(sizeof(GpFontCollection));
|
||||
*fontCollection = calloc(1, sizeof(GpFontCollection));
|
||||
if (!*fontCollection) return OutOfMemory;
|
||||
|
||||
(*fontCollection)->FontFamilies = NULL;
|
||||
|
@ -1082,8 +1082,8 @@ GpStatus WINGDIPAPI GdipDeletePrivateFontCollection(GpFontCollection **fontColle
|
|||
return InvalidParameter;
|
||||
|
||||
for (i = 0; i < (*fontCollection)->count; i++) GdipDeleteFontFamily((*fontCollection)->FontFamilies[i]);
|
||||
heap_free((*fontCollection)->FontFamilies);
|
||||
heap_free(*fontCollection);
|
||||
free((*fontCollection)->FontFamilies);
|
||||
free(*fontCollection);
|
||||
|
||||
return Ok;
|
||||
}
|
||||
|
@ -1364,7 +1364,7 @@ static WCHAR *copy_name_table_string( const tt_name_record *name, const BYTE *da
|
|||
{
|
||||
case TT_PLATFORM_APPLE_UNICODE:
|
||||
case TT_PLATFORM_MICROSOFT:
|
||||
ret = heap_alloc((name_len / 2 + 1) * sizeof(WCHAR));
|
||||
ret = malloc((name_len / 2 + 1) * sizeof(WCHAR));
|
||||
for (len = 0; len < name_len / 2; len++)
|
||||
ret[len] = (data[len * 2] << 8) | data[len * 2 + 1];
|
||||
ret[len] = 0;
|
||||
|
@ -1374,7 +1374,7 @@ static WCHAR *copy_name_table_string( const tt_name_record *name, const BYTE *da
|
|||
len = MultiByteToWideChar( codepage, 0, (char *)data, name_len, NULL, 0 ) + 1;
|
||||
if (!len)
|
||||
return NULL;
|
||||
ret = heap_alloc(len * sizeof(WCHAR));
|
||||
ret = malloc(len * sizeof(WCHAR));
|
||||
len = MultiByteToWideChar( codepage, 0, (char *)data, name_len, ret, len - 1 );
|
||||
ret[len] = 0;
|
||||
return ret;
|
||||
|
@ -1509,7 +1509,7 @@ GpStatus WINGDIPAPI GdipPrivateAddMemoryFont(GpFontCollection* fontCollection,
|
|||
|
||||
DeleteDC(param.hdc);
|
||||
}
|
||||
heap_free(name);
|
||||
free(name);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1560,8 +1560,8 @@ void free_installed_fonts(void)
|
|||
INT i;
|
||||
|
||||
for (i = 0; i < installedFontCollection.count; i++)
|
||||
heap_free(installedFontCollection.FontFamilies[i]);
|
||||
heap_free(installedFontCollection.FontFamilies);
|
||||
free(installedFontCollection.FontFamilies[i]);
|
||||
free(installedFontCollection.FontFamilies);
|
||||
|
||||
installedFontCollection.FontFamilies = NULL;
|
||||
installedFontCollection.allocated = 0;
|
||||
|
@ -1592,7 +1592,7 @@ static INT CALLBACK add_font_proc(const LOGFONTW *lfw, const TEXTMETRICW *ntm,
|
|||
if (fonts->allocated == fonts->count)
|
||||
{
|
||||
INT new_alloc_count = fonts->allocated+50;
|
||||
GpFontFamily** new_family_list = heap_alloc(new_alloc_count*sizeof(void*));
|
||||
GpFontFamily** new_family_list = malloc(new_alloc_count * sizeof(void*));
|
||||
|
||||
if (!new_family_list)
|
||||
{
|
||||
|
@ -1601,12 +1601,12 @@ static INT CALLBACK add_font_proc(const LOGFONTW *lfw, const TEXTMETRICW *ntm,
|
|||
}
|
||||
|
||||
memcpy(new_family_list, fonts->FontFamilies, fonts->count*sizeof(void*));
|
||||
heap_free(fonts->FontFamilies);
|
||||
free(fonts->FontFamilies);
|
||||
fonts->FontFamilies = new_family_list;
|
||||
fonts->allocated = new_alloc_count;
|
||||
}
|
||||
|
||||
family = heap_alloc(sizeof(*family));
|
||||
family = malloc(sizeof(*family));
|
||||
if (!family)
|
||||
{
|
||||
if (param->is_system)
|
||||
|
@ -1621,7 +1621,7 @@ static INT CALLBACK add_font_proc(const LOGFONTW *lfw, const TEXTMETRICW *ntm,
|
|||
{
|
||||
if (wcsicmp(lfw->lfFaceName, fonts->FontFamilies[i]->FamilyName) == 0)
|
||||
{
|
||||
heap_free(family);
|
||||
free(family);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -1634,7 +1634,7 @@ static INT CALLBACK add_font_proc(const LOGFONTW *lfw, const TEXTMETRICW *ntm,
|
|||
SelectObject(param->hdc, old_hfont);
|
||||
DeleteObject(hfont);
|
||||
|
||||
heap_free(family);
|
||||
free(family);
|
||||
param->stat = OutOfMemory;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -143,7 +143,7 @@ ULONG WINAPI GdiplusShutdown_wrapper(ULONG_PTR token)
|
|||
*/
|
||||
void* WINGDIPAPI GdipAlloc(SIZE_T size)
|
||||
{
|
||||
return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
|
||||
return calloc(1, size);
|
||||
}
|
||||
|
||||
/*****************************************************
|
||||
|
@ -151,7 +151,7 @@ void* WINGDIPAPI GdipAlloc(SIZE_T size)
|
|||
*/
|
||||
void WINGDIPAPI GdipFree(void* ptr)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, ptr);
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
/* Calculates the bezier points needed to fill in the arc portion starting at
|
||||
|
@ -418,12 +418,12 @@ BOOL lengthen_path(GpPath *path, INT len)
|
|||
if(path->datalen == 0){
|
||||
path->datalen = len * 2;
|
||||
|
||||
path->pathdata.Points = heap_alloc_zero(path->datalen * sizeof(PointF));
|
||||
if(!path->pathdata.Points) return FALSE;
|
||||
path->pathdata.Points = calloc(path->datalen, sizeof(PointF));
|
||||
if(!path->pathdata.Points) return FALSE;
|
||||
|
||||
path->pathdata.Types = heap_alloc_zero(path->datalen);
|
||||
path->pathdata.Types = calloc(1, path->datalen);
|
||||
if(!path->pathdata.Types){
|
||||
heap_free(path->pathdata.Points);
|
||||
free(path->pathdata.Points);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -432,11 +432,11 @@ BOOL lengthen_path(GpPath *path, INT len)
|
|||
while(path->datalen - path->pathdata.Count < len)
|
||||
path->datalen *= 2;
|
||||
|
||||
path->pathdata.Points = heap_realloc(path->pathdata.Points, path->datalen * sizeof(PointF));
|
||||
if(!path->pathdata.Points) return FALSE;
|
||||
path->pathdata.Points = realloc(path->pathdata.Points, path->datalen * sizeof(PointF));
|
||||
if(!path->pathdata.Points) return FALSE;
|
||||
|
||||
path->pathdata.Types = heap_realloc(path->pathdata.Types, path->datalen);
|
||||
if(!path->pathdata.Types) return FALSE;
|
||||
path->pathdata.Types = realloc(path->pathdata.Types, path->datalen);
|
||||
if(!path->pathdata.Types) return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -477,8 +477,8 @@ void delete_element(region_element* element)
|
|||
default:
|
||||
delete_element(element->elementdata.combine.left);
|
||||
delete_element(element->elementdata.combine.right);
|
||||
heap_free(element->elementdata.combine.left);
|
||||
heap_free(element->elementdata.combine.right);
|
||||
free(element->elementdata.combine.left);
|
||||
free(element->elementdata.combine.right);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include "objbase.h"
|
||||
#include "ocidl.h"
|
||||
#include "wincodecsdk.h"
|
||||
#include "wine/heap.h"
|
||||
#include "wine/list.h"
|
||||
|
||||
#include "gdiplus.h"
|
||||
|
|
|
@ -531,7 +531,7 @@ static GpStatus alpha_blend_pixels_hrgn(GpGraphics *graphics, INT dst_x, INT dst
|
|||
|
||||
size = GetRegionData(hrgn, 0, NULL);
|
||||
|
||||
rgndata = heap_alloc_zero(size);
|
||||
rgndata = malloc(size);
|
||||
if (!rgndata)
|
||||
{
|
||||
DeleteObject(hrgn);
|
||||
|
@ -550,7 +550,7 @@ static GpStatus alpha_blend_pixels_hrgn(GpGraphics *graphics, INT dst_x, INT dst
|
|||
src_stride, fmt);
|
||||
}
|
||||
|
||||
heap_free(rgndata);
|
||||
free(rgndata);
|
||||
|
||||
DeleteObject(hrgn);
|
||||
|
||||
|
@ -1331,7 +1331,7 @@ static GpStatus brush_fill_pixels(GpGraphics *graphics, GpBrush *brush,
|
|||
{
|
||||
BitmapData lockeddata;
|
||||
|
||||
fill->bitmap_bits = heap_alloc_zero(sizeof(ARGB) * bitmap->width * bitmap->height);
|
||||
fill->bitmap_bits = calloc(bitmap->width * bitmap->height, sizeof(ARGB));
|
||||
if (!fill->bitmap_bits)
|
||||
stat = OutOfMemory;
|
||||
|
||||
|
@ -1357,7 +1357,7 @@ static GpStatus brush_fill_pixels(GpGraphics *graphics, GpBrush *brush,
|
|||
|
||||
if (stat != Ok)
|
||||
{
|
||||
heap_free(fill->bitmap_bits);
|
||||
free(fill->bitmap_bits);
|
||||
fill->bitmap_bits = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -1784,9 +1784,9 @@ static void draw_cap(GpGraphics *graphics, COLORREF color, GpLineCap cap, REAL s
|
|||
}
|
||||
|
||||
count = custom->pathdata.Count;
|
||||
custptf = heap_alloc_zero(count * sizeof(PointF));
|
||||
custpt = heap_alloc_zero(count * sizeof(POINT));
|
||||
tp = heap_alloc_zero(count);
|
||||
custptf = malloc(count * sizeof(PointF));
|
||||
custpt = malloc(count * sizeof(POINT));
|
||||
tp = malloc(count);
|
||||
|
||||
if(!custptf || !custpt || !tp)
|
||||
goto custend;
|
||||
|
@ -1817,9 +1817,9 @@ static void draw_cap(GpGraphics *graphics, COLORREF color, GpLineCap cap, REAL s
|
|||
PolyDraw(graphics->hdc, custpt, tp, count);
|
||||
|
||||
custend:
|
||||
heap_free(custptf);
|
||||
heap_free(custpt);
|
||||
heap_free(tp);
|
||||
free(custptf);
|
||||
free(custpt);
|
||||
free(tp);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -1921,9 +1921,9 @@ static void shorten_bezier_amt(GpPointF * pt, REAL amt, BOOL rev)
|
|||
static GpStatus draw_poly(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF * pt,
|
||||
GDIPCONST BYTE * types, INT count, BOOL caps)
|
||||
{
|
||||
POINT *pti = heap_alloc_zero(count * sizeof(POINT));
|
||||
BYTE *tp = heap_alloc_zero(count);
|
||||
GpPointF *ptcopy = heap_alloc_zero(count * sizeof(GpPointF));
|
||||
POINT *pti = malloc(count * sizeof(POINT));
|
||||
BYTE *tp = malloc(count);
|
||||
GpPointF *ptcopy = malloc(count * sizeof(GpPointF));
|
||||
INT i, j;
|
||||
GpStatus status = GenericError;
|
||||
|
||||
|
@ -2038,9 +2038,9 @@ static GpStatus draw_poly(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *
|
|||
status = Ok;
|
||||
|
||||
end:
|
||||
heap_free(pti);
|
||||
heap_free(ptcopy);
|
||||
heap_free(tp);
|
||||
free(pti);
|
||||
free(ptcopy);
|
||||
free(tp);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
@ -2084,7 +2084,7 @@ static GpStatus init_container(GraphicsContainerItem** container,
|
|||
GDIPCONST GpGraphics* graphics, GraphicsContainerType type){
|
||||
GpStatus sts;
|
||||
|
||||
*container = heap_alloc_zero(sizeof(GraphicsContainerItem));
|
||||
*container = calloc(1, sizeof(GraphicsContainerItem));
|
||||
if(!(*container))
|
||||
return OutOfMemory;
|
||||
|
||||
|
@ -2106,7 +2106,7 @@ static GpStatus init_container(GraphicsContainerItem** container,
|
|||
|
||||
sts = GdipCloneRegion(graphics->clip, &(*container)->clip);
|
||||
if(sts != Ok){
|
||||
heap_free(*container);
|
||||
free(*container);
|
||||
*container = NULL;
|
||||
return sts;
|
||||
}
|
||||
|
@ -2117,7 +2117,7 @@ static GpStatus init_container(GraphicsContainerItem** container,
|
|||
static void delete_container(GraphicsContainerItem* container)
|
||||
{
|
||||
GdipDeleteRegion(container->clip);
|
||||
heap_free(container);
|
||||
free(container);
|
||||
}
|
||||
|
||||
static GpStatus restore_container(GpGraphics* graphics,
|
||||
|
@ -2382,13 +2382,13 @@ GpStatus WINGDIPAPI GdipCreateFromHDC2(HDC hdc, HANDLE hDevice, GpGraphics **gra
|
|||
if(graphics == NULL)
|
||||
return InvalidParameter;
|
||||
|
||||
*graphics = heap_alloc_zero(sizeof(GpGraphics));
|
||||
*graphics = calloc(1, sizeof(GpGraphics));
|
||||
if(!*graphics) return OutOfMemory;
|
||||
|
||||
GdipSetMatrixElements(&(*graphics)->worldtrans, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
|
||||
|
||||
if((retval = GdipCreateRegion(&(*graphics)->clip)) != Ok){
|
||||
heap_free(*graphics);
|
||||
free(*graphics);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
@ -2434,14 +2434,14 @@ GpStatus graphics_from_image(GpImage *image, GpGraphics **graphics)
|
|||
{
|
||||
GpStatus retval;
|
||||
|
||||
*graphics = heap_alloc_zero(sizeof(GpGraphics));
|
||||
*graphics = calloc(1, sizeof(GpGraphics));
|
||||
if(!*graphics) return OutOfMemory;
|
||||
|
||||
GdipSetMatrixElements(&(*graphics)->worldtrans, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
|
||||
GdipSetMatrixElements(&(*graphics)->gdi_transform, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
|
||||
|
||||
if((retval = GdipCreateRegion(&(*graphics)->clip)) != Ok){
|
||||
heap_free(*graphics);
|
||||
free(*graphics);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
@ -2562,7 +2562,7 @@ GpStatus WINGDIPAPI GdipDeleteGraphics(GpGraphics *graphics)
|
|||
* accessing freed memory. */
|
||||
graphics->busy = TRUE;
|
||||
|
||||
heap_free(graphics);
|
||||
free(graphics);
|
||||
|
||||
return Ok;
|
||||
}
|
||||
|
@ -2683,7 +2683,7 @@ GpStatus WINGDIPAPI GdipDrawBeziersI(GpGraphics *graphics, GpPen *pen,
|
|||
if(graphics->busy)
|
||||
return ObjectBusy;
|
||||
|
||||
pts = heap_alloc_zero(sizeof(GpPointF) * count);
|
||||
pts = malloc(sizeof(GpPointF) * count);
|
||||
if(!pts)
|
||||
return OutOfMemory;
|
||||
|
||||
|
@ -2694,7 +2694,7 @@ GpStatus WINGDIPAPI GdipDrawBeziersI(GpGraphics *graphics, GpPen *pen,
|
|||
|
||||
ret = GdipDrawBeziers(graphics,pen,pts,count);
|
||||
|
||||
heap_free(pts);
|
||||
free(pts);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -2753,7 +2753,7 @@ GpStatus WINGDIPAPI GdipDrawClosedCurve2I(GpGraphics *graphics, GpPen *pen,
|
|||
if(!points || count <= 0)
|
||||
return InvalidParameter;
|
||||
|
||||
ptf = heap_alloc_zero(sizeof(GpPointF)*count);
|
||||
ptf = malloc(sizeof(GpPointF) * count);
|
||||
if(!ptf)
|
||||
return OutOfMemory;
|
||||
|
||||
|
@ -2764,7 +2764,7 @@ GpStatus WINGDIPAPI GdipDrawClosedCurve2I(GpGraphics *graphics, GpPen *pen,
|
|||
|
||||
stat = GdipDrawClosedCurve2(graphics, pen, ptf, count, tension);
|
||||
|
||||
heap_free(ptf);
|
||||
free(ptf);
|
||||
|
||||
return stat;
|
||||
}
|
||||
|
@ -2789,7 +2789,7 @@ GpStatus WINGDIPAPI GdipDrawCurveI(GpGraphics *graphics, GpPen *pen,
|
|||
if(!points)
|
||||
return InvalidParameter;
|
||||
|
||||
pointsF = heap_alloc_zero(sizeof(GpPointF)*count);
|
||||
pointsF = malloc(sizeof(GpPointF) * count);
|
||||
if(!pointsF)
|
||||
return OutOfMemory;
|
||||
|
||||
|
@ -2799,7 +2799,7 @@ GpStatus WINGDIPAPI GdipDrawCurveI(GpGraphics *graphics, GpPen *pen,
|
|||
}
|
||||
|
||||
ret = GdipDrawCurve(graphics,pen,pointsF,count);
|
||||
heap_free(pointsF);
|
||||
free(pointsF);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -2845,7 +2845,7 @@ GpStatus WINGDIPAPI GdipDrawCurve2I(GpGraphics *graphics, GpPen *pen,
|
|||
if(!points)
|
||||
return InvalidParameter;
|
||||
|
||||
pointsF = heap_alloc_zero(sizeof(GpPointF)*count);
|
||||
pointsF = malloc(sizeof(GpPointF) * count);
|
||||
if(!pointsF)
|
||||
return OutOfMemory;
|
||||
|
||||
|
@ -2855,7 +2855,7 @@ GpStatus WINGDIPAPI GdipDrawCurve2I(GpGraphics *graphics, GpPen *pen,
|
|||
}
|
||||
|
||||
ret = GdipDrawCurve2(graphics,pen,pointsF,count,tension);
|
||||
heap_free(pointsF);
|
||||
free(pointsF);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -3187,7 +3187,7 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image
|
|||
|
||||
TRACE("src_area: %d x %d\n", src_area.Width, src_area.Height);
|
||||
|
||||
src_data = heap_alloc_zero(sizeof(ARGB) * src_area.Width * src_area.Height);
|
||||
src_data = calloc(src_area.Width * src_area.Height, sizeof(ARGB));
|
||||
if (!src_data)
|
||||
return OutOfMemory;
|
||||
src_stride = sizeof(ARGB) * src_area.Width;
|
||||
|
@ -3210,7 +3210,7 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image
|
|||
|
||||
if (stat != Ok)
|
||||
{
|
||||
heap_free(src_data);
|
||||
free(src_data);
|
||||
return stat;
|
||||
}
|
||||
|
||||
|
@ -3245,10 +3245,10 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image
|
|||
y_dy = dst_to_src.matrix[3];
|
||||
|
||||
/* Transform the bits as needed to the destination. */
|
||||
dst_data = dst_dyn_data = heap_alloc_zero(sizeof(ARGB) * (dst_area.right - dst_area.left) * (dst_area.bottom - dst_area.top));
|
||||
dst_data = dst_dyn_data = calloc((dst_area.right - dst_area.left) * (dst_area.bottom - dst_area.top), sizeof(ARGB));
|
||||
if (!dst_data)
|
||||
{
|
||||
heap_free(src_data);
|
||||
free(src_data);
|
||||
return OutOfMemory;
|
||||
}
|
||||
dst_color = (ARGB*)(dst_data);
|
||||
|
@ -3288,9 +3288,9 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image
|
|||
|
||||
gdi_transform_release(graphics);
|
||||
|
||||
heap_free(src_data);
|
||||
free(src_data);
|
||||
|
||||
heap_free(dst_dyn_data);
|
||||
free(dst_dyn_data);
|
||||
|
||||
return stat;
|
||||
}
|
||||
|
@ -3580,7 +3580,7 @@ GpStatus WINGDIPAPI GdipDrawLinesI(GpGraphics *graphics, GpPen *pen, GDIPCONST
|
|||
|
||||
TRACE("(%p, %p, %p, %d)\n", graphics, pen, points, count);
|
||||
|
||||
ptf = heap_alloc_zero(count * sizeof(GpPointF));
|
||||
ptf = malloc(count * sizeof(GpPointF));
|
||||
if(!ptf) return OutOfMemory;
|
||||
|
||||
for(i = 0; i < count; i ++){
|
||||
|
@ -3590,7 +3590,7 @@ GpStatus WINGDIPAPI GdipDrawLinesI(GpGraphics *graphics, GpPen *pen, GDIPCONST
|
|||
|
||||
retval = GdipDrawLines(graphics, pen, ptf, count);
|
||||
|
||||
heap_free(ptf);
|
||||
free(ptf);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
@ -3701,7 +3701,7 @@ static GpStatus SOFTWARE_GdipDrawThinPath(GpGraphics *graphics, GpPen *pen, GpPa
|
|||
gp_output_area.Width = output_width;
|
||||
gp_output_area.Height = output_height;
|
||||
|
||||
output_bits = heap_alloc_zero(output_width * output_height * sizeof(DWORD));
|
||||
output_bits = calloc(output_width * output_height, sizeof(DWORD));
|
||||
if (!output_bits)
|
||||
stat = OutOfMemory;
|
||||
}
|
||||
|
@ -3711,7 +3711,7 @@ static GpStatus SOFTWARE_GdipDrawThinPath(GpGraphics *graphics, GpPen *pen, GpPa
|
|||
if (pen->brush->bt != BrushTypeSolidColor)
|
||||
{
|
||||
/* allocate and draw brush output */
|
||||
brush_bits = heap_alloc_zero(output_width * output_height * sizeof(DWORD));
|
||||
brush_bits = calloc(output_width * output_height, sizeof(DWORD));
|
||||
|
||||
if (brush_bits)
|
||||
{
|
||||
|
@ -3736,7 +3736,7 @@ static GpStatus SOFTWARE_GdipDrawThinPath(GpGraphics *graphics, GpPen *pen, GpPa
|
|||
|
||||
if (dash_pattern_size != 0)
|
||||
{
|
||||
dash_pattern = dyn_dash_pattern = heap_alloc(dash_pattern_size);
|
||||
dash_pattern = dyn_dash_pattern = malloc(dash_pattern_size);
|
||||
|
||||
if (dyn_dash_pattern)
|
||||
{
|
||||
|
@ -3918,9 +3918,9 @@ static GpStatus SOFTWARE_GdipDrawThinPath(GpGraphics *graphics, GpPen *pen, GpPa
|
|||
gdi_transform_release(graphics);
|
||||
}
|
||||
|
||||
heap_free(brush_bits);
|
||||
heap_free(dyn_dash_pattern);
|
||||
heap_free(output_bits);
|
||||
free(brush_bits);
|
||||
free(dyn_dash_pattern);
|
||||
free(output_bits);
|
||||
}
|
||||
|
||||
GdipDeletePath(flat_path);
|
||||
|
@ -4134,7 +4134,7 @@ GpStatus WINGDIPAPI GdipDrawRectanglesI(GpGraphics *graphics, GpPen *pen,
|
|||
if(!rects || count<=0)
|
||||
return InvalidParameter;
|
||||
|
||||
rectsF = heap_alloc_zero(sizeof(GpRectF) * count);
|
||||
rectsF = malloc(sizeof(GpRectF) * count);
|
||||
if(!rectsF)
|
||||
return OutOfMemory;
|
||||
|
||||
|
@ -4142,7 +4142,7 @@ GpStatus WINGDIPAPI GdipDrawRectanglesI(GpGraphics *graphics, GpPen *pen,
|
|||
set_rect(&rectsF[i], rects[i].X, rects[i].Y, rects[i].Width, rects[i].Height);
|
||||
|
||||
ret = GdipDrawRectangles(graphics, pen, rectsF, count);
|
||||
heap_free(rectsF);
|
||||
free(rectsF);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -4192,7 +4192,7 @@ GpStatus WINGDIPAPI GdipFillClosedCurve2I(GpGraphics *graphics, GpBrush *brush,
|
|||
if(count == 1) /* Do nothing */
|
||||
return Ok;
|
||||
|
||||
ptf = heap_alloc_zero(sizeof(GpPointF)*count);
|
||||
ptf = malloc(sizeof(GpPointF) * count);
|
||||
if(!ptf)
|
||||
return OutOfMemory;
|
||||
|
||||
|
@ -4203,7 +4203,7 @@ GpStatus WINGDIPAPI GdipFillClosedCurve2I(GpGraphics *graphics, GpBrush *brush,
|
|||
|
||||
stat = GdipFillClosedCurve2(graphics, brush, ptf, count, tension, fill);
|
||||
|
||||
heap_free(ptf);
|
||||
free(ptf);
|
||||
|
||||
return stat;
|
||||
}
|
||||
|
@ -4548,7 +4548,7 @@ GpStatus WINGDIPAPI GdipFillRectanglesI(GpGraphics *graphics, GpBrush *brush, GD
|
|||
if(!rects || count <= 0)
|
||||
return InvalidParameter;
|
||||
|
||||
rectsF = heap_alloc_zero(sizeof(GpRectF)*count);
|
||||
rectsF = malloc(sizeof(GpRectF) * count);
|
||||
if(!rectsF)
|
||||
return OutOfMemory;
|
||||
|
||||
|
@ -4556,7 +4556,7 @@ GpStatus WINGDIPAPI GdipFillRectanglesI(GpGraphics *graphics, GpBrush *brush, GD
|
|||
set_rect(&rectsF[i], rects[i].X, rects[i].Y, rects[i].Width, rects[i].Height);
|
||||
|
||||
ret = GdipFillRectangles(graphics,brush,rectsF,count);
|
||||
heap_free(rectsF);
|
||||
free(rectsF);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -4665,7 +4665,7 @@ static GpStatus SOFTWARE_GdipFillRegion(GpGraphics *graphics, GpBrush *brush,
|
|||
gp_bound_rect.Width = bound_rect.right - bound_rect.left;
|
||||
gp_bound_rect.Height = bound_rect.bottom - bound_rect.top;
|
||||
|
||||
pixel_data = heap_alloc_zero(sizeof(*pixel_data) * gp_bound_rect.Width * gp_bound_rect.Height);
|
||||
pixel_data = calloc(gp_bound_rect.Width * gp_bound_rect.Height, sizeof(*pixel_data));
|
||||
if (!pixel_data)
|
||||
stat = OutOfMemory;
|
||||
|
||||
|
@ -4680,7 +4680,7 @@ static GpStatus SOFTWARE_GdipFillRegion(GpGraphics *graphics, GpBrush *brush,
|
|||
gp_bound_rect.Height, gp_bound_rect.Width * 4, hregion,
|
||||
PixelFormat32bppARGB);
|
||||
|
||||
heap_free(pixel_data);
|
||||
free(pixel_data);
|
||||
}
|
||||
|
||||
DeleteObject(hregion);
|
||||
|
@ -5181,7 +5181,7 @@ GpStatus gdip_format_string(HDC hdc,
|
|||
|
||||
if(length == -1) length = lstrlenW(string);
|
||||
|
||||
stringdup = heap_alloc_zero((length + 1) * sizeof(WCHAR));
|
||||
stringdup = calloc(length + 1, sizeof(WCHAR));
|
||||
if(!stringdup) return OutOfMemory;
|
||||
|
||||
if (!format)
|
||||
|
@ -5208,10 +5208,10 @@ GpStatus gdip_format_string(HDC hdc,
|
|||
|
||||
if (hotkeyprefix_count)
|
||||
{
|
||||
hotkeyprefix_offsets = heap_alloc_zero(sizeof(INT) * hotkeyprefix_count);
|
||||
hotkeyprefix_offsets = calloc(hotkeyprefix_count, sizeof(INT));
|
||||
if (!hotkeyprefix_offsets)
|
||||
{
|
||||
heap_free(stringdup);
|
||||
free(stringdup);
|
||||
return OutOfMemory;
|
||||
}
|
||||
}
|
||||
|
@ -5358,8 +5358,8 @@ GpStatus gdip_format_string(HDC hdc,
|
|||
break;
|
||||
}
|
||||
|
||||
heap_free(stringdup);
|
||||
heap_free(hotkeyprefix_offsets);
|
||||
free(stringdup);
|
||||
free(hotkeyprefix_offsets);
|
||||
|
||||
return stat;
|
||||
}
|
||||
|
@ -6604,8 +6604,8 @@ GpStatus WINGDIPAPI GdipDrawPolygonI(GpGraphics *graphics,GpPen *pen,GDIPCONST G
|
|||
|
||||
TRACE("(%p, %p, %p, %d)\n", graphics, pen, points, count);
|
||||
|
||||
if(count<=0) return InvalidParameter;
|
||||
ptf = heap_alloc_zero(sizeof(GpPointF) * count);
|
||||
if(count <= 0) return InvalidParameter;
|
||||
ptf = malloc(sizeof(GpPointF) * count);
|
||||
if (!ptf) return OutOfMemory;
|
||||
|
||||
for(i = 0;i < count; i++){
|
||||
|
@ -6614,7 +6614,7 @@ GpStatus WINGDIPAPI GdipDrawPolygonI(GpGraphics *graphics,GpPen *pen,GDIPCONST G
|
|||
}
|
||||
|
||||
ret = GdipDrawPolygon(graphics,pen,ptf,count);
|
||||
heap_free(ptf);
|
||||
free(ptf);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -6842,7 +6842,7 @@ GpStatus WINGDIPAPI GdipGetClip(GpGraphics *graphics, GpRegion *region)
|
|||
/* free everything except root node and header */
|
||||
delete_element(®ion->node);
|
||||
memcpy(region, clip, sizeof(GpRegion));
|
||||
heap_free(clip);
|
||||
free(clip);
|
||||
|
||||
return Ok;
|
||||
}
|
||||
|
@ -6997,7 +6997,7 @@ GpStatus WINGDIPAPI GdipTransformPointsI(GpGraphics *graphics, GpCoordinateSpace
|
|||
if(count <= 0)
|
||||
return InvalidParameter;
|
||||
|
||||
pointsF = heap_alloc_zero(sizeof(GpPointF) * count);
|
||||
pointsF = malloc(sizeof(GpPointF) * count);
|
||||
if(!pointsF)
|
||||
return OutOfMemory;
|
||||
|
||||
|
@ -7013,7 +7013,7 @@ GpStatus WINGDIPAPI GdipTransformPointsI(GpGraphics *graphics, GpCoordinateSpace
|
|||
points[i].X = gdip_round(pointsF[i].X);
|
||||
points[i].Y = gdip_round(pointsF[i].Y);
|
||||
}
|
||||
heap_free(pointsF);
|
||||
free(pointsF);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -7121,7 +7121,7 @@ GpStatus WINGDIPAPI GdipMeasureDriverString(GpGraphics *graphics, GDIPCONST UINT
|
|||
|
||||
if (flags & DriverStringOptionsCmapLookup)
|
||||
{
|
||||
glyph_indices = dynamic_glyph_indices = heap_alloc_zero(sizeof(WORD) * length);
|
||||
glyph_indices = dynamic_glyph_indices = malloc(sizeof(WORD) * length);
|
||||
if (!glyph_indices)
|
||||
{
|
||||
DeleteDC(hdc);
|
||||
|
@ -7163,7 +7163,7 @@ GpStatus WINGDIPAPI GdipMeasureDriverString(GpGraphics *graphics, GDIPCONST UINT
|
|||
if (max_x < x) max_x = x;
|
||||
}
|
||||
|
||||
heap_free(dynamic_glyph_indices);
|
||||
free(dynamic_glyph_indices);
|
||||
DeleteDC(hdc);
|
||||
DeleteObject(hfont);
|
||||
|
||||
|
@ -7194,12 +7194,12 @@ static GpStatus GDI32_GdipDrawDriverString(GpGraphics *graphics, GDIPCONST UINT1
|
|||
|
||||
if (!(flags & DriverStringOptionsRealizedAdvance) && length > 1)
|
||||
{
|
||||
real_positions = heap_alloc(sizeof(*real_positions) * length);
|
||||
eto_positions = heap_alloc(sizeof(*eto_positions) * 2 * (length - 1));
|
||||
real_positions = malloc(sizeof(*real_positions) * length);
|
||||
eto_positions = malloc(sizeof(*eto_positions) * 2 * (length - 1));
|
||||
if (!real_positions || !eto_positions)
|
||||
{
|
||||
heap_free(real_positions);
|
||||
heap_free(eto_positions);
|
||||
free(real_positions);
|
||||
free(eto_positions);
|
||||
return OutOfMemory;
|
||||
}
|
||||
}
|
||||
|
@ -7257,8 +7257,8 @@ static GpStatus GDI32_GdipDrawDriverString(GpGraphics *graphics, GDIPCONST UINT1
|
|||
|
||||
DeleteObject(hfont);
|
||||
|
||||
heap_free(real_positions);
|
||||
heap_free(eto_positions);
|
||||
free(real_positions);
|
||||
free(eto_positions);
|
||||
|
||||
return Ok;
|
||||
}
|
||||
|
@ -7295,7 +7295,7 @@ static GpStatus SOFTWARE_GdipDrawDriverString(GpGraphics *graphics, GDIPCONST UI
|
|||
if (flags & unsupported_flags)
|
||||
FIXME("Ignoring flags %x\n", flags & unsupported_flags);
|
||||
|
||||
pti = heap_alloc_zero(sizeof(POINT) * length);
|
||||
pti = malloc(sizeof(POINT) * length);
|
||||
if (!pti)
|
||||
return OutOfMemory;
|
||||
|
||||
|
@ -7308,10 +7308,10 @@ static GpStatus SOFTWARE_GdipDrawDriverString(GpGraphics *graphics, GDIPCONST UI
|
|||
}
|
||||
else
|
||||
{
|
||||
real_positions = heap_alloc_zero(sizeof(PointF) * length);
|
||||
real_positions = malloc(sizeof(PointF) * length);
|
||||
if (!real_positions)
|
||||
{
|
||||
heap_free(pti);
|
||||
free(pti);
|
||||
return OutOfMemory;
|
||||
}
|
||||
|
||||
|
@ -7320,7 +7320,7 @@ static GpStatus SOFTWARE_GdipDrawDriverString(GpGraphics *graphics, GDIPCONST UI
|
|||
gdip_transform_points(graphics, WineCoordinateSpaceGdiDevice, CoordinateSpaceWorld, real_positions, length);
|
||||
round_points(pti, real_positions, length);
|
||||
|
||||
heap_free(real_positions);
|
||||
free(real_positions);
|
||||
}
|
||||
|
||||
get_font_hfont(graphics, font, format, &hfont, NULL, matrix);
|
||||
|
@ -7340,7 +7340,7 @@ static GpStatus SOFTWARE_GdipDrawDriverString(GpGraphics *graphics, GDIPCONST UI
|
|||
if (glyphsize == GDI_ERROR)
|
||||
{
|
||||
ERR("GetGlyphOutlineW failed\n");
|
||||
heap_free(pti);
|
||||
free(pti);
|
||||
DeleteDC(hdc);
|
||||
DeleteObject(hfont);
|
||||
return GenericError;
|
||||
|
@ -7372,21 +7372,21 @@ static GpStatus SOFTWARE_GdipDrawDriverString(GpGraphics *graphics, GDIPCONST UI
|
|||
if (max_glyphsize == 0)
|
||||
{
|
||||
/* Nothing to draw. */
|
||||
heap_free(pti);
|
||||
free(pti);
|
||||
DeleteDC(hdc);
|
||||
DeleteObject(hfont);
|
||||
return Ok;
|
||||
}
|
||||
|
||||
glyph_mask = heap_alloc_zero(max_glyphsize);
|
||||
text_mask = heap_alloc_zero((max_x - min_x) * (max_y - min_y));
|
||||
glyph_mask = calloc(1, max_glyphsize);
|
||||
text_mask = calloc(1, (max_x - min_x) * (max_y - min_y));
|
||||
text_mask_stride = max_x - min_x;
|
||||
|
||||
if (!(glyph_mask && text_mask))
|
||||
{
|
||||
heap_free(glyph_mask);
|
||||
heap_free(text_mask);
|
||||
heap_free(pti);
|
||||
free(glyph_mask);
|
||||
free(text_mask);
|
||||
free(pti);
|
||||
DeleteDC(hdc);
|
||||
DeleteObject(hfont);
|
||||
return OutOfMemory;
|
||||
|
@ -7421,16 +7421,16 @@ static GpStatus SOFTWARE_GdipDrawDriverString(GpGraphics *graphics, GDIPCONST UI
|
|||
}
|
||||
}
|
||||
|
||||
heap_free(pti);
|
||||
free(pti);
|
||||
DeleteDC(hdc);
|
||||
DeleteObject(hfont);
|
||||
heap_free(glyph_mask);
|
||||
free(glyph_mask);
|
||||
|
||||
/* get the brush data */
|
||||
pixel_data = heap_alloc_zero(4 * (max_x - min_x) * (max_y - min_y));
|
||||
pixel_data = calloc((max_x - min_x) * (max_y - min_y), 4);
|
||||
if (!pixel_data)
|
||||
{
|
||||
heap_free(text_mask);
|
||||
free(text_mask);
|
||||
return OutOfMemory;
|
||||
}
|
||||
|
||||
|
@ -7443,8 +7443,8 @@ static GpStatus SOFTWARE_GdipDrawDriverString(GpGraphics *graphics, GDIPCONST UI
|
|||
stat = brush_fill_pixels(graphics, (GpBrush*)brush, (DWORD*)pixel_data, &pixel_area, pixel_area.Width);
|
||||
if (stat != Ok)
|
||||
{
|
||||
heap_free(text_mask);
|
||||
heap_free(pixel_data);
|
||||
free(text_mask);
|
||||
free(pixel_data);
|
||||
return stat;
|
||||
}
|
||||
|
||||
|
@ -7461,7 +7461,7 @@ static GpStatus SOFTWARE_GdipDrawDriverString(GpGraphics *graphics, GDIPCONST UI
|
|||
}
|
||||
}
|
||||
|
||||
heap_free(text_mask);
|
||||
free(text_mask);
|
||||
|
||||
gdi_transform_acquire(graphics);
|
||||
|
||||
|
@ -7471,7 +7471,7 @@ static GpStatus SOFTWARE_GdipDrawDriverString(GpGraphics *graphics, GDIPCONST UI
|
|||
|
||||
gdi_transform_release(graphics);
|
||||
|
||||
heap_free(pixel_data);
|
||||
free(pixel_data);
|
||||
|
||||
return stat;
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ struct path_list_node_t {
|
|||
/* init list */
|
||||
static BOOL init_path_list(path_list_node_t **node, REAL x, REAL y)
|
||||
{
|
||||
*node = heap_alloc_zero(sizeof(path_list_node_t));
|
||||
*node = calloc(1, sizeof(path_list_node_t));
|
||||
if(!*node)
|
||||
return FALSE;
|
||||
|
||||
|
@ -64,7 +64,7 @@ static void free_path_list(path_list_node_t *node)
|
|||
|
||||
while(n){
|
||||
n = n->next;
|
||||
heap_free(node);
|
||||
free(node);
|
||||
node = n;
|
||||
}
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ static path_list_node_t* add_path_list_node(path_list_node_t *node, REAL x, REAL
|
|||
{
|
||||
path_list_node_t *new;
|
||||
|
||||
new = heap_alloc_zero(sizeof(path_list_node_t));
|
||||
new = calloc(1, sizeof(path_list_node_t));
|
||||
if(!new)
|
||||
return NULL;
|
||||
|
||||
|
@ -319,7 +319,7 @@ GpStatus WINGDIPAPI GdipAddPathArc(GpPath *path, REAL x, REAL y, REAL width,
|
|||
if(count == 0)
|
||||
return Ok;
|
||||
|
||||
points = heap_alloc_zero(sizeof(GpPointF)*count);
|
||||
points = malloc(sizeof(GpPointF) * count);
|
||||
if(!points)
|
||||
return OutOfMemory;
|
||||
|
||||
|
@ -327,7 +327,7 @@ GpStatus WINGDIPAPI GdipAddPathArc(GpPath *path, REAL x, REAL y, REAL width,
|
|||
|
||||
status = extend_current_figure(path, points, count, PathPointTypeBezier);
|
||||
|
||||
heap_free(points);
|
||||
free(points);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@ -401,7 +401,7 @@ GpStatus WINGDIPAPI GdipAddPathBeziersI(GpPath *path, GDIPCONST GpPoint *points,
|
|||
if(!points || ((count - 1) % 3))
|
||||
return InvalidParameter;
|
||||
|
||||
ptsF = heap_alloc_zero(sizeof(GpPointF) * count);
|
||||
ptsF = malloc(sizeof(GpPointF) * count);
|
||||
if(!ptsF)
|
||||
return OutOfMemory;
|
||||
|
||||
|
@ -411,7 +411,7 @@ GpStatus WINGDIPAPI GdipAddPathBeziersI(GpPath *path, GDIPCONST GpPoint *points,
|
|||
}
|
||||
|
||||
ret = GdipAddPathBeziers(path, ptsF, count);
|
||||
heap_free(ptsF);
|
||||
free(ptsF);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -446,11 +446,11 @@ GpStatus WINGDIPAPI GdipAddPathClosedCurve2(GpPath *path, GDIPCONST GpPointF *po
|
|||
if(!path || !points || count <= 1)
|
||||
return InvalidParameter;
|
||||
|
||||
pt = heap_alloc_zero(len_pt * sizeof(GpPointF));
|
||||
pts = heap_alloc_zero((count + 1)*sizeof(GpPointF));
|
||||
pt = malloc(len_pt * sizeof(GpPointF));
|
||||
pts = malloc((count + 1) * sizeof(GpPointF));
|
||||
if(!pt || !pts){
|
||||
heap_free(pt);
|
||||
heap_free(pts);
|
||||
free(pt);
|
||||
free(pts);
|
||||
return OutOfMemory;
|
||||
}
|
||||
|
||||
|
@ -496,8 +496,8 @@ GpStatus WINGDIPAPI GdipAddPathClosedCurve2(GpPath *path, GDIPCONST GpPointF *po
|
|||
path->newfigure = TRUE;
|
||||
}
|
||||
|
||||
heap_free(pts);
|
||||
heap_free(pt);
|
||||
free(pts);
|
||||
free(pt);
|
||||
|
||||
return stat;
|
||||
}
|
||||
|
@ -514,7 +514,7 @@ GpStatus WINGDIPAPI GdipAddPathClosedCurve2I(GpPath *path, GDIPCONST GpPoint *po
|
|||
if(!path || !points || count <= 1)
|
||||
return InvalidParameter;
|
||||
|
||||
ptf = heap_alloc_zero(sizeof(GpPointF)*count);
|
||||
ptf = malloc(sizeof(GpPointF) * count);
|
||||
if(!ptf)
|
||||
return OutOfMemory;
|
||||
|
||||
|
@ -525,7 +525,7 @@ GpStatus WINGDIPAPI GdipAddPathClosedCurve2I(GpPath *path, GDIPCONST GpPoint *po
|
|||
|
||||
stat = GdipAddPathClosedCurve2(path, ptf, count, tension);
|
||||
|
||||
heap_free(ptf);
|
||||
free(ptf);
|
||||
|
||||
return stat;
|
||||
}
|
||||
|
@ -556,7 +556,7 @@ GpStatus WINGDIPAPI GdipAddPathCurve3(GpPath *path, GDIPCONST GpPointF *points,
|
|||
if(!path || !points || offset + 1 >= count || count - offset < nseg + 1 || nseg < 1)
|
||||
return InvalidParameter;
|
||||
|
||||
pt = heap_alloc_zero(len_pt * sizeof(GpPointF));
|
||||
pt = calloc(len_pt, sizeof(GpPointF));
|
||||
if(!pt)
|
||||
return OutOfMemory;
|
||||
|
||||
|
@ -603,7 +603,7 @@ GpStatus WINGDIPAPI GdipAddPathCurve3(GpPath *path, GDIPCONST GpPointF *points,
|
|||
|
||||
stat = extend_current_figure(path, pt, len_pt, PathPointTypeBezier);
|
||||
|
||||
heap_free(pt);
|
||||
free(pt);
|
||||
|
||||
return stat;
|
||||
}
|
||||
|
@ -636,7 +636,7 @@ GpStatus WINGDIPAPI GdipAddPathCurve3I(GpPath *path, GDIPCONST GpPoint *points,
|
|||
if(!path || !points || offset + 1 >= count || count - offset < nseg + 1 || nseg < 1)
|
||||
return InvalidParameter;
|
||||
|
||||
ptf = heap_alloc_zero(sizeof(GpPointF)*count);
|
||||
ptf = malloc(sizeof(GpPointF) * count);
|
||||
if(!ptf)
|
||||
return OutOfMemory;
|
||||
|
||||
|
@ -647,7 +647,7 @@ GpStatus WINGDIPAPI GdipAddPathCurve3I(GpPath *path, GDIPCONST GpPoint *points,
|
|||
|
||||
stat = GdipAddPathCurve3(path, ptf, count, offset, nseg, tension);
|
||||
|
||||
heap_free(ptf);
|
||||
free(ptf);
|
||||
|
||||
return stat;
|
||||
}
|
||||
|
@ -714,8 +714,8 @@ GpStatus WINGDIPAPI GdipAddPathLine2I(GpPath *path, GDIPCONST GpPoint *points, I
|
|||
if(count <= 0)
|
||||
return InvalidParameter;
|
||||
|
||||
pointsF = heap_alloc_zero(sizeof(GpPointF) * count);
|
||||
if(!pointsF) return OutOfMemory;
|
||||
pointsF = malloc(sizeof(GpPointF) * count);
|
||||
if(!pointsF) return OutOfMemory;
|
||||
|
||||
for(i = 0;i < count; i++){
|
||||
pointsF[i].X = (REAL)points[i].X;
|
||||
|
@ -724,7 +724,7 @@ GpStatus WINGDIPAPI GdipAddPathLine2I(GpPath *path, GDIPCONST GpPoint *points, I
|
|||
|
||||
stat = GdipAddPathLine2(path, pointsF, count);
|
||||
|
||||
heap_free(pointsF);
|
||||
free(pointsF);
|
||||
|
||||
return stat;
|
||||
}
|
||||
|
@ -842,7 +842,7 @@ GpStatus WINGDIPAPI GdipAddPathPie(GpPath *path, REAL x, REAL y, REAL width, REA
|
|||
if(count == 0)
|
||||
return Ok;
|
||||
|
||||
ptf = heap_alloc_zero(sizeof(GpPointF)*count);
|
||||
ptf = malloc(sizeof(GpPointF) * count);
|
||||
if(!ptf)
|
||||
return OutOfMemory;
|
||||
|
||||
|
@ -850,12 +850,12 @@ GpStatus WINGDIPAPI GdipAddPathPie(GpPath *path, REAL x, REAL y, REAL width, REA
|
|||
|
||||
status = GdipAddPathLine(path, x + width/2, y + height/2, ptf[0].X, ptf[0].Y);
|
||||
if(status != Ok){
|
||||
heap_free(ptf);
|
||||
free(ptf);
|
||||
return status;
|
||||
}
|
||||
/* one spline is already added as a line endpoint */
|
||||
if(!lengthen_path(path, count - 1)){
|
||||
heap_free(ptf);
|
||||
free(ptf);
|
||||
return OutOfMemory;
|
||||
}
|
||||
|
||||
|
@ -867,7 +867,7 @@ GpStatus WINGDIPAPI GdipAddPathPie(GpPath *path, REAL x, REAL y, REAL width, REA
|
|||
|
||||
GdipClosePathFigure(path);
|
||||
|
||||
heap_free(ptf);
|
||||
free(ptf);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
@ -918,7 +918,7 @@ GpStatus WINGDIPAPI GdipAddPathPolygonI(GpPath *path, GDIPCONST GpPoint *points,
|
|||
if(!points || count < 3)
|
||||
return InvalidParameter;
|
||||
|
||||
ptf = heap_alloc_zero(sizeof(GpPointF) * count);
|
||||
ptf = malloc(sizeof(GpPointF) * count);
|
||||
if(!ptf)
|
||||
return OutOfMemory;
|
||||
|
||||
|
@ -929,7 +929,7 @@ GpStatus WINGDIPAPI GdipAddPathPolygonI(GpPath *path, GDIPCONST GpPoint *points,
|
|||
|
||||
status = GdipAddPathPolygon(path, ptf, count);
|
||||
|
||||
heap_free(ptf);
|
||||
free(ptf);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
@ -981,11 +981,11 @@ static GpStatus format_string_callback(HDC dc,
|
|||
status = GenericError;
|
||||
break;
|
||||
}
|
||||
origph = ph = heap_alloc_zero(len);
|
||||
origph = ph = calloc(1, len);
|
||||
start = (char *)ph;
|
||||
if (!ph || !lengthen_path(path, len / sizeof(POINTFX)))
|
||||
{
|
||||
heap_free(ph);
|
||||
free(ph);
|
||||
status = OutOfMemory;
|
||||
break;
|
||||
}
|
||||
|
@ -1036,7 +1036,7 @@ static GpStatus format_string_callback(HDC dc,
|
|||
x += gm.gmCellIncX * args->scale;
|
||||
y += gm.gmCellIncY * args->scale;
|
||||
|
||||
heap_free(origph);
|
||||
free(origph);
|
||||
if (status != Ok)
|
||||
break;
|
||||
}
|
||||
|
@ -1125,10 +1125,10 @@ GpStatus WINGDIPAPI GdipAddPathString(GpPath* path, GDIPCONST WCHAR* string, INT
|
|||
|
||||
if (status != Ok) /* free backup */
|
||||
{
|
||||
heap_free(path->pathdata.Points);
|
||||
heap_free(path->pathdata.Types);
|
||||
free(path->pathdata.Points);
|
||||
free(path->pathdata.Types);
|
||||
*path = *backup;
|
||||
heap_free(backup);
|
||||
free(backup);
|
||||
return status;
|
||||
}
|
||||
if (format->line_align == StringAlignmentCenter && layoutRect->Y + args.maxY < layoutRect->Height)
|
||||
|
@ -1179,17 +1179,17 @@ GpStatus WINGDIPAPI GdipClonePath(GpPath* path, GpPath **clone)
|
|||
if(!path || !clone)
|
||||
return InvalidParameter;
|
||||
|
||||
*clone = heap_alloc_zero(sizeof(GpPath));
|
||||
*clone = malloc(sizeof(GpPath));
|
||||
if(!*clone) return OutOfMemory;
|
||||
|
||||
**clone = *path;
|
||||
|
||||
(*clone)->pathdata.Points = heap_alloc_zero(path->datalen * sizeof(PointF));
|
||||
(*clone)->pathdata.Types = heap_alloc_zero(path->datalen);
|
||||
(*clone)->pathdata.Points = malloc(path->datalen * sizeof(PointF));
|
||||
(*clone)->pathdata.Types = malloc(path->datalen);
|
||||
if(!(*clone)->pathdata.Points || !(*clone)->pathdata.Types){
|
||||
heap_free((*clone)->pathdata.Points);
|
||||
heap_free((*clone)->pathdata.Types);
|
||||
heap_free(*clone);
|
||||
free((*clone)->pathdata.Points);
|
||||
free((*clone)->pathdata.Types);
|
||||
free(*clone);
|
||||
return OutOfMemory;
|
||||
}
|
||||
|
||||
|
@ -1241,7 +1241,7 @@ GpStatus WINGDIPAPI GdipCreatePath(GpFillMode fill, GpPath **path)
|
|||
if(!path)
|
||||
return InvalidParameter;
|
||||
|
||||
*path = heap_alloc_zero(sizeof(GpPath));
|
||||
*path = calloc(1, sizeof(GpPath));
|
||||
if(!*path) return OutOfMemory;
|
||||
|
||||
(*path)->fill = fill;
|
||||
|
@ -1265,8 +1265,8 @@ GpStatus WINGDIPAPI GdipCreatePath2(GDIPCONST GpPointF* points,
|
|||
return OutOfMemory;
|
||||
}
|
||||
|
||||
*path = heap_alloc_zero(sizeof(GpPath));
|
||||
if(!*path) return OutOfMemory;
|
||||
*path = calloc(1, sizeof(GpPath));
|
||||
if(!*path) return OutOfMemory;
|
||||
|
||||
if(count > 1 && (types[count-1] & PathPointTypePathTypeMask) == PathPointTypeStart)
|
||||
count = 0;
|
||||
|
@ -1284,13 +1284,13 @@ GpStatus WINGDIPAPI GdipCreatePath2(GDIPCONST GpPointF* points,
|
|||
}
|
||||
}
|
||||
|
||||
(*path)->pathdata.Points = heap_alloc_zero(count * sizeof(PointF));
|
||||
(*path)->pathdata.Types = heap_alloc_zero(count);
|
||||
(*path)->pathdata.Points = malloc(count * sizeof(PointF));
|
||||
(*path)->pathdata.Types = malloc(count);
|
||||
|
||||
if(!(*path)->pathdata.Points || !(*path)->pathdata.Types){
|
||||
heap_free((*path)->pathdata.Points);
|
||||
heap_free((*path)->pathdata.Types);
|
||||
heap_free(*path);
|
||||
free((*path)->pathdata.Points);
|
||||
free((*path)->pathdata.Types);
|
||||
free(*path);
|
||||
return OutOfMemory;
|
||||
}
|
||||
|
||||
|
@ -1316,7 +1316,7 @@ GpStatus WINGDIPAPI GdipCreatePath2I(GDIPCONST GpPoint* points,
|
|||
|
||||
TRACE("(%p, %p, %d, %d, %p)\n", points, types, count, fill, path);
|
||||
|
||||
ptF = heap_alloc_zero(sizeof(GpPointF)*count);
|
||||
ptF = malloc(sizeof(GpPointF) * count);
|
||||
|
||||
for(i = 0;i < count; i++){
|
||||
ptF[i].X = (REAL)points[i].X;
|
||||
|
@ -1325,7 +1325,7 @@ GpStatus WINGDIPAPI GdipCreatePath2I(GDIPCONST GpPoint* points,
|
|||
|
||||
ret = GdipCreatePath2(ptF, types, count, fill, path);
|
||||
|
||||
heap_free(ptF);
|
||||
free(ptF);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -1337,9 +1337,9 @@ GpStatus WINGDIPAPI GdipDeletePath(GpPath *path)
|
|||
if(!path)
|
||||
return InvalidParameter;
|
||||
|
||||
heap_free(path->pathdata.Points);
|
||||
heap_free(path->pathdata.Types);
|
||||
heap_free(path);
|
||||
free(path->pathdata.Points);
|
||||
free(path->pathdata.Types);
|
||||
free(path);
|
||||
|
||||
return Ok;
|
||||
}
|
||||
|
@ -1510,8 +1510,8 @@ GpStatus WINGDIPAPI GdipGetPathPointsI(GpPath *path, GpPoint* points, INT count)
|
|||
if(count <= 0)
|
||||
return InvalidParameter;
|
||||
|
||||
ptf = heap_alloc_zero(sizeof(GpPointF)*count);
|
||||
if(!ptf) return OutOfMemory;
|
||||
ptf = malloc(sizeof(GpPointF) * count);
|
||||
if(!ptf) return OutOfMemory;
|
||||
|
||||
ret = GdipGetPathPoints(path,ptf,count);
|
||||
if(ret == Ok)
|
||||
|
@ -1519,7 +1519,7 @@ GpStatus WINGDIPAPI GdipGetPathPointsI(GpPath *path, GpPoint* points, INT count)
|
|||
points[i].X = gdip_round(ptf[i].X);
|
||||
points[i].Y = gdip_round(ptf[i].Y);
|
||||
};
|
||||
heap_free(ptf);
|
||||
free(ptf);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -1673,12 +1673,12 @@ GpStatus WINGDIPAPI GdipReversePath(GpPath* path)
|
|||
|
||||
if(count == 0) return Ok;
|
||||
|
||||
revpath.Points = heap_alloc_zero(sizeof(GpPointF)*count);
|
||||
revpath.Types = heap_alloc_zero(sizeof(BYTE)*count);
|
||||
revpath.Points = calloc(count, sizeof(GpPointF));
|
||||
revpath.Types = calloc(count, sizeof(BYTE));
|
||||
revpath.Count = count;
|
||||
if(!revpath.Points || !revpath.Types){
|
||||
heap_free(revpath.Points);
|
||||
heap_free(revpath.Types);
|
||||
free(revpath.Points);
|
||||
free(revpath.Types);
|
||||
return OutOfMemory;
|
||||
}
|
||||
|
||||
|
@ -1708,8 +1708,8 @@ GpStatus WINGDIPAPI GdipReversePath(GpPath* path)
|
|||
memcpy(path->pathdata.Points, revpath.Points, sizeof(GpPointF)*count);
|
||||
memcpy(path->pathdata.Types, revpath.Types, sizeof(BYTE)*count);
|
||||
|
||||
heap_free(revpath.Points);
|
||||
heap_free(revpath.Types);
|
||||
free(revpath.Points);
|
||||
free(revpath.Types);
|
||||
|
||||
return Ok;
|
||||
}
|
||||
|
@ -2221,7 +2221,7 @@ static void add_anchor(const GpPointF *endpoint, const GpPointF *nextpoint,
|
|||
|
||||
if (!custom->fill)
|
||||
{
|
||||
tmp_points = heap_alloc_zero(custom->pathdata.Count * sizeof(GpPoint));
|
||||
tmp_points = malloc(custom->pathdata.Count * sizeof(GpPoint));
|
||||
if (!tmp_points) {
|
||||
ERR("Out of memory\n");
|
||||
return;
|
||||
|
@ -2378,15 +2378,15 @@ static void widen_dashed_figure(GpPath *path, int start, int end, int closed,
|
|||
break;
|
||||
}
|
||||
|
||||
dash_pattern_scaled = heap_alloc(dash_count * sizeof(REAL));
|
||||
dash_pattern_scaled = malloc(dash_count * sizeof(REAL));
|
||||
if (!dash_pattern_scaled) return;
|
||||
|
||||
for (i = 0; i < dash_count; i++)
|
||||
dash_pattern_scaled[i] = dash_pattern_scaling * dash_pattern[i];
|
||||
|
||||
tmp_points = heap_alloc_zero((end - start + 2) * sizeof(GpPoint));
|
||||
tmp_points = calloc(end - start + 2, sizeof(GpPoint));
|
||||
if (!tmp_points) {
|
||||
heap_free(dash_pattern_scaled);
|
||||
free(dash_pattern_scaled);
|
||||
return; /* FIXME */
|
||||
}
|
||||
|
||||
|
@ -2466,8 +2466,8 @@ static void widen_dashed_figure(GpPath *path, int start, int end, int closed,
|
|||
closed ? LineCapFlat : pen->endcap, pen->customend, last_point);
|
||||
}
|
||||
|
||||
heap_free(dash_pattern_scaled);
|
||||
heap_free(tmp_points);
|
||||
free(dash_pattern_scaled);
|
||||
free(tmp_points);
|
||||
}
|
||||
|
||||
GpStatus WINGDIPAPI GdipWidenPath(GpPath *path, GpPen *pen, GpMatrix *matrix,
|
||||
|
@ -2632,10 +2632,10 @@ GpStatus WINGDIPAPI GdipAddPathRectangle(GpPath *path, REAL x, REAL y,
|
|||
|
||||
fail:
|
||||
/* reverting */
|
||||
heap_free(path->pathdata.Points);
|
||||
heap_free(path->pathdata.Types);
|
||||
free(path->pathdata.Points);
|
||||
free(path->pathdata.Types);
|
||||
memcpy(path, backup, sizeof(*path));
|
||||
heap_free(backup);
|
||||
free(backup);
|
||||
|
||||
return retstat;
|
||||
}
|
||||
|
@ -2678,10 +2678,10 @@ GpStatus WINGDIPAPI GdipAddPathRectangles(GpPath *path, GDIPCONST GpRectF *rects
|
|||
|
||||
fail:
|
||||
/* reverting */
|
||||
heap_free(path->pathdata.Points);
|
||||
heap_free(path->pathdata.Types);
|
||||
free(path->pathdata.Points);
|
||||
free(path->pathdata.Types);
|
||||
memcpy(path, backup, sizeof(*path));
|
||||
heap_free(backup);
|
||||
free(backup);
|
||||
|
||||
return retstat;
|
||||
}
|
||||
|
@ -2700,13 +2700,13 @@ GpStatus WINGDIPAPI GdipAddPathRectanglesI(GpPath *path, GDIPCONST GpRect *rects
|
|||
if(count < 0)
|
||||
return OutOfMemory;
|
||||
|
||||
rectsF = heap_alloc_zero(sizeof(GpRectF)*count);
|
||||
rectsF = malloc(sizeof(GpRectF) * count);
|
||||
|
||||
for(i = 0;i < count;i++)
|
||||
set_rect(&rectsF[i], rects[i].X, rects[i].Y, rects[i].Width, rects[i].Height);
|
||||
|
||||
retstat = GdipAddPathRectangles(path, rectsF, count);
|
||||
heap_free(rectsF);
|
||||
free(rectsF);
|
||||
|
||||
return retstat;
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ static ColorPalette *get_palette(IWICBitmapFrameDecode *frame, WICBitmapPaletteT
|
|||
UINT count;
|
||||
|
||||
IWICPalette_GetColorCount(wic_palette, &count);
|
||||
palette = heap_alloc(2 * sizeof(UINT) + count * sizeof(ARGB));
|
||||
palette = malloc(2 * sizeof(UINT) + count * sizeof(ARGB));
|
||||
IWICPalette_GetColors(wic_palette, count, (UINT *)palette->Entries, &palette->Count);
|
||||
|
||||
IWICPalette_GetType(wic_palette, &type);
|
||||
|
@ -1193,7 +1193,7 @@ GpStatus WINGDIPAPI GdipBitmapLockBits(GpBitmap* bitmap, GDIPCONST GpRect* rect,
|
|||
{
|
||||
lockeddata->Stride = (((act_rect.Width * bitspp + 7) / 8) + 3) & ~3;
|
||||
|
||||
bitmap->bitmapbits = heap_alloc_zero(lockeddata->Stride * act_rect.Height);
|
||||
bitmap->bitmapbits = calloc(lockeddata->Stride, act_rect.Height);
|
||||
|
||||
if (!bitmap->bitmapbits)
|
||||
{
|
||||
|
@ -1222,7 +1222,7 @@ GpStatus WINGDIPAPI GdipBitmapLockBits(GpBitmap* bitmap, GDIPCONST GpRect* rect,
|
|||
|
||||
if (stat != Ok)
|
||||
{
|
||||
heap_free(bitmap->bitmapbits);
|
||||
free(bitmap->bitmapbits);
|
||||
bitmap->bitmapbits = NULL;
|
||||
image_unlock(&bitmap->image);
|
||||
return stat;
|
||||
|
@ -1271,7 +1271,7 @@ GpStatus WINGDIPAPI GdipBitmapUnlockBits(GpBitmap* bitmap,
|
|||
|
||||
if(!(lockeddata->Reserved & ImageLockModeWrite)){
|
||||
bitmap->lockmode = 0;
|
||||
heap_free(bitmap->bitmapbits);
|
||||
free(bitmap->bitmapbits);
|
||||
bitmap->bitmapbits = NULL;
|
||||
image_unlock(&bitmap->image);
|
||||
return Ok;
|
||||
|
@ -1303,7 +1303,7 @@ GpStatus WINGDIPAPI GdipBitmapUnlockBits(GpBitmap* bitmap,
|
|||
ERR("failed to convert pixels; this should never happen\n");
|
||||
}
|
||||
|
||||
heap_free(bitmap->bitmapbits);
|
||||
free(bitmap->bitmapbits);
|
||||
bitmap->bitmapbits = NULL;
|
||||
bitmap->lockmode = 0;
|
||||
|
||||
|
@ -1349,7 +1349,7 @@ GpStatus WINGDIPAPI GdipCloneBitmapArea(REAL x, REAL y, REAL width, REAL height,
|
|||
|
||||
src_palette = srcBitmap->image.palette;
|
||||
|
||||
dst_palette = heap_alloc_zero(sizeof(UINT) * 2 + sizeof(ARGB) * src_palette->Count);
|
||||
dst_palette = calloc(1, sizeof(UINT) * 2 + sizeof(ARGB) * src_palette->Count);
|
||||
|
||||
if (dst_palette)
|
||||
{
|
||||
|
@ -1357,7 +1357,7 @@ GpStatus WINGDIPAPI GdipCloneBitmapArea(REAL x, REAL y, REAL width, REAL height,
|
|||
dst_palette->Count = src_palette->Count;
|
||||
memcpy(dst_palette->Entries, src_palette->Entries, sizeof(ARGB) * src_palette->Count);
|
||||
|
||||
heap_free((*dstBitmap)->image.palette);
|
||||
free((*dstBitmap)->image.palette);
|
||||
(*dstBitmap)->image.palette = dst_palette;
|
||||
}
|
||||
else
|
||||
|
@ -1402,7 +1402,7 @@ GpStatus WINGDIPAPI GdipCloneImage(GpImage *image, GpImage **cloneImage)
|
|||
|
||||
metafile = (GpMetafile*)image;
|
||||
|
||||
result = heap_alloc_zero(sizeof(*result));
|
||||
result = calloc(1, sizeof(*result));
|
||||
if (!result)
|
||||
return OutOfMemory;
|
||||
|
||||
|
@ -1420,7 +1420,7 @@ GpStatus WINGDIPAPI GdipCloneImage(GpImage *image, GpImage **cloneImage)
|
|||
|
||||
if (!result->hemf)
|
||||
{
|
||||
heap_free(result);
|
||||
free(result);
|
||||
return OutOfMemory;
|
||||
}
|
||||
|
||||
|
@ -1683,7 +1683,7 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromHICON(HICON hicon, GpBitmap** bitmap)
|
|||
bih.biClrUsed = 0;
|
||||
bih.biClrImportant = 0;
|
||||
|
||||
bits = heap_alloc(height * stride);
|
||||
bits = malloc(height * stride);
|
||||
if (!bits)
|
||||
{
|
||||
DeleteObject(iinfo.hbmColor);
|
||||
|
@ -1709,7 +1709,7 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromHICON(HICON hicon, GpBitmap** bitmap)
|
|||
if (!screendc || ((color_scanlines == 0 || mask_scanlines == 0) &&
|
||||
GetLastError() == ERROR_INVALID_PARAMETER))
|
||||
{
|
||||
heap_free(bits);
|
||||
free(bits);
|
||||
GdipBitmapUnlockBits(*bitmap, &lockeddata);
|
||||
GdipDisposeImage(&(*bitmap)->image);
|
||||
return GenericError;
|
||||
|
@ -1731,7 +1731,7 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromHICON(HICON hicon, GpBitmap** bitmap)
|
|||
dst_row += lockeddata.Stride;
|
||||
}
|
||||
|
||||
heap_free(bits);
|
||||
free(bits);
|
||||
|
||||
GdipBitmapUnlockBits(*bitmap, &lockeddata);
|
||||
|
||||
|
@ -1853,7 +1853,7 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromScan0(INT width, INT height, INT stride,
|
|||
{
|
||||
INT size = abs(stride) * height;
|
||||
|
||||
own_bits = bits = heap_alloc_zero(size);
|
||||
own_bits = bits = calloc(1, size);
|
||||
if (!own_bits) return OutOfMemory;
|
||||
|
||||
if (stride < 0)
|
||||
|
@ -1861,11 +1861,11 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromScan0(INT width, INT height, INT stride,
|
|||
}
|
||||
}
|
||||
|
||||
*bitmap = heap_alloc_zero(sizeof(GpBitmap));
|
||||
*bitmap = calloc(1, sizeof(GpBitmap));
|
||||
if(!*bitmap)
|
||||
{
|
||||
DeleteObject(hbitmap);
|
||||
heap_free(own_bits);
|
||||
free(own_bits);
|
||||
return OutOfMemory;
|
||||
}
|
||||
|
||||
|
@ -1899,7 +1899,7 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromScan0(INT width, INT height, INT stride,
|
|||
format == PixelFormat4bppIndexed ||
|
||||
format == PixelFormat8bppIndexed)
|
||||
{
|
||||
(*bitmap)->image.palette = heap_alloc_zero(sizeof(UINT) * 2 + sizeof(ARGB) * (1 << PIXELFORMATBPP(format)));
|
||||
(*bitmap)->image.palette = calloc(1, sizeof(UINT) * 2 + sizeof(ARGB) * (1 << PIXELFORMATBPP(format)));
|
||||
|
||||
if (!(*bitmap)->image.palette)
|
||||
{
|
||||
|
@ -1971,13 +1971,13 @@ GpStatus WINGDIPAPI GdipCreateCachedBitmap(GpBitmap *bitmap, GpGraphics *graphic
|
|||
if(!bitmap || !graphics || !cachedbmp)
|
||||
return InvalidParameter;
|
||||
|
||||
*cachedbmp = heap_alloc_zero(sizeof(GpCachedBitmap));
|
||||
*cachedbmp = calloc(1, sizeof(GpCachedBitmap));
|
||||
if(!*cachedbmp)
|
||||
return OutOfMemory;
|
||||
|
||||
stat = GdipCloneImage(&(bitmap->image), &(*cachedbmp)->image);
|
||||
if(stat != Ok){
|
||||
heap_free(*cachedbmp);
|
||||
free(*cachedbmp);
|
||||
return stat;
|
||||
}
|
||||
|
||||
|
@ -2005,7 +2005,7 @@ GpStatus WINGDIPAPI GdipCreateHICONFromBitmap(GpBitmap *bitmap, HICON *hicon)
|
|||
xorstride = lockeddata.Width*4;
|
||||
bitssize = (andstride + xorstride) * lockeddata.Height;
|
||||
|
||||
andbits = heap_alloc_zero(bitssize);
|
||||
andbits = calloc(1, bitssize);
|
||||
|
||||
if (andbits)
|
||||
{
|
||||
|
@ -2027,7 +2027,7 @@ GpStatus WINGDIPAPI GdipCreateHICONFromBitmap(GpBitmap *bitmap, HICON *hicon)
|
|||
*hicon = CreateIcon(NULL, lockeddata.Width, lockeddata.Height, 1, 32,
|
||||
andbits, xorbits);
|
||||
|
||||
heap_free(andbits);
|
||||
free(andbits);
|
||||
}
|
||||
else
|
||||
stat = OutOfMemory;
|
||||
|
@ -2046,7 +2046,7 @@ GpStatus WINGDIPAPI GdipDeleteCachedBitmap(GpCachedBitmap *cachedbmp)
|
|||
return InvalidParameter;
|
||||
|
||||
GdipDisposeImage(cachedbmp->image);
|
||||
heap_free(cachedbmp);
|
||||
free(cachedbmp);
|
||||
|
||||
return Ok;
|
||||
}
|
||||
|
@ -2069,18 +2069,18 @@ static void move_bitmap(GpBitmap *dst, GpBitmap *src, BOOL clobber_palette)
|
|||
assert(src->image.type == ImageTypeBitmap);
|
||||
assert(dst->image.type == ImageTypeBitmap);
|
||||
|
||||
heap_free(dst->bitmapbits);
|
||||
heap_free(dst->own_bits);
|
||||
free(dst->bitmapbits);
|
||||
free(dst->own_bits);
|
||||
DeleteDC(dst->hdc);
|
||||
DeleteObject(dst->hbitmap);
|
||||
|
||||
if (clobber_palette)
|
||||
{
|
||||
heap_free(dst->image.palette);
|
||||
free(dst->image.palette);
|
||||
dst->image.palette = src->image.palette;
|
||||
}
|
||||
else
|
||||
heap_free(src->image.palette);
|
||||
free(src->image.palette);
|
||||
|
||||
dst->image.xres = src->image.xres;
|
||||
dst->image.yres = src->image.yres;
|
||||
|
@ -2095,7 +2095,7 @@ static void move_bitmap(GpBitmap *dst, GpBitmap *src, BOOL clobber_palette)
|
|||
if (dst->metadata_reader)
|
||||
IWICMetadataReader_Release(dst->metadata_reader);
|
||||
dst->metadata_reader = src->metadata_reader;
|
||||
heap_free(dst->prop_item);
|
||||
free(dst->prop_item);
|
||||
dst->prop_item = src->prop_item;
|
||||
dst->prop_count = src->prop_count;
|
||||
if (dst->image.decoder)
|
||||
|
@ -2108,7 +2108,7 @@ static void move_bitmap(GpBitmap *dst, GpBitmap *src, BOOL clobber_palette)
|
|||
dst->image.format = src->image.format;
|
||||
|
||||
src->image.type = ~0;
|
||||
heap_free(src);
|
||||
free(src);
|
||||
}
|
||||
|
||||
static GpStatus free_image_data(GpImage *image)
|
||||
|
@ -2118,13 +2118,13 @@ static GpStatus free_image_data(GpImage *image)
|
|||
|
||||
if (image->type == ImageTypeBitmap)
|
||||
{
|
||||
heap_free(((GpBitmap*)image)->bitmapbits);
|
||||
heap_free(((GpBitmap*)image)->own_bits);
|
||||
free(((GpBitmap*)image)->bitmapbits);
|
||||
free(((GpBitmap*)image)->own_bits);
|
||||
DeleteDC(((GpBitmap*)image)->hdc);
|
||||
DeleteObject(((GpBitmap*)image)->hbitmap);
|
||||
if (((GpBitmap*)image)->metadata_reader)
|
||||
IWICMetadataReader_Release(((GpBitmap*)image)->metadata_reader);
|
||||
heap_free(((GpBitmap*)image)->prop_item);
|
||||
free(((GpBitmap*)image)->prop_item);
|
||||
}
|
||||
else if (image->type == ImageTypeMetafile)
|
||||
METAFILE_Free((GpMetafile *)image);
|
||||
|
@ -2136,7 +2136,7 @@ static GpStatus free_image_data(GpImage *image)
|
|||
if (image->decoder)
|
||||
IWICBitmapDecoder_Release(image->decoder);
|
||||
terminate_encoder_wic(image);
|
||||
heap_free(image->palette);
|
||||
free(image->palette);
|
||||
|
||||
return Ok;
|
||||
}
|
||||
|
@ -2150,7 +2150,7 @@ GpStatus WINGDIPAPI GdipDisposeImage(GpImage *image)
|
|||
status = free_image_data(image);
|
||||
if (status != Ok) return status;
|
||||
image->type = ~0;
|
||||
heap_free(image);
|
||||
free(image);
|
||||
|
||||
return Ok;
|
||||
}
|
||||
|
@ -2881,7 +2881,7 @@ GpStatus WINGDIPAPI GdipGetAllPropertyItems(GpImage *image, UINT size,
|
|||
item_size = propvariant_size(&value);
|
||||
if (item_size)
|
||||
{
|
||||
item = heap_alloc(item_size + sizeof(*item));
|
||||
item = malloc(item_size + sizeof(*item));
|
||||
|
||||
propvariant_to_item(&value, item, item_size + sizeof(*item), id.uiVal);
|
||||
buf[i].id = item->id;
|
||||
|
@ -2891,7 +2891,7 @@ GpStatus WINGDIPAPI GdipGetAllPropertyItems(GpImage *image, UINT size,
|
|||
memcpy(item_value, item->value, item_size);
|
||||
item_value += item_size;
|
||||
|
||||
heap_free(item);
|
||||
free(item);
|
||||
}
|
||||
|
||||
PropVariantClear(&id);
|
||||
|
@ -3022,7 +3022,7 @@ static void add_property(GpBitmap *bitmap, PropertyItem *item)
|
|||
if (bitmap->prop_item == NULL)
|
||||
{
|
||||
prop_size = prop_count = 0;
|
||||
prop_item = heap_alloc_zero(item->length + sizeof(PropertyItem));
|
||||
prop_item = calloc(1, item->length + sizeof(PropertyItem));
|
||||
if (!prop_item) return;
|
||||
}
|
||||
else
|
||||
|
@ -3032,7 +3032,7 @@ static void add_property(GpBitmap *bitmap, PropertyItem *item)
|
|||
|
||||
GdipGetPropertySize(&bitmap->image, &prop_size, &prop_count);
|
||||
|
||||
prop_item = heap_alloc_zero(prop_size + item->length + sizeof(PropertyItem));
|
||||
prop_item = calloc(1, prop_size + item->length + sizeof(PropertyItem));
|
||||
if (!prop_item) return;
|
||||
memcpy(prop_item, bitmap->prop_item, sizeof(PropertyItem) * bitmap->prop_count);
|
||||
prop_size -= sizeof(PropertyItem) * bitmap->prop_count;
|
||||
|
@ -3053,7 +3053,7 @@ static void add_property(GpBitmap *bitmap, PropertyItem *item)
|
|||
prop_item[prop_count].value = (char *)(prop_item + prop_count + 1) + prop_size;
|
||||
memcpy(prop_item[prop_count].value, item->value, item->length);
|
||||
|
||||
heap_free(bitmap->prop_item);
|
||||
free(bitmap->prop_item);
|
||||
bitmap->prop_item = prop_item;
|
||||
bitmap->prop_count++;
|
||||
}
|
||||
|
@ -3109,10 +3109,10 @@ static PropertyItem *get_property(IWICMetadataReader *reader, const GUID *guid,
|
|||
if (item_size)
|
||||
{
|
||||
item_size += sizeof(*item);
|
||||
item = heap_alloc_zero(item_size);
|
||||
item = calloc(1, item_size);
|
||||
if (propvariant_to_item(&value, item, item_size, 0) != Ok)
|
||||
{
|
||||
heap_free(item);
|
||||
free(item);
|
||||
item = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -3153,7 +3153,7 @@ static PropertyItem *get_gif_loopcount(IWICMetadataReader *reader)
|
|||
BYTE *data = appdata->value;
|
||||
if (data[0] == 3 && data[1] == 1)
|
||||
{
|
||||
loop = heap_alloc_zero(sizeof(*loop) + sizeof(SHORT));
|
||||
loop = calloc(1, sizeof(*loop) + sizeof(SHORT));
|
||||
if (loop)
|
||||
{
|
||||
loop->type = PropertyTagTypeShort;
|
||||
|
@ -3168,8 +3168,8 @@ static PropertyItem *get_gif_loopcount(IWICMetadataReader *reader)
|
|||
}
|
||||
}
|
||||
|
||||
heap_free(appext);
|
||||
heap_free(appdata);
|
||||
free(appext);
|
||||
free(appdata);
|
||||
|
||||
return loop;
|
||||
}
|
||||
|
@ -3220,7 +3220,7 @@ static PropertyItem *get_gif_palette(IWICBitmapDecoder *decoder, IWICMetadataRea
|
|||
UINT i;
|
||||
BYTE *rgb;
|
||||
|
||||
pal = heap_alloc_zero(sizeof(*pal) + count * 3);
|
||||
pal = calloc(1, sizeof(*pal) + count * 3);
|
||||
if (!pal) return NULL;
|
||||
pal->type = PropertyTagTypeByte;
|
||||
pal->id = PropertyTagGlobalPalette;
|
||||
|
@ -3282,7 +3282,7 @@ static void get_gif_frame_property(IWICBitmapFrameDecode *frame, const GUID *for
|
|||
else if (prop->type == PropertyTagTypeShort && prop->length == 2)
|
||||
*value = *(SHORT *)prop->value;
|
||||
|
||||
heap_free(prop);
|
||||
free(prop);
|
||||
}
|
||||
IWICMetadataReader_Release(reader);
|
||||
}
|
||||
|
@ -3303,7 +3303,7 @@ static void gif_metadata_reader(GpBitmap *bitmap, IWICBitmapDecoder *decoder, UI
|
|||
PropertyItem *transparent_idx = NULL, *loop = NULL, *palette = NULL;
|
||||
|
||||
IWICBitmapDecoder_GetFrameCount(decoder, &frame_count);
|
||||
delay = heap_alloc_zero(sizeof(*delay) + frame_count * sizeof(LONG));
|
||||
delay = calloc(1, sizeof(*delay) + frame_count * sizeof(LONG));
|
||||
if (delay)
|
||||
{
|
||||
LONG *value;
|
||||
|
@ -3360,7 +3360,7 @@ static void gif_metadata_reader(GpBitmap *bitmap, IWICBitmapDecoder *decoder, UI
|
|||
|
||||
if (!loop)
|
||||
{
|
||||
loop = heap_alloc_zero(sizeof(*loop) + sizeof(SHORT));
|
||||
loop = calloc(1, sizeof(*loop) + sizeof(SHORT));
|
||||
if (loop)
|
||||
{
|
||||
loop->type = PropertyTagTypeShort;
|
||||
|
@ -3377,11 +3377,11 @@ static void gif_metadata_reader(GpBitmap *bitmap, IWICBitmapDecoder *decoder, UI
|
|||
if (palette) add_property(bitmap, palette);
|
||||
if (background) add_property(bitmap, background);
|
||||
|
||||
heap_free(delay);
|
||||
heap_free(comment);
|
||||
heap_free(loop);
|
||||
heap_free(palette);
|
||||
heap_free(background);
|
||||
free(delay);
|
||||
free(comment);
|
||||
free(loop);
|
||||
free(palette);
|
||||
free(background);
|
||||
|
||||
/* Win7 gdiplus always returns transparent color index from frame 0 */
|
||||
hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
|
||||
|
@ -3409,7 +3409,7 @@ static void gif_metadata_reader(GpBitmap *bitmap, IWICBitmapDecoder *decoder, UI
|
|||
}
|
||||
|
||||
if (transparent_idx) add_property(bitmap, transparent_idx);
|
||||
heap_free(transparent_idx);
|
||||
free(transparent_idx);
|
||||
|
||||
IWICBitmapFrameDecode_Release(frame);
|
||||
}
|
||||
|
@ -3422,10 +3422,10 @@ static PropertyItem* create_prop(PROPID propid, PROPVARIANT* value)
|
|||
if (item_size)
|
||||
{
|
||||
item_size += sizeof(*item);
|
||||
item = heap_alloc_zero(item_size);
|
||||
item = calloc(1, item_size);
|
||||
if (propvariant_to_item(value, item, item_size, propid) != Ok)
|
||||
{
|
||||
heap_free(item);
|
||||
free(item);
|
||||
item = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -3476,7 +3476,7 @@ static HRESULT png_read_text(IWICMetadataReader *reader, GpBitmap *bitmap, BOOL
|
|||
};
|
||||
|
||||
if (*seen_text == NULL)
|
||||
*seen_text = heap_alloc_zero(sizeof(BOOL) * ARRAY_SIZE(keywords));
|
||||
*seen_text = calloc(ARRAY_SIZE(keywords), sizeof(BOOL));
|
||||
if (*seen_text == NULL)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
|
@ -3497,7 +3497,7 @@ static HRESULT png_read_text(IWICMetadataReader *reader, GpBitmap *bitmap, BOOL
|
|||
item = create_prop(keywords[i].propid, &value);
|
||||
if (item)
|
||||
add_property(bitmap, item);
|
||||
heap_free(item);
|
||||
free(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3512,7 +3512,7 @@ static HRESULT png_read_gamma(IWICMetadataReader *reader, GpBitmap *bitmap)
|
|||
PropertyItem* item;
|
||||
ULONG *rational;
|
||||
|
||||
item = heap_alloc_zero(sizeof(*item) + sizeof(ULONG) * 2);
|
||||
item = calloc(1, sizeof(*item) + sizeof(ULONG) * 2);
|
||||
if (!item)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
|
@ -3523,7 +3523,7 @@ static HRESULT png_read_gamma(IWICMetadataReader *reader, GpBitmap *bitmap)
|
|||
rational[0] = 100000;
|
||||
rational[1] = get_ulong_by_index(reader, 0);
|
||||
add_property(bitmap, item);
|
||||
heap_free(item);
|
||||
free(item);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -3533,7 +3533,7 @@ static HRESULT png_read_whitepoint(IWICMetadataReader *reader, GpBitmap *bitmap)
|
|||
PropertyItem* item;
|
||||
ULONG *rational;
|
||||
|
||||
item = heap_alloc_zero(sizeof(*item) + sizeof(ULONG) * 4);
|
||||
item = calloc(1, sizeof(*item) + sizeof(ULONG) * 4);
|
||||
if (!item)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
|
@ -3546,7 +3546,7 @@ static HRESULT png_read_whitepoint(IWICMetadataReader *reader, GpBitmap *bitmap)
|
|||
rational[2] = get_ulong_by_index(reader, 1);
|
||||
rational[3] = 100000;
|
||||
add_property(bitmap, item);
|
||||
heap_free(item);
|
||||
free(item);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -3556,7 +3556,7 @@ static HRESULT png_read_chromaticity(IWICMetadataReader *reader, GpBitmap *bitma
|
|||
PropertyItem* item;
|
||||
ULONG *rational;
|
||||
|
||||
item = heap_alloc_zero(sizeof(*item) + sizeof(ULONG) * 12);
|
||||
item = calloc(1, sizeof(*item) + sizeof(ULONG) * 12);
|
||||
if (!item)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
|
@ -3577,7 +3577,7 @@ static HRESULT png_read_chromaticity(IWICMetadataReader *reader, GpBitmap *bitma
|
|||
rational[10] = get_ulong_by_index(reader, 7);
|
||||
rational[11] = 100000;
|
||||
add_property(bitmap, item);
|
||||
heap_free(item);
|
||||
free(item);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -3608,7 +3608,7 @@ static HRESULT png_read_time(IWICMetadataReader *reader, GpBitmap *bitmap)
|
|||
}
|
||||
|
||||
item_size = 20;
|
||||
item = heap_alloc_zero(sizeof(*item) + item_size);
|
||||
item = calloc(1, sizeof(*item) + item_size);
|
||||
if (!item)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
|
@ -3620,7 +3620,7 @@ static HRESULT png_read_time(IWICMetadataReader *reader, GpBitmap *bitmap)
|
|||
datetime[0], datetime[1], datetime[2], datetime[3], datetime[4], datetime[5]);
|
||||
|
||||
add_property(bitmap, item);
|
||||
heap_free(item);
|
||||
free(item);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -3638,7 +3638,7 @@ static HRESULT png_read_histogram(IWICMetadataReader *reader, GpBitmap *bitmap)
|
|||
item = create_prop(PropertyTagPaletteHistogram, &value);
|
||||
if (item)
|
||||
add_property(bitmap, item);
|
||||
heap_free(item);
|
||||
free(item);
|
||||
|
||||
PropVariantClear(&value);
|
||||
|
||||
|
@ -3655,15 +3655,15 @@ static HRESULT png_add_unit_properties(IWICBitmapFrameDecode *frame, GpBitmap *b
|
|||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
unit = heap_alloc_zero(sizeof(*unit) + 1);
|
||||
unitX = heap_alloc_zero(sizeof(*unitX) + 4);
|
||||
unitY = heap_alloc_zero(sizeof(*unitY) + 4);
|
||||
unit = calloc(1, sizeof(*unit) + 1);
|
||||
unitX = calloc(1, sizeof(*unitX) + 4);
|
||||
unitY = calloc(1, sizeof(*unitY) + 4);
|
||||
|
||||
if (!unit || !unitX || !unitY)
|
||||
{
|
||||
heap_free(unit);
|
||||
heap_free(unitX);
|
||||
heap_free(unitY);
|
||||
free(unit);
|
||||
free(unitX);
|
||||
free(unitY);
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
|
@ -3673,7 +3673,7 @@ static HRESULT png_add_unit_properties(IWICBitmapFrameDecode *frame, GpBitmap *b
|
|||
unit->value = unit + 1;
|
||||
*(BYTE *)unit->value = 1;
|
||||
add_property(bitmap, unit);
|
||||
heap_free(unit);
|
||||
free(unit);
|
||||
|
||||
unitX->type = PropertyTagTypeLong;
|
||||
unitX->id = PropertyTagPixelPerUnitX;
|
||||
|
@ -3681,7 +3681,7 @@ static HRESULT png_add_unit_properties(IWICBitmapFrameDecode *frame, GpBitmap *b
|
|||
unitX->value = unitX + 1;
|
||||
*(ULONG *)unitX->value = (dpiX == 96.0) ? 0 : gdip_round(dpiX / 0.0254);
|
||||
add_property(bitmap, unitX);
|
||||
heap_free(unitX);
|
||||
free(unitX);
|
||||
|
||||
unitY->type = PropertyTagTypeLong;
|
||||
unitY->id = PropertyTagPixelPerUnitY;
|
||||
|
@ -3689,7 +3689,7 @@ static HRESULT png_add_unit_properties(IWICBitmapFrameDecode *frame, GpBitmap *b
|
|||
unitY->value = unitY + 1;
|
||||
*(ULONG *)unitY->value = (dpiY == 96.0) ? 0 : gdip_round(dpiY / 0.0254);
|
||||
add_property(bitmap, unitY);
|
||||
heap_free(unitY);
|
||||
free(unitY);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -3780,7 +3780,7 @@ static void png_metadata_reader(GpBitmap *bitmap, IWICBitmapDecoder *decoder, UI
|
|||
|
||||
IWICMetadataReader_Release(reader);
|
||||
}
|
||||
heap_free(seen_text);
|
||||
free(seen_text);
|
||||
|
||||
png_add_unit_properties(frame, bitmap);
|
||||
|
||||
|
@ -3953,7 +3953,7 @@ static GpStatus decode_frame_wic(IWICBitmapDecoder *decoder, BOOL force_conversi
|
|||
IWICBitmapDecoder_AddRef(decoder);
|
||||
if (palette)
|
||||
{
|
||||
heap_free(bitmap->image.palette);
|
||||
free(bitmap->image.palette);
|
||||
bitmap->image.palette = palette;
|
||||
}
|
||||
else
|
||||
|
@ -4011,7 +4011,7 @@ static GpStatus select_frame_wic(GpImage *image, UINT active_frame)
|
|||
body_offset = RTL_SIZEOF_THROUGH_FIELD(GpImage, lock);
|
||||
memcpy((char *)image + body_offset, (char *)new_image + body_offset, obj_size - body_offset);
|
||||
new_image->type = ~0;
|
||||
heap_free(new_image);
|
||||
free(new_image);
|
||||
return Ok;
|
||||
}
|
||||
|
||||
|
@ -4042,14 +4042,14 @@ static HRESULT blit_gif_frame(GpBitmap *bitmap, IWICBitmapFrameDecode *frame, BO
|
|||
if(FAILED(hr))
|
||||
return hr;
|
||||
|
||||
new_bits = heap_alloc_zero(width*height*4);
|
||||
new_bits = calloc(width * height, 4);
|
||||
if(!new_bits)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
hr = IWICBitmapSource_CopyPixels(source, NULL, width*4, width*height*4, new_bits);
|
||||
IWICBitmapSource_Release(source);
|
||||
if(FAILED(hr)) {
|
||||
heap_free(new_bits);
|
||||
free(new_bits);
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
@ -4062,7 +4062,7 @@ static HRESULT blit_gif_frame(GpBitmap *bitmap, IWICBitmapFrameDecode *frame, BO
|
|||
*dst = *src;
|
||||
}
|
||||
}
|
||||
heap_free(new_bits);
|
||||
free(new_bits);
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
@ -4287,7 +4287,7 @@ static GpStatus decode_image_gif(IStream* stream, GpImage **image)
|
|||
return status;
|
||||
|
||||
if(frame_count > 1) {
|
||||
heap_free((*image)->palette);
|
||||
free((*image)->palette);
|
||||
(*image)->palette = NULL;
|
||||
}
|
||||
return Ok;
|
||||
|
@ -4338,18 +4338,18 @@ static GpStatus load_wmf(IStream *stream, GpMetafile **metafile)
|
|||
hr = IStream_Seek(stream, seek, STREAM_SEEK_SET, NULL);
|
||||
if (FAILED(hr)) return hresult_to_status(hr);
|
||||
|
||||
buf = heap_alloc(mh.mtSize * 2);
|
||||
buf = malloc(mh.mtSize * 2);
|
||||
if (!buf) return OutOfMemory;
|
||||
|
||||
hr = IStream_Read(stream, buf, mh.mtSize * 2, &size);
|
||||
if (hr != S_OK || size != mh.mtSize * 2)
|
||||
{
|
||||
heap_free(buf);
|
||||
free(buf);
|
||||
return GenericError;
|
||||
}
|
||||
|
||||
hmf = SetMetaFileBitsEx(mh.mtSize * 2, buf);
|
||||
heap_free(buf);
|
||||
free(buf);
|
||||
if (!hmf)
|
||||
return GenericError;
|
||||
|
||||
|
@ -4400,18 +4400,18 @@ static GpStatus load_emf(IStream *stream, GpMetafile **metafile)
|
|||
hr = IStream_Seek(stream, seek, STREAM_SEEK_SET, NULL);
|
||||
if (FAILED(hr)) return hresult_to_status(hr);
|
||||
|
||||
buf = heap_alloc(emh.nBytes);
|
||||
buf = malloc(emh.nBytes);
|
||||
if (!buf) return OutOfMemory;
|
||||
|
||||
hr = IStream_Read(stream, buf, emh.nBytes, &size);
|
||||
if (hr != S_OK || size != emh.nBytes)
|
||||
{
|
||||
heap_free(buf);
|
||||
free(buf);
|
||||
return GenericError;
|
||||
}
|
||||
|
||||
hemf = SetEnhMetaFileBits(emh.nBytes, buf);
|
||||
heap_free(buf);
|
||||
free(buf);
|
||||
if (!hemf)
|
||||
return GenericError;
|
||||
|
||||
|
@ -5057,10 +5057,10 @@ GpStatus WINGDIPAPI GdipSetImagePalette(GpImage *image,
|
|||
if(!image || !palette || palette->Count > 256)
|
||||
return InvalidParameter;
|
||||
|
||||
new_palette = heap_alloc_zero(2 * sizeof(UINT) + palette->Count * sizeof(ARGB));
|
||||
new_palette = calloc(1, 2 * sizeof(UINT) + palette->Count * sizeof(ARGB));
|
||||
if (!new_palette) return OutOfMemory;
|
||||
|
||||
heap_free(image->palette);
|
||||
free(image->palette);
|
||||
image->palette = new_palette;
|
||||
image->palette->Flags = palette->Flags;
|
||||
image->palette->Count = palette->Count;
|
||||
|
@ -5541,7 +5541,7 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromHBITMAP(HBITMAP hbm, HPALETTE hpal, GpBi
|
|||
if (!num_palette_entries)
|
||||
num_palette_entries = 1 << pbmi->bmiHeader.biBitCount;
|
||||
|
||||
palette = heap_alloc_zero(sizeof(ColorPalette) + sizeof(ARGB) * (num_palette_entries-1));
|
||||
palette = calloc(1, sizeof(ColorPalette) + sizeof(ARGB) * (num_palette_entries - 1));
|
||||
if (!palette)
|
||||
retval = OutOfMemory;
|
||||
else
|
||||
|
@ -5558,7 +5558,7 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromHBITMAP(HBITMAP hbm, HPALETTE hpal, GpBi
|
|||
retval = GdipSetImagePalette(&(*bitmap)->image, palette);
|
||||
}
|
||||
|
||||
heap_free(palette);
|
||||
free(palette);
|
||||
}
|
||||
|
||||
if (retval != Ok)
|
||||
|
@ -6076,7 +6076,7 @@ GpStatus WINGDIPAPI GdipInitializePalette(ColorPalette *palette,
|
|||
else
|
||||
status = GenericError;
|
||||
|
||||
heap_free(wic_palette);
|
||||
free(wic_palette);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ GpStatus WINGDIPAPI GdipCloneImageAttributes(GDIPCONST GpImageAttributes *imagea
|
|||
{
|
||||
remap_tables[i].enabled = TRUE;
|
||||
remap_tables[i].mapsize = imageattr->colorremaptables[i].mapsize;
|
||||
remap_tables[i].colormap = heap_alloc(sizeof(ColorMap) * remap_tables[i].mapsize);
|
||||
remap_tables[i].colormap = malloc(sizeof(ColorMap) * remap_tables[i].mapsize);
|
||||
|
||||
if (remap_tables[i].colormap)
|
||||
{
|
||||
|
@ -73,7 +73,7 @@ GpStatus WINGDIPAPI GdipCloneImageAttributes(GDIPCONST GpImageAttributes *imagea
|
|||
if (stat != Ok)
|
||||
{
|
||||
for (i=0; i<ColorAdjustTypeCount; i++)
|
||||
heap_free(remap_tables[i].colormap);
|
||||
free(remap_tables[i].colormap);
|
||||
}
|
||||
|
||||
return stat;
|
||||
|
@ -84,8 +84,8 @@ GpStatus WINGDIPAPI GdipCreateImageAttributes(GpImageAttributes **imageattr)
|
|||
if(!imageattr)
|
||||
return InvalidParameter;
|
||||
|
||||
*imageattr = heap_alloc_zero(sizeof(GpImageAttributes));
|
||||
if(!*imageattr) return OutOfMemory;
|
||||
*imageattr = calloc(1, sizeof(GpImageAttributes));
|
||||
if(!*imageattr) return OutOfMemory;
|
||||
|
||||
(*imageattr)->wrap = WrapModeClamp;
|
||||
|
||||
|
@ -104,9 +104,9 @@ GpStatus WINGDIPAPI GdipDisposeImageAttributes(GpImageAttributes *imageattr)
|
|||
return InvalidParameter;
|
||||
|
||||
for (i=0; i<ColorAdjustTypeCount; i++)
|
||||
heap_free(imageattr->colorremaptables[i].colormap);
|
||||
free(imageattr->colorremaptables[i].colormap);
|
||||
|
||||
heap_free(imageattr);
|
||||
free(imageattr);
|
||||
|
||||
return Ok;
|
||||
}
|
||||
|
@ -271,21 +271,21 @@ GpStatus WINGDIPAPI GdipSetImageAttributesRemapTable(GpImageAttributes *imageAtt
|
|||
if(!map || !mapSize)
|
||||
return InvalidParameter;
|
||||
|
||||
new_map = heap_alloc_zero(sizeof(*map) * mapSize);
|
||||
new_map = malloc(sizeof(*map) * mapSize);
|
||||
|
||||
if (!new_map)
|
||||
return OutOfMemory;
|
||||
|
||||
memcpy(new_map, map, sizeof(*map) * mapSize);
|
||||
|
||||
heap_free(imageAttr->colorremaptables[type].colormap);
|
||||
free(imageAttr->colorremaptables[type].colormap);
|
||||
|
||||
imageAttr->colorremaptables[type].mapsize = mapSize;
|
||||
imageAttr->colorremaptables[type].colormap = new_map;
|
||||
}
|
||||
else
|
||||
{
|
||||
heap_free(imageAttr->colorremaptables[type].colormap);
|
||||
free(imageAttr->colorremaptables[type].colormap);
|
||||
imageAttr->colorremaptables[type].colormap = NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -64,8 +64,8 @@ GpStatus WINGDIPAPI GdipCreateMatrix2(REAL m11, REAL m12, REAL m21, REAL m22,
|
|||
if(!matrix)
|
||||
return InvalidParameter;
|
||||
|
||||
*matrix = heap_alloc_zero(sizeof(GpMatrix));
|
||||
if(!*matrix) return OutOfMemory;
|
||||
*matrix = malloc(sizeof(GpMatrix));
|
||||
if(!*matrix) return OutOfMemory;
|
||||
|
||||
/* first row */
|
||||
(*matrix)->matrix[0] = m11;
|
||||
|
@ -125,8 +125,8 @@ GpStatus WINGDIPAPI GdipCloneMatrix(GpMatrix *matrix, GpMatrix **clone)
|
|||
if(!matrix || !clone)
|
||||
return InvalidParameter;
|
||||
|
||||
*clone = heap_alloc_zero(sizeof(GpMatrix));
|
||||
if(!*clone) return OutOfMemory;
|
||||
*clone = malloc(sizeof(GpMatrix));
|
||||
if(!*clone) return OutOfMemory;
|
||||
|
||||
**clone = *matrix;
|
||||
|
||||
|
@ -140,8 +140,8 @@ GpStatus WINGDIPAPI GdipCreateMatrix(GpMatrix **matrix)
|
|||
if(!matrix)
|
||||
return InvalidParameter;
|
||||
|
||||
*matrix = heap_alloc_zero(sizeof(GpMatrix));
|
||||
if(!*matrix) return OutOfMemory;
|
||||
*matrix = malloc(sizeof(GpMatrix));
|
||||
if(!*matrix) return OutOfMemory;
|
||||
|
||||
(*matrix)->matrix[0] = 1.0;
|
||||
(*matrix)->matrix[1] = 0.0;
|
||||
|
@ -160,7 +160,7 @@ GpStatus WINGDIPAPI GdipDeleteMatrix(GpMatrix *matrix)
|
|||
if(!matrix)
|
||||
return InvalidParameter;
|
||||
|
||||
heap_free(matrix);
|
||||
free(matrix);
|
||||
|
||||
return Ok;
|
||||
}
|
||||
|
@ -396,7 +396,7 @@ GpStatus WINGDIPAPI GdipTransformMatrixPointsI(GpMatrix *matrix, GpPoint *pts, I
|
|||
if(count <= 0)
|
||||
return InvalidParameter;
|
||||
|
||||
ptsF = heap_alloc_zero(sizeof(GpPointF) * count);
|
||||
ptsF = malloc(sizeof(GpPointF) * count);
|
||||
if(!ptsF)
|
||||
return OutOfMemory;
|
||||
|
||||
|
@ -412,7 +412,7 @@ GpStatus WINGDIPAPI GdipTransformMatrixPointsI(GpMatrix *matrix, GpPoint *pts, I
|
|||
pts[i].X = gdip_round(ptsF[i].X);
|
||||
pts[i].Y = gdip_round(ptsF[i].Y);
|
||||
}
|
||||
heap_free(ptsF);
|
||||
free(ptsF);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -476,7 +476,7 @@ GpStatus WINGDIPAPI GdipVectorTransformMatrixPointsI(GpMatrix *matrix, GpPoint *
|
|||
if(count <= 0)
|
||||
return InvalidParameter;
|
||||
|
||||
ptsF = heap_alloc_zero(sizeof(GpPointF) * count);
|
||||
ptsF = malloc(sizeof(GpPointF) * count);
|
||||
if(!ptsF)
|
||||
return OutOfMemory;
|
||||
|
||||
|
@ -492,7 +492,7 @@ GpStatus WINGDIPAPI GdipVectorTransformMatrixPointsI(GpMatrix *matrix, GpPoint *
|
|||
pts[i].X = gdip_round(ptsF[i].X);
|
||||
pts[i].Y = gdip_round(ptsF[i].Y);
|
||||
}
|
||||
heap_free(ptsF);
|
||||
free(ptsF);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -688,7 +688,7 @@ void METAFILE_Free(GpMetafile *metafile)
|
|||
{
|
||||
unsigned int i;
|
||||
|
||||
heap_free(metafile->comment_data);
|
||||
free(metafile->comment_data);
|
||||
DeleteEnhMetaFile(CloseEnhMetaFile(metafile->record_dc));
|
||||
if (!metafile->preserve_hemf)
|
||||
DeleteEnhMetaFile(metafile->hemf);
|
||||
|
@ -721,7 +721,7 @@ static GpStatus METAFILE_AllocateRecord(GpMetafile *metafile, EmfPlusRecordType
|
|||
if (!metafile->comment_data_size)
|
||||
{
|
||||
DWORD data_size = max(256, size * 2 + 4);
|
||||
metafile->comment_data = heap_alloc_zero(data_size);
|
||||
metafile->comment_data = calloc(1, data_size);
|
||||
|
||||
if (!metafile->comment_data)
|
||||
return OutOfMemory;
|
||||
|
@ -737,7 +737,7 @@ static GpStatus METAFILE_AllocateRecord(GpMetafile *metafile, EmfPlusRecordType
|
|||
if (size_needed > metafile->comment_data_size)
|
||||
{
|
||||
DWORD data_size = size_needed * 2;
|
||||
BYTE *new_data = heap_alloc_zero(data_size);
|
||||
BYTE *new_data = calloc(1, data_size);
|
||||
|
||||
if (!new_data)
|
||||
return OutOfMemory;
|
||||
|
@ -745,7 +745,7 @@ static GpStatus METAFILE_AllocateRecord(GpMetafile *metafile, EmfPlusRecordType
|
|||
memcpy(new_data, metafile->comment_data, metafile->comment_data_length);
|
||||
|
||||
metafile->comment_data_size = data_size;
|
||||
heap_free(metafile->comment_data);
|
||||
free(metafile->comment_data);
|
||||
metafile->comment_data = new_data;
|
||||
}
|
||||
|
||||
|
@ -1682,7 +1682,7 @@ GpStatus METAFILE_GraphicsDeleted(GpMetafile* metafile)
|
|||
metafile->hemf = CloseEnhMetaFile(metafile->record_dc);
|
||||
metafile->record_dc = NULL;
|
||||
|
||||
heap_free(metafile->comment_data);
|
||||
free(metafile->comment_data);
|
||||
metafile->comment_data = NULL;
|
||||
metafile->comment_data_size = 0;
|
||||
|
||||
|
@ -1719,7 +1719,7 @@ GpStatus METAFILE_GraphicsDeleted(GpMetafile* metafile)
|
|||
bounds_rc.bottom = ceilf(metafile->auto_frame_max.Y * y_scale);
|
||||
|
||||
buffer_size = GetEnhMetaFileBits(metafile->hemf, 0, NULL);
|
||||
buffer = heap_alloc(buffer_size);
|
||||
buffer = malloc(buffer_size);
|
||||
if (buffer)
|
||||
{
|
||||
HENHMETAFILE new_hemf;
|
||||
|
@ -1738,7 +1738,7 @@ GpStatus METAFILE_GraphicsDeleted(GpMetafile* metafile)
|
|||
else
|
||||
stat = OutOfMemory;
|
||||
|
||||
heap_free(buffer);
|
||||
free(buffer);
|
||||
}
|
||||
else
|
||||
stat = OutOfMemory;
|
||||
|
@ -1762,7 +1762,7 @@ GpStatus METAFILE_GraphicsDeleted(GpMetafile* metafile)
|
|||
|
||||
buffer_size = GetEnhMetaFileBits(metafile->hemf, 0, NULL);
|
||||
|
||||
buffer = heap_alloc(buffer_size);
|
||||
buffer = malloc(buffer_size);
|
||||
if (buffer)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
@ -1774,7 +1774,7 @@ GpStatus METAFILE_GraphicsDeleted(GpMetafile* metafile)
|
|||
if (FAILED(hr))
|
||||
stat = hresult_to_status(hr);
|
||||
|
||||
heap_free(buffer);
|
||||
free(buffer);
|
||||
}
|
||||
else
|
||||
stat = OutOfMemory;
|
||||
|
@ -2040,8 +2040,8 @@ static GpStatus metafile_deserialize_path(const BYTE *record_data, UINT data_siz
|
|||
return status;
|
||||
|
||||
(*path)->pathdata.Count = data->PathPointCount;
|
||||
(*path)->pathdata.Points = GdipAlloc(data->PathPointCount * sizeof(*(*path)->pathdata.Points));
|
||||
(*path)->pathdata.Types = GdipAlloc(data->PathPointCount * sizeof(*(*path)->pathdata.Types));
|
||||
(*path)->pathdata.Points = malloc(data->PathPointCount * sizeof(*(*path)->pathdata.Points));
|
||||
(*path)->pathdata.Types = malloc(data->PathPointCount * sizeof(*(*path)->pathdata.Types));
|
||||
(*path)->datalen = (*path)->pathdata.Count;
|
||||
|
||||
if (!(*path)->pathdata.Points || !(*path)->pathdata.Types)
|
||||
|
@ -2093,14 +2093,14 @@ static GpStatus metafile_read_region_node(struct memory_buffer *mbuf, GpRegion *
|
|||
{
|
||||
region_element *left, *right;
|
||||
|
||||
left = heap_alloc_zero(sizeof(*left));
|
||||
left = calloc(1, sizeof(*left));
|
||||
if (!left)
|
||||
return OutOfMemory;
|
||||
|
||||
right = heap_alloc_zero(sizeof(*right));
|
||||
right = calloc(1, sizeof(*right));
|
||||
if (!right)
|
||||
{
|
||||
heap_free(left);
|
||||
free(left);
|
||||
return OutOfMemory;
|
||||
}
|
||||
|
||||
|
@ -2117,8 +2117,8 @@ static GpStatus metafile_read_region_node(struct memory_buffer *mbuf, GpRegion *
|
|||
}
|
||||
}
|
||||
|
||||
heap_free(left);
|
||||
heap_free(right);
|
||||
free(left);
|
||||
free(right);
|
||||
return status;
|
||||
}
|
||||
case RegionDataRect:
|
||||
|
@ -2707,14 +2707,14 @@ static GpStatus METAFILE_PlaybackObject(GpMetafile *metafile, UINT flags, UINT d
|
|||
if (data_size < data->Length * sizeof(WCHAR))
|
||||
return InvalidParameter;
|
||||
|
||||
if (!(familyname = GdipAlloc((data->Length + 1) * sizeof(*familyname))))
|
||||
if (!(familyname = malloc((data->Length + 1) * sizeof(*familyname))))
|
||||
return OutOfMemory;
|
||||
|
||||
memcpy(familyname, data->FamilyName, data->Length * sizeof(*familyname));
|
||||
familyname[data->Length] = 0;
|
||||
|
||||
status = GdipCreateFontFamilyFromName(familyname, NULL, &family);
|
||||
GdipFree(familyname);
|
||||
free(familyname);
|
||||
|
||||
/* If a font family cannot be created from family name, native
|
||||
falls back to a sans serif font. */
|
||||
|
@ -2785,7 +2785,7 @@ GpStatus WINGDIPAPI GdipPlayMetafileRecord(GDIPCONST GpMetafile *metafile,
|
|||
/* regular EMF record */
|
||||
if (metafile->playback_dc)
|
||||
{
|
||||
ENHMETARECORD *record = heap_alloc_zero(dataSize + 8);
|
||||
ENHMETARECORD *record = calloc(1, dataSize + 8);
|
||||
|
||||
if (record)
|
||||
{
|
||||
|
@ -2800,7 +2800,7 @@ GpStatus WINGDIPAPI GdipPlayMetafileRecord(GDIPCONST GpMetafile *metafile,
|
|||
record, metafile->handle_count) == 0)
|
||||
ERR("PlayEnhMetaFileRecord failed\n");
|
||||
|
||||
heap_free(record);
|
||||
free(record);
|
||||
}
|
||||
else
|
||||
return OutOfMemory;
|
||||
|
@ -2871,7 +2871,7 @@ GpStatus WINGDIPAPI GdipPlayMetafileRecord(GDIPCONST GpMetafile *metafile,
|
|||
EmfPlusRect *int_rects = (EmfPlusRect*)(record+1);
|
||||
int i;
|
||||
|
||||
rects = temp_rects = heap_alloc_zero(sizeof(GpRectF) * record->Count);
|
||||
rects = temp_rects = calloc(record->Count, sizeof(GpRectF));
|
||||
if (rects)
|
||||
{
|
||||
for (i=0; i<record->Count; i++)
|
||||
|
@ -2895,7 +2895,7 @@ GpStatus WINGDIPAPI GdipPlayMetafileRecord(GDIPCONST GpMetafile *metafile,
|
|||
}
|
||||
|
||||
GdipDeleteBrush(temp_brush);
|
||||
heap_free(temp_rects);
|
||||
free(temp_rects);
|
||||
|
||||
return stat;
|
||||
}
|
||||
|
@ -3050,14 +3050,14 @@ GpStatus WINGDIPAPI GdipPlayMetafileRecord(GDIPCONST GpMetafile *metafile,
|
|||
GpRectF scaled_srcrect;
|
||||
GpMatrix transform;
|
||||
|
||||
cont = heap_alloc_zero(sizeof(*cont));
|
||||
cont = calloc(1, sizeof(*cont));
|
||||
if (!cont)
|
||||
return OutOfMemory;
|
||||
|
||||
stat = GdipCloneRegion(metafile->clip, &cont->clip);
|
||||
if (stat != Ok)
|
||||
{
|
||||
heap_free(cont);
|
||||
free(cont);
|
||||
return stat;
|
||||
}
|
||||
|
||||
|
@ -3066,7 +3066,7 @@ GpStatus WINGDIPAPI GdipPlayMetafileRecord(GDIPCONST GpMetafile *metafile,
|
|||
if (stat != Ok)
|
||||
{
|
||||
GdipDeleteRegion(cont->clip);
|
||||
heap_free(cont);
|
||||
free(cont);
|
||||
return stat;
|
||||
}
|
||||
|
||||
|
@ -3104,14 +3104,14 @@ GpStatus WINGDIPAPI GdipPlayMetafileRecord(GDIPCONST GpMetafile *metafile,
|
|||
EmfPlusContainerRecord *record = (EmfPlusContainerRecord*)header;
|
||||
container* cont;
|
||||
|
||||
cont = heap_alloc_zero(sizeof(*cont));
|
||||
cont = calloc(1, sizeof(*cont));
|
||||
if (!cont)
|
||||
return OutOfMemory;
|
||||
|
||||
stat = GdipCloneRegion(metafile->clip, &cont->clip);
|
||||
if (stat != Ok)
|
||||
{
|
||||
heap_free(cont);
|
||||
free(cont);
|
||||
return stat;
|
||||
}
|
||||
|
||||
|
@ -3123,7 +3123,7 @@ GpStatus WINGDIPAPI GdipPlayMetafileRecord(GDIPCONST GpMetafile *metafile,
|
|||
if (stat != Ok)
|
||||
{
|
||||
GdipDeleteRegion(cont->clip);
|
||||
heap_free(cont);
|
||||
free(cont);
|
||||
return stat;
|
||||
}
|
||||
|
||||
|
@ -3170,7 +3170,7 @@ GpStatus WINGDIPAPI GdipPlayMetafileRecord(GDIPCONST GpMetafile *metafile,
|
|||
{
|
||||
list_remove(&cont2->entry);
|
||||
GdipDeleteRegion(cont2->clip);
|
||||
heap_free(cont2);
|
||||
free(cont2);
|
||||
}
|
||||
|
||||
if (type == BEGIN_CONTAINER)
|
||||
|
@ -3185,7 +3185,7 @@ GpStatus WINGDIPAPI GdipPlayMetafileRecord(GDIPCONST GpMetafile *metafile,
|
|||
|
||||
list_remove(&cont->entry);
|
||||
GdipDeleteRegion(cont->clip);
|
||||
heap_free(cont);
|
||||
free(cont);
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -3399,7 +3399,7 @@ GpStatus WINGDIPAPI GdipPlayMetafileRecord(GDIPCONST GpMetafile *metafile,
|
|||
|
||||
if (flags & (0x800 | 0x4000))
|
||||
{
|
||||
GpPointF *points = GdipAlloc(fill->Count * sizeof(*points));
|
||||
GpPointF *points = malloc(fill->Count * sizeof(*points));
|
||||
if (points)
|
||||
{
|
||||
if (flags & 0x800) /* P */
|
||||
|
@ -3421,7 +3421,7 @@ GpStatus WINGDIPAPI GdipPlayMetafileRecord(GDIPCONST GpMetafile *metafile,
|
|||
|
||||
stat = GdipFillClosedCurve2(real_metafile->playback_graphics, brush,
|
||||
points, fill->Count, fill->Tension, mode);
|
||||
GdipFree(points);
|
||||
free(points);
|
||||
}
|
||||
else
|
||||
stat = OutOfMemory;
|
||||
|
@ -3613,7 +3613,7 @@ GpStatus WINGDIPAPI GdipPlayMetafileRecord(GDIPCONST GpMetafile *metafile,
|
|||
{
|
||||
DWORD i;
|
||||
|
||||
rects = GdipAlloc(draw->Count * sizeof(*rects));
|
||||
rects = malloc(draw->Count * sizeof(*rects));
|
||||
if (!rects)
|
||||
return OutOfMemory;
|
||||
|
||||
|
@ -3628,7 +3628,7 @@ GpStatus WINGDIPAPI GdipPlayMetafileRecord(GDIPCONST GpMetafile *metafile,
|
|||
|
||||
stat = GdipDrawRectangles(real_metafile->playback_graphics, real_metafile->objtable[pen].u.pen,
|
||||
rects ? rects : (GpRectF *)draw->RectData.rectF, draw->Count);
|
||||
GdipFree(rects);
|
||||
free(rects);
|
||||
return stat;
|
||||
}
|
||||
case EmfPlusRecordTypeDrawDriverString:
|
||||
|
@ -3692,7 +3692,7 @@ GpStatus WINGDIPAPI GdipPlayMetafileRecord(GDIPCONST GpMetafile *metafile,
|
|||
if (draw->MatrixPresent)
|
||||
alloc_size += sizeof(*matrix);
|
||||
|
||||
positions = alignedmem = heap_alloc(alloc_size);
|
||||
positions = alignedmem = malloc(alloc_size);
|
||||
if (!positions)
|
||||
{
|
||||
GdipDeleteBrush((GpBrush*)solidfill);
|
||||
|
@ -3712,7 +3712,7 @@ GpStatus WINGDIPAPI GdipPlayMetafileRecord(GDIPCONST GpMetafile *metafile,
|
|||
draw->DriverStringOptionsFlags, matrix);
|
||||
|
||||
GdipDeleteBrush((GpBrush*)solidfill);
|
||||
heap_free(alignedmem);
|
||||
free(alignedmem);
|
||||
|
||||
return stat;
|
||||
}
|
||||
|
@ -3948,7 +3948,7 @@ GpStatus WINGDIPAPI GdipEnumerateMetafileSrcRectDestPoints(GpGraphics *graphics,
|
|||
container* cont = LIST_ENTRY(list_head(&real_metafile->containers), container, entry);
|
||||
list_remove(&cont->entry);
|
||||
GdipDeleteRegion(cont->clip);
|
||||
heap_free(cont);
|
||||
free(cont);
|
||||
}
|
||||
|
||||
GdipEndContainer(graphics, state);
|
||||
|
@ -4248,7 +4248,7 @@ GpStatus WINGDIPAPI GdipCreateMetafileFromEmf(HENHMETAFILE hemf, BOOL delete,
|
|||
if (stat != Ok)
|
||||
return stat;
|
||||
|
||||
*metafile = heap_alloc_zero(sizeof(GpMetafile));
|
||||
*metafile = calloc(1, sizeof(GpMetafile));
|
||||
if (!*metafile)
|
||||
return OutOfMemory;
|
||||
|
||||
|
@ -4296,11 +4296,11 @@ GpStatus WINGDIPAPI GdipCreateMetafileFromWmf(HMETAFILE hwmf, BOOL delete,
|
|||
read = GetMetaFileBitsEx(hwmf, 0, NULL);
|
||||
if(!read)
|
||||
return GenericError;
|
||||
copy = heap_alloc_zero(read);
|
||||
copy = malloc(read);
|
||||
GetMetaFileBitsEx(hwmf, read, copy);
|
||||
|
||||
hemf = SetWinMetaFileBits(read, copy, NULL, NULL);
|
||||
heap_free(copy);
|
||||
free(copy);
|
||||
|
||||
/* FIXME: We should store and use hwmf instead of converting to hemf */
|
||||
retval = GdipCreateMetafileFromEmf(hemf, TRUE, metafile);
|
||||
|
@ -4516,7 +4516,7 @@ GpStatus WINGDIPAPI GdipRecordMetafileFileName(GDIPCONST WCHAR* fileName,
|
|||
if (!record_dc)
|
||||
return GenericError;
|
||||
|
||||
*metafile = heap_alloc_zero(sizeof(GpMetafile));
|
||||
*metafile = calloc(1, sizeof(GpMetafile));
|
||||
if(!*metafile)
|
||||
{
|
||||
DeleteEnhMetaFile(CloseEnhMetaFile(record_dc));
|
||||
|
@ -4557,7 +4557,7 @@ GpStatus WINGDIPAPI GdipRecordMetafileFileName(GDIPCONST WCHAR* fileName,
|
|||
if (stat != Ok)
|
||||
{
|
||||
DeleteEnhMetaFile(CloseEnhMetaFile(record_dc));
|
||||
heap_free(*metafile);
|
||||
free(*metafile);
|
||||
*metafile = NULL;
|
||||
return OutOfMemory;
|
||||
}
|
||||
|
|
|
@ -40,14 +40,14 @@ GpStatus WINGDIPAPI GdipCreatePathIter(GpPathIterator **iterator, GpPath* path)
|
|||
if(!iterator)
|
||||
return InvalidParameter;
|
||||
|
||||
*iterator = heap_alloc_zero(sizeof(GpPathIterator));
|
||||
if(!*iterator) return OutOfMemory;
|
||||
*iterator = calloc(1, sizeof(GpPathIterator));
|
||||
if(!*iterator) return OutOfMemory;
|
||||
|
||||
if(path){
|
||||
size = path->pathdata.Count;
|
||||
|
||||
(*iterator)->pathdata.Types = heap_alloc_zero(size);
|
||||
(*iterator)->pathdata.Points = heap_alloc_zero(size * sizeof(PointF));
|
||||
(*iterator)->pathdata.Types = malloc(size);
|
||||
(*iterator)->pathdata.Points = malloc(size * sizeof(PointF));
|
||||
|
||||
memcpy((*iterator)->pathdata.Types, path->pathdata.Types, size);
|
||||
memcpy((*iterator)->pathdata.Points, path->pathdata.Points,size * sizeof(PointF));
|
||||
|
@ -73,9 +73,9 @@ GpStatus WINGDIPAPI GdipDeletePathIter(GpPathIterator *iter)
|
|||
if(!iter)
|
||||
return InvalidParameter;
|
||||
|
||||
heap_free(iter->pathdata.Types);
|
||||
heap_free(iter->pathdata.Points);
|
||||
heap_free(iter);
|
||||
free(iter->pathdata.Types);
|
||||
free(iter->pathdata.Points);
|
||||
free(iter);
|
||||
|
||||
return Ok;
|
||||
}
|
||||
|
|
|
@ -94,8 +94,8 @@ GpStatus WINGDIPAPI GdipClonePen(GpPen *pen, GpPen **clonepen)
|
|||
if(!pen || !clonepen)
|
||||
return InvalidParameter;
|
||||
|
||||
*clonepen = heap_alloc_zero(sizeof(GpPen));
|
||||
if(!*clonepen) return OutOfMemory;
|
||||
*clonepen = malloc(sizeof(GpPen));
|
||||
if(!*clonepen) return OutOfMemory;
|
||||
|
||||
**clonepen = *pen;
|
||||
|
||||
|
@ -115,7 +115,7 @@ GpStatus WINGDIPAPI GdipClonePen(GpPen *pen, GpPen **clonepen)
|
|||
|
||||
if (stat == Ok && pen->dashes)
|
||||
{
|
||||
(*clonepen)->dashes = heap_alloc_zero(pen->numdashes * sizeof(REAL));
|
||||
(*clonepen)->dashes = malloc(pen->numdashes * sizeof(REAL));
|
||||
if ((*clonepen)->dashes)
|
||||
memcpy((*clonepen)->dashes, pen->dashes, pen->numdashes * sizeof(REAL));
|
||||
else
|
||||
|
@ -124,7 +124,7 @@ GpStatus WINGDIPAPI GdipClonePen(GpPen *pen, GpPen **clonepen)
|
|||
|
||||
if (stat == Ok && pen->compound_array)
|
||||
{
|
||||
(*clonepen)->compound_array = heap_alloc_zero(pen->compound_array_size * sizeof(REAL));
|
||||
(*clonepen)->compound_array = malloc(pen->compound_array_size * sizeof(REAL));
|
||||
if ((*clonepen)->compound_array)
|
||||
memcpy((*clonepen)->compound_array, pen->compound_array, pen->compound_array_size * sizeof(REAL));
|
||||
else
|
||||
|
@ -168,8 +168,8 @@ GpStatus WINGDIPAPI GdipCreatePen2(GpBrush *brush, REAL width, GpUnit unit,
|
|||
if(!pen || !brush)
|
||||
return InvalidParameter;
|
||||
|
||||
gp_pen = heap_alloc_zero(sizeof(GpPen));
|
||||
if(!gp_pen) return OutOfMemory;
|
||||
gp_pen = calloc(1, sizeof(GpPen));
|
||||
if(!gp_pen) return OutOfMemory;
|
||||
|
||||
gp_pen->style = GP_DEFAULT_PENSTYLE;
|
||||
gp_pen->width = width;
|
||||
|
@ -187,7 +187,7 @@ GpStatus WINGDIPAPI GdipCreatePen2(GpBrush *brush, REAL width, GpUnit unit,
|
|||
|
||||
if(!((gp_pen->unit == UnitWorld) || (gp_pen->unit == UnitPixel))) {
|
||||
FIXME("UnitWorld, UnitPixel only supported units\n");
|
||||
heap_free(gp_pen);
|
||||
free(gp_pen);
|
||||
return NotImplemented;
|
||||
}
|
||||
|
||||
|
@ -210,9 +210,9 @@ GpStatus WINGDIPAPI GdipDeletePen(GpPen *pen)
|
|||
GdipDeleteBrush(pen->brush);
|
||||
GdipDeleteCustomLineCap(pen->customstart);
|
||||
GdipDeleteCustomLineCap(pen->customend);
|
||||
heap_free(pen->compound_array);
|
||||
heap_free(pen->dashes);
|
||||
heap_free(pen);
|
||||
free(pen->compound_array);
|
||||
free(pen->dashes);
|
||||
free(pen);
|
||||
|
||||
return Ok;
|
||||
}
|
||||
|
@ -577,10 +577,10 @@ GpStatus WINGDIPAPI GdipSetPenCompoundArray(GpPen *pen, GDIPCONST REAL *compound
|
|||
return InvalidParameter;
|
||||
}
|
||||
|
||||
tmp = heap_alloc_zero(count * sizeof(REAL));
|
||||
tmp = malloc(count * sizeof(REAL));
|
||||
if(!tmp)
|
||||
return OutOfMemory;
|
||||
heap_free(pen->compound_array);
|
||||
free(pen->compound_array);
|
||||
pen->compound_array = tmp;
|
||||
memcpy(pen->compound_array, compoundarray, count * sizeof(REAL));
|
||||
pen->compound_array_size = count;
|
||||
|
@ -643,11 +643,11 @@ GpStatus WINGDIPAPI GdipSetPenDashArray(GpPen *pen, GDIPCONST REAL *dash,
|
|||
return InvalidParameter;
|
||||
}
|
||||
|
||||
heap_free(pen->dashes);
|
||||
free(pen->dashes);
|
||||
pen->dashes = NULL;
|
||||
|
||||
if(count > 0)
|
||||
pen->dashes = heap_alloc_zero(count * sizeof(REAL));
|
||||
pen->dashes = malloc(count * sizeof(REAL));
|
||||
if(!pen->dashes){
|
||||
pen->numdashes = 0;
|
||||
return OutOfMemory;
|
||||
|
@ -693,7 +693,7 @@ GpStatus WINGDIPAPI GdipSetPenDashStyle(GpPen *pen, GpDashStyle dash)
|
|||
return InvalidParameter;
|
||||
|
||||
if(dash != DashStyleCustom){
|
||||
heap_free(pen->dashes);
|
||||
free(pen->dashes);
|
||||
pen->dashes = NULL;
|
||||
pen->numdashes = 0;
|
||||
}
|
||||
|
|
|
@ -144,7 +144,7 @@ static inline GpStatus clone_element(const region_element* element,
|
|||
|
||||
/* root node is allocated with GpRegion */
|
||||
if(!*element2){
|
||||
*element2 = heap_alloc_zero(sizeof(region_element));
|
||||
*element2 = calloc(1, sizeof(region_element));
|
||||
if (!*element2)
|
||||
return OutOfMemory;
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ GpStatus WINGDIPAPI GdipCloneRegion(GpRegion *region, GpRegion **clone)
|
|||
if (!(region && clone))
|
||||
return InvalidParameter;
|
||||
|
||||
*clone = heap_alloc_zero(sizeof(GpRegion));
|
||||
*clone = calloc(1, sizeof(GpRegion));
|
||||
if (!*clone)
|
||||
return OutOfMemory;
|
||||
element = &(*clone)->node;
|
||||
|
@ -248,11 +248,11 @@ GpStatus WINGDIPAPI GdipCombineRegionPath(GpRegion *region, GpPath *path, Combin
|
|||
if(mode == CombineModeReplace){
|
||||
delete_element(®ion->node);
|
||||
memcpy(region, path_region, sizeof(GpRegion));
|
||||
heap_free(path_region);
|
||||
free(path_region);
|
||||
return Ok;
|
||||
}
|
||||
|
||||
left = heap_alloc_zero(sizeof(region_element));
|
||||
left = malloc(sizeof(region_element));
|
||||
if (left)
|
||||
{
|
||||
*left = region->node;
|
||||
|
@ -267,7 +267,7 @@ GpStatus WINGDIPAPI GdipCombineRegionPath(GpRegion *region, GpPath *path, Combin
|
|||
else
|
||||
stat = OutOfMemory;
|
||||
|
||||
heap_free(left);
|
||||
free(left);
|
||||
GdipDeleteRegion(path_region);
|
||||
return stat;
|
||||
}
|
||||
|
@ -295,11 +295,11 @@ GpStatus WINGDIPAPI GdipCombineRegionRect(GpRegion *region,
|
|||
if(mode == CombineModeReplace){
|
||||
delete_element(®ion->node);
|
||||
memcpy(region, rect_region, sizeof(GpRegion));
|
||||
heap_free(rect_region);
|
||||
free(rect_region);
|
||||
return Ok;
|
||||
}
|
||||
|
||||
left = heap_alloc_zero(sizeof(region_element));
|
||||
left = malloc(sizeof(region_element));
|
||||
if (left)
|
||||
{
|
||||
memcpy(left, ®ion->node, sizeof(region_element));
|
||||
|
@ -314,7 +314,7 @@ GpStatus WINGDIPAPI GdipCombineRegionRect(GpRegion *region,
|
|||
else
|
||||
stat = OutOfMemory;
|
||||
|
||||
heap_free(left);
|
||||
free(left);
|
||||
GdipDeleteRegion(rect_region);
|
||||
return stat;
|
||||
}
|
||||
|
@ -358,11 +358,11 @@ GpStatus WINGDIPAPI GdipCombineRegionRegion(GpRegion *region1,
|
|||
|
||||
delete_element(®ion1->node);
|
||||
memcpy(region1, reg2copy, sizeof(GpRegion));
|
||||
heap_free(reg2copy);
|
||||
free(reg2copy);
|
||||
return Ok;
|
||||
}
|
||||
|
||||
left = heap_alloc_zero(sizeof(region_element));
|
||||
left = malloc(sizeof(region_element));
|
||||
if (!left)
|
||||
return OutOfMemory;
|
||||
|
||||
|
@ -370,7 +370,7 @@ GpStatus WINGDIPAPI GdipCombineRegionRegion(GpRegion *region1,
|
|||
stat = clone_element(®ion2->node, &right);
|
||||
if (stat != Ok)
|
||||
{
|
||||
heap_free(left);
|
||||
free(left);
|
||||
return OutOfMemory;
|
||||
}
|
||||
|
||||
|
@ -390,7 +390,7 @@ GpStatus WINGDIPAPI GdipCreateRegion(GpRegion **region)
|
|||
if(!region)
|
||||
return InvalidParameter;
|
||||
|
||||
*region = heap_alloc_zero(sizeof(GpRegion));
|
||||
*region = calloc(1, sizeof(GpRegion));
|
||||
if(!*region)
|
||||
return OutOfMemory;
|
||||
|
||||
|
@ -428,7 +428,7 @@ GpStatus WINGDIPAPI GdipCreateRegionPath(GpPath *path, GpRegion **region)
|
|||
if (!(path && region))
|
||||
return InvalidParameter;
|
||||
|
||||
*region = heap_alloc_zero(sizeof(GpRegion));
|
||||
*region = calloc(1, sizeof(GpRegion));
|
||||
if(!*region)
|
||||
return OutOfMemory;
|
||||
stat = init_region(*region, RegionDataPath);
|
||||
|
@ -462,7 +462,7 @@ GpStatus WINGDIPAPI GdipCreateRegionRect(GDIPCONST GpRectF *rect,
|
|||
if (!(rect && region))
|
||||
return InvalidParameter;
|
||||
|
||||
*region = heap_alloc_zero(sizeof(GpRegion));
|
||||
*region = calloc(1, sizeof(GpRegion));
|
||||
stat = init_region(*region, RegionDataRect);
|
||||
if(stat != Ok)
|
||||
{
|
||||
|
@ -510,32 +510,32 @@ GpStatus WINGDIPAPI GdipCreateRegionHrgn(HRGN hrgn, GpRegion **region)
|
|||
if(!region || !(size = GetRegionData(hrgn, 0, NULL)))
|
||||
return InvalidParameter;
|
||||
|
||||
buf = heap_alloc_zero(size);
|
||||
buf = malloc(size);
|
||||
if(!buf)
|
||||
return OutOfMemory;
|
||||
|
||||
if(!GetRegionData(hrgn, size, buf)){
|
||||
heap_free(buf);
|
||||
free(buf);
|
||||
return GenericError;
|
||||
}
|
||||
|
||||
if(buf->rdh.nCount == 0){
|
||||
if((stat = GdipCreateRegion(&local)) != Ok){
|
||||
heap_free(buf);
|
||||
free(buf);
|
||||
return stat;
|
||||
}
|
||||
if((stat = GdipSetEmpty(local)) != Ok){
|
||||
heap_free(buf);
|
||||
free(buf);
|
||||
GdipDeleteRegion(local);
|
||||
return stat;
|
||||
}
|
||||
*region = local;
|
||||
heap_free(buf);
|
||||
free(buf);
|
||||
return Ok;
|
||||
}
|
||||
|
||||
if((stat = GdipCreatePath(FillModeAlternate, &path)) != Ok){
|
||||
heap_free(buf);
|
||||
free(buf);
|
||||
return stat;
|
||||
}
|
||||
|
||||
|
@ -543,7 +543,7 @@ GpStatus WINGDIPAPI GdipCreateRegionHrgn(HRGN hrgn, GpRegion **region)
|
|||
for(i = 0; i < buf->rdh.nCount; i++){
|
||||
if((stat = GdipAddPathRectangle(path, (REAL)rect->left, (REAL)rect->top,
|
||||
(REAL)(rect->right - rect->left), (REAL)(rect->bottom - rect->top))) != Ok){
|
||||
heap_free(buf);
|
||||
free(buf);
|
||||
GdipDeletePath(path);
|
||||
return stat;
|
||||
}
|
||||
|
@ -552,7 +552,7 @@ GpStatus WINGDIPAPI GdipCreateRegionHrgn(HRGN hrgn, GpRegion **region)
|
|||
|
||||
stat = GdipCreateRegionPath(path, region);
|
||||
|
||||
heap_free(buf);
|
||||
free(buf);
|
||||
GdipDeletePath(path);
|
||||
return stat;
|
||||
}
|
||||
|
@ -568,7 +568,7 @@ GpStatus WINGDIPAPI GdipDeleteRegion(GpRegion *region)
|
|||
return InvalidParameter;
|
||||
|
||||
delete_element(®ion->node);
|
||||
heap_free(region);
|
||||
free(region);
|
||||
|
||||
return Ok;
|
||||
}
|
||||
|
@ -787,12 +787,12 @@ static GpStatus read_element(struct memory_buffer *mbuf, GpRegion *region, regio
|
|||
{
|
||||
region_element *left, *right;
|
||||
|
||||
left = heap_alloc_zero(sizeof(region_element));
|
||||
left = calloc(1, sizeof(region_element));
|
||||
if (!left) return OutOfMemory;
|
||||
right = heap_alloc_zero(sizeof(region_element));
|
||||
right = calloc(1, sizeof(region_element));
|
||||
if (!right)
|
||||
{
|
||||
heap_free(left);
|
||||
free(left);
|
||||
return OutOfMemory;
|
||||
}
|
||||
|
||||
|
@ -809,8 +809,8 @@ static GpStatus read_element(struct memory_buffer *mbuf, GpRegion *region, regio
|
|||
}
|
||||
}
|
||||
|
||||
heap_free(left);
|
||||
heap_free(right);
|
||||
free(left);
|
||||
free(right);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@ -1447,7 +1447,7 @@ static GpStatus transform_region_element(region_element* element, GpMatrix *matr
|
|||
{
|
||||
/* Steal the element from the created region. */
|
||||
memcpy(element, &new_region->node, sizeof(region_element));
|
||||
heap_free(new_region);
|
||||
free(new_region);
|
||||
}
|
||||
else
|
||||
return stat;
|
||||
|
@ -1553,7 +1553,7 @@ static GpStatus get_region_scans_data(GpRegion *region, GpMatrix *matrix, LPRGND
|
|||
{
|
||||
data_size = GetRegionData(hrgn, 0, NULL);
|
||||
|
||||
*data = heap_alloc_zero(data_size);
|
||||
*data = malloc(data_size);
|
||||
|
||||
if (*data)
|
||||
GetRegionData(hrgn, data_size, *data);
|
||||
|
@ -1566,7 +1566,7 @@ static GpStatus get_region_scans_data(GpRegion *region, GpMatrix *matrix, LPRGND
|
|||
{
|
||||
data_size = sizeof(RGNDATAHEADER) + sizeof(RECT);
|
||||
|
||||
*data = heap_alloc_zero(data_size);
|
||||
*data = calloc(1, data_size);
|
||||
|
||||
if (*data)
|
||||
{
|
||||
|
@ -1605,7 +1605,7 @@ GpStatus WINGDIPAPI GdipGetRegionScansCount(GpRegion *region, UINT *count, GpMat
|
|||
if (stat == Ok)
|
||||
{
|
||||
*count = data->rdh.nCount;
|
||||
heap_free(data);
|
||||
free(data);
|
||||
}
|
||||
|
||||
return stat;
|
||||
|
@ -1639,7 +1639,7 @@ GpStatus WINGDIPAPI GdipGetRegionScansI(GpRegion *region, GpRect *scans, INT *co
|
|||
}
|
||||
}
|
||||
|
||||
heap_free(data);
|
||||
free(data);
|
||||
}
|
||||
|
||||
return Ok;
|
||||
|
@ -1673,7 +1673,7 @@ GpStatus WINGDIPAPI GdipGetRegionScans(GpRegion *region, GpRectF *scans, INT *co
|
|||
}
|
||||
}
|
||||
|
||||
heap_free(data);
|
||||
free(data);
|
||||
}
|
||||
|
||||
return Ok;
|
||||
|
|
|
@ -66,11 +66,11 @@ void init_generic_string_formats(void)
|
|||
|
||||
void free_generic_string_formats(void)
|
||||
{
|
||||
heap_free(generic_default_format.character_ranges);
|
||||
heap_free(generic_default_format.tabs);
|
||||
free(generic_default_format.character_ranges);
|
||||
free(generic_default_format.tabs);
|
||||
|
||||
heap_free(generic_typographic_format.character_ranges);
|
||||
heap_free(generic_typographic_format.tabs);
|
||||
free(generic_typographic_format.character_ranges);
|
||||
free(generic_typographic_format.tabs);
|
||||
}
|
||||
|
||||
GpStatus WINGDIPAPI GdipCreateStringFormat(INT attr, LANGID lang,
|
||||
|
@ -81,8 +81,8 @@ GpStatus WINGDIPAPI GdipCreateStringFormat(INT attr, LANGID lang,
|
|||
if(!format)
|
||||
return InvalidParameter;
|
||||
|
||||
*format = heap_alloc_zero(sizeof(GpStringFormat));
|
||||
if(!*format) return OutOfMemory;
|
||||
*format = calloc(1, sizeof(GpStringFormat));
|
||||
if(!*format) return OutOfMemory;
|
||||
|
||||
(*format)->attr = attr;
|
||||
(*format)->lang = lang;
|
||||
|
@ -110,9 +110,9 @@ GpStatus WINGDIPAPI GdipDeleteStringFormat(GpStringFormat *format)
|
|||
if (format == &generic_default_format || format == &generic_typographic_format)
|
||||
return Ok;
|
||||
|
||||
heap_free(format->character_ranges);
|
||||
heap_free(format->tabs);
|
||||
heap_free(format);
|
||||
free(format->character_ranges);
|
||||
free(format->tabs);
|
||||
free(format);
|
||||
|
||||
return Ok;
|
||||
}
|
||||
|
@ -297,11 +297,11 @@ GpStatus WINGDIPAPI GdipSetStringFormatMeasurableCharacterRanges(
|
|||
|
||||
TRACE("%p, %d, %p\n", format, rangeCount, ranges);
|
||||
|
||||
new_ranges = heap_alloc_zero(rangeCount * sizeof(CharacterRange));
|
||||
new_ranges = malloc(rangeCount * sizeof(CharacterRange));
|
||||
if (!new_ranges)
|
||||
return OutOfMemory;
|
||||
|
||||
heap_free(format->character_ranges);
|
||||
free(format->character_ranges);
|
||||
format->character_ranges = new_ranges;
|
||||
memcpy(format->character_ranges, ranges, sizeof(CharacterRange) * rangeCount);
|
||||
format->range_count = rangeCount;
|
||||
|
@ -319,16 +319,9 @@ GpStatus WINGDIPAPI GdipSetStringFormatTabStops(GpStringFormat *format, REAL fir
|
|||
|
||||
if(count > 0){
|
||||
if(firsttab < 0.0) return NotImplemented;
|
||||
/* first time allocation */
|
||||
if(format->tabcount == 0){
|
||||
format->tabs = heap_alloc_zero(sizeof(REAL)*count);
|
||||
if(!format->tabs)
|
||||
return OutOfMemory;
|
||||
}
|
||||
/* reallocation */
|
||||
if((format->tabcount < count) && (format->tabcount > 0)){
|
||||
if(format->tabcount < count){
|
||||
REAL *ptr;
|
||||
ptr = heap_realloc(format->tabs, sizeof(REAL)*count);
|
||||
ptr = realloc(format->tabs, sizeof(REAL) * count);
|
||||
if(!ptr)
|
||||
return OutOfMemory;
|
||||
format->tabs = ptr;
|
||||
|
@ -371,15 +364,15 @@ GpStatus WINGDIPAPI GdipCloneStringFormat(GDIPCONST GpStringFormat *format, GpSt
|
|||
if(!format || !newFormat)
|
||||
return InvalidParameter;
|
||||
|
||||
*newFormat = heap_alloc_zero(sizeof(GpStringFormat));
|
||||
if(!*newFormat) return OutOfMemory;
|
||||
*newFormat = malloc(sizeof(GpStringFormat));
|
||||
if(!*newFormat) return OutOfMemory;
|
||||
|
||||
**newFormat = *format;
|
||||
|
||||
if(format->tabcount > 0){
|
||||
(*newFormat)->tabs = heap_alloc_zero(sizeof(REAL) * format->tabcount);
|
||||
(*newFormat)->tabs = malloc(sizeof(REAL) * format->tabcount);
|
||||
if(!(*newFormat)->tabs){
|
||||
heap_free(*newFormat);
|
||||
free(*newFormat);
|
||||
return OutOfMemory;
|
||||
}
|
||||
memcpy((*newFormat)->tabs, format->tabs, sizeof(REAL) * format->tabcount);
|
||||
|
@ -388,10 +381,10 @@ GpStatus WINGDIPAPI GdipCloneStringFormat(GDIPCONST GpStringFormat *format, GpSt
|
|||
(*newFormat)->tabs = NULL;
|
||||
|
||||
if(format->range_count > 0){
|
||||
(*newFormat)->character_ranges = heap_alloc_zero(sizeof(CharacterRange) * format->range_count);
|
||||
(*newFormat)->character_ranges = malloc(sizeof(CharacterRange) * format->range_count);
|
||||
if(!(*newFormat)->character_ranges){
|
||||
heap_free((*newFormat)->tabs);
|
||||
heap_free(*newFormat);
|
||||
free((*newFormat)->tabs);
|
||||
free(*newFormat);
|
||||
return OutOfMemory;
|
||||
}
|
||||
memcpy((*newFormat)->character_ranges, format->character_ranges,
|
||||
|
|
Loading…
Add table
Reference in a new issue