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 a bad alloc
[swftools.git]
/
lib
/
modules
/
swfbits.c
diff --git
a/lib/modules/swfbits.c
b/lib/modules/swfbits.c
index
0749e0b
..
90c8549
100644
(file)
--- a/
lib/modules/swfbits.c
+++ b/
lib/modules/swfbits.c
@@
-326,7
+326,7
@@
void swf_SetJPEGBits2(TAG * tag, U16 width, U16 height, RGBA * bitmap, int quali
}
#endif
}
#endif
-void swf_GetJPEGSize(char *fname, int *width, int *height)
+void swf_GetJPEGSize(const char *fname, int *width, int *height)
{
struct jpeg_decompress_struct cinfo;
struct jpeg_error_mgr jerr;
{
struct jpeg_decompress_struct cinfo;
struct jpeg_error_mgr jerr;
@@
-347,7
+347,7
@@
void swf_GetJPEGSize(char *fname, int *width, int *height)
fclose(fi);
}
fclose(fi);
}
-int swf_SetJPEGBits(TAG * t, char *fname, int quality)
+int swf_SetJPEGBits(TAG * t, const char *fname, int quality)
{
struct jpeg_decompress_struct cinfo;
struct jpeg_error_mgr jerr;
{
struct jpeg_decompress_struct cinfo;
struct jpeg_error_mgr jerr;
@@
-1185,6
+1185,7
@@
TAG* swf_AddImage(TAG*tag, int bitid, RGBA*mem, int width, int height, int quali
swf_SetU16(tag1, bitid);
swf_SetLosslessImage(tag1, mem, width, height);
swf_SetU16(tag1, bitid);
swf_SetLosslessImage(tag1, mem, width, height);
+#if defined(HAVE_JPEGLIB)
/* try jpeg image */
if(has_alpha) {
tag2 = swf_InsertTag(0, ST_DEFINEBITSJPEG3);
/* try jpeg image */
if(has_alpha) {
tag2 = swf_InsertTag(0, ST_DEFINEBITSJPEG3);
@@
-1195,8
+1196,9
@@
TAG* swf_AddImage(TAG*tag, int bitid, RGBA*mem, int width, int height, int quali
swf_SetU16(tag2, bitid);
swf_SetJPEGBits2(tag2, width, height, mem, quality);
}
swf_SetU16(tag2, bitid);
swf_SetJPEGBits2(tag2, width, height, mem, quality);
}
+#endif
- if(quality>100 || (tag1 && tag1->len < tag2->len)) {
+ if(quality>100 || !tag2 || (tag1 && tag1->len < tag2->len)) {
/* use the zlib version- it's smaller */
tag1->prev = tag;
if(tag) tag->next = tag1;
/* use the zlib version- it's smaller */
tag1->prev = tag;
if(tag) tag->next = tag1;