summaryrefslogtreecommitdiff
path: root/src/lib/emile
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2015-03-17 08:50:49 +0100
committerCedric BAIL <cedric@osg.samsung.com>2015-03-17 09:58:20 +0100
commit75cd6d3628d62f0ecf11875112d2ce3131f799e4 (patch)
treeb5c125ced209932edc409cc5dbb292b3b0b1a6f2 /src/lib/emile
parentdfe39b3d54d96c84b57c48d088e70a3e948f89b0 (diff)
emile: use Eina_Log for Jpeg error message.
Diffstat (limited to 'src/lib/emile')
-rw-r--r--src/lib/emile/emile_image.c53
1 files changed, 40 insertions, 13 deletions
diff --git a/src/lib/emile/emile_image.c b/src/lib/emile/emile_image.c
index 1649e80f84..d4a2bce321 100644
--- a/src/lib/emile/emile_image.c
+++ b/src/lib/emile/emile_image.c
@@ -30,6 +30,7 @@
30 30
31#include "rg_etc1.h" 31#include "rg_etc1.h"
32#include "Emile.h" 32#include "Emile.h"
33#include "emile_private.h"
33 34
34#ifdef BUILD_NEON 35#ifdef BUILD_NEON
35#include <arm_neon.h> 36#include <arm_neon.h>
@@ -648,25 +649,51 @@ struct jpeg_membuf_src
648}; 649};
649 650
650static void 651static void
651_JPEGFatalErrorHandler(j_common_ptr cinfo) 652_emile_image_jpeg_error_exit_cb(j_common_ptr cinfo)
652{ 653{
654 char buffer[JMSG_LENGTH_MAX];
653 emptr errmgr; 655 emptr errmgr;
654 656
655 errmgr = (emptr) cinfo->err; 657 (*cinfo->err->format_message)(cinfo, buffer);
658 ERR("%s", buffer);
659 errmgr = (emptr)cinfo->err;
656 longjmp(errmgr->setjmp_buffer, 1); 660 longjmp(errmgr->setjmp_buffer, 1);
657 return;
658} 661}
659 662
660static void 663static void
661_JPEGErrorHandler(j_common_ptr cinfo EINA_UNUSED) 664_emile_image_jpeg_emit_message_cb(j_common_ptr cinfo,
665 int msg_level)
662{ 666{
663 return; 667 char buffer[JMSG_LENGTH_MAX];
668 struct jpeg_error_mgr *err;
669
670 err = cinfo->err;
671 if (msg_level < 0)
672 {
673 if ((err->num_warnings == 0) || (err->trace_level >= 3))
674 {
675 (*cinfo->err->format_message)(cinfo, buffer);
676 WRN("%s", buffer);
677 }
678 err->num_warnings++;
679 }
680 else
681 {
682 if (err->trace_level >= msg_level)
683 {
684 (*cinfo->err->format_message)(cinfo, buffer);
685 INF("%s", buffer);
686 }
687 }
664} 688}
665 689
666static void 690static void
667_JPEGErrorHandler2(j_common_ptr cinfo EINA_UNUSED, int msg_level EINA_UNUSED) 691_emile_image_jpeg_output_message_cb(j_common_ptr cinfo)
668{ 692{
669 return; 693 char buffer[JMSG_LENGTH_MAX];
694
695 (*cinfo->err->format_message)(cinfo, buffer);
696 ERR("%s", buffer);
670} 697}
671 698
672static void 699static void
@@ -1281,9 +1308,9 @@ _emile_jpeg_head(Emile_Image *image,
1281 1308
1282 memset(&cinfo, 0, sizeof(cinfo)); 1309 memset(&cinfo, 0, sizeof(cinfo));
1283 cinfo.err = jpeg_std_error(&(jerr.pub)); 1310 cinfo.err = jpeg_std_error(&(jerr.pub));
1284 jerr.pub.error_exit = _JPEGFatalErrorHandler; 1311 jerr.pub.error_exit = _emile_image_jpeg_error_exit_cb;
1285 jerr.pub.emit_message = _JPEGErrorHandler2; 1312 jerr.pub.emit_message = _emile_image_jpeg_emit_message_cb;
1286 jerr.pub.output_message = _JPEGErrorHandler; 1313 jerr.pub.output_message = _emile_image_jpeg_output_message_cb;
1287 if (setjmp(jerr.setjmp_buffer)) 1314 if (setjmp(jerr.setjmp_buffer))
1288 { 1315 {
1289 jpeg_destroy_decompress(&cinfo); 1316 jpeg_destroy_decompress(&cinfo);
@@ -1529,9 +1556,9 @@ _emile_jpeg_data(Emile_Image *image,
1529 } 1556 }
1530 1557
1531 cinfo.err = jpeg_std_error(&(jerr.pub)); 1558 cinfo.err = jpeg_std_error(&(jerr.pub));
1532 jerr.pub.error_exit = _JPEGFatalErrorHandler; 1559 jerr.pub.error_exit = _emile_image_jpeg_error_exit_cb;
1533 jerr.pub.emit_message = _JPEGErrorHandler2; 1560 jerr.pub.emit_message = _emile_image_jpeg_emit_message_cb;
1534 jerr.pub.output_message = _JPEGErrorHandler; 1561 jerr.pub.output_message = _emile_image_jpeg_output_message_cb;
1535 if (setjmp(jerr.setjmp_buffer)) 1562 if (setjmp(jerr.setjmp_buffer))
1536 { 1563 {
1537 *error = EMILE_IMAGE_LOAD_ERROR_CORRUPT_FILE; 1564 *error = EMILE_IMAGE_LOAD_ERROR_CORRUPT_FILE;