]> git.pld-linux.org Git - packages/ekg.git/commitdiff
- libjpeg errors handling fix (from CVS)
authorJakub Bogusz <qboosh@pld-linux.org>
Sun, 19 Feb 2006 23:15:22 +0000 (23:15 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    ekg-jpeg.patch -> 1.1

ekg-jpeg.patch [new file with mode: 0644]

diff --git a/ekg-jpeg.patch b/ekg-jpeg.patch
new file mode 100644 (file)
index 0000000..4c12355
--- /dev/null
@@ -0,0 +1,78 @@
+--- ekg-1.6/src/events.c.orig  2005-10-09 12:50:15.000000000 +0200
++++ ekg-1.6/src/events.c       2006-02-20 00:04:49.218225000 +0100
+@@ -33,6 +33,7 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
++#include <setjmp.h>
+ #include <unistd.h>
+ #include "commands.h"
+@@ -1515,6 +1516,21 @@
+       return NULL;
+ }
++#ifdef HAVE_LIBJPEG
++
++struct ekg_jpeg_error_mgr {
++      struct jpeg_error_mgr pub;
++      jmp_buf setjmp_buffer;
++};
++
++void ekg_jpeg_error_exit(j_common_ptr j)
++{
++      struct ekg_jpeg_error_mgr *e = (struct ekg_jpeg_error_mgr *) j->err;
++      /* Return control to the setjmp point */
++      longjmp(e->setjmp_buffer, 1);
++}
++#endif
++
+ /*
+  * handle_token()
+  *
+@@ -1569,7 +1585,7 @@
+ #ifdef HAVE_LIBJPEG
+       if (config_display_token) {
+               struct jpeg_decompress_struct j;
+-              struct jpeg_error_mgr e;
++              struct ekg_jpeg_error_mgr e;
+               JSAMPROW buf[1];
+               int size;
+               char *token, *tmp;
+@@ -1581,7 +1597,18 @@
+                       goto fail;
+               }
+-              j.err = jpeg_std_error(&e);
++              j.err = jpeg_std_error(&e.pub);
++              e.pub.error_exit = ekg_jpeg_error_exit;
++              /* Establish the setjmp return context for ekg_jpeg_error_exit to use. */
++              if (setjmp(e.setjmp_buffer)) {
++                      char buf[JMSG_LENGTH_MAX];
++                      /* If we ended up over here, then it means some call below called longjmp. */
++                      (e.pub.format_message)((j_common_ptr)&j, buf);
++                      print("token_failed", buf);
++                      jpeg_destroy_decompress(&j);
++                      fclose(f);
++                      goto fail;
++              }
+               jpeg_create_decompress(&j);
+               jpeg_stdio_src(&j, f);
+               jpeg_read_header(&j, TRUE);
+@@ -1623,7 +1650,7 @@
+               
+               unlink(file);
+       } else
+-#else /* HAVE_LIBJPEG */
++#endif        /* HAVE_LIBJPEG */
+       {
+               char *file2 = saprintf("%s.jpg", file);
+@@ -1634,7 +1661,6 @@
+               xfree(file2);
+       }
+-#endif        /* HAVE_LIBJPEG */
+ #else /* HAVE_MKSTEMP */
+       print("token_unsupported");
This page took 0.0995 seconds and 4 git commands to generate.