diff options
| author | Paul Eggert | 2014-01-13 17:19:42 -0800 |
|---|---|---|
| committer | Paul Eggert | 2014-01-13 17:19:42 -0800 |
| commit | d1eaf34b2f6775dcefb8f299e0613c47bce736d8 (patch) | |
| tree | bdbd9678b5e8615a2f88af40080f05cbd5b1e4ad /src/image.c | |
| parent | c176054fe1e2e72fb1c34d56658269361bacadd3 (diff) | |
| download | emacs-d1eaf34b2f6775dcefb8f299e0613c47bce736d8.tar.gz emacs-d1eaf34b2f6775dcefb8f299e0613c47bce736d8.zip | |
Fix MinGW64 porting problem with _setjmp.
Reported by Eli Zaretskii in:
http://lists.gnu.org/archive/html/emacs-devel/2014-01/msg01297.html
* image.c (FAST_SETJMP, FAST_LONGJMP): New macros, replacing
the old _setjmp and _longjmp. All uses changed.
Diffstat (limited to 'src/image.c')
| -rw-r--r-- | src/image.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/image.c b/src/image.c index cbc869127d0..63f97fe2eff 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -5608,24 +5608,26 @@ init_png_functions (void) | |||
| 5608 | 5608 | ||
| 5609 | #endif /* WINDOWSNT */ | 5609 | #endif /* WINDOWSNT */ |
| 5610 | 5610 | ||
| 5611 | /* Possibly inefficient/inexact substitutes for _setjmp and _longjmp. | 5611 | /* Fast implementations of setjmp and longjmp. Although setjmp and longjmp |
| 5612 | Do not use sys_setjmp, as PNG supports only jmp_buf. The _longjmp | 5612 | will do, POSIX _setjmp and _longjmp (if available) are often faster. |
| 5613 | substitute may munge the signal mask, but that should be OK here. | 5613 | Do not use sys_setjmp, as PNG supports only jmp_buf. |
| 5614 | MinGW (MS-Windows) uses _setjmp and defines setjmp to _setjmp in | 5614 | It's OK if the longjmp substitute restores the signal mask. */ |
| 5615 | the system header setjmp.h; don't mess up that. */ | 5615 | #ifdef HAVE__SETJMP |
| 5616 | #ifndef HAVE__SETJMP | 5616 | # define FAST_SETJMP(j) _setjmp (j) |
| 5617 | # define _setjmp(j) setjmp (j) | 5617 | # define FAST_LONGJMP _longjmp |
| 5618 | # define _longjmp longjmp | 5618 | #else |
| 5619 | # define FAST_SETJMP(j) setjmp (j) | ||
| 5620 | # define FAST_LONGJMP longjmp | ||
| 5619 | #endif | 5621 | #endif |
| 5620 | 5622 | ||
| 5621 | #if (PNG_LIBPNG_VER < 10500) | 5623 | #if PNG_LIBPNG_VER < 10500 |
| 5622 | #define PNG_LONGJMP(ptr) (_longjmp ((ptr)->jmpbuf, 1)) | 5624 | #define PNG_LONGJMP(ptr) FAST_LONGJMP ((ptr)->jmpbuf, 1) |
| 5623 | #define PNG_JMPBUF(ptr) ((ptr)->jmpbuf) | 5625 | #define PNG_JMPBUF(ptr) ((ptr)->jmpbuf) |
| 5624 | #else | 5626 | #else |
| 5625 | /* In libpng version 1.5, the jmpbuf member is hidden. (Bug#7908) */ | 5627 | /* In libpng version 1.5, the jmpbuf member is hidden. (Bug#7908) */ |
| 5626 | #define PNG_LONGJMP(ptr) (fn_png_longjmp ((ptr), 1)) | 5628 | #define PNG_LONGJMP(ptr) fn_png_longjmp (ptr, 1) |
| 5627 | #define PNG_JMPBUF(ptr) \ | 5629 | #define PNG_JMPBUF(ptr) \ |
| 5628 | (*fn_png_set_longjmp_fn ((ptr), _longjmp, sizeof (jmp_buf))) | 5630 | (*fn_png_set_longjmp_fn (ptr, FAST_LONGJMP, sizeof (jmp_buf))) |
| 5629 | #endif | 5631 | #endif |
| 5630 | 5632 | ||
| 5631 | /* Error and warning handlers installed when the PNG library | 5633 | /* Error and warning handlers installed when the PNG library |
| @@ -5810,7 +5812,7 @@ png_load_body (struct frame *f, struct image *img, struct png_load_context *c) | |||
| 5810 | 5812 | ||
| 5811 | /* Set error jump-back. We come back here when the PNG library | 5813 | /* Set error jump-back. We come back here when the PNG library |
| 5812 | detects an error. */ | 5814 | detects an error. */ |
| 5813 | if (_setjmp (PNG_JMPBUF (png_ptr))) | 5815 | if (FAST_SETJMP (PNG_JMPBUF (png_ptr))) |
| 5814 | { | 5816 | { |
| 5815 | error: | 5817 | error: |
| 5816 | if (c->png_ptr) | 5818 | if (c->png_ptr) |