X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=blobdiff_plain;f=src%2Fpng2swf.c;h=c24d227cc783c86ec0f152690d3647c77a935196;hp=8c1d6e62529845f3823314c483e6c6ecf3d3bb1e;hb=6f78b0ef3998e959ce09c5ef11d46149756b682b;hpb=4ba1e683d43deacab5c90273c45a69311cbd0763 diff --git a/src/png2swf.c b/src/png2swf.c index 8c1d6e6..c24d227 100644 --- a/src/png2swf.c +++ b/src/png2swf.c @@ -119,7 +119,7 @@ int png_read_chunk(char (*head)[4], int*destlen, U8**destdata, FILE*fi) return 0; if(!fread(head, 4, 1, fi)) return 0; - len = REVERSESWAP32(len); + len = BE_32_TO_NATIVE(len); if(destlen) *destlen = len; if(destdata) { if(len) @@ -143,7 +143,7 @@ unsigned int png_get_dword(FILE*fi) { unsigned int a; fread(&a,4,1,fi); - return REVERSESWAP32(a); + return BE_32_TO_NATIVE(a); } struct png_header @@ -173,8 +173,8 @@ int png_read_header(FILE*fi, struct png_header*header) if(!strncasecmp(id, "IHDR", 4)) { char a,b,c,f,i; if(len < 8) exit(1); - header->width = REVERSESWAP32(*(U32*)&data[0]); - header->height = REVERSESWAP32(*(U32*)&data[4]); + header->width = BE_32_TO_NATIVE(*(U32*)&data[0]); + header->height = BE_32_TO_NATIVE(*(U32*)&data[4]); a = data[8]; // should be 8 b = data[9]; // should be 3(indexed), 2(rgb), 0(grayscale) or 6(truecolor+alpha) @@ -197,7 +197,7 @@ int png_read_header(FILE*fi, struct png_header*header) exit(1); } if(a!=8 && (b==2 || b==6)) { - fprintf(stderr, "Bpp %d in mode %d not supported!\n", a); + fprintf(stderr, "Bpp %d in mode %d not supported!\n", b, a); exit(1); } if(c!=0) { @@ -454,7 +454,7 @@ void applyfilter1(int mode, U8*src, U8*old, U8*dest, int width) } -TAG* PNG2Image(TAG*t, U16 id, char*filename, int*width, int*height) +TAG* PNG2Image(TAG*t, U16 id, char*filename, unsigned*width, unsigned*height) { char tagid[4]; U8*data; @@ -553,7 +553,7 @@ TAG* PNG2Image(TAG*t, U16 id, char*filename, int*width, int*height) } if(!zimagedata || uncompress(imagedata, &imagedatalen, zimagedata, zimagedatalen) != Z_OK) { - fprintf(stderr, "Couldn't uncompress IDAT chunk (%d bytes) in %s!\n", imagedatalen, filename); + fprintf(stderr, "Couldn't uncompress IDAT chunk (%lu bytes) in %s!\n", imagedatalen, filename); if(zimagedata) free(zimagedata); return 0; @@ -749,7 +749,7 @@ TAG *MovieAddFrame(SWF * swf, TAG * t, char *sname, int id) MATRIX m; int fs; - int width=0, height=0; + unsigned width=0, height=0; #ifndef HAVE_JPEGLIB if(global.mkjpeg) { @@ -760,7 +760,7 @@ TAG *MovieAddFrame(SWF * swf, TAG * t, char *sname, int id) if(global.mkjpeg) { #ifdef HAVE_JPEGLIB RGBA*data = 0; - getPNG(sname, &width, &height, (unsigned char**)&data); + png_load(sname, &width, &height, (unsigned char**)&data); if(!data) exit(1); if(swf_ImageHasAlpha(data, width, height)) { @@ -775,7 +775,7 @@ TAG *MovieAddFrame(SWF * swf, TAG * t, char *sname, int id) #endif } else if(1) { RGBA*data = 0; - getPNG(sname, &width, &height, (unsigned char**)&data); + png_load(sname, &width, &height, (unsigned char**)&data); if(!data) exit(1); t = swf_InsertTag(t, ST_DEFINEBITSLOSSLESS); @@ -1067,7 +1067,7 @@ void args_callback_usage(char *name) printf("-q , --quiet Omit normal log messages, only log errors\n"); printf("-C , --cgi For use as CGI- prepend http header, write to stdout\n"); printf("-V , --version Print version information and exit\n"); - printf("-s , --scale Scale image to % size.\n"); + printf("-s , --scale Scale image to %% size.\n"); printf("\n"); }