emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/emacs-23 r100341: More elegant solution for


From: Eli Zaretskii
Subject: [Emacs-diffs] /srv/bzr/emacs/emacs-23 r100341: More elegant solution for accessing png_ptr without GCC warnings.
Date: Fri, 31 Dec 2010 18:33:40 +0200
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 100341
committer: Eli Zaretskii <address@hidden>
branch nick: emacs-23
timestamp: Fri 2010-12-31 18:33:40 +0200
message:
  More elegant solution for accessing png_ptr without GCC warnings.
  
   image.c (png_jmpbuf): New macro.
   (my_png_error, png_load): Use it instead of #ifdef'ing according
   to PNG_LIBPNG_VER_MAJOR and PNG_LIBPNG_VER_MINOR.
modified:
  src/ChangeLog
  src/image.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2010-12-31 12:38:06 +0000
+++ b/src/ChangeLog     2010-12-31 16:33:40 +0000
@@ -5,6 +5,9 @@
        version of PNG library we were compiled with.
        (my_png_error, png_load): Avoid GCC warnings about direct access
        to png_ptr->jmpbuf.  (Bug#7716)
+       (png_jmpbuf): New macro.
+       (my_png_error, png_load): Use it instead of #ifdef'ing according
+       to PNG_LIBPNG_VER_MAJOR and PNG_LIBPNG_VER_MINOR.
 
 2010-12-27  Stefan Monnier  <address@hidden>
 

=== modified file 'src/image.c'
--- a/src/image.c       2010-12-31 12:38:06 +0000
+++ b/src/image.c       2010-12-31 16:33:40 +0000
@@ -5648,6 +5648,12 @@
 
 #endif /* HAVE_NTGUI */
 
+/* libpng before 1.4.0 didn't have png_jmpbuf; v1.4.0 and later
+   deprecate direct access to png_ptr fields.  */
+#ifndef png_jmpbuf
+# define png_jmpbuf(PTR)  ((PTR)->jmpbuf)
+#endif
+
 /* Error and warning handlers installed when the PNG library
    is initialized.  */
 
@@ -5660,12 +5666,7 @@
   /* Avoid compiler warning about deprecated direct access to
      png_ptr's fields in libpng versions 1.4.x.  */
   image_error ("PNG error: %s", build_string (msg), Qnil);
-#if PNG_LIBPNG_VER_MAJOR > 1                                   \
-  || (PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_MINOR >= 4)
   longjmp (png_jmpbuf (png_ptr), 1);
-#else
-  longjmp (png_ptr->jmpbuf, 1);
-#endif
 }
 
 
@@ -5839,16 +5840,9 @@
       return 0;
     }
 
-  /* Avoid compiler warning about deprecated direct access to
-     png_ptr's fields in libpng versions 1.4.x.  */
-#if PNG_LIBPNG_VER_MAJOR > 1                                   \
-  || (PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_MINOR >= 4)
   /* Set error jump-back.  We come back here when the PNG library
      detects an error.  */
   if (setjmp (png_jmpbuf (png_ptr)))
-#else
-  if (setjmp (png_ptr->jmpbuf))
-#endif
     {
     error:
       if (png_ptr)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]