ReactOS  0.4.14-dev-323-g6fe6a88
tif_dir.h File Reference
#include "tiff.h"
#include "tiffio.h"
Include dependency graph for tif_dir.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  TIFFTagValue
 
struct  TIFFDirEntry
 
struct  TIFFDirectory
 
struct  _TIFFFieldArray
 
struct  _TIFFField
 

Macros

#define FIELD_SETLONGS   4
 
#define FIELD_IGNORE   0
 
#define FIELD_IMAGEDIMENSIONS   1
 
#define FIELD_TILEDIMENSIONS   2
 
#define FIELD_RESOLUTION   3
 
#define FIELD_POSITION   4
 
#define FIELD_SUBFILETYPE   5
 
#define FIELD_BITSPERSAMPLE   6
 
#define FIELD_COMPRESSION   7
 
#define FIELD_PHOTOMETRIC   8
 
#define FIELD_THRESHHOLDING   9
 
#define FIELD_FILLORDER   10
 
#define FIELD_ORIENTATION   15
 
#define FIELD_SAMPLESPERPIXEL   16
 
#define FIELD_ROWSPERSTRIP   17
 
#define FIELD_MINSAMPLEVALUE   18
 
#define FIELD_MAXSAMPLEVALUE   19
 
#define FIELD_PLANARCONFIG   20
 
#define FIELD_RESOLUTIONUNIT   22
 
#define FIELD_PAGENUMBER   23
 
#define FIELD_STRIPBYTECOUNTS   24
 
#define FIELD_STRIPOFFSETS   25
 
#define FIELD_COLORMAP   26
 
#define FIELD_EXTRASAMPLES   31
 
#define FIELD_SAMPLEFORMAT   32
 
#define FIELD_SMINSAMPLEVALUE   33
 
#define FIELD_SMAXSAMPLEVALUE   34
 
#define FIELD_IMAGEDEPTH   35
 
#define FIELD_TILEDEPTH   36
 
#define FIELD_HALFTONEHINTS   37
 
#define FIELD_YCBCRSUBSAMPLING   39
 
#define FIELD_YCBCRPOSITIONING   40
 
#define FIELD_REFBLACKWHITE   41
 
#define FIELD_TRANSFERFUNCTION   44
 
#define FIELD_INKNAMES   46
 
#define FIELD_SUBIFD   49
 
#define FIELD_CODEC   66 /* base of codec-private tags */
 
#define FIELD_PSEUDO   0
 
#define FIELD_LAST   (32*FIELD_SETLONGS-1)
 
#define BITn(n)   (((unsigned long)1L)<<((n)&0x1f))
 
#define BITFIELDn(tif, n)   ((tif)->tif_dir.td_fieldsset[(n)/32])
 
#define TIFFFieldSet(tif, field)   (BITFIELDn(tif, field) & BITn(field))
 
#define TIFFSetFieldBit(tif, field)   (BITFIELDn(tif, field) |= BITn(field))
 
#define TIFFClrFieldBit(tif, field)   (BITFIELDn(tif, field) &= ~BITn(field))
 
#define FieldSet(fields, f)   (fields[(f)/32] & BITn(f))
 
#define ResetFieldBit(fields, f)   (fields[(f)/32] &= ~BITn(f))
 

Enumerations

enum  TIFFSetGetFieldType {
  TIFF_SETGET_UNDEFINED = 0, TIFF_SETGET_ASCII = 1, TIFF_SETGET_UINT8 = 2, TIFF_SETGET_SINT8 = 3,
  TIFF_SETGET_UINT16 = 4, TIFF_SETGET_SINT16 = 5, TIFF_SETGET_UINT32 = 6, TIFF_SETGET_SINT32 = 7,
  TIFF_SETGET_UINT64 = 8, TIFF_SETGET_SINT64 = 9, TIFF_SETGET_FLOAT = 10, TIFF_SETGET_DOUBLE = 11,
  TIFF_SETGET_IFD8 = 12, TIFF_SETGET_INT = 13, TIFF_SETGET_UINT16_PAIR = 14, TIFF_SETGET_C0_ASCII = 15,
  TIFF_SETGET_C0_UINT8 = 16, TIFF_SETGET_C0_SINT8 = 17, TIFF_SETGET_C0_UINT16 = 18, TIFF_SETGET_C0_SINT16 = 19,
  TIFF_SETGET_C0_UINT32 = 20, TIFF_SETGET_C0_SINT32 = 21, TIFF_SETGET_C0_UINT64 = 22, TIFF_SETGET_C0_SINT64 = 23,
  TIFF_SETGET_C0_FLOAT = 24, TIFF_SETGET_C0_DOUBLE = 25, TIFF_SETGET_C0_IFD8 = 26, TIFF_SETGET_C16_ASCII = 27,
  TIFF_SETGET_C16_UINT8 = 28, TIFF_SETGET_C16_SINT8 = 29, TIFF_SETGET_C16_UINT16 = 30, TIFF_SETGET_C16_SINT16 = 31,
  TIFF_SETGET_C16_UINT32 = 32, TIFF_SETGET_C16_SINT32 = 33, TIFF_SETGET_C16_UINT64 = 34, TIFF_SETGET_C16_SINT64 = 35,
  TIFF_SETGET_C16_FLOAT = 36, TIFF_SETGET_C16_DOUBLE = 37, TIFF_SETGET_C16_IFD8 = 38, TIFF_SETGET_C32_ASCII = 39,
  TIFF_SETGET_C32_UINT8 = 40, TIFF_SETGET_C32_SINT8 = 41, TIFF_SETGET_C32_UINT16 = 42, TIFF_SETGET_C32_SINT16 = 43,
  TIFF_SETGET_C32_UINT32 = 44, TIFF_SETGET_C32_SINT32 = 45, TIFF_SETGET_C32_UINT64 = 46, TIFF_SETGET_C32_SINT64 = 47,
  TIFF_SETGET_C32_FLOAT = 48, TIFF_SETGET_C32_DOUBLE = 49, TIFF_SETGET_C32_IFD8 = 50, TIFF_SETGET_OTHER = 51
}
 
enum  TIFFFieldArrayType { tfiatImage, tfiatExif, tfiatOther }
 

Functions

const TIFFFieldArray_TIFFGetFields (void)
 
const TIFFFieldArray_TIFFGetExifFields (void)
 
void _TIFFSetupFields (TIFF *tif, const TIFFFieldArray *infoarray)
 
void _TIFFPrintFieldInfo (TIFF *, FILE *)
 
int _TIFFFillStriles (TIFF *)
 
int _TIFFMergeFields (TIFF *, const TIFFField[], uint32)
 
const TIFFField_TIFFFindOrRegisterField (TIFF *, uint32, TIFFDataType)
 
TIFFField_TIFFCreateAnonField (TIFF *, uint32, TIFFDataType)
 
int _TIFFCheckFieldIsValidForCodec (TIFF *tif, ttag_t tag)
 

Macro Definition Documentation

◆ BITFIELDn

#define BITFIELDn (   tif,
  n 
)    ((tif)->tif_dir.td_fieldsset[(n)/32])

Definition at line 191 of file tif_dir.h.

◆ BITn

#define BITn (   n)    (((unsigned long)1L)<<((n)&0x1f))

Definition at line 190 of file tif_dir.h.

◆ FIELD_BITSPERSAMPLE

#define FIELD_BITSPERSAMPLE   6

Definition at line 144 of file tif_dir.h.

◆ FIELD_CODEC

#define FIELD_CODEC   66 /* base of codec-private tags */

Definition at line 175 of file tif_dir.h.

◆ FIELD_COLORMAP

#define FIELD_COLORMAP   26

Definition at line 159 of file tif_dir.h.

◆ FIELD_COMPRESSION

#define FIELD_COMPRESSION   7

Definition at line 145 of file tif_dir.h.

◆ FIELD_EXTRASAMPLES

#define FIELD_EXTRASAMPLES   31

Definition at line 160 of file tif_dir.h.

◆ FIELD_FILLORDER

#define FIELD_FILLORDER   10

Definition at line 148 of file tif_dir.h.

◆ FIELD_HALFTONEHINTS

#define FIELD_HALFTONEHINTS   37

Definition at line 166 of file tif_dir.h.

◆ FIELD_IGNORE

#define FIELD_IGNORE   0

Definition at line 134 of file tif_dir.h.

◆ FIELD_IMAGEDEPTH

#define FIELD_IMAGEDEPTH   35

Definition at line 164 of file tif_dir.h.

◆ FIELD_IMAGEDIMENSIONS

#define FIELD_IMAGEDIMENSIONS   1

Definition at line 137 of file tif_dir.h.

◆ FIELD_INKNAMES

#define FIELD_INKNAMES   46

Definition at line 171 of file tif_dir.h.

◆ FIELD_LAST

#define FIELD_LAST   (32*FIELD_SETLONGS-1)

Definition at line 188 of file tif_dir.h.

◆ FIELD_MAXSAMPLEVALUE

#define FIELD_MAXSAMPLEVALUE   19

Definition at line 153 of file tif_dir.h.

◆ FIELD_MINSAMPLEVALUE

#define FIELD_MINSAMPLEVALUE   18

Definition at line 152 of file tif_dir.h.

◆ FIELD_ORIENTATION

#define FIELD_ORIENTATION   15

Definition at line 149 of file tif_dir.h.

◆ FIELD_PAGENUMBER

#define FIELD_PAGENUMBER   23

Definition at line 156 of file tif_dir.h.

◆ FIELD_PHOTOMETRIC

#define FIELD_PHOTOMETRIC   8

Definition at line 146 of file tif_dir.h.

◆ FIELD_PLANARCONFIG

#define FIELD_PLANARCONFIG   20

Definition at line 154 of file tif_dir.h.

◆ FIELD_POSITION

#define FIELD_POSITION   4

Definition at line 140 of file tif_dir.h.

◆ FIELD_PSEUDO

#define FIELD_PSEUDO   0

Definition at line 186 of file tif_dir.h.

◆ FIELD_REFBLACKWHITE

#define FIELD_REFBLACKWHITE   41

Definition at line 169 of file tif_dir.h.

◆ FIELD_RESOLUTION

#define FIELD_RESOLUTION   3

Definition at line 139 of file tif_dir.h.

◆ FIELD_RESOLUTIONUNIT

#define FIELD_RESOLUTIONUNIT   22

Definition at line 155 of file tif_dir.h.

◆ FIELD_ROWSPERSTRIP

#define FIELD_ROWSPERSTRIP   17

Definition at line 151 of file tif_dir.h.

◆ FIELD_SAMPLEFORMAT

#define FIELD_SAMPLEFORMAT   32

Definition at line 161 of file tif_dir.h.

◆ FIELD_SAMPLESPERPIXEL

#define FIELD_SAMPLESPERPIXEL   16

Definition at line 150 of file tif_dir.h.

◆ FIELD_SETLONGS

#define FIELD_SETLONGS   4

Definition at line 67 of file tif_dir.h.

◆ FIELD_SMAXSAMPLEVALUE

#define FIELD_SMAXSAMPLEVALUE   34

Definition at line 163 of file tif_dir.h.

◆ FIELD_SMINSAMPLEVALUE

#define FIELD_SMINSAMPLEVALUE   33

Definition at line 162 of file tif_dir.h.

◆ FIELD_STRIPBYTECOUNTS

#define FIELD_STRIPBYTECOUNTS   24

Definition at line 157 of file tif_dir.h.

◆ FIELD_STRIPOFFSETS

#define FIELD_STRIPOFFSETS   25

Definition at line 158 of file tif_dir.h.

◆ FIELD_SUBFILETYPE

#define FIELD_SUBFILETYPE   5

Definition at line 143 of file tif_dir.h.

◆ FIELD_SUBIFD

#define FIELD_SUBIFD   49

Definition at line 172 of file tif_dir.h.

◆ FIELD_THRESHHOLDING

#define FIELD_THRESHHOLDING   9

Definition at line 147 of file tif_dir.h.

◆ FIELD_TILEDEPTH

#define FIELD_TILEDEPTH   36

Definition at line 165 of file tif_dir.h.

◆ FIELD_TILEDIMENSIONS

#define FIELD_TILEDIMENSIONS   2

Definition at line 138 of file tif_dir.h.

◆ FIELD_TRANSFERFUNCTION

#define FIELD_TRANSFERFUNCTION   44

Definition at line 170 of file tif_dir.h.

◆ FIELD_YCBCRPOSITIONING

#define FIELD_YCBCRPOSITIONING   40

Definition at line 168 of file tif_dir.h.

◆ FIELD_YCBCRSUBSAMPLING

#define FIELD_YCBCRSUBSAMPLING   39

Definition at line 167 of file tif_dir.h.

◆ FieldSet

#define FieldSet (   fields,
  f 
)    (fields[(f)/32] & BITn(f))

Definition at line 196 of file tif_dir.h.

◆ ResetFieldBit

#define ResetFieldBit (   fields,
  f 
)    (fields[(f)/32] &= ~BITn(f))

Definition at line 197 of file tif_dir.h.

◆ TIFFClrFieldBit

#define TIFFClrFieldBit (   tif,
  field 
)    (BITFIELDn(tif, field) &= ~BITn(field))

Definition at line 194 of file tif_dir.h.

◆ TIFFFieldSet

#define TIFFFieldSet (   tif,
  field 
)    (BITFIELDn(tif, field) & BITn(field))

Definition at line 192 of file tif_dir.h.

◆ TIFFSetFieldBit

#define TIFFSetFieldBit (   tif,
  field 
)    (BITFIELDn(tif, field) |= BITn(field))

Definition at line 193 of file tif_dir.h.

Enumeration Type Documentation

◆ TIFFFieldArrayType

Enumerator
tfiatImage 
tfiatExif 
tfiatOther 

Definition at line 265 of file tif_dir.h.

265  {
266  tfiatImage,
267  tfiatExif,
268  tfiatOther
TIFFFieldArrayType
Definition: tif_dir.h:265

◆ TIFFSetGetFieldType

Enumerator
TIFF_SETGET_UNDEFINED 
TIFF_SETGET_ASCII 
TIFF_SETGET_UINT8 
TIFF_SETGET_SINT8 
TIFF_SETGET_UINT16 
TIFF_SETGET_SINT16 
TIFF_SETGET_UINT32 
TIFF_SETGET_SINT32 
TIFF_SETGET_UINT64 
TIFF_SETGET_SINT64 
TIFF_SETGET_FLOAT 
TIFF_SETGET_DOUBLE 
TIFF_SETGET_IFD8 
TIFF_SETGET_INT 
TIFF_SETGET_UINT16_PAIR 
TIFF_SETGET_C0_ASCII 
TIFF_SETGET_C0_UINT8 
TIFF_SETGET_C0_SINT8 
TIFF_SETGET_C0_UINT16 
TIFF_SETGET_C0_SINT16 
TIFF_SETGET_C0_UINT32 
TIFF_SETGET_C0_SINT32 
TIFF_SETGET_C0_UINT64 
TIFF_SETGET_C0_SINT64 
TIFF_SETGET_C0_FLOAT 
TIFF_SETGET_C0_DOUBLE 
TIFF_SETGET_C0_IFD8 
TIFF_SETGET_C16_ASCII 
TIFF_SETGET_C16_UINT8 
TIFF_SETGET_C16_SINT8 
TIFF_SETGET_C16_UINT16 
TIFF_SETGET_C16_SINT16 
TIFF_SETGET_C16_UINT32 
TIFF_SETGET_C16_SINT32 
TIFF_SETGET_C16_UINT64 
TIFF_SETGET_C16_SINT64 
TIFF_SETGET_C16_FLOAT 
TIFF_SETGET_C16_DOUBLE 
TIFF_SETGET_C16_IFD8 
TIFF_SETGET_C32_ASCII 
TIFF_SETGET_C32_UINT8 
TIFF_SETGET_C32_SINT8 
TIFF_SETGET_C32_UINT16 
TIFF_SETGET_C32_SINT16 
TIFF_SETGET_C32_UINT32 
TIFF_SETGET_C32_SINT32 
TIFF_SETGET_C32_UINT64 
TIFF_SETGET_C32_SINT64 
TIFF_SETGET_C32_FLOAT 
TIFF_SETGET_C32_DOUBLE 
TIFF_SETGET_C32_IFD8 
TIFF_SETGET_OTHER 

Definition at line 199 of file tif_dir.h.

199  {
201  TIFF_SETGET_ASCII = 1,
202  TIFF_SETGET_UINT8 = 2,
203  TIFF_SETGET_SINT8 = 3,
204  TIFF_SETGET_UINT16 = 4,
205  TIFF_SETGET_SINT16 = 5,
206  TIFF_SETGET_UINT32 = 6,
207  TIFF_SETGET_SINT32 = 7,
208  TIFF_SETGET_UINT64 = 8,
209  TIFF_SETGET_SINT64 = 9,
210  TIFF_SETGET_FLOAT = 10,
211  TIFF_SETGET_DOUBLE = 11,
212  TIFF_SETGET_IFD8 = 12,
213  TIFF_SETGET_INT = 13,
226  TIFF_SETGET_C0_IFD8 = 26,
251  TIFF_SETGET_OTHER = 51
TIFFSetGetFieldType
Definition: tif_dir.h:199

Function Documentation

◆ _TIFFCheckFieldIsValidForCodec()

int _TIFFCheckFieldIsValidForCodec ( TIFF tif,
ttag_t  tag 
)

Definition at line 958 of file tif_dirinfo.c.

959 {
960  /* Filter out non-codec specific tags */
961  switch (tag) {
962  /* Shared tags */
963  case TIFFTAG_PREDICTOR:
964  /* JPEG tags */
965  case TIFFTAG_JPEGTABLES:
966  /* OJPEG tags */
969  case TIFFTAG_JPEGQTABLES:
972  case TIFFTAG_JPEGPROC:
974  /* CCITT* */
975  case TIFFTAG_BADFAXLINES:
980  /* LERC */
982  break;
983  default:
984  return 1;
985  }
986  /* Check if codec specific tags are allowed for the current
987  * compression scheme (codec) */
988  switch (tif->tif_dir.td_compression) {
989  case COMPRESSION_LZW:
990  if (tag == TIFFTAG_PREDICTOR)
991  return 1;
992  break;
994  /* No codec-specific tags */
995  break;
997  /* No codec-specific tags */
998  break;
999  case COMPRESSION_NEXT:
1000  /* No codec-specific tags */
1001  break;
1002  case COMPRESSION_JPEG:
1003  if (tag == TIFFTAG_JPEGTABLES)
1004  return 1;
1005  break;
1006  case COMPRESSION_OJPEG:
1007  switch (tag) {
1008  case TIFFTAG_JPEGIFOFFSET:
1010  case TIFFTAG_JPEGQTABLES:
1011  case TIFFTAG_JPEGDCTABLES:
1012  case TIFFTAG_JPEGACTABLES:
1013  case TIFFTAG_JPEGPROC:
1015  return 1;
1016  }
1017  break;
1018  case COMPRESSION_CCITTRLE:
1019  case COMPRESSION_CCITTRLEW:
1020  case COMPRESSION_CCITTFAX3:
1021  case COMPRESSION_CCITTFAX4:
1022  switch (tag) {
1023  case TIFFTAG_BADFAXLINES:
1024  case TIFFTAG_CLEANFAXDATA:
1026  return 1;
1027  case TIFFTAG_GROUP3OPTIONS:
1029  return 1;
1030  break;
1031  case TIFFTAG_GROUP4OPTIONS:
1033  return 1;
1034  break;
1035  }
1036  break;
1037  case COMPRESSION_JBIG:
1038  /* No codec-specific tags */
1039  break;
1040  case COMPRESSION_DEFLATE:
1042  if (tag == TIFFTAG_PREDICTOR)
1043  return 1;
1044  break;
1045  case COMPRESSION_PIXARLOG:
1046  if (tag == TIFFTAG_PREDICTOR)
1047  return 1;
1048  break;
1049  case COMPRESSION_SGILOG:
1050  case COMPRESSION_SGILOG24:
1051  /* No codec-specific tags */
1052  break;
1053  case COMPRESSION_LZMA:
1054  if (tag == TIFFTAG_PREDICTOR)
1055  return 1;
1056  break;
1057  case COMPRESSION_ZSTD:
1058  if (tag == TIFFTAG_PREDICTOR)
1059  return 1;
1060  break;
1061  case COMPRESSION_LERC:
1063  return 1;
1064  break;
1065  case COMPRESSION_WEBP:
1066  if (tag == TIFFTAG_PREDICTOR)
1067  return 1;
1068  break;
1069  }
1070  return 0;
1071 }
#define TIFFTAG_JPEGTABLES
Definition: tiff.h:325
#define COMPRESSION_PACKBITS
Definition: tiff.h:171
#define TIFFTAG_JPEGIFOFFSET
Definition: tiff.h:358
#define COMPRESSION_WEBP
Definition: tiff.h:194
#define COMPRESSION_CCITTFAX3
Definition: tiff.h:160
#define COMPRESSION_SGILOG24
Definition: tiff.h:188
#define TIFFTAG_CONSECUTIVEBADFAXLINES
Definition: tiff.h:295
Definition: ecma_167.h:138
#define COMPRESSION_CCITTRLE
Definition: tiff.h:159
#define COMPRESSION_OJPEG
Definition: tiff.h:165
#define COMPRESSION_DEFLATE
Definition: tiff.h:181
#define TIFFTAG_LERC_PARAMETERS
Definition: tiff.h:456
#define COMPRESSION_CCITTFAX4
Definition: tiff.h:162
#define TIFFTAG_JPEGACTABLES
Definition: tiff.h:365
#define TIFFTAG_JPEGQTABLES
Definition: tiff.h:363
#define COMPRESSION_CCITTRLEW
Definition: tiff.h:170
#define COMPRESSION_PIXARLOG
Definition: tiff.h:180
#define COMPRESSION_JBIG
Definition: tiff.h:186
#define TIFFTAG_GROUP3OPTIONS
Definition: tiff.h:254
#define COMPRESSION_LERC
Definition: tiff.h:190
#define COMPRESSION_LZMA
Definition: tiff.h:192
#define TIFFTAG_BADFAXLINES
Definition: tiff.h:290
#define TIFFTAG_JPEGPROC
Definition: tiff.h:355
#define COMPRESSION_SGILOG
Definition: tiff.h:187
#define COMPRESSION_JPEG
Definition: tiff.h:166
#define TIFFTAG_JPEGDCTABLES
Definition: tiff.h:364
#define TIFFTAG_JPEGIFBYTECOUNT
Definition: tiff.h:359
#define COMPRESSION_THUNDERSCAN
Definition: tiff.h:172
#define COMPRESSION_ADOBE_DEFLATE
Definition: tiff.h:182
TIFFDirectory tif_dir
Definition: tiffiop.h:135
#define TIFFTAG_GROUP4OPTIONS
Definition: tiff.h:259
#define TIFFTAG_PREDICTOR
Definition: tiff.h:278
#define COMPRESSION_ZSTD
Definition: tiff.h:193
uint16 td_compression
Definition: tif_dir.h:76
#define COMPRESSION_LZW
Definition: tiff.h:164
#define TIFFTAG_CLEANFAXDATA
Definition: tiff.h:291
#define TIFFTAG_JPEGRESTARTINTERVAL
Definition: tiff.h:360
#define COMPRESSION_NEXT
Definition: tiff.h:169

Referenced by TIFFReadDirectory().

◆ _TIFFCreateAnonField()

TIFFField* _TIFFCreateAnonField ( TIFF ,
uint32  ,
TIFFDataType   
)

Definition at line 634 of file tif_dirinfo.c.

635 {
636  TIFFField *fld;
637  (void) tif;
638 
639  fld = (TIFFField *) _TIFFmalloc(sizeof (TIFFField));
640  if (fld == NULL)
641  return NULL;
642  _TIFFmemset(fld, 0, sizeof(TIFFField));
643 
644  fld->field_tag = tag;
647  fld->field_type = field_type;
648  fld->reserved = 0;
649  switch (field_type)
650  {
651  case TIFF_BYTE:
652  case TIFF_UNDEFINED:
655  break;
656  case TIFF_ASCII:
659  break;
660  case TIFF_SHORT:
663  break;
664  case TIFF_LONG:
667  break;
668  case TIFF_RATIONAL:
669  case TIFF_SRATIONAL:
670  case TIFF_FLOAT:
673  break;
674  case TIFF_SBYTE:
677  break;
678  case TIFF_SSHORT:
681  break;
682  case TIFF_SLONG:
685  break;
686  case TIFF_DOUBLE:
689  break;
690  case TIFF_IFD:
691  case TIFF_IFD8:
694  break;
695  case TIFF_LONG8:
698  break;
699  case TIFF_SLONG8:
702  break;
703  default:
706  break;
707  }
708  fld->field_bit = FIELD_CUSTOM;
709  fld->field_oktochange = TRUE;
710  fld->field_passcount = TRUE;
711  fld->field_name = (char *) _TIFFmalloc(32);
712  if (fld->field_name == NULL) {
713  _TIFFfree(fld);
714  return NULL;
715  }
716  fld->field_subfields = NULL;
717 
718  /*
719  * note that this name is a special sign to TIFFClose() and
720  * _TIFFSetupFields() to free the field
721  */
722  (void) snprintf(fld->field_name, 32, "Tag %d", (int) tag);
723 
724  return fld;
725 }
void _TIFFmemset(void *p, int v, tmsize_t c)
Definition: tif_unix.c:338
#define TRUE
Definition: types.h:120
#define FIELD_CUSTOM
Definition: tiffio.h:317
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define snprintf
Definition: wintirpc.h:48
TIFFFieldArray * field_subfields
Definition: tif_dir.h:290
unsigned short field_bit
Definition: tif_dir.h:286
char * field_name
Definition: tif_dir.h:289
short field_writecount
Definition: tif_dir.h:281
smooth NULL
Definition: ftsmooth.c:416
void * _TIFFmalloc(tmsize_t s)
Definition: tif_unix.c:309
TIFFSetGetFieldType get_field_type
Definition: tif_dir.h:285
unsigned char field_passcount
Definition: tif_dir.h:288
uint32 field_tag
Definition: tif_dir.h:279
uint32 reserved
Definition: tif_dir.h:283
unsigned char field_oktochange
Definition: tif_dir.h:287
#define TIFF_VARIABLE2
Definition: tiffio.h:315
TIFFDataType field_type
Definition: tif_dir.h:282
TIFFSetGetFieldType set_field_type
Definition: tif_dir.h:284
Definition: tiff.h:137
void _TIFFfree(void *p)
Definition: tif_unix.c:326
short field_readcount
Definition: tif_dir.h:280
char * tag
Definition: main.c:59

Referenced by _TIFFFindOrRegisterField(), TIFFReadCustomDirectory(), and TIFFReadDirectory().

◆ _TIFFFillStriles()

int _TIFFFillStriles ( TIFF )

◆ _TIFFFindOrRegisterField()

const TIFFField* _TIFFFindOrRegisterField ( TIFF ,
uint32  ,
TIFFDataType   
)

Definition at line 618 of file tif_dirinfo.c.

620 {
621  const TIFFField *fld;
622 
623  fld = TIFFFindField(tif, tag, dt);
624  if (fld == NULL) {
625  fld = _TIFFCreateAnonField(tif, tag, dt);
626  if (!_TIFFMergeFields(tif, fld, 1))
627  return NULL;
628  }
629 
630  return fld;
631 }
TIFFField * _TIFFCreateAnonField(TIFF *tif, uint32 tag, TIFFDataType field_type)
Definition: tif_dirinfo.c:634
Definition: ecma_167.h:138
int _TIFFMergeFields(TIFF *tif, const TIFFField info[], uint32 n)
Definition: tif_dirinfo.c:369
smooth NULL
Definition: ftsmooth.c:416
const TIFFField * TIFFFindField(TIFF *tif, uint32 tag, TIFFDataType dt)
Definition: tif_dirinfo.c:506

◆ _TIFFGetExifFields()

const TIFFFieldArray* _TIFFGetExifFields ( void  )

Definition at line 311 of file tif_dirinfo.c.

312 {
313  return(&exifFieldArray);
314 }
static const TIFFFieldArray exifFieldArray
Definition: tif_dirinfo.c:49

Referenced by TIFFCreateEXIFDirectory(), and TIFFReadEXIFDirectory().

◆ _TIFFGetFields()

const TIFFFieldArray* _TIFFGetFields ( void  )

Definition at line 305 of file tif_dirinfo.c.

306 {
307  return(&tiffFieldArray);
308 }
static const TIFFFieldArray tiffFieldArray
Definition: tif_dirinfo.c:48

Referenced by TIFFDefaultDirectory().

◆ _TIFFMergeFields()

int _TIFFMergeFields ( TIFF ,
const  TIFFField[],
uint32   
)

Definition at line 369 of file tif_dirinfo.c.

370 {
371  static const char module[] = "_TIFFMergeFields";
372  static const char reason[] = "for fields array";
373  /* TIFFField** tp; */
374  uint32 i;
375 
376  tif->tif_foundfield = NULL;
377 
378  if (tif->tif_fields && tif->tif_nfields > 0) {
379  tif->tif_fields = (TIFFField**)
380  _TIFFCheckRealloc(tif, tif->tif_fields,
381  (tif->tif_nfields + n),
382  sizeof(TIFFField *), reason);
383  } else {
384  tif->tif_fields = (TIFFField **)
385  _TIFFCheckMalloc(tif, n, sizeof(TIFFField *),
386  reason);
387  }
388  if (!tif->tif_fields) {
389  TIFFErrorExt(tif->tif_clientdata, module,
390  "Failed to allocate fields array");
391  return 0;
392  }
393 
394  /* tp = tif->tif_fields + tif->tif_nfields; */
395  for (i = 0; i < n; i++) {
396  const TIFFField *fip =
397  TIFFFindField(tif, info[i].field_tag, TIFF_ANY);
398 
399  /* only add definitions that aren't already present */
400  if (!fip) {
401  tif->tif_fields[tif->tif_nfields] = (TIFFField *) (info+i);
402  tif->tif_nfields++;
403  }
404  }
405 
406  /* Sort the field info by tag number */
407  qsort(tif->tif_fields, tif->tif_nfields,
408  sizeof(TIFFField *), tagCompare);
409 
410  return n;
411 }
#define TIFF_ANY
Definition: tiffio.h:312
void * _TIFFCheckRealloc(TIFF *tif, void *buffer, tmsize_t nmemb, tmsize_t elem_size, const char *what)
Definition: tif_aux.c:62
unsigned int uint32
Definition: types.h:32
GLdouble n
Definition: glext.h:7729
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 __cdecl qsort(_Inout_updates_bytes_(_NumOfElements *_SizeOfElements) void *_Base, _In_ size_t _NumOfElements, _In_ size_t _SizeOfElements, _In_ int(__cdecl *_PtFuncCompare)(const void *, const void *))
void * _TIFFCheckMalloc(TIFF *tif, tmsize_t nmemb, tmsize_t elem_size, const char *what)
Definition: tif_aux.c:85
smooth NULL
Definition: ftsmooth.c:416
void TIFFErrorExt(thandle_t fd, const char *module, const char *fmt,...)
Definition: tif_error.c:65
static WCHAR reason[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1904
const TIFFField * TIFFFindField(TIFF *tif, uint32 tag, TIFFDataType dt)
Definition: tif_dirinfo.c:506
static int tagCompare(const void *a, const void *b)
Definition: tif_dirinfo.c:342

Referenced by _TIFFFindOrRegisterField(), _TIFFSetupFields(), TIFFMergeFieldInfo(), TIFFPredictorInit(), TIFFReadCustomDirectory(), and TIFFReadDirectory().

◆ _TIFFPrintFieldInfo()

void _TIFFPrintFieldInfo ( TIFF ,
FILE  
)

Definition at line 414 of file tif_dirinfo.c.

415 {
416  uint32 i;
417 
418  fprintf(fd, "%s: \n", tif->tif_name);
419  for (i = 0; i < tif->tif_nfields; i++) {
420  const TIFFField* fip = tif->tif_fields[i];
421  fprintf(fd, "field[%2d] %5lu, %2d, %2d, %d, %2d, %5s, %5s, %s\n"
422  , (int)i
423  , (unsigned long) fip->field_tag
424  , fip->field_readcount, fip->field_writecount
425  , fip->field_type
426  , fip->field_bit
427  , fip->field_oktochange ? "TRUE" : "FALSE"
428  , fip->field_passcount ? "TRUE" : "FALSE"
429  , fip->field_name
430  );
431  }
432 }
unsigned int uint32
Definition: types.h:32
static int fd
Definition: io.c:51
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
char * field_name
Definition: tif_dir.h:289
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
short field_writecount
Definition: tif_dir.h:281
unsigned char field_passcount
Definition: tif_dir.h:288
uint32 field_tag
Definition: tif_dir.h:279
unsigned char field_oktochange
Definition: tif_dir.h:287
TIFFDataType field_type
Definition: tif_dir.h:282
short field_readcount
Definition: tif_dir.h:280

◆ _TIFFSetupFields()

void _TIFFSetupFields ( TIFF tif,
const TIFFFieldArray infoarray 
)

Definition at line 317 of file tif_dirinfo.c.

318 {
319  if (tif->tif_fields && tif->tif_nfields > 0) {
320  uint32 i;
321 
322  for (i = 0; i < tif->tif_nfields; i++) {
323  TIFFField *fld = tif->tif_fields[i];
324  if (fld->field_bit == FIELD_CUSTOM &&
325  strncmp("Tag ", fld->field_name, 4) == 0) {
326  _TIFFfree(fld->field_name);
327  _TIFFfree(fld);
328  }
329  }
330 
331  _TIFFfree(tif->tif_fields);
332  tif->tif_fields = NULL;
333  tif->tif_nfields = 0;
334  }
335  if (!_TIFFMergeFields(tif, fieldarray->fields, fieldarray->count)) {
336  TIFFErrorExt(tif->tif_clientdata, "_TIFFSetupFields",
337  "Setting up field info failed");
338  }
339 }
#define FIELD_CUSTOM
Definition: tiffio.h:317
unsigned int uint32
Definition: types.h:32
thandle_t tif_clientdata
Definition: tiffiop.h:191
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
char * field_name
Definition: tif_dir.h:289
int _TIFFMergeFields(TIFF *tif, const TIFFField info[], uint32 n)
Definition: tif_dirinfo.c:369
smooth NULL
Definition: ftsmooth.c:416
size_t tif_nfields
Definition: tiffiop.h:201
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
void TIFFErrorExt(thandle_t fd, const char *module, const char *fmt,...)
Definition: tif_error.c:65
TIFFField ** tif_fields
Definition: tiffiop.h:200
void _TIFFfree(void *p)
Definition: tif_unix.c:326

Referenced by TIFFCreateCustomDirectory(), TIFFDefaultDirectory(), and TIFFReadCustomDirectory().