GraphicsMagick: coders/tiff.c "tif_dir.h" is no longer needed.

GraphicsMagick Commits <[email protected]> Sun, 17 Dec 2023 18:58:44 -0600
Newsgroups gmane.comp.video.graphicsmagick.cvs
Message-ID <mailman.8069.1702861135.7803.graphicsmagick-commit@lists.sourceforge.net>
changeset 9eb113adfb7b in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=9eb113adfb7b
summary: coders/tiff.c "tif_dir.h" is no longer needed.

diffstat:

 coders/tiff.c |  27 +++++++--------------------
 1 files changed, 7 insertions(+), 20 deletions(-)

diffs (75 lines):

diff -r df120e244c33 -r 9eb113adfb7b coders/tiff.c
--- a/coders/tiff.c	Mon Dec 18 01:30:24 2023 +0100
+++ b/coders/tiff.c	Mon Dec 18 01:58:21 2023 +0100
@@ -4401,10 +4401,6 @@
 
 #if TIFFLIB_VERSION >= 20120922
 
-#ifdef HasTIFF_dir
-  #include "tif_dir.h"
-#endif
-
 /*
 static TIFFField customFields[] = {
     {544, -1, -1, TIFF_LONG, 0, TIFF_SETGET_UINT32,
@@ -4438,20 +4434,16 @@
 
 static const char *FipFieldName(const TIFFField *fip)
 {
-#ifdef HasTIFF_dir
   if(fip)
   {
-    if(fip->field_name==NULL) return "N/A";
-    return fip->field_name;
+    const char * const FName = TIFFFieldName(fip);
+    if(FName==NULL) return "N/A";
+    return FName;
   }
   return "UNSUPPORTED";
-#else
-  return "";
-#endif
 }
 
 
-
 static int AddExifFields(TIFF *tiff, const unsigned char *profile_data, size_t profile_length, MagickBool logging)
 {
 const char EXIF[6] = {'E','x','i','f',0,0};
@@ -4519,13 +4511,12 @@
 
       if(fip!=NULL)		/* libtiff doesn't understand these */
       {
+        const TIFFDataType FDT = TIFFFieldDataType(fip);
         switch(Field)
         {
           case TIFF_ASCII:
-#ifdef HasTIFF_dir
-                            if(fip->field_type!=TIFF_ASCII)
+                            if(FDT!=TIFF_ASCII)
                                break;	/* Incompatible recipe.*/
-#endif
                            if(Value>=profile_length-1) break;		/* String outside EXIF boundary. */
                            if(TIFFSetField(tiff, Tag, profile_data+Value))
                                FieldCount++;
@@ -4533,18 +4524,14 @@
           case TIFF_BYTE:
           case TIFF_SHORT:
           case TIFF_LONG:
-#ifdef HasTIFF_dir
-                           if(fip->field_type!=TIFF_BYTE && fip->field_type!=TIFF_SHORT && fip->field_type!=TIFF_LONG)
+                           if(FDT!=TIFF_BYTE && FDT!=TIFF_SHORT && FDT!=TIFF_LONG)
                                break;
-#endif
                            if(TIFFSetField(tiff, Tag, Value))
                                FieldCount++;
                            break;
           //case TIFF_SRATIONAL:  ??
           case TIFF_RATIONAL:
-#ifdef HasTIFF_dir
-                           if(fip->field_type == TIFF_RATIONAL)
-#endif
+                           if(FDT == TIFF_RATIONAL)
                            {
                              double d = Value / (double)Long2;
                              if(TIFFSetField(tiff, Tag, d))