From a4be97bc967c8aceac1c893cbbe307b23b603683 Mon Sep 17 00:00:00 2001 From: Matthias Kramm Date: Tue, 27 Apr 2010 16:17:35 -0700 Subject: [PATCH] bugfixes in jpeg.c --- lib/jpeg.c | 2 ++ lib/jpeg.h | 1 + 2 files changed, 3 insertions(+) diff --git a/lib/jpeg.c b/lib/jpeg.c index 1f74910..1c5e91c 100644 --- a/lib/jpeg.c +++ b/lib/jpeg.c @@ -413,6 +413,8 @@ void jpeg_get_size(const char *filename, int *width, int *height) *width = 0; *height = 0; cinfo.err = jpeg_std_error(&jerr); + cinfo.image_width = 0; + cinfo.image_height = 0; jpeg_create_decompress(&cinfo); if ((fi = fopen(filename, "rb")) == NULL) { fprintf(stderr, "couldn't open %s\n", filename); diff --git a/lib/jpeg.h b/lib/jpeg.h index 090d147..ef4f4d2 100644 --- a/lib/jpeg.h +++ b/lib/jpeg.h @@ -13,6 +13,7 @@ int jpeg_save_to_file(unsigned char*data, int width, int height, int quality, FI int jpeg_save_to_mem(unsigned char*data, int width, int height, int quality, unsigned char*dest, int destsize); int jpeg_load(const char*filename, unsigned char**dest, int*width, int*height); int jpeg_load_from_mem(unsigned char*_data, int size, unsigned char*dest, int width, int height); +void jpeg_get_size(const char *fname, int *width, int *height); #ifdef __cplusplus } -- 1.7.10.4