ReactOS  0.4.14-dev-358-gbef841c
tif_dir.c File Reference
#include <precomp.h>
#include <float.h>
Include dependency graph for tif_dir.c:

Go to the source code of this file.

Macros

#define DATATYPE_VOID   0 /* !untyped data */
 
#define DATATYPE_INT   1 /* !signed integer data */
 
#define DATATYPE_UINT   2 /* !unsigned integer data */
 
#define DATATYPE_IEEEFP   3 /* !IEEE floating point data */
 
#define EXTRASAMPLE_COREL_UNASSALPHA   999
 
#define CleanupField(member)
 

Functions

static void setByteArray (void **vpp, void *vp, size_t nmemb, size_t elem_size)
 
void _TIFFsetByteArray (void **vpp, void *vp, uint32 n)
 
void _TIFFsetString (char **cpp, char *cp)
 
static void _TIFFsetNString (char **cpp, char *cp, uint32 n)
 
void _TIFFsetShortArray (uint16 **wpp, uint16 *wp, uint32 n)
 
void _TIFFsetLongArray (uint32 **lpp, uint32 *lp, uint32 n)
 
static void _TIFFsetLong8Array (uint64 **lpp, uint64 *lp, uint32 n)
 
void _TIFFsetFloatArray (float **fpp, float *fp, uint32 n)
 
void _TIFFsetDoubleArray (double **dpp, double *dp, uint32 n)
 
static void setDoubleArrayOneValue (double **vpp, double value, size_t nmemb)
 
static int setExtraSamples (TIFFDirectory *td, va_list ap, uint32 *v)
 
static uint32 checkInkNamesString (TIFF *tif, uint32 slen, const char *s)
 
static float TIFFClampDoubleToFloat (double val)
 
static int _TIFFVSetField (TIFF *tif, uint32 tag, va_list ap)
 
static int OkToChangeTag (TIFF *tif, uint32 tag)
 
int TIFFSetField (TIFF *tif, uint32 tag,...)
 
int TIFFUnsetField (TIFF *tif, uint32 tag)
 
int TIFFVSetField (TIFF *tif, uint32 tag, va_list ap)
 
static int _TIFFVGetField (TIFF *tif, uint32 tag, va_list ap)
 
int TIFFGetField (TIFF *tif, uint32 tag,...)
 
int TIFFVGetField (TIFF *tif, uint32 tag, va_list ap)
 
void TIFFFreeDirectory (TIFF *tif)
 
TIFFExtendProc TIFFSetTagExtender (TIFFExtendProc extender)
 
int TIFFCreateDirectory (TIFF *tif)
 
int TIFFCreateCustomDirectory (TIFF *tif, const TIFFFieldArray *infoarray)
 
int TIFFCreateEXIFDirectory (TIFF *tif)
 
int TIFFDefaultDirectory (TIFF *tif)
 
static int TIFFAdvanceDirectory (TIFF *tif, uint64 *nextdir, uint64 *off)
 
uint16 TIFFNumberOfDirectories (TIFF *tif)
 
int TIFFSetDirectory (TIFF *tif, uint16 dirn)
 
int TIFFSetSubDirectory (TIFF *tif, uint64 diroff)
 
uint64 TIFFCurrentDirOffset (TIFF *tif)
 
int TIFFLastDirectory (TIFF *tif)
 
int TIFFUnlinkDirectory (TIFF *tif, uint16 dirn)
 

Variables

static TIFFExtendProc _TIFFextender = (TIFFExtendProc) NULL
 

Macro Definition Documentation

◆ CleanupField

#define CleanupField (   member)
Value:
{ \
if (td->member) { \
_TIFFfree(td->member); \
td->member = 0; \
} \
}

Definition at line 1240 of file tif_dir.c.

◆ DATATYPE_IEEEFP

#define DATATYPE_IEEEFP   3 /* !IEEE floating point data */

Definition at line 40 of file tif_dir.c.

◆ DATATYPE_INT

#define DATATYPE_INT   1 /* !signed integer data */

Definition at line 38 of file tif_dir.c.

◆ DATATYPE_UINT

#define DATATYPE_UINT   2 /* !unsigned integer data */

Definition at line 39 of file tif_dir.c.

◆ DATATYPE_VOID

#define DATATYPE_VOID   0 /* !untyped data */

Definition at line 37 of file tif_dir.c.

◆ EXTRASAMPLE_COREL_UNASSALPHA

#define EXTRASAMPLE_COREL_UNASSALPHA   999

Function Documentation

◆ _TIFFsetByteArray()

void _TIFFsetByteArray ( void **  vpp,
void vp,
uint32  n 
)

Definition at line 57 of file tif_dir.c.

58  { setByteArray(vpp, vp, n, 1); }
static void setByteArray(void **vpp, void *vp, size_t nmemb, size_t elem_size)
Definition: tif_dir.c:43
GLdouble n
Definition: glext.h:7729

◆ _TIFFsetDoubleArray()

void _TIFFsetDoubleArray ( double **  dpp,
double dp,
uint32  n 
)

Definition at line 71 of file tif_dir.c.

72  { setByteArray((void**) dpp, (void*) dp, n, sizeof (double)); }
static void setByteArray(void **vpp, void *vp, size_t nmemb, size_t elem_size)
Definition: tif_dir.c:43
GLdouble n
Definition: glext.h:7729

Referenced by _TIFFVSetField().

◆ _TIFFsetFloatArray()

void _TIFFsetFloatArray ( float **  fpp,
float *  fp,
uint32  n 
)

Definition at line 69 of file tif_dir.c.

70  { setByteArray((void**) fpp, (void*) fp, n, sizeof (float)); }
static void setByteArray(void **vpp, void *vp, size_t nmemb, size_t elem_size)
Definition: tif_dir.c:43
GLdouble n
Definition: glext.h:7729

Referenced by _TIFFVSetField().

◆ _TIFFsetLong8Array()

static void _TIFFsetLong8Array ( uint64 **  lpp,
uint64 lp,
uint32  n 
)
static

Definition at line 67 of file tif_dir.c.

68  { setByteArray((void**) lpp, (void*) lp, n, sizeof (uint64)); }
unsigned long long uint64
Definition: platform.h:18
static void setByteArray(void **vpp, void *vp, size_t nmemb, size_t elem_size)
Definition: tif_dir.c:43
GLdouble n
Definition: glext.h:7729

Referenced by _TIFFVSetField().

◆ _TIFFsetLongArray()

void _TIFFsetLongArray ( uint32 **  lpp,
uint32 lp,
uint32  n 
)

Definition at line 65 of file tif_dir.c.

66  { setByteArray((void**) lpp, (void*) lp, n, sizeof (uint32)); }
static void setByteArray(void **vpp, void *vp, size_t nmemb, size_t elem_size)
Definition: tif_dir.c:43
unsigned int uint32
Definition: types.h:32
GLdouble n
Definition: glext.h:7729

◆ _TIFFsetNString()

static void _TIFFsetNString ( char **  cpp,
char cp,
uint32  n 
)
static

Definition at line 61 of file tif_dir.c.

62  { setByteArray((void**) cpp, (void*) cp, n, 1); }
static void setByteArray(void **vpp, void *vp, size_t nmemb, size_t elem_size)
Definition: tif_dir.c:43
GLdouble n
Definition: glext.h:7729
POINT cp
Definition: magnifier.c:59

Referenced by _TIFFVSetField().

◆ _TIFFsetShortArray()

void _TIFFsetShortArray ( uint16 **  wpp,
uint16 wp,
uint32  n 
)

Definition at line 63 of file tif_dir.c.

64  { setByteArray((void**) wpp, (void*) wp, n, sizeof (uint16)); }
static void setByteArray(void **vpp, void *vp, size_t nmemb, size_t elem_size)
Definition: tif_dir.c:43
GLdouble n
Definition: glext.h:7729
unsigned short uint16
Definition: types.h:30

Referenced by _TIFFVSetField(), setExtraSamples(), and TIFFReadDirectory().

◆ _TIFFsetString()

void _TIFFsetString ( char **  cpp,
char cp 
)

Definition at line 59 of file tif_dir.c.

60  { setByteArray((void**) cpp, (void*) cp, strlen(cp)+1, 1); }
static void setByteArray(void **vpp, void *vp, size_t nmemb, size_t elem_size)
Definition: tif_dir.c:43
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
POINT cp
Definition: magnifier.c:59

◆ _TIFFVGetField()

static int _TIFFVGetField ( TIFF tif,
uint32  tag,
va_list  ap 
)
static

Definition at line 856 of file tif_dir.c.

857 {
858  TIFFDirectory* td = &tif->tif_dir;
859  int ret_val = 1;
860  uint32 standard_tag = tag;
861  const TIFFField* fip = TIFFFindField(tif, tag, TIFF_ANY);
862  if( fip == NULL ) /* cannot happen since TIFFGetField() already checks it */
863  return 0;
864 
865  /*
866  * We want to force the custom code to be used for custom
867  * fields even if the tag happens to match a well known
868  * one - important for reinterpreted handling of standard
869  * tag values in custom directories (i.e. EXIF)
870  */
871  if (fip->field_bit == FIELD_CUSTOM) {
872  standard_tag = 0;
873  }
874 
875  if( standard_tag == TIFFTAG_NUMBEROFINKS )
876  {
877  int i;
878  for (i = 0; i < td->td_customValueCount; i++) {
879  uint16 val;
880  TIFFTagValue *tv = td->td_customValues + i;
881  if (tv->info->field_tag != standard_tag)
882  continue;
883  if( tv->value == NULL )
884  return 0;
885  val = *(uint16 *)tv->value;
886  /* Truncate to SamplesPerPixel, since the */
887  /* setting code for INKNAMES assume that there are SamplesPerPixel */
888  /* inknames. */
889  /* Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2599 */
890  if( val > td->td_samplesperpixel )
891  {
892  TIFFWarningExt(tif->tif_clientdata,"_TIFFVGetField",
893  "Truncating NumberOfInks from %u to %u",
894  val, td->td_samplesperpixel);
895  val = td->td_samplesperpixel;
896  }
897  *va_arg(ap, uint16*) = val;
898  return 1;
899  }
900  return 0;
901  }
902 
903  switch (standard_tag) {
904  case TIFFTAG_SUBFILETYPE:
905  *va_arg(ap, uint32*) = td->td_subfiletype;
906  break;
907  case TIFFTAG_IMAGEWIDTH:
908  *va_arg(ap, uint32*) = td->td_imagewidth;
909  break;
910  case TIFFTAG_IMAGELENGTH:
911  *va_arg(ap, uint32*) = td->td_imagelength;
912  break;
914  *va_arg(ap, uint16*) = td->td_bitspersample;
915  break;
916  case TIFFTAG_COMPRESSION:
917  *va_arg(ap, uint16*) = td->td_compression;
918  break;
919  case TIFFTAG_PHOTOMETRIC:
920  *va_arg(ap, uint16*) = td->td_photometric;
921  break;
923  *va_arg(ap, uint16*) = td->td_threshholding;
924  break;
925  case TIFFTAG_FILLORDER:
926  *va_arg(ap, uint16*) = td->td_fillorder;
927  break;
928  case TIFFTAG_ORIENTATION:
929  *va_arg(ap, uint16*) = td->td_orientation;
930  break;
933  break;
935  *va_arg(ap, uint32*) = td->td_rowsperstrip;
936  break;
938  *va_arg(ap, uint16*) = td->td_minsamplevalue;
939  break;
941  *va_arg(ap, uint16*) = td->td_maxsamplevalue;
942  break;
944  if (tif->tif_flags & TIFF_PERSAMPLE)
945  *va_arg(ap, double**) = td->td_sminsamplevalue;
946  else
947  {
948  /* libtiff historically treats this as a single value. */
949  uint16 i;
950  double v = td->td_sminsamplevalue[0];
951  for (i=1; i < td->td_samplesperpixel; ++i)
952  if( td->td_sminsamplevalue[i] < v )
953  v = td->td_sminsamplevalue[i];
954  *va_arg(ap, double*) = v;
955  }
956  break;
958  if (tif->tif_flags & TIFF_PERSAMPLE)
959  *va_arg(ap, double**) = td->td_smaxsamplevalue;
960  else
961  {
962  /* libtiff historically treats this as a single value. */
963  uint16 i;
964  double v = td->td_smaxsamplevalue[0];
965  for (i=1; i < td->td_samplesperpixel; ++i)
966  if( td->td_smaxsamplevalue[i] > v )
967  v = td->td_smaxsamplevalue[i];
968  *va_arg(ap, double*) = v;
969  }
970  break;
971  case TIFFTAG_XRESOLUTION:
972  *va_arg(ap, float*) = td->td_xresolution;
973  break;
974  case TIFFTAG_YRESOLUTION:
975  *va_arg(ap, float*) = td->td_yresolution;
976  break;
978  *va_arg(ap, uint16*) = td->td_planarconfig;
979  break;
980  case TIFFTAG_XPOSITION:
981  *va_arg(ap, float*) = td->td_xposition;
982  break;
983  case TIFFTAG_YPOSITION:
984  *va_arg(ap, float*) = td->td_yposition;
985  break;
987  *va_arg(ap, uint16*) = td->td_resolutionunit;
988  break;
989  case TIFFTAG_PAGENUMBER:
990  *va_arg(ap, uint16*) = td->td_pagenumber[0];
991  *va_arg(ap, uint16*) = td->td_pagenumber[1];
992  break;
994  *va_arg(ap, uint16*) = td->td_halftonehints[0];
995  *va_arg(ap, uint16*) = td->td_halftonehints[1];
996  break;
997  case TIFFTAG_COLORMAP:
998  *va_arg(ap, uint16**) = td->td_colormap[0];
999  *va_arg(ap, uint16**) = td->td_colormap[1];
1000  *va_arg(ap, uint16**) = td->td_colormap[2];
1001  break;
1002  case TIFFTAG_STRIPOFFSETS:
1003  case TIFFTAG_TILEOFFSETS:
1004  _TIFFFillStriles( tif );
1005  *va_arg(ap, uint64**) = td->td_stripoffset;
1006  break;
1009  _TIFFFillStriles( tif );
1010  *va_arg(ap, uint64**) = td->td_stripbytecount;
1011  break;
1012  case TIFFTAG_MATTEING:
1013  *va_arg(ap, uint16*) =
1014  (td->td_extrasamples == 1 &&
1016  break;
1017  case TIFFTAG_EXTRASAMPLES:
1018  *va_arg(ap, uint16*) = td->td_extrasamples;
1019  *va_arg(ap, uint16**) = td->td_sampleinfo;
1020  break;
1021  case TIFFTAG_TILEWIDTH:
1022  *va_arg(ap, uint32*) = td->td_tilewidth;
1023  break;
1024  case TIFFTAG_TILELENGTH:
1025  *va_arg(ap, uint32*) = td->td_tilelength;
1026  break;
1027  case TIFFTAG_TILEDEPTH:
1028  *va_arg(ap, uint32*) = td->td_tiledepth;
1029  break;
1030  case TIFFTAG_DATATYPE:
1031  switch (td->td_sampleformat) {
1032  case SAMPLEFORMAT_UINT:
1033  *va_arg(ap, uint16*) = DATATYPE_UINT;
1034  break;
1035  case SAMPLEFORMAT_INT:
1036  *va_arg(ap, uint16*) = DATATYPE_INT;
1037  break;
1038  case SAMPLEFORMAT_IEEEFP:
1040  break;
1041  case SAMPLEFORMAT_VOID:
1042  *va_arg(ap, uint16*) = DATATYPE_VOID;
1043  break;
1044  }
1045  break;
1046  case TIFFTAG_SAMPLEFORMAT:
1047  *va_arg(ap, uint16*) = td->td_sampleformat;
1048  break;
1049  case TIFFTAG_IMAGEDEPTH:
1050  *va_arg(ap, uint32*) = td->td_imagedepth;
1051  break;
1052  case TIFFTAG_SUBIFD:
1053  *va_arg(ap, uint16*) = td->td_nsubifd;
1054  *va_arg(ap, uint64**) = td->td_subifd;
1055  break;
1057  *va_arg(ap, uint16*) = td->td_ycbcrpositioning;
1058  break;
1060  *va_arg(ap, uint16*) = td->td_ycbcrsubsampling[0];
1061  *va_arg(ap, uint16*) = td->td_ycbcrsubsampling[1];
1062  break;
1064  *va_arg(ap, uint16**) = td->td_transferfunction[0];
1065  if (td->td_samplesperpixel - td->td_extrasamples > 1) {
1066  *va_arg(ap, uint16**) = td->td_transferfunction[1];
1067  *va_arg(ap, uint16**) = td->td_transferfunction[2];
1068  } else {
1069  *va_arg(ap, uint16**) = NULL;
1070  *va_arg(ap, uint16**) = NULL;
1071  }
1072  break;
1074  *va_arg(ap, float**) = td->td_refblackwhite;
1075  break;
1076  case TIFFTAG_INKNAMES:
1077  *va_arg(ap, char**) = td->td_inknames;
1078  break;
1079  default:
1080  {
1081  int i;
1082 
1083  /*
1084  * This can happen if multiple images are open
1085  * with different codecs which have private
1086  * tags. The global tag information table may
1087  * then have tags that are valid for one file
1088  * but not the other. If the client tries to
1089  * get a tag that is not valid for the image's
1090  * codec then we'll arrive here.
1091  */
1092  if( fip->field_bit != FIELD_CUSTOM )
1093  {
1094  TIFFErrorExt(tif->tif_clientdata, "_TIFFVGetField",
1095  "%s: Invalid %stag \"%s\" "
1096  "(not supported by codec)",
1097  tif->tif_name,
1098  isPseudoTag(tag) ? "pseudo-" : "",
1099  fip->field_name);
1100  ret_val = 0;
1101  break;
1102  }
1103 
1104  /*
1105  * Do we have a custom value?
1106  */
1107  ret_val = 0;
1108  for (i = 0; i < td->td_customValueCount; i++) {
1109  TIFFTagValue *tv = td->td_customValues + i;
1110 
1111  if (tv->info->field_tag != tag)
1112  continue;
1113 
1114  if (fip->field_passcount) {
1115  if (fip->field_readcount == TIFF_VARIABLE2)
1116  *va_arg(ap, uint32*) = (uint32)tv->count;
1117  else /* Assume TIFF_VARIABLE */
1118  *va_arg(ap, uint16*) = (uint16)tv->count;
1119  *va_arg(ap, void **) = tv->value;
1120  ret_val = 1;
1121  } else if (fip->field_tag == TIFFTAG_DOTRANGE
1122  && strcmp(fip->field_name,"DotRange") == 0) {
1123  /* TODO: This is an evil exception and should not have been
1124  handled this way ... likely best if we move it into
1125  the directory structure with an explicit field in
1126  libtiff 4.1 and assign it a FIELD_ value */
1127  *va_arg(ap, uint16*) = ((uint16 *)tv->value)[0];
1128  *va_arg(ap, uint16*) = ((uint16 *)tv->value)[1];
1129  ret_val = 1;
1130  } else {
1131  if (fip->field_type == TIFF_ASCII
1132  || fip->field_readcount == TIFF_VARIABLE
1133  || fip->field_readcount == TIFF_VARIABLE2
1134  || fip->field_readcount == TIFF_SPP
1135  || tv->count > 1) {
1136  *va_arg(ap, void **) = tv->value;
1137  ret_val = 1;
1138  } else {
1139  char *val = (char *)tv->value;
1140  assert( tv->count == 1 );
1141  switch (fip->field_type) {
1142  case TIFF_BYTE:
1143  case TIFF_UNDEFINED:
1144  *va_arg(ap, uint8*) =
1145  *(uint8 *)val;
1146  ret_val = 1;
1147  break;
1148  case TIFF_SBYTE:
1149  *va_arg(ap, int8*) =
1150  *(int8 *)val;
1151  ret_val = 1;
1152  break;
1153  case TIFF_SHORT:
1154  *va_arg(ap, uint16*) =
1155  *(uint16 *)val;
1156  ret_val = 1;
1157  break;
1158  case TIFF_SSHORT:
1159  *va_arg(ap, int16*) =
1160  *(int16 *)val;
1161  ret_val = 1;
1162  break;
1163  case TIFF_LONG:
1164  case TIFF_IFD:
1165  *va_arg(ap, uint32*) =
1166  *(uint32 *)val;
1167  ret_val = 1;
1168  break;
1169  case TIFF_SLONG:
1170  *va_arg(ap, int32*) =
1171  *(int32 *)val;
1172  ret_val = 1;
1173  break;
1174  case TIFF_LONG8:
1175  case TIFF_IFD8:
1176  *va_arg(ap, uint64*) =
1177  *(uint64 *)val;
1178  ret_val = 1;
1179  break;
1180  case TIFF_SLONG8:
1181  *va_arg(ap, int64*) =
1182  *(int64 *)val;
1183  ret_val = 1;
1184  break;
1185  case TIFF_RATIONAL:
1186  case TIFF_SRATIONAL:
1187  case TIFF_FLOAT:
1188  *va_arg(ap, float*) =
1189  *(float *)val;
1190  ret_val = 1;
1191  break;
1192  case TIFF_DOUBLE:
1193  *va_arg(ap, double*) =
1194  *(double *)val;
1195  ret_val = 1;
1196  break;
1197  default:
1198  ret_val = 0;
1199  break;
1200  }
1201  }
1202  }
1203  break;
1204  }
1205  }
1206  }
1207  return(ret_val);
1208 }
unsigned long long uint64
Definition: platform.h:18
#define DATATYPE_IEEEFP
Definition: tif_dir.c:40
#define TIFFTAG_SUBFILETYPE
Definition: tiff.h:146
#define TIFF_VARIABLE
Definition: tiffio.h:313
uint16 td_ycbcrpositioning
Definition: tif_dir.h:111
#define FIELD_CUSTOM
Definition: tiffio.h:317
float td_yposition
Definition: tif_dir.h:89
uint16 td_bitspersample
Definition: tif_dir.h:74
uint32 td_tiledepth
Definition: tif_dir.h:72
#define TIFFTAG_BITSPERSAMPLE
Definition: tiff.h:156
void TIFFWarningExt(thandle_t fd, const char *module, const char *fmt,...)
Definition: tif_warning.c:65
#define TIFFTAG_ROWSPERSTRIP
Definition: tiff.h:233
#define TIFF_ANY
Definition: tiffio.h:312
char * td_inknames
Definition: tif_dir.h:117
#define TIFFTAG_STRIPBYTECOUNTS
Definition: tiff.h:234
#define TIFFTAG_COLORMAP
Definition: tiff.h:284
#define TIFFTAG_EXTRASAMPLES
Definition: tiff.h:304
#define TIFFTAG_ORIENTATION
Definition: tiff.h:223
#define isPseudoTag(t)
Definition: tiffiop.h:211
unsigned int uint32
Definition: types.h:32
#define TIFFTAG_IMAGEWIDTH
Definition: tiff.h:154
#define TIFFTAG_YRESOLUTION
Definition: tiff.h:238
#define TIFFTAG_DATATYPE
Definition: tiff.h:385
#define TIFFTAG_MINSAMPLEVALUE
Definition: tiff.h:235
#define TIFFTAG_INKNAMES
Definition: tiff.h:300
#define TIFFTAG_FILLORDER
Definition: tiff.h:215
TIFFTagValue * td_customValues
Definition: tif_dir.h:120
uint16 td_halftonehints[2]
Definition: tif_dir.h:92
int count
Definition: tif_dir.h:37
#define assert(x)
Definition: debug.h:53
Definition: ecma_167.h:138
#define TIFFTAG_DOTRANGE
Definition: tiff.h:302
uint32 td_imagedepth
Definition: tif_dir.h:71
int td_customValueCount
Definition: tif_dir.h:119
#define TIFFTAG_STRIPOFFSETS
Definition: tiff.h:222
#define TIFFTAG_SUBIFD
Definition: tiff.h:296
#define TIFFTAG_THRESHHOLDING
Definition: tiff.h:209
#define TIFFTAG_YCBCRSUBSAMPLING
Definition: tiff.h:367
thandle_t tif_clientdata
Definition: tiffiop.h:191
#define TIFFTAG_YPOSITION
Definition: tiff.h:244
#define TIFFTAG_SMINSAMPLEVALUE
Definition: tiff.h:315
long long int64
Definition: platform.h:13
#define TIFFTAG_REFERENCEBLACKWHITE
Definition: tiff.h:371
#define TIFFTAG_PLANARCONFIG
Definition: tiff.h:239
#define TIFFTAG_MATTEING
Definition: tiff.h:384
char * tif_name
Definition: tiffiop.h:103
#define SAMPLEFORMAT_INT
Definition: tiff.h:310
float td_xresolution
Definition: tif_dir.h:86
#define TIFFTAG_TILEBYTECOUNTS
Definition: tiff.h:289
uint32 td_tilelength
Definition: tif_dir.h:72
unsigned short field_bit
Definition: tif_dir.h:286
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
float td_xposition
Definition: tif_dir.h:89
#define TIFFTAG_YCBCRPOSITIONING
Definition: tiff.h:368
#define TIFFTAG_TILEWIDTH
Definition: tiff.h:286
#define DATATYPE_VOID
Definition: tif_dir.c:37
char * field_name
Definition: tif_dir.h:289
uint32 td_subfiletype
Definition: tif_dir.h:73
uint16 * td_sampleinfo
Definition: tif_dir.h:94
uint16 td_nsubifd
Definition: tif_dir.h:107
uint16 td_resolutionunit
Definition: tif_dir.h:87
#define TIFFTAG_TILELENGTH
Definition: tiff.h:287
uint32 tif_flags
Definition: tiffiop.h:106
smooth NULL
Definition: ftsmooth.c:416
#define TIFFTAG_IMAGELENGTH
Definition: tiff.h:155
#define TIFFTAG_TILEOFFSETS
Definition: tiff.h:288
#define TIFFTAG_SAMPLESPERPIXEL
Definition: tiff.h:232
uint16 td_planarconfig
Definition: tif_dir.h:88
#define SAMPLEFORMAT_VOID
Definition: tiff.h:312
uint16 * td_colormap[3]
Definition: tif_dir.h:91
double * td_sminsamplevalue
Definition: tif_dir.h:84
uint16 td_orientation
Definition: tif_dir.h:80
uint16 td_minsamplevalue
Definition: tif_dir.h:83
GLuint GLfloat * val
Definition: glext.h:7180
unsigned char field_passcount
Definition: tif_dir.h:288
#define SAMPLEFORMAT_UINT
Definition: tiff.h:309
const TIFFField * info
Definition: tif_dir.h:36
#define TIFF_PERSAMPLE
Definition: tiffiop.h:128
uint16 td_extrasamples
Definition: tif_dir.h:93
uint32 td_imagelength
Definition: tif_dir.h:71
uint32 field_tag
Definition: tif_dir.h:279
#define SAMPLEFORMAT_IEEEFP
Definition: tiff.h:311
#define TIFFTAG_XPOSITION
Definition: tiff.h:243
uint16 td_photometric
Definition: tif_dir.h:77
#define TIFFTAG_HALFTONEHINTS
Definition: tiff.h:285
unsigned char uint8
Definition: types.h:28
void TIFFErrorExt(thandle_t fd, const char *module, const char *fmt,...)
Definition: tif_error.c:65
double * td_smaxsamplevalue
Definition: tif_dir.h:85
#define TIFFTAG_PHOTOMETRIC
Definition: tiff.h:195
uint16 td_fillorder
Definition: tif_dir.h:79
#define TIFFTAG_PAGENUMBER
Definition: tiff.h:266
uint64 * td_stripoffset
Definition: tif_dir.h:100
#define TIFFTAG_TRANSFERFUNCTION
Definition: tiff.h:273
#define TIFFTAG_COMPRESSION
Definition: tiff.h:157
uint32 td_tilewidth
Definition: tif_dir.h:72
uint16 td_sampleformat
Definition: tif_dir.h:75
uint16 td_threshholding
Definition: tif_dir.h:78
uint64 * td_stripbytecount
Definition: tif_dir.h:101
uint16 td_pagenumber[2]
Definition: tif_dir.h:90
#define TIFFTAG_NUMBEROFINKS
Definition: tiff.h:301
#define TIFFTAG_SMAXSAMPLEVALUE
Definition: tiff.h:316
#define DATATYPE_UINT
Definition: tif_dir.c:39
#define TIFF_VARIABLE2
Definition: tiffio.h:315
uint16 td_maxsamplevalue
Definition: tif_dir.h:83
void * value
Definition: tif_dir.h:38
#define va_arg(ap, T)
Definition: acmsvcex.h:89
uint32 td_rowsperstrip
Definition: tif_dir.h:82
const GLdouble * v
Definition: gl.h:2040
uint64 * td_subifd
Definition: tif_dir.h:108
TIFFDataType field_type
Definition: tif_dir.h:282
#define TIFFTAG_TILEDEPTH
Definition: tiff.h:387
#define TIFFTAG_IMAGEDEPTH
Definition: tiff.h:386
#define TIFFTAG_RESOLUTIONUNIT
Definition: tiff.h:262
#define TIFF_SPP
Definition: tiffio.h:314
uint16 td_ycbcrsubsampling[2]
Definition: tif_dir.h:110
#define TIFFTAG_XRESOLUTION
Definition: tiff.h:237
unsigned short uint16
Definition: types.h:30
short int16
Definition: platform.h:11
TIFFDirectory tif_dir
Definition: tiffiop.h:135
float * td_refblackwhite
Definition: tif_dir.h:114
uint16 * td_transferfunction[3]
Definition: tif_dir.h:113
long int32
Definition: platform.h:12
void int int ULONGLONG int va_list * ap
Definition: winesup.h:32
float td_yresolution
Definition: tif_dir.h:86
const TIFFField * TIFFFindField(TIFF *tif, uint32 tag, TIFFDataType dt)
Definition: tif_dirinfo.c:506
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define DATATYPE_INT
Definition: tif_dir.c:38
uint16 td_samplesperpixel
Definition: tif_dir.h:81
Definition: tiff.h:137
uint16 td_compression
Definition: tif_dir.h:76
#define TIFFTAG_SAMPLEFORMAT
Definition: tiff.h:308
#define EXTRASAMPLE_ASSOCALPHA
Definition: tiff.h:306
uint32 td_imagewidth
Definition: tif_dir.h:71
#define TIFFTAG_MAXSAMPLEVALUE
Definition: tiff.h:236
int _TIFFFillStriles(TIFF *tif)
Definition: tif_dirread.c:5812
char int8
Definition: platform.h:10
short field_readcount
Definition: tif_dir.h:280
char * tag
Definition: main.c:59

Referenced by TIFFDefaultDirectory().

◆ _TIFFVSetField()

static int _TIFFVSetField ( TIFF tif,
uint32  tag,
va_list  ap 
)
static

Definition at line 166 of file tif_dir.c.

167 {
168  static const char module[] = "_TIFFVSetField";
169 
170  TIFFDirectory* td = &tif->tif_dir;
171  int status = 1;
172  uint32 v32, i, v;
173  double dblval;
174  char* s;
175  const TIFFField *fip = TIFFFindField(tif, tag, TIFF_ANY);
176  uint32 standard_tag = tag;
177  if( fip == NULL ) /* cannot happen since OkToChangeTag() already checks it */
178  return 0;
179  /*
180  * We want to force the custom code to be used for custom
181  * fields even if the tag happens to match a well known
182  * one - important for reinterpreted handling of standard
183  * tag values in custom directories (i.e. EXIF)
184  */
185  if (fip->field_bit == FIELD_CUSTOM) {
186  standard_tag = 0;
187  }
188 
189  switch (standard_tag) {
190  case TIFFTAG_SUBFILETYPE:
192  break;
193  case TIFFTAG_IMAGEWIDTH:
194  td->td_imagewidth = (uint32) va_arg(ap, uint32);
195  break;
196  case TIFFTAG_IMAGELENGTH:
198  break;
201  /*
202  * If the data require post-decoding processing to byte-swap
203  * samples, set it up here. Note that since tags are required
204  * to be ordered, compression code can override this behaviour
205  * in the setup method if it wants to roll the post decoding
206  * work in with its normal work.
207  */
208  if (tif->tif_flags & TIFF_SWAB) {
209  if (td->td_bitspersample == 8)
211  else if (td->td_bitspersample == 16)
213  else if (td->td_bitspersample == 24)
215  else if (td->td_bitspersample == 32)
217  else if (td->td_bitspersample == 64)
219  else if (td->td_bitspersample == 128) /* two 64's */
221  }
222  break;
223  case TIFFTAG_COMPRESSION:
224  v = (uint16) va_arg(ap, uint16_vap);
225  /*
226  * If we're changing the compression scheme, the notify the
227  * previous module so that it can cleanup any state it's
228  * setup.
229  */
230  if (TIFFFieldSet(tif, FIELD_COMPRESSION)) {
231  if ((uint32)td->td_compression == v)
232  break;
233  (*tif->tif_cleanup)(tif);
234  tif->tif_flags &= ~TIFF_CODERSETUP;
235  }
236  /*
237  * Setup new compression routine state.
238  */
239  if( (status = TIFFSetCompressionScheme(tif, v)) != 0 )
240  td->td_compression = (uint16) v;
241  else
242  status = 0;
243  break;
244  case TIFFTAG_PHOTOMETRIC:
246  break;
249  break;
250  case TIFFTAG_FILLORDER:
251  v = (uint16) va_arg(ap, uint16_vap);
252  if (v != FILLORDER_LSB2MSB && v != FILLORDER_MSB2LSB)
253  goto badvalue;
254  td->td_fillorder = (uint16) v;
255  break;
256  case TIFFTAG_ORIENTATION:
257  v = (uint16) va_arg(ap, uint16_vap);
259  goto badvalue;
260  else
261  td->td_orientation = (uint16) v;
262  break;
264  v = (uint16) va_arg(ap, uint16_vap);
265  if (v == 0)
266  goto badvalue;
267  if( v != td->td_samplesperpixel )
268  {
269  /* See http://bugzilla.maptools.org/show_bug.cgi?id=2500 */
270  if( td->td_sminsamplevalue != NULL )
271  {
273  "SamplesPerPixel tag value is changing, "
274  "but SMinSampleValue tag was read with a different value. Cancelling it");
277  td->td_sminsamplevalue = NULL;
278  }
279  if( td->td_smaxsamplevalue != NULL )
280  {
282  "SamplesPerPixel tag value is changing, "
283  "but SMaxSampleValue tag was read with a different value. Cancelling it");
286  td->td_smaxsamplevalue = NULL;
287  }
288  }
289  td->td_samplesperpixel = (uint16) v;
290  break;
292  v32 = (uint32) va_arg(ap, uint32);
293  if (v32 == 0)
294  goto badvalue32;
295  td->td_rowsperstrip = v32;
296  if (!TIFFFieldSet(tif, FIELD_TILEDIMENSIONS)) {
297  td->td_tilelength = v32;
298  td->td_tilewidth = td->td_imagewidth;
299  }
300  break;
303  break;
306  break;
308  if (tif->tif_flags & TIFF_PERSAMPLE)
310  else
312  break;
314  if (tif->tif_flags & TIFF_PERSAMPLE)
316  else
318  break;
319  case TIFFTAG_XRESOLUTION:
320  dblval = va_arg(ap, double);
321  if( dblval < 0 )
322  goto badvaluedouble;
323  td->td_xresolution = TIFFClampDoubleToFloat( dblval );
324  break;
325  case TIFFTAG_YRESOLUTION:
326  dblval = va_arg(ap, double);
327  if( dblval < 0 )
328  goto badvaluedouble;
329  td->td_yresolution = TIFFClampDoubleToFloat( dblval );
330  break;
332  v = (uint16) va_arg(ap, uint16_vap);
334  goto badvalue;
335  td->td_planarconfig = (uint16) v;
336  break;
337  case TIFFTAG_XPOSITION:
338  td->td_xposition = TIFFClampDoubleToFloat( va_arg(ap, double) );
339  break;
340  case TIFFTAG_YPOSITION:
341  td->td_yposition = TIFFClampDoubleToFloat( va_arg(ap, double) );
342  break;
344  v = (uint16) va_arg(ap, uint16_vap);
345  if (v < RESUNIT_NONE || RESUNIT_CENTIMETER < v)
346  goto badvalue;
347  td->td_resolutionunit = (uint16) v;
348  break;
349  case TIFFTAG_PAGENUMBER:
350  td->td_pagenumber[0] = (uint16) va_arg(ap, uint16_vap);
351  td->td_pagenumber[1] = (uint16) va_arg(ap, uint16_vap);
352  break;
356  break;
357  case TIFFTAG_COLORMAP:
358  v32 = (uint32)(1L<<td->td_bitspersample);
359  _TIFFsetShortArray(&td->td_colormap[0], va_arg(ap, uint16*), v32);
360  _TIFFsetShortArray(&td->td_colormap[1], va_arg(ap, uint16*), v32);
361  _TIFFsetShortArray(&td->td_colormap[2], va_arg(ap, uint16*), v32);
362  break;
364  if (!setExtraSamples(td, ap, &v))
365  goto badvalue;
366  break;
367  case TIFFTAG_MATTEING:
368  td->td_extrasamples = (((uint16) va_arg(ap, uint16_vap)) != 0);
369  if (td->td_extrasamples) {
371  _TIFFsetShortArray(&td->td_sampleinfo, &sv, 1);
372  }
373  break;
374  case TIFFTAG_TILEWIDTH:
375  v32 = (uint32) va_arg(ap, uint32);
376  if (v32 % 16) {
377  if (tif->tif_mode != O_RDONLY)
378  goto badvalue32;
380  "Nonstandard tile width %d, convert file", v32);
381  }
382  td->td_tilewidth = v32;
383  tif->tif_flags |= TIFF_ISTILED;
384  break;
385  case TIFFTAG_TILELENGTH:
386  v32 = (uint32) va_arg(ap, uint32);
387  if (v32 % 16) {
388  if (tif->tif_mode != O_RDONLY)
389  goto badvalue32;
391  "Nonstandard tile length %d, convert file", v32);
392  }
393  td->td_tilelength = v32;
394  tif->tif_flags |= TIFF_ISTILED;
395  break;
396  case TIFFTAG_TILEDEPTH:
397  v32 = (uint32) va_arg(ap, uint32);
398  if (v32 == 0)
399  goto badvalue32;
400  td->td_tiledepth = v32;
401  break;
402  case TIFFTAG_DATATYPE:
403  v = (uint16) va_arg(ap, uint16_vap);
404  switch (v) {
405  case DATATYPE_VOID: v = SAMPLEFORMAT_VOID; break;
406  case DATATYPE_INT: v = SAMPLEFORMAT_INT; break;
407  case DATATYPE_UINT: v = SAMPLEFORMAT_UINT; break;
408  case DATATYPE_IEEEFP: v = SAMPLEFORMAT_IEEEFP;break;
409  default: goto badvalue;
410  }
411  td->td_sampleformat = (uint16) v;
412  break;
414  v = (uint16) va_arg(ap, uint16_vap);
416  goto badvalue;
417  td->td_sampleformat = (uint16) v;
418 
419  /* Try to fix up the SWAB function for complex data. */
421  && td->td_bitspersample == 32
426  && td->td_bitspersample == 64
429  break;
430  case TIFFTAG_IMAGEDEPTH:
431  td->td_imagedepth = (uint32) va_arg(ap, uint32);
432  break;
433  case TIFFTAG_SUBIFD:
434  if ((tif->tif_flags & TIFF_INSUBIFD) == 0) {
437  (uint32) td->td_nsubifd);
438  } else {
440  "%s: Sorry, cannot nest SubIFDs",
441  tif->tif_name);
442  status = 0;
443  }
444  break;
447  break;
451  break;
453  v = (td->td_samplesperpixel - td->td_extrasamples) > 1 ? 3 : 1;
454  for (i = 0; i < v; i++)
456  va_arg(ap, uint16*), 1U<<td->td_bitspersample);
457  break;
459  /* XXX should check for null range */
460  _TIFFsetFloatArray(&td->td_refblackwhite, va_arg(ap, float*), 6);
461  break;
462  case TIFFTAG_INKNAMES:
463  v = (uint16) va_arg(ap, uint16_vap);
464  s = va_arg(ap, char*);
465  v = checkInkNamesString(tif, v, s);
466  status = v > 0;
467  if( v > 0 ) {
468  _TIFFsetNString(&td->td_inknames, s, v);
469  td->td_inknameslen = v;
470  }
471  break;
472  case TIFFTAG_PERSAMPLE:
473  v = (uint16) va_arg(ap, uint16_vap);
474  if( v == PERSAMPLE_MULTI )
475  tif->tif_flags |= TIFF_PERSAMPLE;
476  else
477  tif->tif_flags &= ~TIFF_PERSAMPLE;
478  break;
479  default: {
480  TIFFTagValue *tv;
481  int tv_size, iCustom;
482 
483  /*
484  * This can happen if multiple images are open with different
485  * codecs which have private tags. The global tag information
486  * table may then have tags that are valid for one file but not
487  * the other. If the client tries to set a tag that is not valid
488  * for the image's codec then we'll arrive here. This
489  * happens, for example, when tiffcp is used to convert between
490  * compression schemes and codec-specific tags are blindly copied.
491  */
492  if(fip->field_bit != FIELD_CUSTOM) {
494  "%s: Invalid %stag \"%s\" (not supported by codec)",
495  tif->tif_name, isPseudoTag(tag) ? "pseudo-" : "",
496  fip->field_name);
497  status = 0;
498  break;
499  }
500 
501  /*
502  * Find the existing entry for this custom value.
503  */
504  tv = NULL;
505  for (iCustom = 0; iCustom < td->td_customValueCount; iCustom++) {
506  if (td->td_customValues[iCustom].info->field_tag == tag) {
507  tv = td->td_customValues + iCustom;
508  if (tv->value != NULL) {
509  _TIFFfree(tv->value);
510  tv->value = NULL;
511  }
512  break;
513  }
514  }
515 
516  /*
517  * Grow the custom list if the entry was not found.
518  */
519  if(tv == NULL) {
520  TIFFTagValue *new_customValues;
521 
522  td->td_customValueCount++;
523  new_customValues = (TIFFTagValue *)
525  sizeof(TIFFTagValue) * td->td_customValueCount);
526  if (!new_customValues) {
528  "%s: Failed to allocate space for list of custom values",
529  tif->tif_name);
530  status = 0;
531  goto end;
532  }
533 
534  td->td_customValues = new_customValues;
535 
536  tv = td->td_customValues + (td->td_customValueCount - 1);
537  tv->info = fip;
538  tv->value = NULL;
539  tv->count = 0;
540  }
541 
542  /*
543  * Set custom value ... save a copy of the custom tag value.
544  */
545  tv_size = _TIFFDataSize(fip->field_type);
546  if (tv_size == 0) {
547  status = 0;
549  "%s: Bad field type %d for \"%s\"",
550  tif->tif_name, fip->field_type,
551  fip->field_name);
552  goto end;
553  }
554 
555  if (fip->field_type == TIFF_ASCII)
556  {
557  uint32 ma;
558  char* mb;
559  if (fip->field_passcount)
560  {
562  ma=(uint32)va_arg(ap,uint32);
563  mb=(char*)va_arg(ap,char*);
564  }
565  else
566  {
567  mb=(char*)va_arg(ap,char*);
568  ma=(uint32)(strlen(mb)+1);
569  }
570  tv->count=ma;
571  setByteArray(&tv->value,mb,ma,1);
572  }
573  else
574  {
575  if (fip->field_passcount) {
576  if (fip->field_writecount == TIFF_VARIABLE2)
577  tv->count = (uint32) va_arg(ap, uint32);
578  else
579  tv->count = (int) va_arg(ap, int);
580  } else if (fip->field_writecount == TIFF_VARIABLE
581  || fip->field_writecount == TIFF_VARIABLE2)
582  tv->count = 1;
583  else if (fip->field_writecount == TIFF_SPP)
584  tv->count = td->td_samplesperpixel;
585  else
586  tv->count = fip->field_writecount;
587 
588  if (tv->count == 0) {
589  status = 0;
591  "%s: Null count for \"%s\" (type "
592  "%d, writecount %d, passcount %d)",
593  tif->tif_name,
594  fip->field_name,
595  fip->field_type,
596  fip->field_writecount,
597  fip->field_passcount);
598  goto end;
599  }
600 
601  tv->value = _TIFFCheckMalloc(tif, tv->count, tv_size,
602  "custom tag binary object");
603  if (!tv->value) {
604  status = 0;
605  goto end;
606  }
607 
608  if (fip->field_tag == TIFFTAG_DOTRANGE
609  && strcmp(fip->field_name,"DotRange") == 0) {
610  /* TODO: This is an evil exception and should not have been
611  handled this way ... likely best if we move it into
612  the directory structure with an explicit field in
613  libtiff 4.1 and assign it a FIELD_ value */
614  uint16 v2[2];
615  v2[0] = (uint16)va_arg(ap, int);
616  v2[1] = (uint16)va_arg(ap, int);
617  _TIFFmemcpy(tv->value, &v2, 4);
618  }
619 
620  else if (fip->field_passcount
623  || fip->field_writecount == TIFF_SPP
624  || tv->count > 1) {
625  _TIFFmemcpy(tv->value, va_arg(ap, void *),
626  tv->count * tv_size);
627  } else {
628  char *val = (char *)tv->value;
629  assert( tv->count == 1 );
630 
631  switch (fip->field_type) {
632  case TIFF_BYTE:
633  case TIFF_UNDEFINED:
634  {
635  uint8 v2 = (uint8)va_arg(ap, int);
636  _TIFFmemcpy(val, &v2, tv_size);
637  }
638  break;
639  case TIFF_SBYTE:
640  {
641  int8 v2 = (int8)va_arg(ap, int);
642  _TIFFmemcpy(val, &v2, tv_size);
643  }
644  break;
645  case TIFF_SHORT:
646  {
647  uint16 v2 = (uint16)va_arg(ap, int);
648  _TIFFmemcpy(val, &v2, tv_size);
649  }
650  break;
651  case TIFF_SSHORT:
652  {
653  int16 v2 = (int16)va_arg(ap, int);
654  _TIFFmemcpy(val, &v2, tv_size);
655  }
656  break;
657  case TIFF_LONG:
658  case TIFF_IFD:
659  {
660  uint32 v2 = va_arg(ap, uint32);
661  _TIFFmemcpy(val, &v2, tv_size);
662  }
663  break;
664  case TIFF_SLONG:
665  {
666  int32 v2 = va_arg(ap, int32);
667  _TIFFmemcpy(val, &v2, tv_size);
668  }
669  break;
670  case TIFF_LONG8:
671  case TIFF_IFD8:
672  {
673  uint64 v2 = va_arg(ap, uint64);
674  _TIFFmemcpy(val, &v2, tv_size);
675  }
676  break;
677  case TIFF_SLONG8:
678  {
679  int64 v2 = va_arg(ap, int64);
680  _TIFFmemcpy(val, &v2, tv_size);
681  }
682  break;
683  case TIFF_RATIONAL:
684  case TIFF_SRATIONAL:
685  case TIFF_FLOAT:
686  {
687  float v2 = TIFFClampDoubleToFloat(va_arg(ap, double));
688  _TIFFmemcpy(val, &v2, tv_size);
689  }
690  break;
691  case TIFF_DOUBLE:
692  {
693  double v2 = va_arg(ap, double);
694  _TIFFmemcpy(val, &v2, tv_size);
695  }
696  break;
697  default:
698  _TIFFmemset(val, 0, tv_size);
699  status = 0;
700  break;
701  }
702  }
703  }
704  }
705  }
706  if (status) {
707  const TIFFField* fip2=TIFFFieldWithTag(tif,tag);
708  if (fip2)
709  TIFFSetFieldBit(tif, fip2->field_bit);
710  tif->tif_flags |= TIFF_DIRTYDIRECT;
711  }
712 
713 end:
714  va_end(ap);
715  return (status);
716 badvalue:
717  {
718  const TIFFField* fip2=TIFFFieldWithTag(tif,tag);
720  "%s: Bad value %u for \"%s\" tag",
721  tif->tif_name, v,
722  fip2 ? fip2->field_name : "Unknown");
723  va_end(ap);
724  }
725  return (0);
726 badvalue32:
727  {
728  const TIFFField* fip2=TIFFFieldWithTag(tif,tag);
730  "%s: Bad value %u for \"%s\" tag",
731  tif->tif_name, v32,
732  fip2 ? fip2->field_name : "Unknown");
733  va_end(ap);
734  }
735  return (0);
736 badvaluedouble:
737  {
738  const TIFFField* fip2=TIFFFieldWithTag(tif,tag);
740  "%s: Bad value %f for \"%s\" tag",
741  tif->tif_name, dblval,
742  fip2 ? fip2->field_name : "Unknown");
743  va_end(ap);
744  }
745  return (0);
746 }
unsigned long long uint64
Definition: platform.h:18
static void _TIFFsetNString(char **cpp, char *cp, uint32 n)
Definition: tif_dir.c:61
#define DATATYPE_IEEEFP
Definition: tif_dir.c:40
#define TIFFTAG_SUBFILETYPE
Definition: tiff.h:146
void _TIFFmemset(void *p, int v, tmsize_t c)
Definition: tif_unix.c:338
#define TIFF_VARIABLE
Definition: tiffio.h:313
uint16 td_ycbcrpositioning
Definition: tif_dir.h:111
#define FIELD_CUSTOM
Definition: tiffio.h:317
float td_yposition
Definition: tif_dir.h:89
uint16 td_bitspersample
Definition: tif_dir.h:74
#define TIFFClrFieldBit(tif, field)
Definition: tif_dir.h:194
uint32 td_tiledepth
Definition: tif_dir.h:72
void _TIFFSwab64BitData(TIFF *tif, uint8 *buf, tmsize_t cc)
Definition: tif_read.c:1563
#define TIFFTAG_BITSPERSAMPLE
Definition: tiff.h:156
void TIFFWarningExt(thandle_t fd, const char *module, const char *fmt,...)
Definition: tif_warning.c:65
static void setByteArray(void **vpp, void *vp, size_t nmemb, size_t elem_size)
Definition: tif_dir.c:43
#define TIFFTAG_ROWSPERSTRIP
Definition: tiff.h:233
#define TIFF_ANY
Definition: tiffio.h:312
char * td_inknames
Definition: tif_dir.h:117
int td_inknameslen
Definition: tif_dir.h:116
#define TIFFTAG_COLORMAP
Definition: tiff.h:284
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define TIFFTAG_EXTRASAMPLES
Definition: tiff.h:304
#define TIFFTAG_ORIENTATION
Definition: tiff.h:223
#define isPseudoTag(t)
Definition: tiffiop.h:211
unsigned int uint32
Definition: types.h:32
#define TIFF_ISTILED
Definition: tiffiop.h:116
#define TIFFTAG_IMAGEWIDTH
Definition: tiff.h:154
#define TIFFTAG_YRESOLUTION
Definition: tiff.h:238
#define U(x)
Definition: wordpad.c:44
#define TIFFTAG_DATATYPE
Definition: tiff.h:385
#define TIFFTAG_MINSAMPLEVALUE
Definition: tiff.h:235
#define TIFFTAG_INKNAMES
Definition: tiff.h:300
#define TIFFTAG_FILLORDER
Definition: tiff.h:215
TIFFTagValue * td_customValues
Definition: tif_dir.h:120
static void setDoubleArrayOneValue(double **vpp, double value, size_t nmemb)
Definition: tif_dir.c:75
uint16 td_halftonehints[2]
Definition: tif_dir.h:92
#define FILLORDER_LSB2MSB
Definition: tiff.h:217
int count
Definition: tif_dir.h:37
#define assert(x)
Definition: debug.h:53
Definition: ecma_167.h:138
#define TIFFTAG_DOTRANGE
Definition: tiff.h:302
uint32 td_imagedepth
Definition: tif_dir.h:71
int td_customValueCount
Definition: tif_dir.h:119
#define TIFFTAG_SUBIFD
Definition: tiff.h:296
#define TIFFTAG_THRESHHOLDING
Definition: tiff.h:209
GLuint GLuint end
Definition: gl.h:1545
#define PERSAMPLE_MULTI
Definition: tiff.h:609
#define TIFFTAG_YCBCRSUBSAMPLING
Definition: tiff.h:367
thandle_t tif_clientdata
Definition: tiffiop.h:191
#define TIFFTAG_YPOSITION
Definition: tiff.h:244
#define TIFFTAG_SMINSAMPLEVALUE
Definition: tiff.h:315
long long int64
Definition: platform.h:13
#define TIFFTAG_REFERENCEBLACKWHITE
Definition: tiff.h:371
#define TIFFTAG_PLANARCONFIG
Definition: tiff.h:239
#define ORIENTATION_TOPLEFT
Definition: tiff.h:224
#define TIFFTAG_MATTEING
Definition: tiff.h:384
char * tif_name
Definition: tiffiop.h:103
#define TIFF_DIRTYDIRECT
Definition: tiffiop.h:109
#define SAMPLEFORMAT_INT
Definition: tiff.h:310
#define FIELD_SMAXSAMPLEVALUE
Definition: tif_dir.h:163
float td_xresolution
Definition: tif_dir.h:86
#define TIFFTAG_PERSAMPLE
Definition: tiff.h:607
uint32 td_tilelength
Definition: tif_dir.h:72
unsigned short field_bit
Definition: tif_dir.h:286
void _TIFFSwab32BitData(TIFF *tif, uint8 *buf, tmsize_t cc)
Definition: tif_read.c:1555
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
float td_xposition
Definition: tif_dir.h:89
#define TIFFSetFieldBit(tif, field)
Definition: tif_dir.h:193
#define va_end(ap)
Definition: acmsvcex.h:90
#define TIFF_SWAB
Definition: tiffiop.h:113
#define TIFFTAG_YCBCRPOSITIONING
Definition: tiff.h:368
#define TIFFTAG_TILEWIDTH
Definition: tiff.h:286
#define DATATYPE_VOID
Definition: tif_dir.c:37
char * field_name
Definition: tif_dir.h:289
uint32 td_subfiletype
Definition: tif_dir.h:73
uint16 * td_sampleinfo
Definition: tif_dir.h:94
void * _TIFFCheckMalloc(TIFF *tif, tmsize_t nmemb, tmsize_t elem_size, const char *what)
Definition: tif_aux.c:85
uint16 td_nsubifd
Definition: tif_dir.h:107
uint16 td_resolutionunit
Definition: tif_dir.h:87
void _TIFFsetFloatArray(float **fpp, float *fp, uint32 n)
Definition: tif_dir.c:69
#define TIFFTAG_TILELENGTH
Definition: tiff.h:287
int tif_mode
Definition: tiffiop.h:105
uint32 tif_flags
Definition: tiffiop.h:106
short field_writecount
Definition: tif_dir.h:281
smooth NULL
Definition: ftsmooth.c:416
#define TIFFTAG_IMAGELENGTH
Definition: tiff.h:155
#define TIFFTAG_SAMPLESPERPIXEL
Definition: tiff.h:232
uint16 td_planarconfig
Definition: tif_dir.h:88
#define SAMPLEFORMAT_VOID
Definition: tiff.h:312
uint16 * td_colormap[3]
Definition: tif_dir.h:91
double * td_sminsamplevalue
Definition: tif_dir.h:84
uint16 td_orientation
Definition: tif_dir.h:80
uint16 td_minsamplevalue
Definition: tif_dir.h:83
GLuint GLfloat * val
Definition: glext.h:7180
unsigned char field_passcount
Definition: tif_dir.h:288
#define SAMPLEFORMAT_COMPLEXIEEEFP
Definition: tiff.h:314
#define SAMPLEFORMAT_UINT
Definition: tiff.h:309
static uint32 checkInkNamesString(TIFF *tif, uint32 slen, const char *s)
Definition: tif_dir.c:131
const TIFFField * info
Definition: tif_dir.h:36
#define TIFF_PERSAMPLE
Definition: tiffiop.h:128
#define RESUNIT_CENTIMETER
Definition: tiff.h:265
uint16 td_extrasamples
Definition: tif_dir.h:93
uint32 td_imagelength
Definition: tif_dir.h:71
uint32 field_tag
Definition: tif_dir.h:279
#define SAMPLEFORMAT_IEEEFP
Definition: tiff.h:311
int badvalue
Definition: class.c:931
TIFFPostMethod tif_postdecode
Definition: tiffiop.h:198
#define TIFFTAG_XPOSITION
Definition: tiff.h:243
uint16 td_photometric
Definition: tif_dir.h:77
#define TIFFTAG_HALFTONEHINTS
Definition: tiff.h:285
unsigned char uint8
Definition: types.h:28
void _TIFFSwab24BitData(TIFF *tif, uint8 *buf, tmsize_t cc)
Definition: tif_read.c:1547
void TIFFErrorExt(thandle_t fd, const char *module, const char *fmt,...)
Definition: tif_error.c:65
double * td_smaxsamplevalue
Definition: tif_dir.h:85
#define TIFFTAG_PHOTOMETRIC
Definition: tiff.h:195
#define TIFFFieldSet(tif, field)
Definition: tif_dir.h:192
uint16 td_fillorder
Definition: tif_dir.h:79
#define TIFFTAG_PAGENUMBER
Definition: tiff.h:266
static void _TIFFsetLong8Array(uint64 **lpp, uint64 *lp, uint32 n)
Definition: tif_dir.c:67
#define FIELD_COMPRESSION
Definition: tif_dir.h:145
#define FIELD_SMINSAMPLEVALUE
Definition: tif_dir.h:162
int uint16_vap
Definition: tiff.h:86
void * _TIFFrealloc(void *p, tmsize_t s)
Definition: tif_unix.c:332
static const WCHAR L[]
Definition: oid.c:1250
#define TIFFTAG_TRANSFERFUNCTION
Definition: tiff.h:273
#define TIFFTAG_COMPRESSION
Definition: tiff.h:157
uint32 td_tilewidth
Definition: tif_dir.h:72
uint16 td_sampleformat
Definition: tif_dir.h:75
uint16 td_threshholding
Definition: tif_dir.h:78
#define PLANARCONFIG_SEPARATE
Definition: tiff.h:241
TIFFVoidMethod tif_cleanup
Definition: tiffiop.h:172
GLdouble s
Definition: gl.h:2039
void _TIFFNoPostDecode(TIFF *tif, uint8 *buf, tmsize_t cc)
Definition: tif_read.c:1533
void _TIFFSwab16BitData(TIFF *tif, uint8 *buf, tmsize_t cc)
Definition: tif_read.c:1539
uint16 td_pagenumber[2]
Definition: tif_dir.h:90
const TIFFField * TIFFFieldWithTag(TIFF *tif, uint32 tag)
Definition: tif_dirinfo.c:558
#define TIFFTAG_SMAXSAMPLEVALUE
Definition: tiff.h:316
#define DATATYPE_UINT
Definition: tif_dir.c:39
#define TIFF_CODERSETUP
Definition: tiffiop.h:111
GLfloat GLfloat GLfloat v2
Definition: glext.h:6063
int _TIFFDataSize(TIFFDataType type)
Definition: tif_dirinfo.c:476
#define TIFF_VARIABLE2
Definition: tiffio.h:315
uint16 td_maxsamplevalue
Definition: tif_dir.h:83
void * value
Definition: tif_dir.h:38
#define va_arg(ap, T)
Definition: acmsvcex.h:89
uint32 td_rowsperstrip
Definition: tif_dir.h:82
const GLdouble * v
Definition: gl.h:2040
uint64 * td_subifd
Definition: tif_dir.h:108
TIFFDataType field_type
Definition: tif_dir.h:282
#define TIFFTAG_TILEDEPTH
Definition: tiff.h:387
#define TIFFTAG_IMAGEDEPTH
Definition: tiff.h:386
#define TIFFTAG_RESOLUTIONUNIT
Definition: tiff.h:262
#define TIFF_SPP
Definition: tiffio.h:314
uint16 td_ycbcrsubsampling[2]
Definition: tif_dir.h:110
#define TIFFTAG_XRESOLUTION
Definition: tiff.h:237
unsigned short uint16
Definition: types.h:30
short int16
Definition: platform.h:11
TIFFDirectory tif_dir
Definition: tiffiop.h:135
static float TIFFClampDoubleToFloat(double val)
Definition: tif_dir.c:156
#define FIELD_TILEDIMENSIONS
Definition: tif_dir.h:138
int TIFFSetCompressionScheme(TIFF *tif, int scheme)
Definition: tif_compress.c:160
float * td_refblackwhite
Definition: tif_dir.h:114
uint16 * td_transferfunction[3]
Definition: tif_dir.h:113
#define SAMPLEFORMAT_COMPLEXINT
Definition: tiff.h:313
void _TIFFsetShortArray(uint16 **wpp, uint16 *wp, uint32 n)
Definition: tif_dir.c:63
long int32
Definition: platform.h:12
void int int ULONGLONG int va_list * ap
Definition: winesup.h:32
float td_yresolution
Definition: tif_dir.h:86
const TIFFField * TIFFFindField(TIFF *tif, uint32 tag, TIFFDataType dt)
Definition: tif_dirinfo.c:506
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define DATATYPE_INT
Definition: tif_dir.c:38
#define RESUNIT_NONE
Definition: tiff.h:263
uint16 td_samplesperpixel
Definition: tif_dir.h:81
static int setExtraSamples(TIFFDirectory *td, va_list ap, uint32 *v)
Definition: tif_dir.c:91
Definition: tiff.h:137
uint16 td_compression
Definition: tif_dir.h:76
void _TIFFfree(void *p)
Definition: tif_unix.c:326
#define TIFFTAG_SAMPLEFORMAT
Definition: tiff.h:308
#define EXTRASAMPLE_ASSOCALPHA
Definition: tiff.h:306
uint32 td_imagewidth
Definition: tif_dir.h:71
void _TIFFsetDoubleArray(double **dpp, double *dp, uint32 n)
Definition: tif_dir.c:71
#define ORIENTATION_LEFTBOT
Definition: tiff.h:231
#define TIFF_INSUBIFD
Definition: tiffiop.h:119
void _TIFFmemcpy(void *d, const void *s, tmsize_t c)
Definition: tif_unix.c:344
#define FILLORDER_MSB2LSB
Definition: tiff.h:216
#define TIFFTAG_MAXSAMPLEVALUE
Definition: tiff.h:236
#define PLANARCONFIG_CONTIG
Definition: tiff.h:240
char int8
Definition: platform.h:10
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
#define O_RDONLY
Definition: acwin.h:108
Definition: ps.c:97
char * tag
Definition: main.c:59

Referenced by TIFFDefaultDirectory().

◆ checkInkNamesString()

static uint32 checkInkNamesString ( TIFF tif,
uint32  slen,
const char s 
)
static

Definition at line 131 of file tif_dir.c.

132 {
133  TIFFDirectory* td = &tif->tif_dir;
135 
136  if (slen > 0) {
137  const char* ep = s+slen;
138  const char* cp = s;
139  for (; i > 0; i--) {
140  for (; cp < ep && *cp != '\0'; cp++) {}
141  if (cp >= ep)
142  goto bad;
143  cp++; /* skip \0 */
144  }
145  return ((uint32)(cp-s));
146  }
147 bad:
148  TIFFErrorExt(tif->tif_clientdata, "TIFFSetField",
149  "%s: Invalid InkNames value; expecting %d names, found %d",
150  tif->tif_name,
151  td->td_samplesperpixel,
152  td->td_samplesperpixel-i);
153  return (0);
154 }
unsigned int uint32
Definition: types.h:32
thandle_t tif_clientdata
Definition: tiffiop.h:191
char * tif_name
Definition: tiffiop.h:103
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
void TIFFErrorExt(thandle_t fd, const char *module, const char *fmt,...)
Definition: tif_error.c:65
GLdouble s
Definition: gl.h:2039
unsigned short uint16
Definition: types.h:30
TIFFDirectory tif_dir
Definition: tiffiop.h:135
POINT cp
Definition: magnifier.c:59
uint16 td_samplesperpixel
Definition: tif_dir.h:81

Referenced by _TIFFVSetField().

◆ OkToChangeTag()

static int OkToChangeTag ( TIFF tif,
uint32  tag 
)
static

Definition at line 758 of file tif_dir.c.

759 {
760  const TIFFField* fip = TIFFFindField(tif, tag, TIFF_ANY);
761  if (!fip) { /* unknown tag */
762  TIFFErrorExt(tif->tif_clientdata, "TIFFSetField", "%s: Unknown %stag %u",
763  tif->tif_name, isPseudoTag(tag) ? "pseudo-" : "", tag);
764  return (0);
765  }
766  if (tag != TIFFTAG_IMAGELENGTH && (tif->tif_flags & TIFF_BEENWRITING) &&
767  !fip->field_oktochange) {
768  /*
769  * Consult info table to see if tag can be changed
770  * after we've started writing. We only allow changes
771  * to those tags that don't/shouldn't affect the
772  * compression and/or format of the data.
773  */
774  TIFFErrorExt(tif->tif_clientdata, "TIFFSetField",
775  "%s: Cannot modify tag \"%s\" while writing",
776  tif->tif_name, fip->field_name);
777  return (0);
778  }
779  return (1);
780 }
#define TIFF_BEENWRITING
Definition: tiffiop.h:112
#define TIFF_ANY
Definition: tiffio.h:312
#define isPseudoTag(t)
Definition: tiffiop.h:211
Definition: ecma_167.h:138
thandle_t tif_clientdata
Definition: tiffiop.h:191
char * tif_name
Definition: tiffiop.h:103
char * field_name
Definition: tif_dir.h:289
uint32 tif_flags
Definition: tiffiop.h:106
#define TIFFTAG_IMAGELENGTH
Definition: tiff.h:155
void TIFFErrorExt(thandle_t fd, const char *module, const char *fmt,...)
Definition: tif_error.c:65
unsigned char field_oktochange
Definition: tif_dir.h:287
const TIFFField * TIFFFindField(TIFF *tif, uint32 tag, TIFFDataType dt)
Definition: tif_dirinfo.c:506

Referenced by TIFFVSetField().

◆ setByteArray()

static void setByteArray ( void **  vpp,
void vp,
size_t  nmemb,
size_t  elem_size 
)
static

Definition at line 43 of file tif_dir.c.

44 {
45  if (*vpp) {
46  _TIFFfree(*vpp);
47  *vpp = 0;
48  }
49  if (vp) {
50  tmsize_t bytes = (tmsize_t)(nmemb * elem_size);
51  if (elem_size && bytes / elem_size == nmemb)
52  *vpp = (void*) _TIFFmalloc(bytes);
53  if (*vpp)
54  _TIFFmemcpy(*vpp, vp, bytes);
55  }
56 }
static unsigned char bytes[4]
Definition: adnsresfilter.c:74
TIFF_SSIZE_T tmsize_t
Definition: tiffio.h:65
void * _TIFFmalloc(tmsize_t s)
Definition: tif_unix.c:309
void _TIFFfree(void *p)
Definition: tif_unix.c:326
void _TIFFmemcpy(void *d, const void *s, tmsize_t c)
Definition: tif_unix.c:344

Referenced by _TIFFsetByteArray(), _TIFFsetDoubleArray(), _TIFFsetFloatArray(), _TIFFsetLong8Array(), _TIFFsetLongArray(), _TIFFsetNString(), _TIFFsetShortArray(), _TIFFsetString(), and _TIFFVSetField().

◆ setDoubleArrayOneValue()

static void setDoubleArrayOneValue ( double **  vpp,
double  value,
size_t  nmemb 
)
static

Definition at line 75 of file tif_dir.c.

76 {
77  if (*vpp)
78  _TIFFfree(*vpp);
79  *vpp = _TIFFmalloc(nmemb*sizeof(double));
80  if (*vpp)
81  {
82  while (nmemb--)
83  ((double*)*vpp)[nmemb] = value;
84  }
85 }
void * _TIFFmalloc(tmsize_t s)
Definition: tif_unix.c:309
GLsizei const GLfloat * value
Definition: glext.h:6069
void _TIFFfree(void *p)
Definition: tif_unix.c:326

Referenced by _TIFFVSetField().

◆ setExtraSamples()

static int setExtraSamples ( TIFFDirectory td,
va_list  ap,
uint32 v 
)
static

Definition at line 91 of file tif_dir.c.

92 {
93 /* XXX: Unassociated alpha data == 999 is a known Corel Draw bug, see below */
94 #define EXTRASAMPLE_COREL_UNASSALPHA 999
95 
96  uint16* va;
97  uint32 i;
98 
99  *v = (uint16) va_arg(ap, uint16_vap);
100  if ((uint16) *v > td->td_samplesperpixel)
101  return 0;
102  va = va_arg(ap, uint16*);
103  if (*v > 0 && va == NULL) /* typically missing param */
104  return 0;
105  for (i = 0; i < *v; i++) {
106  if (va[i] > EXTRASAMPLE_UNASSALPHA) {
107  /*
108  * XXX: Corel Draw is known to produce incorrect
109  * ExtraSamples tags which must be patched here if we
110  * want to be able to open some of the damaged TIFF
111  * files:
112  */
113  if (va[i] == EXTRASAMPLE_COREL_UNASSALPHA)
115  else
116  return 0;
117  }
118  }
119  td->td_extrasamples = (uint16) *v;
121  return 1;
122 
123 #undef EXTRASAMPLE_COREL_UNASSALPHA
124 }
unsigned int uint32
Definition: types.h:32
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
uint16 * td_sampleinfo
Definition: tif_dir.h:94
smooth NULL
Definition: ftsmooth.c:416
#define EXTRASAMPLE_COREL_UNASSALPHA
uint16 td_extrasamples
Definition: tif_dir.h:93
#define EXTRASAMPLE_UNASSALPHA
Definition: tiff.h:307
int uint16_vap
Definition: tiff.h:86
#define va_arg(ap, T)
Definition: acmsvcex.h:89
const GLdouble * v
Definition: gl.h:2040
unsigned short uint16
Definition: types.h:30
void _TIFFsetShortArray(uint16 **wpp, uint16 *wp, uint32 n)
Definition: tif_dir.c:63
void int int ULONGLONG int va_list * ap
Definition: winesup.h:32
uint16 td_samplesperpixel
Definition: tif_dir.h:81

Referenced by _TIFFVSetField().

◆ TIFFAdvanceDirectory()

static int TIFFAdvanceDirectory ( TIFF tif,
uint64 nextdir,
uint64 off 
)
static

Definition at line 1426 of file tif_dir.c.

1427 {
1428  static const char module[] = "TIFFAdvanceDirectory";
1429  if (isMapped(tif))
1430  {
1431  uint64 poff=*nextdir;
1432  if (!(tif->tif_flags&TIFF_BIGTIFF))
1433  {
1434  tmsize_t poffa,poffb,poffc,poffd;
1435  uint16 dircount;
1436  uint32 nextdir32;
1437  poffa=(tmsize_t)poff;
1438  poffb=poffa+sizeof(uint16);
1439  if (((uint64)poffa!=poff)||(poffb<poffa)||(poffb<(tmsize_t)sizeof(uint16))||(poffb>tif->tif_size))
1440  {
1441  TIFFErrorExt(tif->tif_clientdata,module,"Error fetching directory count");
1442  *nextdir=0;
1443  return(0);
1444  }
1445  _TIFFmemcpy(&dircount,tif->tif_base+poffa,sizeof(uint16));
1446  if (tif->tif_flags&TIFF_SWAB)
1447  TIFFSwabShort(&dircount);
1448  poffc=poffb+dircount*12;
1449  poffd=poffc+sizeof(uint32);
1450  if ((poffc<poffb)||(poffc<dircount*12)||(poffd<poffc)||(poffd<(tmsize_t)sizeof(uint32))||(poffd>tif->tif_size))
1451  {
1452  TIFFErrorExt(tif->tif_clientdata,module,"Error fetching directory link");
1453  return(0);
1454  }
1455  if (off!=NULL)
1456  *off=(uint64)poffc;
1457  _TIFFmemcpy(&nextdir32,tif->tif_base+poffc,sizeof(uint32));
1458  if (tif->tif_flags&TIFF_SWAB)
1459  TIFFSwabLong(&nextdir32);
1460  *nextdir=nextdir32;
1461  }
1462  else
1463  {
1464  tmsize_t poffa,poffb,poffc,poffd;
1465  uint64 dircount64;
1466  uint16 dircount16;
1467  poffa=(tmsize_t)poff;
1468  poffb=poffa+sizeof(uint64);
1469  if (((uint64)poffa!=poff)||(poffb<poffa)||(poffb<(tmsize_t)sizeof(uint64))||(poffb>tif->tif_size))
1470  {
1471  TIFFErrorExt(tif->tif_clientdata,module,"Error fetching directory count");
1472  return(0);
1473  }
1474  _TIFFmemcpy(&dircount64,tif->tif_base+poffa,sizeof(uint64));
1475  if (tif->tif_flags&TIFF_SWAB)
1476  TIFFSwabLong8(&dircount64);
1477  if (dircount64>0xFFFF)
1478  {
1479  TIFFErrorExt(tif->tif_clientdata,module,"Sanity check on directory count failed");
1480  return(0);
1481  }
1482  dircount16=(uint16)dircount64;
1483  poffc=poffb+dircount16*20;
1484  poffd=poffc+sizeof(uint64);
1485  if ((poffc<poffb)||(poffc<dircount16*20)||(poffd<poffc)||(poffd<(tmsize_t)sizeof(uint64))||(poffd>tif->tif_size))
1486  {
1487  TIFFErrorExt(tif->tif_clientdata,module,"Error fetching directory link");
1488  return(0);
1489  }
1490  if (off!=NULL)
1491  *off=(uint64)poffc;
1492  _TIFFmemcpy(nextdir,tif->tif_base+poffc,sizeof(uint64));
1493  if (tif->tif_flags&TIFF_SWAB)
1494  TIFFSwabLong8(nextdir);
1495  }
1496  return(1);
1497  }
1498  else
1499  {
1500  if (!(tif->tif_flags&TIFF_BIGTIFF))
1501  {
1502  uint16 dircount;
1503  uint32 nextdir32;
1504  if (!SeekOK(tif, *nextdir) ||
1505  !ReadOK(tif, &dircount, sizeof (uint16))) {
1506  TIFFErrorExt(tif->tif_clientdata, module, "%s: Error fetching directory count",
1507  tif->tif_name);
1508  return (0);
1509  }
1510  if (tif->tif_flags & TIFF_SWAB)
1511  TIFFSwabShort(&dircount);
1512  if (off != NULL)
1513  *off = TIFFSeekFile(tif,
1514  dircount*12, SEEK_CUR);
1515  else
1516  (void) TIFFSeekFile(tif,
1517  dircount*12, SEEK_CUR);
1518  if (!ReadOK(tif, &nextdir32, sizeof (uint32))) {
1519  TIFFErrorExt(tif->tif_clientdata, module, "%s: Error fetching directory link",
1520  tif->tif_name);
1521  return (0);
1522  }
1523  if (tif->tif_flags & TIFF_SWAB)
1524  TIFFSwabLong(&nextdir32);
1525  *nextdir=nextdir32;
1526  }
1527  else
1528  {
1529  uint64 dircount64;
1530  uint16 dircount16;
1531  if (!SeekOK(tif, *nextdir) ||
1532  !ReadOK(tif, &dircount64, sizeof (uint64))) {
1533  TIFFErrorExt(tif->tif_clientdata, module, "%s: Error fetching directory count",
1534  tif->tif_name);
1535  return (0);
1536  }
1537  if (tif->tif_flags & TIFF_SWAB)
1538  TIFFSwabLong8(&dircount64);
1539  if (dircount64>0xFFFF)
1540  {
1541  TIFFErrorExt(tif->tif_clientdata, module, "Error fetching directory count");
1542  return(0);
1543  }
1544  dircount16 = (uint16)dircount64;
1545  if (off != NULL)
1546  *off = TIFFSeekFile(tif,
1547  dircount16*20, SEEK_CUR);
1548  else
1549  (void) TIFFSeekFile(tif,
1550  dircount16*20, SEEK_CUR);
1551  if (!ReadOK(tif, nextdir, sizeof (uint64))) {
1553  "%s: Error fetching directory link",
1554  tif->tif_name);
1555  return (0);
1556  }
1557  if (tif->tif_flags & TIFF_SWAB)
1558  TIFFSwabLong8(nextdir);
1559  }
1560  return (1);
1561  }
1562 }
unsigned long long uint64
Definition: platform.h:18
#define SEEK_CUR
Definition: util.h:63
uint8 * tif_base
Definition: tiffiop.h:186
unsigned int uint32
Definition: types.h:32
#define TIFFSeekFile(tif, off, whence)
Definition: tiffiop.h:221
thandle_t tif_clientdata
Definition: tiffiop.h:191
char * tif_name
Definition: tiffiop.h:103
#define TIFF_BIGTIFF
Definition: tiffiop.h:125
#define TIFF_SWAB
Definition: tiffiop.h:113
TIFF_SSIZE_T tmsize_t
Definition: tiffio.h:65
uint32 tif_flags
Definition: tiffiop.h:106
smooth NULL
Definition: ftsmooth.c:416
#define isMapped(tif)
Definition: tiffiop.h:214
void TIFFSwabShort(uint16 *wp)
Definition: tif_swab.c:34
void TIFFErrorExt(thandle_t fd, const char *module, const char *fmt,...)
Definition: tif_error.c:65
tmsize_t tif_size
Definition: tiffiop.h:187
void TIFFSwabLong(uint32 *lp)
Definition: tif_swab.c:45
unsigned short uint16
Definition: types.h:30
#define SeekOK(tif, off)
Definition: tiffiop.h:240
#define ReadOK(tif, buf, size)
Definition: tiffiop.h:236
void _TIFFmemcpy(void *d, const void *s, tmsize_t c)
Definition: tif_unix.c:344
void TIFFSwabLong8(uint64 *lp)
Definition: tif_swab.c:57
off
Definition: i386-dis.c:3909

Referenced by TIFFNumberOfDirectories(), TIFFSetDirectory(), and TIFFUnlinkDirectory().

◆ TIFFClampDoubleToFloat()

static float TIFFClampDoubleToFloat ( double  val)
static

Definition at line 156 of file tif_dir.c.

157 {
158  if( val > FLT_MAX )
159  return FLT_MAX;
160  if( val < -FLT_MAX )
161  return -FLT_MAX;
162  return (float)val;
163 }
#define FLT_MAX
Definition: gcc_float.h:107
GLuint GLfloat * val
Definition: glext.h:7180

Referenced by _TIFFVSetField().

◆ TIFFCreateCustomDirectory()

int TIFFCreateCustomDirectory ( TIFF tif,
const TIFFFieldArray infoarray 
)

Definition at line 1324 of file tif_dir.c.

1325 {
1326  TIFFDefaultDirectory(tif);
1327 
1328  /*
1329  * Reset the field definitions to match the application provided list.
1330  * Hopefully TIFFDefaultDirectory() won't have done anything irreversable
1331  * based on it's assumption this is an image directory.
1332  */
1333  _TIFFSetupFields(tif, infoarray);
1334 
1335  tif->tif_diroff = 0;
1336  tif->tif_nextdiroff = 0;
1337  tif->tif_curoff = 0;
1338  tif->tif_row = (uint32) -1;
1339  tif->tif_curstrip = (uint32) -1;
1340 
1341  return 0;
1342 }
unsigned int uint32
Definition: types.h:32
uint32 tif_curstrip
Definition: tiffiop.h:145
uint64 tif_curoff
Definition: tiffiop.h:146
uint64 tif_nextdiroff
Definition: tiffiop.h:131
void _TIFFSetupFields(TIFF *tif, const TIFFFieldArray *fieldarray)
Definition: tif_dirinfo.c:317
uint64 tif_diroff
Definition: tiffiop.h:130
uint32 tif_row
Definition: tiffiop.h:143
int TIFFDefaultDirectory(TIFF *tif)
Definition: tif_dir.c:1356

Referenced by TIFFCreateEXIFDirectory().

◆ TIFFCreateDirectory()

int TIFFCreateDirectory ( TIFF tif)

Definition at line 1311 of file tif_dir.c.

1312 {
1313  TIFFDefaultDirectory(tif);
1314  tif->tif_diroff = 0;
1315  tif->tif_nextdiroff = 0;
1316  tif->tif_curoff = 0;
1317  tif->tif_row = (uint32) -1;
1318  tif->tif_curstrip = (uint32) -1;
1319 
1320  return 0;
1321 }
unsigned int uint32
Definition: types.h:32
uint32 tif_curstrip
Definition: tiffiop.h:145
uint64 tif_curoff
Definition: tiffiop.h:146
uint64 tif_nextdiroff
Definition: tiffiop.h:131
uint64 tif_diroff
Definition: tiffiop.h:130
uint32 tif_row
Definition: tiffiop.h:143
int TIFFDefaultDirectory(TIFF *tif)
Definition: tif_dir.c:1356

Referenced by TIFFWriteDirectorySec().

◆ TIFFCreateEXIFDirectory()

int TIFFCreateEXIFDirectory ( TIFF tif)

Definition at line 1345 of file tif_dir.c.

1346 {
1350 }
int TIFFCreateCustomDirectory(TIFF *tif, const TIFFFieldArray *infoarray)
Definition: tif_dir.c:1324
const TIFFFieldArray * _TIFFGetExifFields(void)
Definition: tif_dirinfo.c:311
static const TIFFFieldArray exifFieldArray
Definition: tif_dirinfo.c:49

◆ TIFFCurrentDirOffset()

uint64 TIFFCurrentDirOffset ( TIFF tif)

Definition at line 1648 of file tif_dir.c.

1649 {
1650  return (tif->tif_diroff);
1651 }
uint64 tif_diroff
Definition: tiffiop.h:130

◆ TIFFDefaultDirectory()

int TIFFDefaultDirectory ( TIFF tif)

Definition at line 1356 of file tif_dir.c.

1357 {
1358  register TIFFDirectory* td = &tif->tif_dir;
1360 
1363 
1364  _TIFFmemset(td, 0, sizeof (*td));
1366  td->td_bitspersample = 1;
1369  td->td_samplesperpixel = 1;
1370  td->td_rowsperstrip = (uint32) -1;
1371  td->td_tilewidth = 0;
1372  td->td_tilelength = 0;
1373  td->td_tiledepth = 1;
1374  td->td_stripbytecountsorted = 1; /* Our own arrays always sorted. */
1377  td->td_imagedepth = 1;
1378  td->td_ycbcrsubsampling[0] = 2;
1379  td->td_ycbcrsubsampling[1] = 2;
1382  tif->tif_foundfield = NULL;
1385  tif->tif_tagmethods.printdir = NULL;
1386  /*
1387  * Give client code a chance to install their own
1388  * tag extensions & methods, prior to compression overloads,
1389  * but do some prior cleanup first. (http://trac.osgeo.org/gdal/ticket/5054)
1390  */
1391  if (tif->tif_nfieldscompat > 0) {
1392  uint32 i;
1393 
1394  for (i = 0; i < tif->tif_nfieldscompat; i++) {
1395  if (tif->tif_fieldscompat[i].allocated_size)
1397  }
1399  tif->tif_nfieldscompat = 0;
1400  tif->tif_fieldscompat = NULL;
1401  }
1402  if (_TIFFextender)
1403  (*_TIFFextender)(tif);
1405  /*
1406  * NB: The directory is marked dirty as a result of setting
1407  * up the default compression scheme. However, this really
1408  * isn't correct -- we want TIFF_DIRTYDIRECT to be set only
1409  * if the user does something. We could just do the setup
1410  * by hand, but it seems better to use the normal mechanism
1411  * (i.e. TIFFSetField).
1412  */
1413  tif->tif_flags &= ~TIFF_DIRTYDIRECT;
1414 
1415  /*
1416  * As per http://bugzilla.remotesensing.org/show_bug.cgi?id=19
1417  * we clear the ISTILED flag when setting up a new directory.
1418  * Should we also be clearing stuff like INSUBIFD?
1419  */
1420  tif->tif_flags &= ~TIFF_ISTILED;
1421 
1422  return (1);
1423 }
TIFFTagMethods tif_tagmethods
Definition: tiffiop.h:203
void _TIFFmemset(void *p, int v, tmsize_t c)
Definition: tif_unix.c:338
uint16 td_ycbcrpositioning
Definition: tif_dir.h:111
uint16 td_bitspersample
Definition: tif_dir.h:74
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
uint32 td_tiledepth
Definition: tif_dir.h:72
#define THRESHHOLD_BILEVEL
Definition: tiff.h:210
static int _TIFFVGetField(TIFF *tif, uint32 tag, va_list ap)
Definition: tif_dir.c:856
unsigned int uint32
Definition: types.h:32
#define TIFF_ISTILED
Definition: tiffiop.h:116
static const TIFFFieldArray tiffFieldArray
Definition: tif_dirinfo.c:48
static int _TIFFVSetField(TIFF *tif, uint32 tag, va_list ap)
Definition: tif_dir.c:166
const TIFFFieldArray * _TIFFGetFields(void)
Definition: tif_dirinfo.c:305
uint32 td_imagedepth
Definition: tif_dir.h:71
#define ORIENTATION_TOPLEFT
Definition: tiff.h:224
#define TIFF_DIRTYDIRECT
Definition: tiffiop.h:109
#define RESUNIT_INCH
Definition: tiff.h:264
uint32 td_tilelength
Definition: tif_dir.h:72
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
TIFFPrintMethod printdir
Definition: tiffio.h:340
int td_stripbytecountsorted
Definition: tif_dir.h:102
#define YCBCRPOSITION_CENTERED
Definition: tiff.h:369
uint16 td_resolutionunit
Definition: tif_dir.h:87
static TIFFExtendProc _TIFFextender
Definition: tif_dir.c:1293
uint32 tif_flags
Definition: tiffiop.h:106
smooth NULL
Definition: ftsmooth.c:416
TIFFFieldArray * tif_fieldscompat
Definition: tiffiop.h:207
uint16 td_orientation
Definition: tif_dir.h:80
uint32 allocated_size
Definition: tif_dir.h:273
void _TIFFSetupFields(TIFF *tif, const TIFFFieldArray *fieldarray)
Definition: tif_dirinfo.c:317
#define SAMPLEFORMAT_UINT
Definition: tiff.h:309
TIFFField * fields
Definition: tif_dir.h:275
TIFFPostMethod tif_postdecode
Definition: tiffiop.h:198
uint16 td_fillorder
Definition: tif_dir.h:79
#define COMPRESSION_NONE
Definition: tiff.h:158
#define TIFFTAG_COMPRESSION
Definition: tiff.h:157
uint32 td_tilewidth
Definition: tif_dir.h:72
uint16 td_sampleformat
Definition: tif_dir.h:75
uint16 td_threshholding
Definition: tif_dir.h:78
void _TIFFNoPostDecode(TIFF *tif, uint8 *buf, tmsize_t cc)
Definition: tif_read.c:1533
uint32 td_rowsperstrip
Definition: tif_dir.h:82
TIFFVGetMethod vgetfield
Definition: tiffio.h:339
uint16 td_ycbcrsubsampling[2]
Definition: tif_dir.h:110
TIFFDirectory tif_dir
Definition: tiffiop.h:135
size_t tif_nfieldscompat
Definition: tiffiop.h:208
TIFFVSetMethod vsetfield
Definition: tiffio.h:338
uint16 td_samplesperpixel
Definition: tif_dir.h:81
const TIFFField * tif_foundfield
Definition: tiffiop.h:202
void _TIFFfree(void *p)
Definition: tif_unix.c:326
int TIFFSetField(TIFF *tif, uint32 tag,...)
Definition: tif_dir.c:790
#define FILLORDER_MSB2LSB
Definition: tiff.h:216

Referenced by TIFFClientOpen(), TIFFCreateCustomDirectory(), TIFFCreateDirectory(), TIFFReadDirectory(), and TIFFUnlinkDirectory().

◆ TIFFFreeDirectory()

void TIFFFreeDirectory ( TIFF tif)

Definition at line 1251 of file tif_dir.c.

1252 {
1253  TIFFDirectory *td = &tif->tif_dir;
1254  int i;
1255 
1257  CleanupField(td_sminsamplevalue);
1258  CleanupField(td_smaxsamplevalue);
1259  CleanupField(td_colormap[0]);
1260  CleanupField(td_colormap[1]);
1261  CleanupField(td_colormap[2]);
1262  CleanupField(td_sampleinfo);
1263  CleanupField(td_subifd);
1264  CleanupField(td_inknames);
1265  CleanupField(td_refblackwhite);
1266  CleanupField(td_transferfunction[0]);
1267  CleanupField(td_transferfunction[1]);
1268  CleanupField(td_transferfunction[2]);
1269  CleanupField(td_stripoffset);
1270  CleanupField(td_stripbytecount);
1273 
1274  /* Cleanup custom tag values */
1275  for( i = 0; i < td->td_customValueCount; i++ ) {
1276  if (td->td_customValues[i].value)
1278  }
1279 
1280  td->td_customValueCount = 0;
1281  CleanupField(td_customValues);
1282 
1283 #if defined(DEFER_STRILE_LOAD)
1284  _TIFFmemset( &(td->td_stripoffset_entry), 0, sizeof(TIFFDirEntry));
1285  _TIFFmemset( &(td->td_stripbytecount_entry), 0, sizeof(TIFFDirEntry));
1286 #endif
1287 }
void _TIFFmemset(void *p, int v, tmsize_t c)
Definition: tif_unix.c:338
#define TIFFClrFieldBit(tif, field)
Definition: tif_dir.h:194
TIFFTagValue * td_customValues
Definition: tif_dir.h:120
int td_customValueCount
Definition: tif_dir.h:119
#define FIELD_YCBCRSUBSAMPLING
Definition: tif_dir.h:167
#define FIELD_SETLONGS
Definition: tif_dir.h:67
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define CleanupField(member)
Definition: tif_dir.c:1240
#define FIELD_YCBCRPOSITIONING
Definition: tif_dir.h:168
void * value
Definition: tif_dir.h:38
TIFFDirectory tif_dir
Definition: tiffiop.h:135
unsigned long td_fieldsset[FIELD_SETLONGS]
Definition: tif_dir.h:69
void _TIFFfree(void *p)
Definition: tif_unix.c:326

Referenced by TIFFCleanup(), TIFFReadCustomDirectory(), TIFFReadDirectory(), TIFFUnlinkDirectory(), and TIFFWriteDirectorySec().

◆ TIFFGetField()

int TIFFGetField ( TIFF tif,
uint32  tag,
  ... 
)

Definition at line 1215 of file tif_dir.c.

1216 {
1217  int status;
1218  va_list ap;
1219 
1220  va_start(ap, tag);
1221  status = TIFFVGetField(tif, tag, ap);
1222  va_end(ap);
1223  return (status);
1224 }
Definition: ecma_167.h:138
#define va_end(ap)
Definition: acmsvcex.h:90
char * va_list
Definition: acmsvcex.h:78
int TIFFVGetField(TIFF *tif, uint32 tag, va_list ap)
Definition: tif_dir.c:1233
#define va_start(ap, A)
Definition: acmsvcex.h:91
void int int ULONGLONG int va_list * ap
Definition: winesup.h:32
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

Referenced by gtTileContig(), gtTileSeparate(), isCCITTCompression(), TIFFFlush(), TIFFPrintDirectory(), TIFFRGBAImageBegin(), TIFFRGBAImageOK(), and TIFFWriteDirectorySec().

◆ TIFFLastDirectory()

int TIFFLastDirectory ( TIFF tif)

Definition at line 1658 of file tif_dir.c.

1659 {
1660  return (tif->tif_nextdiroff == 0);
1661 }
uint64 tif_nextdiroff
Definition: tiffiop.h:131

◆ TIFFNumberOfDirectories()

uint16 TIFFNumberOfDirectories ( TIFF tif)

Definition at line 1568 of file tif_dir.c.

1569 {
1570  static const char module[] = "TIFFNumberOfDirectories";
1571  uint64 nextdir;
1572  uint16 n;
1573  if (!(tif->tif_flags&TIFF_BIGTIFF))
1574  nextdir = tif->tif_header.classic.tiff_diroff;
1575  else
1576  nextdir = tif->tif_header.big.tiff_diroff;
1577  n = 0;
1578  while (nextdir != 0 && TIFFAdvanceDirectory(tif, &nextdir, NULL))
1579  {
1580  if (n != 65535) {
1581  ++n;
1582  }
1583  else
1584  {
1586  "Directory count exceeded 65535 limit,"
1587  " giving up on counting.");
1588  return (65535);
1589  }
1590  }
1591  return (n);
1592 }
unsigned long long uint64
Definition: platform.h:18
GLdouble n
Definition: glext.h:7729
thandle_t tif_clientdata
Definition: tiffiop.h:191
#define TIFF_BIGTIFF
Definition: tiffiop.h:125
uint32 tif_flags
Definition: tiffiop.h:106
smooth NULL
Definition: ftsmooth.c:416
union tiff::@3329 tif_header
uint32 tiff_diroff
Definition: tiff.h:98
void TIFFErrorExt(thandle_t fd, const char *module, const char *fmt,...)
Definition: tif_error.c:65
static int TIFFAdvanceDirectory(TIFF *tif, uint64 *nextdir, uint64 *off)
Definition: tif_dir.c:1426
TIFFHeaderBig big
Definition: tiffiop.h:140
unsigned short uint16
Definition: types.h:30
uint64 tiff_diroff
Definition: tiff.h:105
TIFFHeaderClassic classic
Definition: tiffiop.h:139

◆ TIFFSetDirectory()

int TIFFSetDirectory ( TIFF tif,
uint16  dirn 
)

Definition at line 1599 of file tif_dir.c.

1600 {
1601  uint64 nextdir;
1602  uint16 n;
1603 
1604  if (!(tif->tif_flags&TIFF_BIGTIFF))
1605  nextdir = tif->tif_header.classic.tiff_diroff;
1606  else
1607  nextdir = tif->tif_header.big.tiff_diroff;
1608  for (n = dirn; n > 0 && nextdir != 0; n--)
1609  if (!TIFFAdvanceDirectory(tif, &nextdir, NULL))
1610  return (0);
1611  tif->tif_nextdiroff = nextdir;
1612  /*
1613  * Set curdir to the actual directory index. The
1614  * -1 is because TIFFReadDirectory will increment
1615  * tif_curdir after successfully reading the directory.
1616  */
1617  tif->tif_curdir = (dirn - n) - 1;
1618  /*
1619  * Reset tif_dirnumber counter and start new list of seen directories.
1620  * We need this to prevent IFD loops.
1621  */
1622  tif->tif_dirnumber = 0;
1623  return (TIFFReadDirectory(tif));
1624 }
unsigned long long uint64
Definition: platform.h:18
int TIFFReadDirectory(TIFF *tif)
Definition: tif_dirread.c:3542
GLdouble n
Definition: glext.h:7729
uint16 tif_curdir
Definition: tiffiop.h:144
#define TIFF_BIGTIFF
Definition: tiffiop.h:125
uint32 tif_flags
Definition: tiffiop.h:106
smooth NULL
Definition: ftsmooth.c:416
uint64 tif_nextdiroff
Definition: tiffiop.h:131
union tiff::@3329 tif_header
uint32 tiff_diroff
Definition: tiff.h:98
static int TIFFAdvanceDirectory(TIFF *tif, uint64 *nextdir, uint64 *off)
Definition: tif_dir.c:1426
uint16 tif_dirnumber
Definition: tiffiop.h:134
TIFFHeaderBig big
Definition: tiffiop.h:140
unsigned short uint16
Definition: types.h:30
uint64 tiff_diroff
Definition: tiff.h:105
TIFFHeaderClassic classic
Definition: tiffiop.h:139

◆ TIFFSetField()

int TIFFSetField ( TIFF tif,
uint32  tag,
  ... 
)

Definition at line 790 of file tif_dir.c.

791 {
792  va_list ap;
793  int status;
794 
795  va_start(ap, tag);
796  status = TIFFVSetField(tif, tag, ap);
797  va_end(ap);
798  return (status);
799 }
Definition: ecma_167.h:138
#define va_end(ap)
Definition: acmsvcex.h:90
char * va_list
Definition: acmsvcex.h:78
int TIFFVSetField(TIFF *tif, uint32 tag, va_list ap)
Definition: tif_dir.c:849
#define va_start(ap, A)
Definition: acmsvcex.h:91
void int int ULONGLONG int va_list * ap
Definition: winesup.h:32
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

Referenced by ChopUpSingleUncompressedStrip(), TIFFDefaultDirectory(), TIFFFetchNormalTag(), TIFFFetchSubjectDistance(), TIFFReadDirectory(), and TIFFRGBAImageBegin().

◆ TIFFSetSubDirectory()

int TIFFSetSubDirectory ( TIFF tif,
uint64  diroff 
)

Definition at line 1633 of file tif_dir.c.

1634 {
1635  tif->tif_nextdiroff = diroff;
1636  /*
1637  * Reset tif_dirnumber counter and start new list of seen directories.
1638  * We need this to prevent IFD loops.
1639  */
1640  tif->tif_dirnumber = 0;
1641  return (TIFFReadDirectory(tif));
1642 }
int TIFFReadDirectory(TIFF *tif)
Definition: tif_dirread.c:3542
uint64 tif_nextdiroff
Definition: tiffiop.h:131
uint16 tif_dirnumber
Definition: tiffiop.h:134

◆ TIFFSetTagExtender()

TIFFExtendProc TIFFSetTagExtender ( TIFFExtendProc  extender)

Definition at line 1296 of file tif_dir.c.

1297 {
1299  _TIFFextender = extender;
1300  return (prev);
1301 }
static TIFFExtendProc _TIFFextender
Definition: tif_dir.c:1293
void(* TIFFExtendProc)(TIFF *)
Definition: tiffio.h:284

◆ TIFFUnlinkDirectory()

int TIFFUnlinkDirectory ( TIFF tif,
uint16  dirn 
)

Definition at line 1667 of file tif_dir.c.

1668 {
1669  static const char module[] = "TIFFUnlinkDirectory";
1670  uint64 nextdir;
1671  uint64 off;
1672  uint16 n;
1673 
1674  if (tif->tif_mode == O_RDONLY) {
1676  "Can not unlink directory in read-only file");
1677  return (0);
1678  }
1679  /*
1680  * Go to the directory before the one we want
1681  * to unlink and nab the offset of the link
1682  * field we'll need to patch.
1683  */
1684  if (!(tif->tif_flags&TIFF_BIGTIFF))
1685  {
1686  nextdir = tif->tif_header.classic.tiff_diroff;
1687  off = 4;
1688  }
1689  else
1690  {
1691  nextdir = tif->tif_header.big.tiff_diroff;
1692  off = 8;
1693  }
1694  for (n = dirn-1; n > 0; n--) {
1695  if (nextdir == 0) {
1696  TIFFErrorExt(tif->tif_clientdata, module, "Directory %d does not exist", dirn);
1697  return (0);
1698  }
1699  if (!TIFFAdvanceDirectory(tif, &nextdir, &off))
1700  return (0);
1701  }
1702  /*
1703  * Advance to the directory to be unlinked and fetch
1704  * the offset of the directory that follows.
1705  */
1706  if (!TIFFAdvanceDirectory(tif, &nextdir, NULL))
1707  return (0);
1708  /*
1709  * Go back and patch the link field of the preceding
1710  * directory to point to the offset of the directory
1711  * that follows.
1712  */
1713  (void) TIFFSeekFile(tif, off, SEEK_SET);
1714  if (!(tif->tif_flags&TIFF_BIGTIFF))
1715  {
1716  uint32 nextdir32;
1717  nextdir32=(uint32)nextdir;
1718  assert((uint64)nextdir32==nextdir);
1719  if (tif->tif_flags & TIFF_SWAB)
1720  TIFFSwabLong(&nextdir32);
1721  if (!WriteOK(tif, &nextdir32, sizeof (uint32))) {
1722  TIFFErrorExt(tif->tif_clientdata, module, "Error writing directory link");
1723  return (0);
1724  }
1725  }
1726  else
1727  {
1728  if (tif->tif_flags & TIFF_SWAB)
1729  TIFFSwabLong8(&nextdir);
1730  if (!WriteOK(tif, &nextdir, sizeof (uint64))) {
1731  TIFFErrorExt(tif->tif_clientdata, module, "Error writing directory link");
1732  return (0);
1733  }
1734  }
1735  /*
1736  * Leave directory state setup safely. We don't have
1737  * facilities for doing inserting and removing directories,
1738  * so it's safest to just invalidate everything. This
1739  * means that the caller can only append to the directory
1740  * chain.
1741  */
1742  (*tif->tif_cleanup)(tif);
1743  if ((tif->tif_flags & TIFF_MYBUFFER) && tif->tif_rawdata) {
1744  _TIFFfree(tif->tif_rawdata);
1745  tif->tif_rawdata = NULL;
1746  tif->tif_rawcc = 0;
1747  tif->tif_rawdataoff = 0;
1748  tif->tif_rawdataloaded = 0;
1749  }
1751  TIFFFreeDirectory(tif);
1752  TIFFDefaultDirectory(tif);
1753  tif->tif_diroff = 0; /* force link on next write */
1754  tif->tif_nextdiroff = 0; /* next write must be at end */
1755  tif->tif_curoff = 0;
1756  tif->tif_row = (uint32) -1;
1757  tif->tif_curstrip = (uint32) -1;
1758  return (1);
1759 }
unsigned long long uint64
Definition: platform.h:18
#define TIFF_BEENWRITING
Definition: tiffiop.h:112
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define WriteOK(tif, buf, size)
Definition: tiffiop.h:243
unsigned int uint32
Definition: types.h:32
#define TIFFSeekFile(tif, off, whence)
Definition: tiffiop.h:221
uint32 tif_curstrip
Definition: tiffiop.h:145
GLdouble n
Definition: glext.h:7729
#define assert(x)
Definition: debug.h:53
uint8 * tif_rawdata
Definition: tiffiop.h:179
uint64 tif_curoff
Definition: tiffiop.h:146
thandle_t tif_clientdata
Definition: tiffiop.h:191
tmsize_t tif_rawdataoff
Definition: tiffiop.h:181
tmsize_t tif_rawcc
Definition: tiffiop.h:184
#define TIFF_BIGTIFF
Definition: tiffiop.h:125
#define TIFF_SWAB
Definition: tiffiop.h:113
int tif_mode
Definition: tiffiop.h:105
uint32 tif_flags
Definition: tiffiop.h:106
smooth NULL
Definition: ftsmooth.c:416
uint64 tif_nextdiroff
Definition: tiffiop.h:131
#define TIFF_POSTENCODE
Definition: tiffiop.h:118
union tiff::@3329 tif_header
void TIFFFreeDirectory(TIFF *tif)
Definition: tif_dir.c:1251
#define TIFF_BUF4WRITE
Definition: tiffiop.h:126
#define SEEK_SET
Definition: jmemansi.c:26
uint32 tiff_diroff
Definition: tiff.h:98
void TIFFErrorExt(thandle_t fd, const char *module, const char *fmt,...)
Definition: tif_error.c:65
static int TIFFAdvanceDirectory(TIFF *tif, uint64 *nextdir, uint64 *off)
Definition: tif_dir.c:1426
tmsize_t tif_rawdataloaded
Definition: tiffiop.h:182
uint64 tif_diroff
Definition: tiffiop.h:130
TIFFVoidMethod tif_cleanup
Definition: tiffiop.h:172
#define TIFF_BUFFERSETUP
Definition: tiffiop.h:110
TIFFHeaderBig big
Definition: tiffiop.h:140
uint32 tif_row
Definition: tiffiop.h:143
void TIFFSwabLong(uint32 *lp)
Definition: tif_swab.c:45
unsigned short uint16
Definition: types.h:30
int TIFFDefaultDirectory(TIFF *tif)
Definition: tif_dir.c:1356
uint64 tiff_diroff
Definition: tiff.h:105
TIFFHeaderClassic classic
Definition: tiffiop.h:139
void _TIFFfree(void *p)
Definition: tif_unix.c:326
#define TIFF_MYBUFFER
Definition: tiffiop.h:115
void TIFFSwabLong8(uint64 *lp)
Definition: tif_swab.c:57
#define O_RDONLY
Definition: acwin.h:108
off
Definition: i386-dis.c:3909

◆ TIFFUnsetField()

int TIFFUnsetField ( TIFF tif,
uint32  tag 
)

Definition at line 805 of file tif_dir.c.

806 {
807  const TIFFField *fip = TIFFFieldWithTag(tif, tag);
808  TIFFDirectory* td = &tif->tif_dir;
809 
810  if( !fip )
811  return 0;
812 
813  if( fip->field_bit != FIELD_CUSTOM )
814  TIFFClrFieldBit(tif, fip->field_bit);
815  else
816  {
817  TIFFTagValue *tv = NULL;
818  int i;
819 
820  for (i = 0; i < td->td_customValueCount; i++) {
821 
822  tv = td->td_customValues + i;
823  if( tv->info->field_tag == tag )
824  break;
825  }
826 
827  if( i < td->td_customValueCount )
828  {
829  _TIFFfree(tv->value);
830  for( ; i < td->td_customValueCount-1; i++) {
831  td->td_customValues[i] = td->td_customValues[i+1];
832  }
833  td->td_customValueCount--;
834  }
835  }
836 
837  tif->tif_flags |= TIFF_DIRTYDIRECT;
838 
839  return (1);
840 }
#define FIELD_CUSTOM
Definition: tiffio.h:317
#define TIFFClrFieldBit(tif, field)
Definition: tif_dir.h:194
TIFFTagValue * td_customValues
Definition: tif_dir.h:120
Definition: ecma_167.h:138
int td_customValueCount
Definition: tif_dir.h:119
#define TIFF_DIRTYDIRECT
Definition: tiffiop.h:109
unsigned short field_bit
Definition: tif_dir.h:286
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
uint32 tif_flags
Definition: tiffiop.h:106
smooth NULL
Definition: ftsmooth.c:416
const TIFFField * info
Definition: tif_dir.h:36
uint32 field_tag
Definition: tif_dir.h:279
const TIFFField * TIFFFieldWithTag(TIFF *tif, uint32 tag)
Definition: tif_dirinfo.c:558
void * value
Definition: tif_dir.h:38
TIFFDirectory tif_dir
Definition: tiffiop.h:135
void _TIFFfree(void *p)
Definition: tif_unix.c:326

◆ TIFFVGetField()

int TIFFVGetField ( TIFF tif,
uint32  tag,
va_list  ap 
)

Definition at line 1233 of file tif_dir.c.

1234 {
1235  const TIFFField* fip = TIFFFindField(tif, tag, TIFF_ANY);
1236  return (fip && (isPseudoTag(tag) || TIFFFieldSet(tif, fip->field_bit)) ?
1237  (*tif->tif_tagmethods.vgetfield)(tif, tag, ap) : 0);
1238 }
TIFFTagMethods tif_tagmethods
Definition: tiffiop.h:203
#define TIFF_ANY
Definition: tiffio.h:312
#define isPseudoTag(t)
Definition: tiffiop.h:211
Definition: ecma_167.h:138
unsigned short field_bit
Definition: tif_dir.h:286
#define TIFFFieldSet(tif, field)
Definition: tif_dir.h:192
TIFFVGetMethod vgetfield
Definition: tiffio.h:339
void int int ULONGLONG int va_list * ap
Definition: winesup.h:32
const TIFFField * TIFFFindField(TIFF *tif, uint32 tag, TIFFDataType dt)
Definition: tif_dirinfo.c:506

Referenced by TIFFGetField(), and TIFFVGetFieldDefaulted().

◆ TIFFVSetField()

int TIFFVSetField ( TIFF tif,
uint32  tag,
va_list  ap 
)

Definition at line 849 of file tif_dir.c.

850 {
851  return OkToChangeTag(tif, tag) ?
852  (*tif->tif_tagmethods.vsetfield)(tif, tag, ap) : 0;
853 }
TIFFTagMethods tif_tagmethods
Definition: tiffiop.h:203
static int OkToChangeTag(TIFF *tif, uint32 tag)
Definition: tif_dir.c:758
Definition: ecma_167.h:138
void int int ULONGLONG int va_list * ap
Definition: winesup.h:32
TIFFVSetMethod vsetfield
Definition: tiffio.h:338

Referenced by TIFFSetField().

Variable Documentation

◆ _TIFFextender

TIFFExtendProc _TIFFextender = (TIFFExtendProc) NULL
static

Definition at line 1293 of file tif_dir.c.

Referenced by TIFFDefaultDirectory(), and TIFFSetTagExtender().