summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@gmail.com>2012-01-19 14:54:01 +0000
committerGustavo Sverzut Barbieri <barbieri@gmail.com>2012-01-19 14:54:01 +0000
commit23688c3cbbe67a5aa61fc770f913dd06f12c3d39 (patch)
tree698bd45dd60671d7c3afdcea1f026da8917ea09f
parente416281168837a6c787c8605c28cc62c4fe9cef1 (diff)
downloadeet-23688c3cbbe67a5aa61fc770f913dd06f12c3d39.tar.gz
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. SVN revision: 67345
-rw-r--r--src/lib/eet_image.c19
1 files 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 *