git.asbjorn.biz
/
swftools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed memory realloc issue in xpdf
[swftools.git]
/
lib
/
png.c
diff --git
a/lib/png.c
b/lib/png.c
index
d917cbd
..
14de7f6
100644
(file)
--- a/
lib/png.c
+++ b/
lib/png.c
@@
-455,6
+455,7
@@
EXPORT int getPNGdimensions(const char*sname, int*destwidth, int*destheight)
*destwidth = header.width;
*destheight = header.height;
*destwidth = header.width;
*destheight = header.height;
+ fclose(fi);
return 1;
}
return 1;
}
@@
-561,6
+562,7
@@
EXPORT int getPNG(const char*sname, int*destwidth, int*destheight, unsigned char
}
}
}
}
+ fclose(fi);
if(!zimagedata || uncompress(imagedata, &imagedatalen, zimagedata, zimagedatalen) != Z_OK) {
printf("Couldn't uncompress %s!\n", sname);
if(zimagedata)
if(!zimagedata || uncompress(imagedata, &imagedatalen, zimagedata, zimagedatalen) != Z_OK) {
printf("Couldn't uncompress %s!\n", sname);
if(zimagedata)
@@
-568,7
+570,6
@@
EXPORT int getPNG(const char*sname, int*destwidth, int*destheight, unsigned char
return 0;
}
free(zimagedata);
return 0;
}
free(zimagedata);
- fclose(fi);
*destwidth = header.width;
*destheight = header.height;
*destwidth = header.width;
*destheight = header.height;
@@
-1528,8
+1529,6
@@
EXPORT void savePNG(const char*filename, unsigned char*data, int width, int heig
unsigned char format;
unsigned char tmp;
unsigned char* data2=0;
unsigned char format;
unsigned char tmp;
unsigned char* data2=0;
- u32 datalen;
- u32 datalen2;
unsigned char head[] = {137,80,78,71,13,10,26,10}; // PNG header
int cols;
char alpha = 1;
unsigned char head[] = {137,80,78,71,13,10,26,10}; // PNG header
int cols;
char alpha = 1;
@@
-1566,8
+1565,6
@@
EXPORT void savePNG(const char*filename, unsigned char*data, int width, int heig
png_quantize_image(data, width*height, numcolors, &data, palette);
}
png_quantize_image(data, width*height, numcolors, &data, palette);
}
- datalen = (width*height*bpp/8+cols*8);
-
fi = fopen(filename, "wb");
if(!fi) {
perror("open");
fi = fopen(filename, "wb");
if(!fi) {
perror("open");