From 4bf9e199ee4132c33ba82d941472cbe6356c34d6 Mon Sep 17 00:00:00 2001 From: barbieri Date: Thu, 19 Jan 2012 14:54:01 +0000 Subject: [PATCH] make eet_data_image_jpeg_alpha_decode() more like eet_data_image_jpeg_rgb_decode(). eet_data_image_jpeg_rgb_decode() did not had a warning the alpha version did, as the code is very similar and the return pointer was not used, make it just like rgb and return an integer. git-svn-id: http://svn.enlightenment.org/svn/e/trunk/eet@67345 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/eet_image.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/lib/eet_image.c b/src/lib/eet_image.c index 8c6c03c..b622236 100644 --- a/src/lib/eet_image.c +++ b/src/lib/eet_image.c @@ -246,7 +246,7 @@ eet_data_image_jpeg_rgb_decode(const void *data, unsigned int w, unsigned int h, unsigned int row_stride); -static void * +static int eet_data_image_jpeg_alpha_decode(const void *data, int size, unsigned int src_x, @@ -560,7 +560,7 @@ eet_data_image_jpeg_rgb_decode(const void *data, return 1; } -static void * +static int eet_data_image_jpeg_alpha_decode(const void *data, int size, unsigned int src_x, @@ -577,6 +577,10 @@ eet_data_image_jpeg_alpha_decode(const void *data, unsigned int x, y, l, scans; unsigned int i, iw; + /* FIXME: handle src_x, src_y and row_stride correctly */ + if (!d) + return 0; + memset(&cinfo, 0, sizeof (struct jpeg_decompress_struct)); cinfo.err = jpeg_std_error(&(jerr.pub)); @@ -584,14 +588,14 @@ eet_data_image_jpeg_alpha_decode(const void *data, jerr.pub.emit_message = _JPEGErrorHandler2; jerr.pub.output_message = _JPEGErrorHandler; if (setjmp(jerr.setjmp_buffer)) - return NULL; + return 0; jpeg_create_decompress(&cinfo); if (eet_jpeg_membuf_src(&cinfo, data, (size_t)size)) { jpeg_destroy_decompress(&cinfo); - return NULL; + return 0; } jpeg_read_header(&cinfo, TRUE); @@ -609,7 +613,7 @@ eet_data_image_jpeg_alpha_decode(const void *data, cinfo.src = NULL; jpeg_destroy_decompress(&cinfo); - return NULL; + return 0; } /* end head decoding */ @@ -620,11 +624,12 @@ eet_data_image_jpeg_alpha_decode(const void *data, cinfo.src = NULL; jpeg_destroy_decompress(&cinfo); - return NULL; + return 0; } tdata = alloca(w * 16 * 3); ptr2 = d; + if (cinfo.output_components == 1) { for (i = 0; i < (unsigned int)cinfo.rec_outbuf_height; i++) @@ -666,7 +671,7 @@ eet_data_image_jpeg_alpha_decode(const void *data, /* end data decoding */ jpeg_finish_decompress(&cinfo); jpeg_destroy_decompress(&cinfo); - return d; + return 1; } static void * -- 2.7.4