X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fjpeg.c;h=24bf2edf06836efc52f00f8c91c45cdf0d3e5735;hb=3d7393729761993b7d7e1d8db602560d339adac2;hp=d58215c27b0c49e6ef8f3e3a7ced0b2126aa895a;hpb=6aed88dfdec745e702a15f44ea058a21342729a0;p=swftools.git diff --git a/lib/jpeg.c b/lib/jpeg.c index d58215c..24bf2ed 100644 --- a/lib/jpeg.c +++ b/lib/jpeg.c @@ -298,12 +298,10 @@ int jpeg_load(const char*filename, unsigned char**dest, int*_width, int*_height) struct jpeg_source_mgr mgr; FILE*fi = fopen(filename, "rb"); - if(!fi) + if(!fi) { + fprintf(stderr, "Couldn't open file %s\n", filename); return 0; - fseek(fi, SEEK_END, 0); - long filesize = ftell(fi); - fseek(fi, SEEK_SET, 0); - fclose(fi); + } cinfo.err = jpeg_std_error(&jerr); jpeg_create_decompress(&cinfo); @@ -315,13 +313,13 @@ int jpeg_load(const char*filename, unsigned char**dest, int*_width, int*_height) int width = *_width = cinfo.output_width; int height = *_height = cinfo.output_height; - *dest = malloc(width*height*4); + *dest = (unsigned char*)malloc(width*height*4); int y; for (y=0;y