unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Chong Yidong <cyd@stupidchicken.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 7908@debbugs.gnu.org, Thomas Klausner <tk@giga.or.at>
Subject: bug#7908: png-1.5 fix for emacs-23.2 and HEAD
Date: Tue, 25 Jan 2011 15:57:38 -0500	[thread overview]
Message-ID: <87ei80em65.fsf@stupidchicken.com> (raw)
In-Reply-To: <838vy9zlpa.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 25 Jan 2011 05:49:53 +0200")

Eli Zaretskii <eliz@gnu.org> writes:

>> DEF_IMGLIB_FN (png_set_longjmp_fn);
>> LOAD_IMGLIB_FN (library, png_set_longjmp_fn);
>> #define fn_png_set_longjmp_fn	png_set_longjmp_fn
>> setjmp(*png_set_longjmp_fn(png_ptr, longjmp, sizeof(jmp_buf)));
>>
>> and similarly for png_longjmp. Completely untested, just guessed,
>> since I haven't tried compiling emacs on MS-Windows before.
>
> This doesn't work, I tried that a few weeks ago, and I still get link
> errors.

Do you have the exact link errors?  If possible, please try with this
patch (the libpng API changes are a bit of a mess, and it's possible
that small changes might affect success or failure).

*** src/image.c	2011-01-16 15:40:47 +0000
--- src/image.c	2011-01-25 20:57:03 +0000
***************
*** 5590,5595 ****
--- 5590,5600 ----
  DEF_IMGLIB_FN (png_read_end);
  DEF_IMGLIB_FN (png_error);
  
+ #if (PNG_LIBPNG_VER >= 10500)
+ DEF_IMGLIB_FN (png_longjmp);
+ DEF_IMGLIB_FN (png_set_longjmp_fn);
+ #endif /* libpng version >= 1.5 */
+ 
  static int
  init_png_functions (Lisp_Object libraries)
  {
***************
*** 5620,5625 ****
--- 5625,5636 ----
    LOAD_IMGLIB_FN (library, png_read_image);
    LOAD_IMGLIB_FN (library, png_read_end);
    LOAD_IMGLIB_FN (library, png_error);
+ 
+ #if (PNG_LIBPNG_VER >= 10500)
+   LOAD_IMGLIB_FN (library, png_longjmp);
+   LOAD_IMGLIB_FN (library, png_set_longjmp_fn);
+ #endif /* libpng version >= 1.5 */
+ 
    return 1;
  }
  #else
***************
*** 5646,5653 ****
--- 5657,5680 ----
  #define fn_png_read_end			png_read_end
  #define fn_png_error			png_error
  
+ #if (PNG_LIBPNG_VER >= 10500)
+ #define fn_png_longjmp			png_longjmp
+ #define fn_png_set_longjmp_fn		png_set_longjmp_fn
+ #endif /* libpng version >= 1.5 */
+ 
  #endif /* HAVE_NTGUI */
  
+ 
+ #if (PNG_LIBPNG_VER < 10500)
+ #define PNG_LONGJMP(ptr) (longjmp (ptr->jmpbuf, 1))
+ #define PNG_JMPBUF(ptr) ((ptr)->jmpbuf)
+ #else
+ /* In libpng version 1.5, the jmpbuf member is hidden.  */
+ #define PNG_LONGJMP(ptr) (fn_png_longjmp (png_ptr, 1))
+ #define PNG_JMPBUF(ptr) \
+   (*fn_png_set_longjmp_fn((ptr), longjmp, sizeof (jmp_buf)))
+ #endif
+ 
  /* Error and warning handlers installed when the PNG library
     is initialized.  */
  
***************
*** 5660,5666 ****
    /* 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);
!   longjmp (png_ptr->jmpbuf, 1);
  }
  
  
--- 5687,5693 ----
    /* 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);
!   PNG_LONGJMP (png_ptr);
  }
  
  
***************
*** 5836,5842 ****
  
    /* Set error jump-back.  We come back here when the PNG library
       detects an error.  */
!   if (setjmp (png_ptr->jmpbuf))
      {
      error:
        if (png_ptr)
--- 5863,5869 ----
  
    /* Set error jump-back.  We come back here when the PNG library
       detects an error.  */
!   if (PNG_JMPBUF (png_ptr))
      {
      error:
        if (png_ptr)






  parent reply	other threads:[~2011-01-25 20:57 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-24 12:54 bug#7908: png-1.5 fix for emacs-23.2 and HEAD Thomas Klausner
2011-01-24 17:43 ` Eli Zaretskii
2011-01-24 21:59   ` Thomas Klausner
2011-01-25  3:49     ` Eli Zaretskii
2011-01-25  7:18       ` Thomas Klausner
2011-01-25 10:53         ` Eli Zaretskii
2011-01-25 11:29           ` Thomas Klausner
2011-01-25 20:57       ` Chong Yidong [this message]
2011-01-25 21:09         ` Chong Yidong
2011-01-25 21:56         ` Eli Zaretskii
2011-01-25 23:35           ` Chong Yidong
2011-01-29 13:54         ` Eli Zaretskii
2011-01-29 15:44           ` Chong Yidong
2011-01-29 16:16             ` Eli Zaretskii
2011-01-29 18:29               ` Chong Yidong
2011-01-29 19:02                 ` Eli Zaretskii
2011-01-29 19:50                   ` Eli Zaretskii
2011-01-29 20:33                     ` Chong Yidong
2011-01-29 20:46                       ` Eli Zaretskii
2011-01-29 21:29                         ` Chong Yidong
2011-01-29 22:03                       ` Andreas Schwab
2011-01-29 22:27                         ` Chong Yidong
2011-01-30  0:00                           ` Andreas Schwab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ei80em65.fsf@stupidchicken.com \
    --to=cyd@stupidchicken.com \
    --cc=7908@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=tk@giga.or.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).