Don't block threads in the png codec when PNG_SETJMP_SUPPORTED is not defined.
diff --git a/coders/png.c b/coders/png.c
index 28e44fe..b7788c1 100644
--- a/coders/png.c
+++ b/coders/png.c
@@ -628,13 +628,15 @@
setjmp/longjmp is claimed to be safe on these platforms:
setjmp/longjmp is alleged to be unsafe on these platforms:
*/
-#ifndef SETJMP_IS_THREAD_SAFE
-#define PNG_SETJMP_NOT_THREAD_SAFE
-#endif
+#ifdef PNG_SETJMP_SUPPORTED
+# ifndef IMPNG_SETJMP_IS_THREAD_SAFE
+# define IMPNG_SETJMP_NOT_THREAD_SAFE
+# endif
-#ifdef PNG_SETJMP_NOT_THREAD_SAFE
+# ifdef IMPNG_SETJMP_NOT_THREAD_SAFE
static SemaphoreInfo
*ping_semaphore = (SemaphoreInfo *) NULL;
+# endif
#endif
/*
@@ -2342,7 +2344,7 @@
*/
png_destroy_read_struct(&ping,&ping_info,&end_info);
-#ifdef PNG_SETJMP_NOT_THREAD_SAFE
+#ifdef IMPNG_SETJMP_NOT_THREAD_SAFE
UnlockSemaphoreInfo(ping_semaphore);
#endif
@@ -2367,7 +2369,7 @@
* that libpng is able to clean up, and that the semaphore is unlocked.
*/
-#ifdef PNG_SETJMP_NOT_THREAD_SAFE
+#ifdef IMPNG_SETJMP_NOT_THREAD_SAFE
LockSemaphoreInfo(ping_semaphore);
#endif
@@ -3252,7 +3254,7 @@
mng_info->scenes_found-1);
png_destroy_read_struct(&ping,&ping_info,&end_info);
-#ifdef PNG_SETJMP_NOT_THREAD_SAFE
+#ifdef IMPNG_SETJMP_NOT_THREAD_SAFE
UnlockSemaphoreInfo(ping_semaphore);
#endif
@@ -3625,7 +3627,7 @@
pixel_info=RelinquishVirtualMemory(pixel_info);
image->colors=2;
(void) SetImageBackgroundColor(image,exception);
-#ifdef PNG_SETJMP_NOT_THREAD_SAFE
+#ifdef IMPNG_SETJMP_NOT_THREAD_SAFE
UnlockSemaphoreInfo(ping_semaphore);
#endif
if (logging != MagickFalse)
@@ -4017,7 +4019,7 @@
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" exit ReadOnePNGImage()");
-#ifdef PNG_SETJMP_NOT_THREAD_SAFE
+#ifdef IMPNG_SETJMP_NOT_THREAD_SAFE
UnlockSemaphoreInfo(ping_semaphore);
#endif
@@ -7664,7 +7666,7 @@
entry->note=ConstantString(JNGNote);
(void) RegisterMagickInfo(entry);
-#ifdef PNG_SETJMP_NOT_THREAD_SAFE
+#ifdef IMPNG_SETJMP_NOT_THREAD_SAFE
ping_semaphore=AcquireSemaphoreInfo();
#endif
@@ -7702,7 +7704,7 @@
(void) UnregisterMagickInfo("PNG00");
(void) UnregisterMagickInfo("JNG");
-#ifdef PNG_SETJMP_NOT_THREAD_SAFE
+#ifdef IMPNG_SETJMP_NOT_THREAD_SAFE
if (ping_semaphore != (SemaphoreInfo *) NULL)
RelinquishSemaphoreInfo(&ping_semaphore);
#endif
@@ -9504,7 +9506,7 @@
(void) printf("PNG write has failed.\n");
#endif
png_destroy_write_struct(&ping,&ping_info);
-#ifdef PNG_SETJMP_NOT_THREAD_SAFE
+#ifdef IMPNG_SETJMP_NOT_THREAD_SAFE
UnlockSemaphoreInfo(ping_semaphore);
#endif
@@ -9526,7 +9528,7 @@
* that libpng is able to clean up, and that the semaphore is unlocked.
*/
-#ifdef PNG_SETJMP_NOT_THREAD_SAFE
+#ifdef IMPNG_SETJMP_NOT_THREAD_SAFE
LockSemaphoreInfo(ping_semaphore);
#endif
@@ -11408,7 +11410,7 @@
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" exit WriteOnePNGImage()");
-#ifdef PNG_SETJMP_NOT_THREAD_SAFE
+#ifdef IMPNG_SETJMP_NOT_THREAD_SAFE
UnlockSemaphoreInfo(ping_semaphore);
#endif