]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Wed, 9 Nov 2011 22:50:49 +0000 (22:50 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Wed, 9 Nov 2011 22:50:49 +0000 (22:50 +0000)
coders/tiff.c

index 79ddc535491ef05f1160c4ad51f29c740f6c390d..134a763182cd8e3c11a7043af6feac94d965e91d 100644 (file)
@@ -739,25 +739,6 @@ static toff_t TIFFSeekBlob(thandle_t image,toff_t offset,int whence)
   return((toff_t) SeekBlob((Image *) image,(MagickOffsetType) offset,whence));
 }
 
-#if defined(MAGICKCORE_HAVE_TIFFMERGEFIELDINFO) && defined(MAGICKCORE_HAVE_TIFFSETTAGEXTENDER)
-static TIFFExtendProc
-  tiff_extensions = (TIFFExtendProc) NULL;
-
-static void TIFFTagExtender(TIFF *tiff)
-{
-  static const TIFFFieldInfo
-    TIFFExtensions[] =
-    {
-      { 37724, -3, -3, TIFF_UNDEFINED, FIELD_CUSTOM, 1, 1, "PhotoshopLayerData" }
-    };
-
-  TIFFMergeFieldInfo(tiff,TIFFExtensions,sizeof(TIFFExtensions)/
-    sizeof(*TIFFExtensions));
-  if (tiff_extensions != (TIFFExtendProc) NULL)
-    (*tiff_extensions)(tiff);
-}
-#endif
-
 static void TIFFUnmapBlob(thandle_t image,tdata_t base,toff_t size)
 {
   (void) image;
@@ -895,10 +876,6 @@ static Image *ReadTIFFImage(const ImageInfo *image_info,
       image_info->filename);
   assert(exception != (ExceptionInfo *) NULL);
   assert(exception->signature == MagickSignature);
-#if defined(MAGICKCORE_HAVE_TIFFMERGEFIELDINFO) && defined(MAGICKCORE_HAVE_TIFFSETTAGEXTENDER)
-  if (tiff_extensions == (TIFFExtendProc) NULL)
-    tiff_extensions=TIFFSetTagExtender(TIFFTagExtender);
-#endif
   image=AcquireImage(image_info,exception);
   status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
   if (status == MagickFalse)
@@ -1772,6 +1749,26 @@ static Image *ReadTIFFImage(const ImageInfo *image_info,
 %      size_t RegisterTIFFImage(void)
 %
 */
+
+#if defined(MAGICKCORE_HAVE_TIFFMERGEFIELDINFO) && defined(MAGICKCORE_HAVE_TIFFSETTAGEXTENDER)
+static TIFFExtendProc
+  tiff_extensions = (TIFFExtendProc) NULL;
+
+static void TIFFTagExtender(TIFF *tiff)
+{
+  static const TIFFFieldInfo
+    TIFFExtensions[] =
+    {
+      { 37724, -3, -3, TIFF_UNDEFINED, FIELD_CUSTOM, 1, 1, "PhotoshopLayerData" }
+    };
+
+  TIFFMergeFieldInfo(tiff,TIFFExtensions,sizeof(TIFFExtensions)/
+    sizeof(*TIFFExtensions));
+  if (tiff_extensions != (TIFFExtendProc) NULL)
+    (*tiff_extensions)(tiff);
+}
+#endif
+
 ModuleExport size_t RegisterTIFFImage(void)
 {
 #define TIFFDescription  "Tagged Image File Format"
@@ -1789,6 +1786,10 @@ ModuleExport size_t RegisterTIFFImage(void)
     {
       if (MagickCreateThreadKey(&tiff_exception) == MagickFalse)
         ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
+#if defined(MAGICKCORE_HAVE_TIFFMERGEFIELDINFO) && defined(MAGICKCORE_HAVE_TIFFSETTAGEXTENDER)
+      if (tiff_extensions == (TIFFExtendProc) NULL)
+        tiff_extensions=TIFFSetTagExtender(TIFFTagExtender);
+#endif
       instantiate_key=MagickTrue;
     }
   UnlockSemaphoreInfo(tiff_semaphore);