Modifications made to the ZLib library
The prototypes for memory allocation in the PNG library were mentioned as being modified;
voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size));
void zcfree OF((voidpf opaque, voidpf ptr));
zutil.cpp
The following function excerpts have been taken from zutil.cpp, where modifications are marked "//here"
voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
{
if (opaque) items += size - size; /* make compiler happy */
/*
return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
(voidpf)calloc(items, size);
*/
return img_malloc(items * size); //Here
}
void zcfree (voidpf opaque, voidpf ptr)
{
/*
free(ptr);
*/
img_free(ptr); //Here
if (opaque) return; /* make compiler happy */
}
|