GraphicsMagick: coders/tiff.c Do not include #include "tif_dir.h...

GraphicsMagick Commits <[email protected]> Sun, 17 Dec 2023 18:35:15 -0600
Newsgroups gmane.comp.video.graphicsmagick.cvs
Message-ID <mailman.13224.1702859728.7940.graphicsmagick-commit@lists.sourceforge.net>
changeset df120e244c33 in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=df120e244c33
summary: coders/tiff.c Do not include #include "tif_dir.h" if it is not present.

diffstat:

 coders/tiff.c |  22 +++++++++++++++++++---
 1 files changed, 19 insertions(+), 3 deletions(-)

diffs (76 lines):

diff -r dace329c2cde -r df120e244c33 coders/tiff.c
--- a/coders/tiff.c	Mon Dec 18 00:08:05 2023 +0100
+++ b/coders/tiff.c	Mon Dec 18 01:30:24 2023 +0100
@@ -4401,7 +4401,9 @@
 
 #if TIFFLIB_VERSION >= 20120922
 
-#include "tif_dir.h"
+#ifdef HasTIFF_dir
+  #include "tif_dir.h"
+#endif
 
 /*
 static TIFFField customFields[] = {
@@ -4436,15 +4438,20 @@
 
 static const char *FipFieldName(const TIFFField *fip)
 {
+#ifdef HasTIFF_dir
   if(fip)
   {
     if(fip->field_name==NULL) return "N/A";
     return fip->field_name;
   }
   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};
@@ -4503,6 +4510,7 @@
       Field = LD_UINT16(profile_data+IFDpos+2);
       Long2 = LD_UINT32(profile_data+IFDpos+4);
       Value = LD_UINT32(profile_data+IFDpos+8);
+
       fip = TIFFFindField(tiff, Tag, TIFF_ANY);
 
       if(logging)
@@ -4513,22 +4521,30 @@
       {
         switch(Field)
         {
-          case TIFF_ASCII: if(fip->field_type!=TIFF_ASCII)
+          case TIFF_ASCII:
+#ifdef HasTIFF_dir
+                            if(fip->field_type!=TIFF_ASCII)
                                break;	/* Incompatible recipe.*/
+#endif
                            if(Value>=profile_length-1) break;		/* String outside EXIF boundary. */
                            if(TIFFSetField(tiff, Tag, profile_data+Value))
                                FieldCount++;
                            break;
           case TIFF_BYTE:
           case TIFF_SHORT:
-          case TIFF_LONG:  if(fip->field_type!=TIFF_BYTE && fip->field_type!=TIFF_SHORT && fip->field_type!=TIFF_LONG)
+          case TIFF_LONG:
+#ifdef HasTIFF_dir
+                           if(fip->field_type!=TIFF_BYTE && fip->field_type!=TIFF_SHORT && fip->field_type!=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
                            {
                              double d = Value / (double)Long2;
                              if(TIFFSetField(tiff, Tag, d))