comparison src/image.c @ 112106:70be6bbb683b

Don't use png_jmpbuf, it doesn't work with dynamic loading. image.c (png_jmpbuf): Remove definition. (my_png_error, png_load): Don't use png_jmpbuf.
author Eli Zaretskii <eliz@gnu.org>
date Mon, 03 Jan 2011 21:35:59 +0200
parents 40af77a50adc
children f87a5809d0c2
comparison
equal deleted inserted replaced
112105:d0bb1b112e73 112106:70be6bbb683b
5526 #define fn_png_read_end png_read_end 5526 #define fn_png_read_end png_read_end
5527 #define fn_png_error png_error 5527 #define fn_png_error png_error
5528 5528
5529 #endif /* HAVE_NTGUI */ 5529 #endif /* HAVE_NTGUI */
5530 5530
5531 /* libpng before 1.4.0 didn't have png_jmpbuf; v1.4.0 and later
5532 deprecate direct access to png_ptr fields. */
5533 #ifndef png_jmpbuf
5534 # define png_jmpbuf(PTR) ((PTR)->jmpbuf)
5535 #endif
5536
5537 /* Error and warning handlers installed when the PNG library 5531 /* Error and warning handlers installed when the PNG library
5538 is initialized. */ 5532 is initialized. */
5539 5533
5540 static void 5534 static void
5541 my_png_error (png_struct *png_ptr, const char *msg) 5535 my_png_error (png_struct *png_ptr, const char *msg)
5542 { 5536 {
5543 xassert (png_ptr != NULL); 5537 xassert (png_ptr != NULL);
5544 /* Avoid compiler warning about deprecated direct access to 5538 /* Avoid compiler warning about deprecated direct access to
5545 png_ptr's fields in libpng versions 1.4.x. */ 5539 png_ptr's fields in libpng versions 1.4.x. */
5546 image_error ("PNG error: %s", build_string (msg), Qnil); 5540 image_error ("PNG error: %s", build_string (msg), Qnil);
5547 longjmp (png_jmpbuf (png_ptr), 1); 5541 longjmp (png_ptr->jmpbuf, 1);
5548 } 5542 }
5549 5543
5550 5544
5551 static void 5545 static void
5552 my_png_warning (png_struct *png_ptr, const char *msg) 5546 my_png_warning (png_struct *png_ptr, const char *msg)
5704 return 0; 5698 return 0;
5705 } 5699 }
5706 5700
5707 /* Set error jump-back. We come back here when the PNG library 5701 /* Set error jump-back. We come back here when the PNG library
5708 detects an error. */ 5702 detects an error. */
5709 if (setjmp (png_jmpbuf (png_ptr))) 5703 if (setjmp (png_ptr->jmpbuf))
5710 { 5704 {
5711 error: 5705 error:
5712 if (png_ptr) 5706 if (png_ptr)
5713 fn_png_destroy_read_struct (&png_ptr, &info_ptr, &end_info); 5707 fn_png_destroy_read_struct (&png_ptr, &info_ptr, &end_info);
5714 xfree (pixels); 5708 xfree (pixels);