]> granicus.if.org Git - imagemagick/commitdiff
Don't block threads in the png codec when PNG_SETJMP_SUPPORTED is not defined.
authorglennrp <glennrp@git.imagemagick.org>
Sun, 16 Mar 2014 22:09:06 +0000 (22:09 +0000)
committerglennrp <glennrp@git.imagemagick.org>
Sun, 16 Mar 2014 22:09:06 +0000 (22:09 +0000)
coders/png.c

index 28e44feac87ebc3467c218f6888cd455a73fc0ca..b7788c1370cdba6ceb9fbcd718333e7aabbb04ae 100644 (file)
@@ -628,13 +628,15 @@ const struct sRGB_info_struct sRGB_info[] =
   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 @@ static Image *ReadOnePNGImage(MngInfo *mng_info,
       */
       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 @@ static Image *ReadOnePNGImage(MngInfo *mng_info,
    *    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 @@ static Image *ReadOnePNGImage(MngInfo *mng_info,
           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 @@ static Image *ReadOnePNGImage(MngInfo *mng_info,
       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 @@ static Image *ReadOnePNGImage(MngInfo *mng_info,
     (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 @@ ModuleExport size_t RegisterPNGImage(void)
   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 @@ ModuleExport void UnregisterPNGImage(void)
   (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 @@ static MagickBooleanType WriteOnePNGImage(MngInfo *mng_info,
         (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 @@ static MagickBooleanType WriteOnePNGImage(MngInfo *mng_info,
    *    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 @@ static MagickBooleanType WriteOnePNGImage(MngInfo *mng_info,
     (void) LogMagickEvent(CoderEvent,GetMagickModule(),
       "  exit WriteOnePNGImage()");
 
-#ifdef PNG_SETJMP_NOT_THREAD_SAFE
+#ifdef IMPNG_SETJMP_NOT_THREAD_SAFE
   UnlockSemaphoreInfo(ping_semaphore);
 #endif