ReactOS 0.4.16-dev-122-g325d74c
tiffiop.h File Reference
#include "tif_config.h"
#include <fcntl.h>
#include <sys/types.h>
#include <string.h>
#include <assert.h>
#include <search.h>
#include "tiffio.h"
#include "tif_dir.h"
Include dependency graph for tiffiop.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  client_info
 
struct  tiff
 

Macros

#define STRIP_SIZE_DEFAULT   8192
 
#define streq(a, b)   (strcmp(a,b) == 0)
 
#define strneq(a, b, n)   (strncmp(a,b,n) == 0)
 
#define TRUE   1
 
#define FALSE   0
 
#define TIFF_SIZE_T_MAX   ((size_t) ~ ((size_t)0))
 
#define TIFF_TMSIZE_T_MAX   (tmsize_t)(TIFF_SIZE_T_MAX >> 1)
 
#define TIFF_UINT32_MAX   0xFFFFFFFFU
 
#define TIFF_UINT64_MAX   (((uint64)(TIFF_UINT32_MAX)) << 32 | TIFF_UINT32_MAX)
 
#define TIFF_FILLORDER   0x00003U /* natural bit fill order for machine */
 
#define TIFF_DIRTYHEADER   0x00004U /* header must be written on close */
 
#define TIFF_DIRTYDIRECT   0x00008U /* current directory must be written */
 
#define TIFF_BUFFERSETUP   0x00010U /* data buffers setup */
 
#define TIFF_CODERSETUP   0x00020U /* encoder/decoder setup done */
 
#define TIFF_BEENWRITING   0x00040U /* written 1+ scanlines to file */
 
#define TIFF_SWAB   0x00080U /* byte swap file information */
 
#define TIFF_NOBITREV   0x00100U /* inhibit bit reversal logic */
 
#define TIFF_MYBUFFER   0x00200U /* my raw data buffer; free on close */
 
#define TIFF_ISTILED   0x00400U /* file is tile, not strip- based */
 
#define TIFF_MAPPED   0x00800U /* file is mapped into memory */
 
#define TIFF_POSTENCODE   0x01000U /* need call to postencode routine */
 
#define TIFF_INSUBIFD   0x02000U /* currently writing a subifd */
 
#define TIFF_UPSAMPLED   0x04000U /* library is doing data up-sampling */
 
#define TIFF_STRIPCHOP   0x08000U /* enable strip chopping support */
 
#define TIFF_HEADERONLY   0x10000U /* read header only, do not process the first directory */
 
#define TIFF_NOREADRAW   0x20000U /* skip reading of raw uncompressed image data */
 
#define TIFF_INCUSTOMIFD   0x40000U /* currently writing a custom IFD */
 
#define TIFF_BIGTIFF   0x80000U /* read/write bigtiff */
 
#define TIFF_BUF4WRITE   0x100000U /* rawcc bytes are for writing */
 
#define TIFF_DIRTYSTRIP   0x200000U /* stripoffsets/stripbytecount dirty*/
 
#define TIFF_PERSAMPLE   0x400000U /* get/set per sample tags as arrays */
 
#define TIFF_BUFFERMMAP   0x800000U /* read buffer (tif_rawdata) points into mmap() memory */
 
#define TIFF_DEFERSTRILELOAD   0x1000000U /* defer strip/tile offset/bytecount array loading. */
 
#define TIFF_LAZYSTRILELOAD   0x2000000U /* lazy/ondemand loading of strip/tile offset/bytecount values. Only used if TIFF_DEFERSTRILELOAD is set and in read-only mode */
 
#define TIFF_CHOPPEDUPARRAYS   0x4000000U /* set when allocChoppedUpStripArrays() has modified strip array */
 
#define isPseudoTag(t)   (t > 0xffff) /* is tag value normal or pseudo */
 
#define isTiled(tif)   (((tif)->tif_flags & TIFF_ISTILED) != 0)
 
#define isMapped(tif)   (((tif)->tif_flags & TIFF_MAPPED) != 0)
 
#define isFillOrder(tif, o)   (((tif)->tif_flags & (o)) != 0)
 
#define isUpSampled(tif)   (((tif)->tif_flags & TIFF_UPSAMPLED) != 0)
 
#define TIFFReadFile(tif, buf, size)    ((*(tif)->tif_readproc)((tif)->tif_clientdata,(buf),(size)))
 
#define TIFFWriteFile(tif, buf, size)    ((*(tif)->tif_writeproc)((tif)->tif_clientdata,(buf),(size)))
 
#define TIFFSeekFile(tif, off, whence)    ((*(tif)->tif_seekproc)((tif)->tif_clientdata,(off),(whence)))
 
#define TIFFCloseFile(tif)    ((*(tif)->tif_closeproc)((tif)->tif_clientdata))
 
#define TIFFGetFileSize(tif)    ((*(tif)->tif_sizeproc)((tif)->tif_clientdata))
 
#define TIFFMapFileContents(tif, paddr, psize)    ((*(tif)->tif_mapproc)((tif)->tif_clientdata,(paddr),(psize)))
 
#define TIFFUnmapFileContents(tif, addr, size)    ((*(tif)->tif_unmapproc)((tif)->tif_clientdata,(addr),(size)))
 
#define ReadOK(tif, buf, size)    (TIFFReadFile((tif),(buf),(size))==(size))
 
#define SeekOK(tif, off)   _TIFFSeekOK(tif, off)
 
#define WriteOK(tif, buf, size)    (TIFFWriteFile((tif),(buf),(size))==(size))
 
#define TIFFhowmany_32(x, y)
 
#define TIFFhowmany_32_maxuint_compat(x, y)    (((uint32)(x) / (uint32)(y)) + ((((uint32)(x) % (uint32)(y)) != 0) ? 1 : 0))
 
#define TIFFhowmany8_32(x)   (((x)&0x07)?((uint32)(x)>>3)+1:(uint32)(x)>>3)
 
#define TIFFroundup_32(x, y)   (TIFFhowmany_32(x,y)*(y))
 
#define TIFFhowmany_64(x, y)   ((((uint64)(x))+(((uint64)(y))-1))/((uint64)(y)))
 
#define TIFFhowmany8_64(x)   (((x)&0x07)?((uint64)(x)>>3)+1:(uint64)(x)>>3)
 
#define TIFFroundup_64(x, y)   (TIFFhowmany_64(x,y)*(y))
 
#define TIFFSafeMultiply(t, v, m)   ((((t)(m) != (t)0) && (((t)(((v)*(m))/(m))) == (t)(v))) ? (t)((v)*(m)) : (t)0)
 
#define TIFFmax(A, B)   ((A)>(B)?(A):(B))
 
#define TIFFmin(A, B)   ((A)<(B)?(A):(B))
 
#define TIFFArrayCount(a)   (sizeof (a) / sizeof ((a)[0]))
 
#define _TIFF_lseek_f(fildes, offset, whence)   lseek(fildes,offset,whence)
 
#define _TIFF_fseek_f(stream, offset, whence)   fseek(stream,offset,whence)
 
#define _TIFF_fstat_f(fildes, stat_buff)   fstat(fildes,stat_buff)
 
#define _TIFF_stat_s   struct stat
 
#define _TIFF_off_t   off_t
 
#define TIFF_NOSANITIZE_UNSIGNED_INT_OVERFLOW
 

Typedefs

typedef struct client_info TIFFClientInfoLink
 
typedef unsigned char tidataval_t
 
typedef tidataval_ttidata_t
 
typedef void(* TIFFVoidMethod) (TIFF *)
 
typedef int(* TIFFBoolMethod) (TIFF *)
 
typedef int(* TIFFPreMethod) (TIFF *, uint16)
 
typedef int(* TIFFCodeMethod) (TIFF *tif, uint8 *buf, tmsize_t size, uint16 sample)
 
typedef int(* TIFFSeekMethod) (TIFF *, uint32)
 
typedef void(* TIFFPostMethod) (TIFF *tif, uint8 *buf, tmsize_t size)
 
typedef uint32(* TIFFStripMethod) (TIFF *, uint32)
 
typedef void(* TIFFTileMethod) (TIFF *, uint32 *, uint32 *)
 
typedef size_t TIFFIOSize_t
 

Functions

int _TIFFgetMode (const char *mode, const char *module)
 
int _TIFFNoRowEncode (TIFF *tif, uint8 *pp, tmsize_t cc, uint16 s)
 
int _TIFFNoStripEncode (TIFF *tif, uint8 *pp, tmsize_t cc, uint16 s)
 
int _TIFFNoTileEncode (TIFF *, uint8 *pp, tmsize_t cc, uint16 s)
 
int _TIFFNoRowDecode (TIFF *tif, uint8 *pp, tmsize_t cc, uint16 s)
 
int _TIFFNoStripDecode (TIFF *tif, uint8 *pp, tmsize_t cc, uint16 s)
 
int _TIFFNoTileDecode (TIFF *, uint8 *pp, tmsize_t cc, uint16 s)
 
void _TIFFNoPostDecode (TIFF *tif, uint8 *buf, tmsize_t cc)
 
int _TIFFNoPreCode (TIFF *tif, uint16 s)
 
int _TIFFNoSeek (TIFF *tif, uint32 off)
 
void _TIFFSwab16BitData (TIFF *tif, uint8 *buf, tmsize_t cc)
 
void _TIFFSwab24BitData (TIFF *tif, uint8 *buf, tmsize_t cc)
 
void _TIFFSwab32BitData (TIFF *tif, uint8 *buf, tmsize_t cc)
 
void _TIFFSwab64BitData (TIFF *tif, uint8 *buf, tmsize_t cc)
 
int TIFFFlushData1 (TIFF *tif)
 
int TIFFDefaultDirectory (TIFF *tif)
 
void _TIFFSetDefaultCompressionState (TIFF *tif)
 
int _TIFFRewriteField (TIFF *, uint16, TIFFDataType, tmsize_t, void *)
 
int TIFFSetCompressionScheme (TIFF *tif, int scheme)
 
int TIFFSetDefaultCompressionState (TIFF *tif)
 
uint32 _TIFFDefaultStripSize (TIFF *tif, uint32 s)
 
void _TIFFDefaultTileSize (TIFF *tif, uint32 *tw, uint32 *th)
 
int _TIFFDataSize (TIFFDataType type)
 
void _TIFFsetByteArray (void **, void *, uint32)
 
void _TIFFsetString (char **, char *)
 
void _TIFFsetShortArray (uint16 **, uint16 *, uint32)
 
void _TIFFsetLongArray (uint32 **, uint32 *, uint32)
 
void _TIFFsetFloatArray (float **, float *, uint32)
 
void _TIFFsetDoubleArray (double **, double *, uint32)
 
void _TIFFprintAscii (FILE *, const char *)
 
void _TIFFprintAsciiTag (FILE *, const char *, const char *)
 
uint32 _TIFFMultiply32 (TIFF *, uint32, uint32, const char *)
 
uint64 _TIFFMultiply64 (TIFF *, uint64, uint64, const char *)
 
tmsize_t _TIFFMultiplySSize (TIFF *, tmsize_t, tmsize_t, const char *)
 
tmsize_t _TIFFCastUInt64ToSSize (TIFF *, uint64, const char *)
 
void_TIFFCheckMalloc (TIFF *, tmsize_t, tmsize_t, const char *)
 
void_TIFFCheckRealloc (TIFF *, void *, tmsize_t, tmsize_t, const char *)
 
double _TIFFUInt64ToDouble (uint64)
 
float _TIFFUInt64ToFloat (uint64)
 
float _TIFFClampDoubleToFloat (double)
 
tmsize_t _TIFFReadEncodedStripAndAllocBuffer (TIFF *tif, uint32 strip, void **buf, tmsize_t bufsizetoalloc, tmsize_t size_to_read)
 
tmsize_t _TIFFReadEncodedTileAndAllocBuffer (TIFF *tif, uint32 tile, void **buf, tmsize_t bufsizetoalloc, tmsize_t size_to_read)
 
tmsize_t _TIFFReadTileAndAllocBuffer (TIFF *tif, void **buf, tmsize_t bufsizetoalloc, uint32 x, uint32 y, uint32 z, uint16 s)
 
int _TIFFSeekOK (TIFF *tif, toff_t off)
 
int TIFFInitDumpMode (TIFF *, int)
 
int TIFFInitPackBits (TIFF *, int)
 
int TIFFInitCCITTRLE (TIFF *, int)
 
int TIFFInitCCITTRLEW (TIFF *, int)
 
int TIFFInitCCITTFax3 (TIFF *, int)
 
int TIFFInitCCITTFax4 (TIFF *, int)
 
int TIFFInitThunderScan (TIFF *, int)
 
int TIFFInitNeXT (TIFF *, int)
 
int TIFFInitLZW (TIFF *, int)
 
int TIFFInitZIP (TIFF *, int)
 
int TIFFInitPixarLog (TIFF *, int)
 
int TIFFInitSGILog (TIFF *, int)
 

Variables

TIFFErrorHandler _TIFFwarningHandler
 
TIFFErrorHandler _TIFFerrorHandler
 
TIFFErrorHandlerExt _TIFFwarningHandlerExt
 
TIFFErrorHandlerExt _TIFFerrorHandlerExt
 
TIFFCodec _TIFFBuiltinCODECS []
 

Macro Definition Documentation

◆ _TIFF_fseek_f

#define _TIFF_fseek_f (   stream,
  offset,
  whence 
)    fseek(stream,offset,whence)

Definition at line 324 of file tiffiop.h.

◆ _TIFF_fstat_f

#define _TIFF_fstat_f (   fildes,
  stat_buff 
)    fstat(fildes,stat_buff)

Definition at line 325 of file tiffiop.h.

◆ _TIFF_lseek_f

#define _TIFF_lseek_f (   fildes,
  offset,
  whence 
)    lseek(fildes,offset,whence)

Definition at line 322 of file tiffiop.h.

◆ _TIFF_off_t

#define _TIFF_off_t   off_t

Definition at line 329 of file tiffiop.h.

◆ _TIFF_stat_s

#define _TIFF_stat_s   struct stat

Definition at line 328 of file tiffiop.h.

◆ FALSE

#define FALSE   0

Definition at line 77 of file tiffiop.h.

◆ isFillOrder

#define isFillOrder (   tif,
 
)    (((tif)->tif_flags & (o)) != 0)

Definition at line 231 of file tiffiop.h.

◆ isMapped

#define isMapped (   tif)    (((tif)->tif_flags & TIFF_MAPPED) != 0)

Definition at line 230 of file tiffiop.h.

◆ isPseudoTag

#define isPseudoTag (   t)    (t > 0xffff) /* is tag value normal or pseudo */

Definition at line 227 of file tiffiop.h.

◆ isTiled

#define isTiled (   tif)    (((tif)->tif_flags & TIFF_ISTILED) != 0)

Definition at line 229 of file tiffiop.h.

◆ isUpSampled

#define isUpSampled (   tif)    (((tif)->tif_flags & TIFF_UPSAMPLED) != 0)

Definition at line 232 of file tiffiop.h.

◆ ReadOK

#define ReadOK (   tif,
  buf,
  size 
)     (TIFFReadFile((tif),(buf),(size))==(size))

Definition at line 252 of file tiffiop.h.

◆ SeekOK

#define SeekOK (   tif,
  off 
)    _TIFFSeekOK(tif, off)

Definition at line 256 of file tiffiop.h.

◆ streq

#define streq (   a,
  b 
)    (strcmp(a,b) == 0)

Definition at line 72 of file tiffiop.h.

◆ STRIP_SIZE_DEFAULT

#define STRIP_SIZE_DEFAULT   8192

Definition at line 69 of file tiffiop.h.

◆ strneq

#define strneq (   a,
  b,
  n 
)    (strncmp(a,b,n) == 0)

Definition at line 73 of file tiffiop.h.

◆ TIFF_BEENWRITING

#define TIFF_BEENWRITING   0x00040U /* written 1+ scanlines to file */

Definition at line 125 of file tiffiop.h.

◆ TIFF_BIGTIFF

#define TIFF_BIGTIFF   0x80000U /* read/write bigtiff */

Definition at line 138 of file tiffiop.h.

◆ TIFF_BUF4WRITE

#define TIFF_BUF4WRITE   0x100000U /* rawcc bytes are for writing */

Definition at line 139 of file tiffiop.h.

◆ TIFF_BUFFERMMAP

#define TIFF_BUFFERMMAP   0x800000U /* read buffer (tif_rawdata) points into mmap() memory */

Definition at line 142 of file tiffiop.h.

◆ TIFF_BUFFERSETUP

#define TIFF_BUFFERSETUP   0x00010U /* data buffers setup */

Definition at line 123 of file tiffiop.h.

◆ TIFF_CHOPPEDUPARRAYS

#define TIFF_CHOPPEDUPARRAYS   0x4000000U /* set when allocChoppedUpStripArrays() has modified strip array */

Definition at line 145 of file tiffiop.h.

◆ TIFF_CODERSETUP

#define TIFF_CODERSETUP   0x00020U /* encoder/decoder setup done */

Definition at line 124 of file tiffiop.h.

◆ TIFF_DEFERSTRILELOAD

#define TIFF_DEFERSTRILELOAD   0x1000000U /* defer strip/tile offset/bytecount array loading. */

Definition at line 143 of file tiffiop.h.

◆ TIFF_DIRTYDIRECT

#define TIFF_DIRTYDIRECT   0x00008U /* current directory must be written */

Definition at line 122 of file tiffiop.h.

◆ TIFF_DIRTYHEADER

#define TIFF_DIRTYHEADER   0x00004U /* header must be written on close */

Definition at line 121 of file tiffiop.h.

◆ TIFF_DIRTYSTRIP

#define TIFF_DIRTYSTRIP   0x200000U /* stripoffsets/stripbytecount dirty*/

Definition at line 140 of file tiffiop.h.

◆ TIFF_FILLORDER

#define TIFF_FILLORDER   0x00003U /* natural bit fill order for machine */

Definition at line 120 of file tiffiop.h.

◆ TIFF_HEADERONLY

#define TIFF_HEADERONLY   0x10000U /* read header only, do not process the first directory */

Definition at line 135 of file tiffiop.h.

◆ TIFF_INCUSTOMIFD

#define TIFF_INCUSTOMIFD   0x40000U /* currently writing a custom IFD */

Definition at line 137 of file tiffiop.h.

◆ TIFF_INSUBIFD

#define TIFF_INSUBIFD   0x02000U /* currently writing a subifd */

Definition at line 132 of file tiffiop.h.

◆ TIFF_ISTILED

#define TIFF_ISTILED   0x00400U /* file is tile, not strip- based */

Definition at line 129 of file tiffiop.h.

◆ TIFF_LAZYSTRILELOAD

#define TIFF_LAZYSTRILELOAD   0x2000000U /* lazy/ondemand loading of strip/tile offset/bytecount values. Only used if TIFF_DEFERSTRILELOAD is set and in read-only mode */

Definition at line 144 of file tiffiop.h.

◆ TIFF_MAPPED

#define TIFF_MAPPED   0x00800U /* file is mapped into memory */

Definition at line 130 of file tiffiop.h.

◆ TIFF_MYBUFFER

#define TIFF_MYBUFFER   0x00200U /* my raw data buffer; free on close */

Definition at line 128 of file tiffiop.h.

◆ TIFF_NOBITREV

#define TIFF_NOBITREV   0x00100U /* inhibit bit reversal logic */

Definition at line 127 of file tiffiop.h.

◆ TIFF_NOREADRAW

#define TIFF_NOREADRAW   0x20000U /* skip reading of raw uncompressed image data */

Definition at line 136 of file tiffiop.h.

◆ TIFF_NOSANITIZE_UNSIGNED_INT_OVERFLOW

#define TIFF_NOSANITIZE_UNSIGNED_INT_OVERFLOW

Definition at line 339 of file tiffiop.h.

◆ TIFF_PERSAMPLE

#define TIFF_PERSAMPLE   0x400000U /* get/set per sample tags as arrays */

Definition at line 141 of file tiffiop.h.

◆ TIFF_POSTENCODE

#define TIFF_POSTENCODE   0x01000U /* need call to postencode routine */

Definition at line 131 of file tiffiop.h.

◆ TIFF_SIZE_T_MAX

#define TIFF_SIZE_T_MAX   ((size_t) ~ ((size_t)0))

Definition at line 80 of file tiffiop.h.

◆ TIFF_STRIPCHOP

#define TIFF_STRIPCHOP   0x08000U /* enable strip chopping support */

Definition at line 134 of file tiffiop.h.

◆ TIFF_SWAB

#define TIFF_SWAB   0x00080U /* byte swap file information */

Definition at line 126 of file tiffiop.h.

◆ TIFF_TMSIZE_T_MAX

#define TIFF_TMSIZE_T_MAX   (tmsize_t)(TIFF_SIZE_T_MAX >> 1)

Definition at line 81 of file tiffiop.h.

◆ TIFF_UINT32_MAX

#define TIFF_UINT32_MAX   0xFFFFFFFFU

Definition at line 86 of file tiffiop.h.

◆ TIFF_UINT64_MAX

#define TIFF_UINT64_MAX   (((uint64)(TIFF_UINT32_MAX)) << 32 | TIFF_UINT32_MAX)

Definition at line 91 of file tiffiop.h.

◆ TIFF_UPSAMPLED

#define TIFF_UPSAMPLED   0x04000U /* library is doing data up-sampling */

Definition at line 133 of file tiffiop.h.

◆ TIFFArrayCount

#define TIFFArrayCount (   a)    (sizeof (a) / sizeof ((a)[0]))

Definition at line 283 of file tiffiop.h.

◆ TIFFCloseFile

#define TIFFCloseFile (   tif)     ((*(tif)->tif_closeproc)((tif)->tif_clientdata))

Definition at line 239 of file tiffiop.h.

◆ TIFFGetFileSize

#define TIFFGetFileSize (   tif)     ((*(tif)->tif_sizeproc)((tif)->tif_clientdata))

Definition at line 241 of file tiffiop.h.

◆ TIFFhowmany8_32

#define TIFFhowmany8_32 (   x)    (((x)&0x07)?((uint32)(x)>>3)+1:(uint32)(x)>>3)

Definition at line 271 of file tiffiop.h.

◆ TIFFhowmany8_64

#define TIFFhowmany8_64 (   x)    (((x)&0x07)?((uint64)(x)>>3)+1:(uint64)(x)>>3)

Definition at line 274 of file tiffiop.h.

◆ TIFFhowmany_32

#define TIFFhowmany_32 (   x,
  y 
)
Value:
(((uint32)x < (0xffffffff - (uint32)(y-1))) ? \
((((uint32)(x))+(((uint32)(y))-1))/((uint32)(y))) : \
0U)
unsigned int uint32
Definition: types.h:32
#define U(x)
Definition: wordpad.c:45
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

Definition at line 264 of file tiffiop.h.

◆ TIFFhowmany_32_maxuint_compat

#define TIFFhowmany_32_maxuint_compat (   x,
  y 
)     (((uint32)(x) / (uint32)(y)) + ((((uint32)(x) % (uint32)(y)) != 0) ? 1 : 0))

Definition at line 269 of file tiffiop.h.

◆ TIFFhowmany_64

#define TIFFhowmany_64 (   x,
  y 
)    ((((uint64)(x))+(((uint64)(y))-1))/((uint64)(y)))

Definition at line 273 of file tiffiop.h.

◆ TIFFMapFileContents

#define TIFFMapFileContents (   tif,
  paddr,
  psize 
)     ((*(tif)->tif_mapproc)((tif)->tif_clientdata,(paddr),(psize)))

Definition at line 243 of file tiffiop.h.

◆ TIFFmax

#define TIFFmax (   A,
  B 
)    ((A)>(B)?(A):(B))

Definition at line 280 of file tiffiop.h.

◆ TIFFmin

#define TIFFmin (   A,
  B 
)    ((A)<(B)?(A):(B))

Definition at line 281 of file tiffiop.h.

◆ TIFFReadFile

#define TIFFReadFile (   tif,
  buf,
  size 
)     ((*(tif)->tif_readproc)((tif)->tif_clientdata,(buf),(size)))

Definition at line 233 of file tiffiop.h.

◆ TIFFroundup_32

#define TIFFroundup_32 (   x,
  y 
)    (TIFFhowmany_32(x,y)*(y))

Definition at line 272 of file tiffiop.h.

◆ TIFFroundup_64

#define TIFFroundup_64 (   x,
  y 
)    (TIFFhowmany_64(x,y)*(y))

Definition at line 275 of file tiffiop.h.

◆ TIFFSafeMultiply

#define TIFFSafeMultiply (   t,
  v,
  m 
)    ((((t)(m) != (t)0) && (((t)(((v)*(m))/(m))) == (t)(v))) ? (t)((v)*(m)) : (t)0)

Definition at line 278 of file tiffiop.h.

◆ TIFFSeekFile

#define TIFFSeekFile (   tif,
  off,
  whence 
)     ((*(tif)->tif_seekproc)((tif)->tif_clientdata,(off),(whence)))

Definition at line 237 of file tiffiop.h.

◆ TIFFUnmapFileContents

#define TIFFUnmapFileContents (   tif,
  addr,
  size 
)     ((*(tif)->tif_unmapproc)((tif)->tif_clientdata,(addr),(size)))

Definition at line 245 of file tiffiop.h.

◆ TIFFWriteFile

#define TIFFWriteFile (   tif,
  buf,
  size 
)     ((*(tif)->tif_writeproc)((tif)->tif_clientdata,(buf),(size)))

Definition at line 235 of file tiffiop.h.

◆ TRUE

#define TRUE   1

Definition at line 76 of file tiffiop.h.

◆ WriteOK

#define WriteOK (   tif,
  buf,
  size 
)     (TIFFWriteFile((tif),(buf),(size))==(size))

Definition at line 259 of file tiffiop.h.

Typedef Documentation

◆ tidata_t

Definition at line 104 of file tiffiop.h.

◆ tidataval_t

Definition at line 103 of file tiffiop.h.

◆ TIFFBoolMethod

typedef int(* TIFFBoolMethod) (TIFF *)

Definition at line 107 of file tiffiop.h.

◆ TIFFClientInfoLink

◆ TIFFCodeMethod

typedef int(* TIFFCodeMethod) (TIFF *tif, uint8 *buf, tmsize_t size, uint16 sample)

Definition at line 109 of file tiffiop.h.

◆ TIFFIOSize_t

Definition at line 321 of file tiffiop.h.

◆ TIFFPostMethod

typedef void(* TIFFPostMethod) (TIFF *tif, uint8 *buf, tmsize_t size)

Definition at line 111 of file tiffiop.h.

◆ TIFFPreMethod

typedef int(* TIFFPreMethod) (TIFF *, uint16)

Definition at line 108 of file tiffiop.h.

◆ TIFFSeekMethod

typedef int(* TIFFSeekMethod) (TIFF *, uint32)

Definition at line 110 of file tiffiop.h.

◆ TIFFStripMethod

typedef uint32(* TIFFStripMethod) (TIFF *, uint32)

Definition at line 112 of file tiffiop.h.

◆ TIFFTileMethod

typedef void(* TIFFTileMethod) (TIFF *, uint32 *, uint32 *)

Definition at line 113 of file tiffiop.h.

◆ TIFFVoidMethod

typedef void(* TIFFVoidMethod) (TIFF *)

Definition at line 106 of file tiffiop.h.

Function Documentation

◆ _TIFFCastUInt64ToSSize()

tmsize_t _TIFFCastUInt64ToSSize ( TIFF tif,
uint64  val,
const char module 
)

Definition at line 83 of file tif_aux.c.

84{
86 {
87 if( tif != NULL && module != NULL )
88 {
89 TIFFErrorExt(tif->tif_clientdata,module,"Integer overflow");
90 }
91 return 0;
92 }
93 return (tmsize_t)val;
94}
#define NULL
Definition: types.h:112
unsigned long long uint64
Definition: platform.h:18
GLuint GLfloat * val
Definition: glext.h:7180
thandle_t tif_clientdata
Definition: tiffiop.h:207
void TIFFErrorExt(thandle_t fd, const char *module, const char *fmt,...)
Definition: tif_error.c:65
TIFF_SSIZE_T tmsize_t
Definition: tiffio.h:65
#define TIFF_TMSIZE_T_MAX
Definition: tiffiop.h:81

Referenced by TIFFRasterScanlineSize(), TIFFReadRawStrip(), TIFFReadRawTile(), TIFFScanlineSize(), TIFFStripSize(), TIFFTileRowSize(), TIFFTileSize(), TIFFVStripSize(), and TIFFVTileSize().

◆ _TIFFCheckMalloc()

void * _TIFFCheckMalloc ( TIFF tif,
tmsize_t  nmemb,
tmsize_t  elem_size,
const char what 
)

Definition at line 121 of file tif_aux.c.

122{
123 return _TIFFCheckRealloc(tif, NULL, nmemb, elem_size, what);
124}
void * _TIFFCheckRealloc(TIFF *tif, void *buffer, tmsize_t nmemb, tmsize_t elem_size, const char *what)
Definition: tif_aux.c:97

Referenced by _TIFFMergeFields(), _TIFFRewriteField(), _TIFFVSetField(), allocChoppedUpStripArrays(), EstimateStripByteCounts(), TIFFFetchDirectory(), TIFFFetchStripThing(), TIFFMergeFieldInfo(), TIFFReadDirEntryArrayWithLimit(), and TIFFSetupStrips().

◆ _TIFFCheckRealloc()

void * _TIFFCheckRealloc ( TIFF tif,
void buffer,
tmsize_t  nmemb,
tmsize_t  elem_size,
const char what 
)

Definition at line 97 of file tif_aux.c.

99{
100 void* cp = NULL;
101 tmsize_t count = _TIFFMultiplySSize(tif, nmemb, elem_size, NULL);
102 /*
103 * Check for integer overflow.
104 */
105 if (count != 0)
106 {
108 }
109
110 if (cp == NULL) {
112 "Failed to allocate memory for %s "
113 "(%ld elements of %ld bytes each)",
114 what,(long) nmemb, (long) elem_size);
115 }
116
117 return cp;
118}
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint buffer
Definition: glext.h:5915
POINT cp
Definition: magnifier.c:59
char * tif_name
Definition: tiffiop.h:116
tmsize_t _TIFFMultiplySSize(TIFF *tif, tmsize_t first, tmsize_t second, const char *where)
Definition: tif_aux.c:59
void * _TIFFrealloc(void *p, tmsize_t s)
Definition: tif_unix.c:332

Referenced by _TIFFCheckMalloc(), _TIFFMergeFields(), TIFFCheckDirOffset(), and TIFFMergeFieldInfo().

◆ _TIFFClampDoubleToFloat()

float _TIFFClampDoubleToFloat ( double  val)

Definition at line 397 of file tif_aux.c.

398{
399 if( val > FLT_MAX )
400 return FLT_MAX;
401 if( val < -FLT_MAX )
402 return -FLT_MAX;
403 return (float)val;
404}
#define FLT_MAX
Definition: gcc_float.h:107

Referenced by _TIFFVSetField(), and TIFFWriteDirectoryTagSampleformatArray().

◆ _TIFFDataSize()

int _TIFFDataSize ( TIFFDataType  type)

Definition at line 476 of file tif_dirinfo.c.

477{
478 switch (type)
479 {
480 case TIFF_BYTE:
481 case TIFF_SBYTE:
482 case TIFF_ASCII:
483 case TIFF_UNDEFINED:
484 return 1;
485 case TIFF_SHORT:
486 case TIFF_SSHORT:
487 return 2;
488 case TIFF_LONG:
489 case TIFF_SLONG:
490 case TIFF_FLOAT:
491 case TIFF_IFD:
492 case TIFF_RATIONAL:
493 case TIFF_SRATIONAL:
494 return 4;
495 case TIFF_DOUBLE:
496 case TIFF_LONG8:
497 case TIFF_SLONG8:
498 case TIFF_IFD8:
499 return 8;
500 default:
501 return 0;
502 }
503}
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
@ TIFF_SSHORT
Definition: tiff.h:132
@ TIFF_SLONG
Definition: tiff.h:133
@ TIFF_BYTE
Definition: tiff.h:125
@ TIFF_SBYTE
Definition: tiff.h:130
@ TIFF_IFD
Definition: tiff.h:137
@ TIFF_SHORT
Definition: tiff.h:127
@ TIFF_UNDEFINED
Definition: tiff.h:131
@ TIFF_LONG
Definition: tiff.h:128
@ TIFF_SLONG8
Definition: tiff.h:139
@ TIFF_LONG8
Definition: tiff.h:138
@ TIFF_ASCII
Definition: tiff.h:126
@ TIFF_FLOAT
Definition: tiff.h:135
@ TIFF_DOUBLE
Definition: tiff.h:136
@ TIFF_IFD8
Definition: tiff.h:140
@ TIFF_SRATIONAL
Definition: tiff.h:134
@ TIFF_RATIONAL
Definition: tiff.h:129

Referenced by _TIFFVSetField(), and TIFFPrintDirectory().

◆ _TIFFDefaultStripSize()

uint32 _TIFFDefaultStripSize ( TIFF tif,
uint32  s 
)

Definition at line 223 of file tif_strip.c.

224{
225 if ((int32) s < 1) {
226 /*
227 * If RowsPerStrip is unspecified, try to break the
228 * image up into strips that are approximately
229 * STRIP_SIZE_DEFAULT bytes long.
230 */
231 uint64 scanlinesize;
232 uint64 rows;
233 scanlinesize=TIFFScanlineSize64(tif);
234 if (scanlinesize==0)
235 scanlinesize=1;
236 rows=(uint64)STRIP_SIZE_DEFAULT/scanlinesize;
237 if (rows==0)
238 rows=1;
239 else if (rows>0xFFFFFFFF)
240 rows=0xFFFFFFFF;
241 s=(uint32)rows;
242 }
243 return (s);
244}
long int32
Definition: platform.h:12
GLdouble s
Definition: gl.h:2039
uint64 TIFFScanlineSize64(TIFF *tif)
Definition: tif_strip.c:257
#define STRIP_SIZE_DEFAULT
Definition: tiffiop.h:69

Referenced by _TIFFSetDefaultCompressionState().

◆ _TIFFDefaultTileSize()

void _TIFFDefaultTileSize ( TIFF tif,
uint32 tw,
uint32 th 
)

Definition at line 278 of file tif_tile.c.

279{
280 (void) tif;
281 if (*(int32*) tw < 1)
282 *tw = 256;
283 if (*(int32*) th < 1)
284 *th = 256;
285 /* roundup to a multiple of 16 per the spec */
286 if (*tw & 0xf)
287 *tw = TIFFroundup_32(*tw, 16);
288 if (*th & 0xf)
289 *th = TIFFroundup_32(*th, 16);
290}
#define TIFFroundup_32(x, y)
Definition: tiffiop.h:272

Referenced by _TIFFSetDefaultCompressionState().

◆ _TIFFgetMode()

int _TIFFgetMode ( const char mode,
const char module 
)

Definition at line 47 of file tif_open.c.

48{
49 int m = -1;
50
51 switch (mode[0]) {
52 case 'r':
53 m = O_RDONLY;
54 if (mode[1] == '+')
55 m = O_RDWR;
56 break;
57 case 'w':
58 case 'a':
60 if (mode[0] == 'w')
61 m |= O_TRUNC;
62 break;
63 default:
64 TIFFErrorExt(0, module, "\"%s\": Bad mode", mode);
65 break;
66 }
67 return (m);
68}
#define O_CREAT
Definition: acwin.h:110
#define O_RDONLY
Definition: acwin.h:108
#define O_TRUNC
Definition: acwin.h:112
GLenum mode
Definition: glext.h:6217
const GLfloat * m
Definition: glext.h:10848
#define O_RDWR
Definition: fcntl.h:36

Referenced by TIFFClientOpen(), TIFFOpen(), and TIFFOpenW().

◆ _TIFFMultiply32()

uint32 _TIFFMultiply32 ( TIFF tif,
uint32  first,
uint32  second,
const char where 
)

Definition at line 37 of file tif_aux.c.

38{
39 if (second && first > TIFF_UINT32_MAX / second) {
40 TIFFErrorExt(tif->tif_clientdata, where, "Integer overflow in %s", where);
41 return 0;
42 }
43
44 return first * second;
45}
const GLint * first
Definition: glext.h:5794
#define TIFF_UINT32_MAX
Definition: tiffiop.h:86

Referenced by TIFFNumberOfStrips(), and TIFFNumberOfTiles().

◆ _TIFFMultiply64()

uint64 _TIFFMultiply64 ( TIFF tif,
uint64  first,
uint64  second,
const char where 
)

Definition at line 48 of file tif_aux.c.

49{
50 if (second && first > TIFF_UINT64_MAX / second) {
51 TIFFErrorExt(tif->tif_clientdata, where, "Integer overflow in %s", where);
52 return 0;
53 }
54
55 return first * second;
56}
#define TIFF_UINT64_MAX
Definition: tiffiop.h:91

Referenced by TIFFRasterScanlineSize64(), TIFFScanlineSize64(), TIFFTileRowSize64(), TIFFVStripSize64(), and TIFFVTileSize64().

◆ _TIFFMultiplySSize()

tmsize_t _TIFFMultiplySSize ( TIFF tif,
tmsize_t  first,
tmsize_t  second,
const char where 
)

Definition at line 59 of file tif_aux.c.

60{
61 if( first <= 0 || second <= 0 )
62 {
63 if( tif != NULL && where != NULL )
64 {
65 TIFFErrorExt(tif->tif_clientdata, where,
66 "Invalid argument to _TIFFMultiplySSize() in %s", where);
67 }
68 return 0;
69 }
70
71 if( first > TIFF_TMSIZE_T_MAX / second )
72 {
73 if( tif != NULL && where != NULL )
74 {
75 TIFFErrorExt(tif->tif_clientdata, where,
76 "Integer overflow in %s", where);
77 }
78 return 0;
79 }
80 return first * second;
81}

Referenced by _TIFFCheckRealloc(), gtStripSeparate(), gtTileSeparate(), and setByteArray().

◆ _TIFFNoPostDecode()

void _TIFFNoPostDecode ( TIFF tif,
uint8 buf,
tmsize_t  cc 
)

Definition at line 1603 of file tif_read.c.

1604{
1605 (void) tif; (void) buf; (void) cc;
1606}
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
uint32_t cc
Definition: isohybrid.c:75

Referenced by _TIFFVSetField(), PredictorSetupDecode(), PredictorSetupEncode(), and TIFFDefaultDirectory().

◆ _TIFFNoPreCode()

int _TIFFNoPreCode ( TIFF tif,
uint16  s 
)

Definition at line 125 of file tif_compress.c.

126{
127 (void) tif; (void) s;
128 return (1);
129}

Referenced by _TIFFSetDefaultCompressionState().

◆ _TIFFNoRowDecode()

int _TIFFNoRowDecode ( TIFF tif,
uint8 pp,
tmsize_t  cc,
uint16  s 
)

Definition at line 95 of file tif_compress.c.

96{
97 (void) pp; (void) cc; (void) s;
98 return (TIFFNoDecode(tif, "scanline"));
99}
static int TIFFNoDecode(TIFF *tif, const char *method)
Definition: tif_compress.c:72

Referenced by _TIFFSetDefaultCompressionState().

◆ _TIFFNoRowEncode()

int _TIFFNoRowEncode ( TIFF tif,
uint8 pp,
tmsize_t  cc,
uint16  s 
)

Definition at line 51 of file tif_compress.c.

52{
53 (void) pp; (void) cc; (void) s;
54 return (TIFFNoEncode(tif, "scanline"));
55}
static int TIFFNoEncode(TIFF *tif, const char *method)
Definition: tif_compress.c:34

Referenced by _TIFFSetDefaultCompressionState().

◆ _TIFFNoSeek()

int _TIFFNoSeek ( TIFF tif,
uint32  off 
)

Definition at line 116 of file tif_compress.c.

117{
118 (void) off;
120 "Compression algorithm does not support random access");
121 return (0);
122}

Referenced by _TIFFSetDefaultCompressionState().

◆ _TIFFNoStripDecode()

int _TIFFNoStripDecode ( TIFF tif,
uint8 pp,
tmsize_t  cc,
uint16  s 
)

Definition at line 102 of file tif_compress.c.

103{
104 (void) pp; (void) cc; (void) s;
105 return (TIFFNoDecode(tif, "strip"));
106}

Referenced by _TIFFSetDefaultCompressionState().

◆ _TIFFNoStripEncode()

int _TIFFNoStripEncode ( TIFF tif,
uint8 pp,
tmsize_t  cc,
uint16  s 
)

Definition at line 58 of file tif_compress.c.

59{
60 (void) pp; (void) cc; (void) s;
61 return (TIFFNoEncode(tif, "strip"));
62}

Referenced by _TIFFSetDefaultCompressionState().

◆ _TIFFNoTileDecode()

int _TIFFNoTileDecode ( TIFF tif,
uint8 pp,
tmsize_t  cc,
uint16  s 
)

Definition at line 109 of file tif_compress.c.

110{
111 (void) pp; (void) cc; (void) s;
112 return (TIFFNoDecode(tif, "tile"));
113}

Referenced by _TIFFSetDefaultCompressionState().

◆ _TIFFNoTileEncode()

int _TIFFNoTileEncode ( TIFF tif,
uint8 pp,
tmsize_t  cc,
uint16  s 
)

Definition at line 65 of file tif_compress.c.

66{
67 (void) pp; (void) cc; (void) s;
68 return (TIFFNoEncode(tif, "tile"));
69}

Referenced by _TIFFSetDefaultCompressionState().

◆ _TIFFprintAscii()

void _TIFFprintAscii ( FILE fd,
const char cp 
)

Definition at line 678 of file tif_print.c.

679{
681}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
static int fd
Definition: io.c:51
static void _TIFFprintAsciiBounded(FILE *fd, const char *cp, size_t max_chars)
Definition: tif_print.c:684

Referenced by _TIFFprintAsciiTag().

◆ _TIFFprintAsciiTag()

void _TIFFprintAsciiTag ( FILE fd,
const char name,
const char value 
)

Definition at line 704 of file tif_print.c.

705{
706 fprintf(fd, " %s: \"", name);
708 fprintf(fd, "\"\n");
709}
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
Definition: name.c:39
void _TIFFprintAscii(FILE *fd, const char *cp)
Definition: tif_print.c:678
Definition: pdh_main.c:94

◆ _TIFFReadEncodedStripAndAllocBuffer()

tmsize_t _TIFFReadEncodedStripAndAllocBuffer ( TIFF tif,
uint32  strip,
void **  buf,
tmsize_t  bufsizetoalloc,
tmsize_t  size_to_read 
)

Definition at line 572 of file tif_read.c.

575{
576 tmsize_t this_stripsize;
578
579 if( *buf != NULL )
580 {
581 return TIFFReadEncodedStrip(tif, strip, *buf, size_to_read);
582 }
583
584 this_stripsize=TIFFReadEncodedStripGetStripSize(tif, strip, &plane);
585 if (this_stripsize==((tmsize_t)(-1)))
586 return((tmsize_t)(-1));
587
588 if ((size_to_read!=(tmsize_t)(-1))&&(size_to_read<this_stripsize))
589 this_stripsize=size_to_read;
590 if (!TIFFFillStrip(tif,strip))
591 return((tmsize_t)(-1));
592
593 *buf = _TIFFmalloc(bufsizetoalloc);
594 if (*buf == NULL) {
595 TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), "No space for strip buffer");
596 return((tmsize_t)(-1));
597 }
598 _TIFFmemset(*buf, 0, bufsizetoalloc);
599
600 if ((*tif->tif_decodestrip)(tif,*buf,this_stripsize,plane)<=0)
601 return((tmsize_t)(-1));
602 (*tif->tif_postdecode)(tif,*buf,this_stripsize);
603 return(this_stripsize);
604
605
606}
unsigned short uint16
Definition: types.h:30
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 GLint GLint GLenum GLenum GLenum GLint GLuint GLenum GLenum GLfloat GLenum GLfloat GLenum GLint const GLfloat GLenum GLint const GLushort GLint GLint GLsizei GLsizei GLenum GLsizei GLsizei GLenum GLenum const GLvoid GLenum plane
Definition: glfuncs.h:270
TIFFCodeMethod tif_decodestrip
Definition: tiffiop.h:182
TIFFPostMethod tif_postdecode
Definition: tiffiop.h:214
const char * TIFFFileName(TIFF *tif)
Definition: tif_open.c:513
static tmsize_t TIFFReadEncodedStripGetStripSize(TIFF *tif, uint32 strip, uint16 *pplane)
Definition: tif_read.c:488
tmsize_t TIFFReadEncodedStrip(TIFF *tif, uint32 strip, void *buf, tmsize_t size)
Definition: tif_read.c:527
int TIFFFillStrip(TIFF *tif, uint32 strip)
Definition: tif_read.c:766
void _TIFFmemset(void *p, int v, tmsize_t c)
Definition: tif_unix.c:338
void * _TIFFmalloc(tmsize_t s)
Definition: tif_unix.c:309

Referenced by gtStripContig(), and gtStripSeparate().

◆ _TIFFReadEncodedTileAndAllocBuffer()

tmsize_t _TIFFReadEncodedTileAndAllocBuffer ( TIFF tif,
uint32  tile,
void **  buf,
tmsize_t  bufsizetoalloc,
tmsize_t  size_to_read 
)

Definition at line 1048 of file tif_read.c.

1051{
1052 static const char module[] = "_TIFFReadEncodedTileAndAllocBuffer";
1053 TIFFDirectory *td = &tif->tif_dir;
1054 tmsize_t tilesize = tif->tif_tilesize;
1055
1056 if( *buf != NULL )
1057 {
1058 return TIFFReadEncodedTile(tif, tile, *buf, size_to_read);
1059 }
1060
1061 if (!TIFFCheckRead(tif, 1))
1062 return ((tmsize_t)(-1));
1063 if (tile >= td->td_nstrips) {
1065 "%lu: Tile out of range, max %lu",
1066 (unsigned long) tile, (unsigned long) td->td_nstrips);
1067 return ((tmsize_t)(-1));
1068 }
1069
1070 if (!TIFFFillTile(tif,tile))
1071 return((tmsize_t)(-1));
1072
1073 *buf = _TIFFmalloc(bufsizetoalloc);
1074 if (*buf == NULL) {
1076 "No space for tile buffer");
1077 return((tmsize_t)(-1));
1078 }
1079 _TIFFmemset(*buf, 0, bufsizetoalloc);
1080
1081 if (size_to_read == (tmsize_t)(-1))
1082 size_to_read = tilesize;
1083 else if (size_to_read > tilesize)
1084 size_to_read = tilesize;
1085 if( (*tif->tif_decodetile)(tif,
1086 (uint8*) *buf, size_to_read, (uint16)(tile/td->td_stripsperimage))) {
1087 (*tif->tif_postdecode)(tif, (uint8*) *buf, size_to_read);
1088 return (size_to_read);
1089 } else
1090 return ((tmsize_t)(-1));
1091}
unsigned char uint8
Definition: types.h:28
uint32 td_nstrips
Definition: tif_dir.h:100
uint32 td_stripsperimage
Definition: tif_dir.h:99
TIFFDirectory tif_dir
Definition: tiffiop.h:151
tmsize_t tif_tilesize
Definition: tiffiop.h:170
TIFFCodeMethod tif_decodetile
Definition: tiffiop.h:184
tmsize_t TIFFReadEncodedTile(TIFF *tif, uint32 tile, void *buf, tmsize_t size)
Definition: tif_read.c:978
static int TIFFCheckRead(TIFF *, int)
Definition: tif_read.c:1500
int TIFFFillTile(TIFF *tif, uint32 tile)
Definition: tif_read.c:1204

Referenced by _TIFFReadTileAndAllocBuffer().

◆ _TIFFReadTileAndAllocBuffer()

tmsize_t _TIFFReadTileAndAllocBuffer ( TIFF tif,
void **  buf,
tmsize_t  bufsizetoalloc,
uint32  x,
uint32  y,
uint32  z,
uint16  s 
)

Definition at line 1029 of file tif_read.c.

1032{
1033 if (!TIFFCheckRead(tif, 1) || !TIFFCheckTile(tif, x, y, z, s))
1034 return ((tmsize_t)(-1));
1036 TIFFComputeTile(tif, x, y, z, s),
1037 buf, bufsizetoalloc,
1038 (tmsize_t)(-1)));
1039}
GLdouble GLdouble z
Definition: glext.h:5874
tmsize_t _TIFFReadEncodedTileAndAllocBuffer(TIFF *tif, uint32 tile, void **buf, tmsize_t bufsizetoalloc, tmsize_t size_to_read)
Definition: tif_read.c:1048
int TIFFCheckTile(TIFF *tif, uint32 x, uint32 y, uint32 z, uint16 s)
Definition: tif_tile.c:73
uint32 TIFFComputeTile(TIFF *tif, uint32 x, uint32 y, uint32 z, uint16 s)
Definition: tif_tile.c:36

Referenced by gtTileContig(), and gtTileSeparate().

◆ _TIFFRewriteField()

int _TIFFRewriteField ( TIFF tif,
uint16  tag,
TIFFDataType  in_datatype,
tmsize_t  count,
void data 
)

Definition at line 2824 of file tif_dirwrite.c.

2826{
2827 static const char module[] = "TIFFResetField";
2828 /* const TIFFField* fip = NULL; */
2829 uint16 dircount;
2830 tmsize_t dirsize;
2831 uint8 direntry_raw[20];
2832 uint16 entry_tag = 0;
2833 uint16 entry_type = 0;
2834 uint64 entry_count = 0;
2835 uint64 entry_offset = 0;
2836 int value_in_entry = 0;
2837 uint64 read_offset;
2838 uint8 *buf_to_write = NULL;
2839 TIFFDataType datatype;
2840
2841/* -------------------------------------------------------------------- */
2842/* Find field definition. */
2843/* -------------------------------------------------------------------- */
2844 /*fip =*/ TIFFFindField(tif, tag, TIFF_ANY);
2845
2846/* -------------------------------------------------------------------- */
2847/* Do some checking this is a straight forward case. */
2848/* -------------------------------------------------------------------- */
2849 if( isMapped(tif) )
2850 {
2852 "Memory mapped files not currently supported for this operation." );
2853 return 0;
2854 }
2855
2856 if( tif->tif_diroff == 0 )
2857 {
2859 "Attempt to reset field on directory not already on disk." );
2860 return 0;
2861 }
2862
2863/* -------------------------------------------------------------------- */
2864/* Read the directory entry count. */
2865/* -------------------------------------------------------------------- */
2866 if (!SeekOK(tif, tif->tif_diroff)) {
2868 "%s: Seek error accessing TIFF directory",
2869 tif->tif_name);
2870 return 0;
2871 }
2872
2873 read_offset = tif->tif_diroff;
2874
2875 if (!(tif->tif_flags&TIFF_BIGTIFF))
2876 {
2877 if (!ReadOK(tif, &dircount, sizeof (uint16))) {
2879 "%s: Can not read TIFF directory count",
2880 tif->tif_name);
2881 return 0;
2882 }
2883 if (tif->tif_flags & TIFF_SWAB)
2884 TIFFSwabShort(&dircount);
2885 dirsize = 12;
2886 read_offset += 2;
2887 } else {
2888 uint64 dircount64;
2889 if (!ReadOK(tif, &dircount64, sizeof (uint64))) {
2891 "%s: Can not read TIFF directory count",
2892 tif->tif_name);
2893 return 0;
2894 }
2895 if (tif->tif_flags & TIFF_SWAB)
2896 TIFFSwabLong8(&dircount64);
2897 dircount = (uint16)dircount64;
2898 dirsize = 20;
2899 read_offset += 8;
2900 }
2901
2902/* -------------------------------------------------------------------- */
2903/* Read through directory to find target tag. */
2904/* -------------------------------------------------------------------- */
2905 while( dircount > 0 )
2906 {
2907 if (!ReadOK(tif, direntry_raw, dirsize)) {
2909 "%s: Can not read TIFF directory entry.",
2910 tif->tif_name);
2911 return 0;
2912 }
2913
2914 memcpy( &entry_tag, direntry_raw + 0, sizeof(uint16) );
2915 if (tif->tif_flags&TIFF_SWAB)
2916 TIFFSwabShort( &entry_tag );
2917
2918 if( entry_tag == tag )
2919 break;
2920
2921 read_offset += dirsize;
2922 }
2923
2924 if( entry_tag != tag )
2925 {
2927 "%s: Could not find tag %d.",
2928 tif->tif_name, tag );
2929 return 0;
2930 }
2931
2932/* -------------------------------------------------------------------- */
2933/* Extract the type, count and offset for this entry. */
2934/* -------------------------------------------------------------------- */
2935 memcpy( &entry_type, direntry_raw + 2, sizeof(uint16) );
2936 if (tif->tif_flags&TIFF_SWAB)
2937 TIFFSwabShort( &entry_type );
2938
2939 if (!(tif->tif_flags&TIFF_BIGTIFF))
2940 {
2941 uint32 value;
2942
2943 memcpy( &value, direntry_raw + 4, sizeof(uint32) );
2944 if (tif->tif_flags&TIFF_SWAB)
2945 TIFFSwabLong( &value );
2946 entry_count = value;
2947
2948 memcpy( &value, direntry_raw + 8, sizeof(uint32) );
2949 if (tif->tif_flags&TIFF_SWAB)
2950 TIFFSwabLong( &value );
2951 entry_offset = value;
2952 }
2953 else
2954 {
2955 memcpy( &entry_count, direntry_raw + 4, sizeof(uint64) );
2956 if (tif->tif_flags&TIFF_SWAB)
2957 TIFFSwabLong8( &entry_count );
2958
2959 memcpy( &entry_offset, direntry_raw + 12, sizeof(uint64) );
2960 if (tif->tif_flags&TIFF_SWAB)
2961 TIFFSwabLong8( &entry_offset );
2962 }
2963
2964/* -------------------------------------------------------------------- */
2965/* When a dummy tag was written due to TIFFDeferStrileArrayWriting() */
2966/* -------------------------------------------------------------------- */
2967 if( entry_offset == 0 && entry_count == 0 && entry_type == 0 )
2968 {
2970 {
2971 entry_type = (tif->tif_flags&TIFF_BIGTIFF) ? TIFF_LONG8 : TIFF_LONG;
2972 }
2973 else
2974 {
2975 int write_aslong8 = 1;
2976 if( count > 1 && tag == TIFFTAG_STRIPBYTECOUNTS )
2977 {
2978 write_aslong8 = WriteAsLong8(tif, TIFFStripSize64(tif));
2979 }
2980 else if( count > 1 && tag == TIFFTAG_TILEBYTECOUNTS )
2981 {
2982 write_aslong8 = WriteAsLong8(tif, TIFFTileSize64(tif));
2983 }
2984 if( write_aslong8 )
2985 {
2986 entry_type = TIFF_LONG8;
2987 }
2988 else
2989 {
2990 int write_aslong4 = 1;
2991 if( count > 1 && tag == TIFFTAG_STRIPBYTECOUNTS )
2992 {
2993 write_aslong4 = WriteAsLong4(tif, TIFFStripSize64(tif));
2994 }
2995 else if( count > 1 && tag == TIFFTAG_TILEBYTECOUNTS )
2996 {
2997 write_aslong4 = WriteAsLong4(tif, TIFFTileSize64(tif));
2998 }
2999 if( write_aslong4 )
3000 {
3001 entry_type = TIFF_LONG;
3002 }
3003 else
3004 {
3005 entry_type = TIFF_SHORT;
3006 }
3007 }
3008 }
3009 }
3010
3011/* -------------------------------------------------------------------- */
3012/* What data type do we want to write this as? */
3013/* -------------------------------------------------------------------- */
3014 if( TIFFDataWidth(in_datatype) == 8 && !(tif->tif_flags&TIFF_BIGTIFF) )
3015 {
3016 if( in_datatype == TIFF_LONG8 )
3017 datatype = entry_type == TIFF_SHORT ? TIFF_SHORT : TIFF_LONG;
3018 else if( in_datatype == TIFF_SLONG8 )
3019 datatype = TIFF_SLONG;
3020 else if( in_datatype == TIFF_IFD8 )
3021 datatype = TIFF_IFD;
3022 else
3023 datatype = in_datatype;
3024 }
3025 else
3026 {
3027 if( in_datatype == TIFF_LONG8 &&
3028 (entry_type == TIFF_SHORT || entry_type == TIFF_LONG ||
3029 entry_type == TIFF_LONG8 ) )
3030 datatype = entry_type;
3031 else if( in_datatype == TIFF_SLONG8 &&
3032 (entry_type == TIFF_SLONG || entry_type == TIFF_SLONG8 ) )
3033 datatype = entry_type;
3034 else if( in_datatype == TIFF_IFD8 &&
3035 (entry_type == TIFF_IFD || entry_type == TIFF_IFD8 ) )
3036 datatype = entry_type;
3037 else
3038 datatype = in_datatype;
3039 }
3040
3041/* -------------------------------------------------------------------- */
3042/* Prepare buffer of actual data to write. This includes */
3043/* swabbing as needed. */
3044/* -------------------------------------------------------------------- */
3045 buf_to_write =
3046 (uint8 *)_TIFFCheckMalloc(tif, count, TIFFDataWidth(datatype),
3047 "for field buffer.");
3048 if (!buf_to_write)
3049 return 0;
3050
3051 if( datatype == in_datatype )
3052 memcpy( buf_to_write, data, count * TIFFDataWidth(datatype) );
3053 else if( datatype == TIFF_SLONG && in_datatype == TIFF_SLONG8 )
3054 {
3055 tmsize_t i;
3056
3057 for( i = 0; i < count; i++ )
3058 {
3059 ((int32 *) buf_to_write)[i] =
3060 (int32) ((int64 *) data)[i];
3061 if( (int64) ((int32 *) buf_to_write)[i] != ((int64 *) data)[i] )
3062 {
3063 _TIFFfree( buf_to_write );
3065 "Value exceeds 32bit range of output type." );
3066 return 0;
3067 }
3068 }
3069 }
3070 else if( (datatype == TIFF_LONG && in_datatype == TIFF_LONG8)
3071 || (datatype == TIFF_IFD && in_datatype == TIFF_IFD8) )
3072 {
3073 tmsize_t i;
3074
3075 for( i = 0; i < count; i++ )
3076 {
3077 ((uint32 *) buf_to_write)[i] =
3078 (uint32) ((uint64 *) data)[i];
3079 if( (uint64) ((uint32 *) buf_to_write)[i] != ((uint64 *) data)[i] )
3080 {
3081 _TIFFfree( buf_to_write );
3083 "Value exceeds 32bit range of output type." );
3084 return 0;
3085 }
3086 }
3087 }
3088 else if( datatype == TIFF_SHORT && in_datatype == TIFF_LONG8 )
3089 {
3090 tmsize_t i;
3091
3092 for( i = 0; i < count; i++ )
3093 {
3094 ((uint16 *) buf_to_write)[i] =
3095 (uint16) ((uint64 *) data)[i];
3096 if( (uint64) ((uint16 *) buf_to_write)[i] != ((uint64 *) data)[i] )
3097 {
3098 _TIFFfree( buf_to_write );
3100 "Value exceeds 16bit range of output type." );
3101 return 0;
3102 }
3103 }
3104 }
3105 else
3106 {
3108 "Unhandled type conversion." );
3109 return 0;
3110 }
3111
3112 if( TIFFDataWidth(datatype) > 1 && (tif->tif_flags&TIFF_SWAB) )
3113 {
3114 if( TIFFDataWidth(datatype) == 2 )
3115 TIFFSwabArrayOfShort( (uint16 *) buf_to_write, count );
3116 else if( TIFFDataWidth(datatype) == 4 )
3117 TIFFSwabArrayOfLong( (uint32 *) buf_to_write, count );
3118 else if( TIFFDataWidth(datatype) == 8 )
3119 TIFFSwabArrayOfLong8( (uint64 *) buf_to_write, count );
3120 }
3121
3122/* -------------------------------------------------------------------- */
3123/* Is this a value that fits into the directory entry? */
3124/* -------------------------------------------------------------------- */
3125 if (!(tif->tif_flags&TIFF_BIGTIFF))
3126 {
3127 if( TIFFDataWidth(datatype) * count <= 4 )
3128 {
3129 entry_offset = read_offset + 8;
3130 value_in_entry = 1;
3131 }
3132 }
3133 else
3134 {
3135 if( TIFFDataWidth(datatype) * count <= 8 )
3136 {
3137 entry_offset = read_offset + 12;
3138 value_in_entry = 1;
3139 }
3140 }
3141
3146 {
3147 tif->tif_dir.td_stripoffset_entry.tdir_type = datatype;
3149 }
3154 {
3157 }
3158
3159/* -------------------------------------------------------------------- */
3160/* If the tag type, and count match, then we just write it out */
3161/* over the old values without altering the directory entry at */
3162/* all. */
3163/* -------------------------------------------------------------------- */
3164 if( entry_count == (uint64)count && entry_type == (uint16) datatype )
3165 {
3166 if (!SeekOK(tif, entry_offset)) {
3167 _TIFFfree( buf_to_write );
3169 "%s: Seek error accessing TIFF directory",
3170 tif->tif_name);
3171 return 0;
3172 }
3173 if (!WriteOK(tif, buf_to_write, count*TIFFDataWidth(datatype))) {
3174 _TIFFfree( buf_to_write );
3176 "Error writing directory link");
3177 return (0);
3178 }
3179
3180 _TIFFfree( buf_to_write );
3181 return 1;
3182 }
3183
3184/* -------------------------------------------------------------------- */
3185/* Otherwise, we write the new tag data at the end of the file. */
3186/* -------------------------------------------------------------------- */
3187 if( !value_in_entry )
3188 {
3189 entry_offset = TIFFSeekFile(tif,0,SEEK_END);
3190
3191 if (!WriteOK(tif, buf_to_write, count*TIFFDataWidth(datatype))) {
3192 _TIFFfree( buf_to_write );
3194 "Error writing directory link");
3195 return (0);
3196 }
3197 }
3198 else
3199 {
3200 memcpy( &entry_offset, buf_to_write, count*TIFFDataWidth(datatype));
3201 }
3202
3203 _TIFFfree( buf_to_write );
3204 buf_to_write = 0;
3205
3206/* -------------------------------------------------------------------- */
3207/* Adjust the directory entry. */
3208/* -------------------------------------------------------------------- */
3209 entry_type = datatype;
3210 entry_count = (uint64)count;
3211 memcpy( direntry_raw + 2, &entry_type, sizeof(uint16) );
3212 if (tif->tif_flags&TIFF_SWAB)
3213 TIFFSwabShort( (uint16 *) (direntry_raw + 2) );
3214
3215 if (!(tif->tif_flags&TIFF_BIGTIFF))
3216 {
3217 uint32 value;
3218
3219 value = (uint32) entry_count;
3220 memcpy( direntry_raw + 4, &value, sizeof(uint32) );
3221 if (tif->tif_flags&TIFF_SWAB)
3222 TIFFSwabLong( (uint32 *) (direntry_raw + 4) );
3223
3224 value = (uint32) entry_offset;
3225 memcpy( direntry_raw + 8, &value, sizeof(uint32) );
3226 if (tif->tif_flags&TIFF_SWAB)
3227 TIFFSwabLong( (uint32 *) (direntry_raw + 8) );
3228 }
3229 else
3230 {
3231 memcpy( direntry_raw + 4, &entry_count, sizeof(uint64) );
3232 if (tif->tif_flags&TIFF_SWAB)
3233 TIFFSwabLong8( (uint64 *) (direntry_raw + 4) );
3234
3235 memcpy( direntry_raw + 12, &entry_offset, sizeof(uint64) );
3236 if (tif->tif_flags&TIFF_SWAB)
3237 TIFFSwabLong8( (uint64 *) (direntry_raw + 12) );
3238 }
3239
3240/* -------------------------------------------------------------------- */
3241/* Write the directory entry out to disk. */
3242/* -------------------------------------------------------------------- */
3243 if (!SeekOK(tif, read_offset )) {
3245 "%s: Seek error accessing TIFF directory",
3246 tif->tif_name);
3247 return 0;
3248 }
3249
3250 if (!WriteOK(tif, direntry_raw,dirsize))
3251 {
3253 "%s: Can not write TIFF directory entry.",
3254 tif->tif_name);
3255 return 0;
3256 }
3257
3258 return 1;
3259}
#define SEEK_END
Definition: cabinet.c:29
long long int64
Definition: platform.h:13
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
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 memcpy(s1, s2, n)
Definition: mkisofs.h:878
uint64 toff_long8
Definition: tif_dir.h:59
uint64 tdir_count
Definition: tif_dir.h:55
uint16 tdir_type
Definition: tif_dir.h:54
union TIFFDirEntry::@3460 tdir_offset
TIFFDirEntry td_stripoffset_entry
Definition: tif_dir.h:107
TIFFDirEntry td_stripbytecount_entry
Definition: tif_dir.h:108
Definition: ecma_167.h:138
uint32 tif_flags
Definition: tiffiop.h:119
uint64 tif_diroff
Definition: tiffiop.h:146
void * _TIFFCheckMalloc(TIFF *tif, tmsize_t nmemb, tmsize_t elem_size, const char *what)
Definition: tif_aux.c:121
int TIFFDataWidth(TIFFDataType type)
Definition: tif_dirinfo.c:438
const TIFFField * TIFFFindField(TIFF *tif, uint32 tag, TIFFDataType dt)
Definition: tif_dirinfo.c:506
static int WriteAsLong4(TIFF *tif, uint64 strile_size)
static int WriteAsLong8(TIFF *tif, uint64 strile_size)
uint64 TIFFStripSize64(TIFF *tif)
Definition: tif_strip.c:193
void TIFFSwabArrayOfShort(register uint16 *wp, tmsize_t n)
Definition: tif_swab.c:71
void TIFFSwabLong(uint32 *lp)
Definition: tif_swab.c:45
void TIFFSwabShort(uint16 *wp)
Definition: tif_swab.c:34
void TIFFSwabArrayOfLong8(register uint64 *lp, tmsize_t n)
Definition: tif_swab.c:120
void TIFFSwabLong8(uint64 *lp)
Definition: tif_swab.c:57
void TIFFSwabArrayOfLong(register uint32 *lp, tmsize_t n)
Definition: tif_swab.c:103
uint64 TIFFTileSize64(TIFF *tif)
Definition: tif_tile.c:252
void _TIFFfree(void *p)
Definition: tif_unix.c:326
TIFFDataType
Definition: tiff.h:123
#define TIFFTAG_TILEBYTECOUNTS
Definition: tiff.h:288
#define TIFFTAG_STRIPBYTECOUNTS
Definition: tiff.h:233
#define TIFFTAG_TILEOFFSETS
Definition: tiff.h:287
#define TIFFTAG_STRIPOFFSETS
Definition: tiff.h:221
#define TIFF_ANY
Definition: tiffio.h:307
#define WriteOK(tif, buf, size)
Definition: tiffiop.h:259
#define ReadOK(tif, buf, size)
Definition: tiffiop.h:252
#define SeekOK(tif, off)
Definition: tiffiop.h:256
#define isMapped(tif)
Definition: tiffiop.h:230
#define TIFFSeekFile(tif, off, whence)
Definition: tiffiop.h:237
#define TIFF_BIGTIFF
Definition: tiffiop.h:138
#define TIFF_SWAB
Definition: tiffiop.h:126

Referenced by TIFFForceStrileArrayWriting().

◆ _TIFFSeekOK()

int _TIFFSeekOK ( TIFF tif,
toff_t  off 
)

Definition at line 406 of file tif_aux.c.

407{
408 /* Huge offsets, especially -1 / UINT64_MAX, can cause issues */
409 /* See http://bugzilla.maptools.org/show_bug.cgi?id=2726 */
410 return off <= (~(uint64)0)/2 && TIFFSeekFile(tif,off,SEEK_SET)==off;
411}
#define SEEK_SET
Definition: jmemansi.c:26

◆ _TIFFsetByteArray()

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

Definition at line 57 of file tif_dir.c.

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

◆ _TIFFSetDefaultCompressionState()

void _TIFFSetDefaultCompressionState ( TIFF tif)

Definition at line 135 of file tif_compress.c.

136{
138 tif->tif_decodestatus = TRUE;
144 tif->tif_encodestatus = TRUE;
151 tif->tif_close = _TIFFvoid;
152 tif->tif_seek = _TIFFNoSeek;
153 tif->tif_cleanup = _TIFFvoid;
157}
#define TRUE
Definition: types.h:120
TIFFTileMethod tif_deftilesize
Definition: tiffiop.h:190
TIFFCodeMethod tif_encodestrip
Definition: tiffiop.h:183
TIFFSeekMethod tif_seek
Definition: tiffiop.h:187
TIFFCodeMethod tif_encodetile
Definition: tiffiop.h:185
TIFFPreMethod tif_preencode
Definition: tiffiop.h:178
TIFFBoolMethod tif_fixuptags
Definition: tiffiop.h:173
TIFFPreMethod tif_predecode
Definition: tiffiop.h:175
TIFFStripMethod tif_defstripsize
Definition: tiffiop.h:189
TIFFCodeMethod tif_decoderow
Definition: tiffiop.h:180
TIFFBoolMethod tif_setupencode
Definition: tiffiop.h:176
TIFFBoolMethod tif_postencode
Definition: tiffiop.h:179
TIFFCodeMethod tif_encoderow
Definition: tiffiop.h:181
TIFFVoidMethod tif_close
Definition: tiffiop.h:186
int tif_decodestatus
Definition: tiffiop.h:172
int tif_encodestatus
Definition: tiffiop.h:177
TIFFVoidMethod tif_cleanup
Definition: tiffiop.h:188
TIFFBoolMethod tif_setupdecode
Definition: tiffiop.h:174
int _TIFFNoPreCode(TIFF *tif, uint16 s)
Definition: tif_compress.c:125
int _TIFFNoSeek(TIFF *tif, uint32 off)
Definition: tif_compress.c:116
static void _TIFFvoid(TIFF *tif)
Definition: tif_compress.c:132
int _TIFFNoStripDecode(TIFF *tif, uint8 *pp, tmsize_t cc, uint16 s)
Definition: tif_compress.c:102
int _TIFFNoTileEncode(TIFF *tif, uint8 *pp, tmsize_t cc, uint16 s)
Definition: tif_compress.c:65
static int _TIFFtrue(TIFF *tif)
Definition: tif_compress.c:131
static int _TIFFNoFixupTags(TIFF *tif)
Definition: tif_compress.c:88
int _TIFFNoRowEncode(TIFF *tif, uint8 *pp, tmsize_t cc, uint16 s)
Definition: tif_compress.c:51
int _TIFFNoStripEncode(TIFF *tif, uint8 *pp, tmsize_t cc, uint16 s)
Definition: tif_compress.c:58
int _TIFFNoTileDecode(TIFF *tif, uint8 *pp, tmsize_t cc, uint16 s)
Definition: tif_compress.c:109
int _TIFFNoRowDecode(TIFF *tif, uint8 *pp, tmsize_t cc, uint16 s)
Definition: tif_compress.c:95
uint32 _TIFFDefaultStripSize(TIFF *tif, uint32 s)
Definition: tif_strip.c:223
void _TIFFDefaultTileSize(TIFF *tif, uint32 *tw, uint32 *th)
Definition: tif_tile.c:278
#define TIFF_NOREADRAW
Definition: tiffiop.h:136
#define TIFF_NOBITREV
Definition: tiffiop.h:127

Referenced by TIFFClientOpen(), and TIFFSetCompressionScheme().

◆ _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)); }

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)); }

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)); }

◆ _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)); }

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); }

◆ _TIFFSwab16BitData()

void _TIFFSwab16BitData ( TIFF tif,
uint8 buf,
tmsize_t  cc 
)

Definition at line 1609 of file tif_read.c.

1610{
1611 (void) tif;
1612 assert((cc & 1) == 0);
1614}
#define assert(x)
Definition: debug.h:53

Referenced by _TIFFVSetField().

◆ _TIFFSwab24BitData()

void _TIFFSwab24BitData ( TIFF tif,
uint8 buf,
tmsize_t  cc 
)

Definition at line 1617 of file tif_read.c.

1618{
1619 (void) tif;
1620 assert((cc % 3) == 0);
1622}
void TIFFSwabArrayOfTriples(register uint8 *tp, tmsize_t n)
Definition: tif_swab.c:87

Referenced by _TIFFVSetField().

◆ _TIFFSwab32BitData()

void _TIFFSwab32BitData ( TIFF tif,
uint8 buf,
tmsize_t  cc 
)

Definition at line 1625 of file tif_read.c.

1626{
1627 (void) tif;
1628 assert((cc & 3) == 0);
1630}

Referenced by _TIFFVSetField().

◆ _TIFFSwab64BitData()

void _TIFFSwab64BitData ( TIFF tif,
uint8 buf,
tmsize_t  cc 
)

Definition at line 1633 of file tif_read.c.

1634{
1635 (void) tif;
1636 assert((cc & 7) == 0);
1637 TIFFSwabArrayOfDouble((double*) buf, cc/8);
1638}
void TIFFSwabArrayOfDouble(double *dp, tmsize_t n)
Definition: tif_swab.c:182

Referenced by _TIFFVSetField().

◆ _TIFFUInt64ToDouble()

double _TIFFUInt64ToDouble ( uint64  ui64)

Definition at line 382 of file tif_aux.c.

383{
384 _Int64 i;
385
386 i.value = ui64;
387 if (i.part.high >= 0) {
388 return (double)i.value;
389 } else {
390 long double df;
391 df = (long double)i.value;
392 df += 18446744073709551616.0; /* adding 2**64 */
393 return (double)df;
394 }
395}
return
Definition: dirsup.c:529
static const char mbstate_t *static wchar_t const char mbstate_t *static const wchar_t int *static double
Definition: string.c:80

Referenced by TIFFReadDirEntryDouble(), and TIFFReadDirEntryDoubleArray().

◆ _TIFFUInt64ToFloat()

float _TIFFUInt64ToFloat ( uint64  ui64)

Definition at line 366 of file tif_aux.c.

367{
368 _Int64 i;
369
370 i.value = ui64;
371 if (i.part.high >= 0) {
372 return (float)i.value;
373 } else {
374 long double df;
375 df = (long double)i.value;
376 df += 18446744073709551616.0; /* adding 2**64 */
377 return (float)df;
378 }
379}

Referenced by TIFFReadDirEntryFloat(), and TIFFReadDirEntryFloatArray().

◆ TIFFDefaultDirectory()

int TIFFDefaultDirectory ( TIFF tif)

Definition at line 1372 of file tif_dir.c.

1373{
1374 register TIFFDirectory* td = &tif->tif_dir;
1376
1379
1380 _TIFFmemset(td, 0, sizeof (*td));
1382 td->td_bitspersample = 1;
1385 td->td_samplesperpixel = 1;
1386 td->td_rowsperstrip = (uint32) -1;
1387 td->td_tilewidth = 0;
1388 td->td_tilelength = 0;
1389 td->td_tiledepth = 1;
1390#ifdef STRIPBYTECOUNTSORTED_UNUSED
1391 td->td_stripbytecountsorted = 1; /* Our own arrays always sorted. */
1392#endif
1395 td->td_imagedepth = 1;
1396 td->td_ycbcrsubsampling[0] = 2;
1397 td->td_ycbcrsubsampling[1] = 2;
1400 tif->tif_foundfield = NULL;
1404 /*
1405 * Give client code a chance to install their own
1406 * tag extensions & methods, prior to compression overloads,
1407 * but do some prior cleanup first. (http://trac.osgeo.org/gdal/ticket/5054)
1408 */
1409 if (tif->tif_nfieldscompat > 0) {
1410 uint32 i;
1411
1412 for (i = 0; i < tif->tif_nfieldscompat; i++) {
1415 }
1417 tif->tif_nfieldscompat = 0;
1418 tif->tif_fieldscompat = NULL;
1419 }
1420 if (_TIFFextender)
1421 (*_TIFFextender)(tif);
1423 /*
1424 * NB: The directory is marked dirty as a result of setting
1425 * up the default compression scheme. However, this really
1426 * isn't correct -- we want TIFF_DIRTYDIRECT to be set only
1427 * if the user does something. We could just do the setup
1428 * by hand, but it seems better to use the normal mechanism
1429 * (i.e. TIFFSetField).
1430 */
1431 tif->tif_flags &= ~TIFF_DIRTYDIRECT;
1432
1433 /*
1434 * As per http://bugzilla.remotesensing.org/show_bug.cgi?id=19
1435 * we clear the ISTILED flag when setting up a new directory.
1436 * Should we also be clearing stuff like INSUBIFD?
1437 */
1438 tif->tif_flags &= ~TIFF_ISTILED;
1439
1440 return (1);
1441}
uint16 td_resolutionunit
Definition: tif_dir.h:88
uint16 td_sampleformat
Definition: tif_dir.h:76
uint16 td_samplesperpixel
Definition: tif_dir.h:82
uint32 td_imagedepth
Definition: tif_dir.h:72
uint16 td_bitspersample
Definition: tif_dir.h:75
uint32 td_rowsperstrip
Definition: tif_dir.h:83
uint32 td_tiledepth
Definition: tif_dir.h:73
uint16 td_fillorder
Definition: tif_dir.h:80
uint16 td_threshholding
Definition: tif_dir.h:79
uint32 td_tilelength
Definition: tif_dir.h:73
uint16 td_ycbcrpositioning
Definition: tif_dir.h:113
uint32 td_tilewidth
Definition: tif_dir.h:73
uint16 td_orientation
Definition: tif_dir.h:81
uint16 td_ycbcrsubsampling[2]
Definition: tif_dir.h:112
TIFFVGetMethod vgetfield
Definition: tiffio.h:334
TIFFVSetMethod vsetfield
Definition: tiffio.h:333
TIFFPrintMethod printdir
Definition: tiffio.h:335
TIFFField * fields
Definition: tif_dir.h:279
uint32 allocated_size
Definition: tif_dir.h:277
const TIFFField * tif_foundfield
Definition: tiffiop.h:218
TIFFTagMethods tif_tagmethods
Definition: tiffiop.h:219
size_t tif_nfieldscompat
Definition: tiffiop.h:224
TIFFFieldArray * tif_fieldscompat
Definition: tiffiop.h:223
static int _TIFFVGetField(TIFF *tif, uint32 tag, va_list ap)
Definition: tif_dir.c:873
int TIFFSetField(TIFF *tif, uint32 tag,...)
Definition: tif_dir.c:807
static TIFFExtendProc _TIFFextender
Definition: tif_dir.c:1309
static int _TIFFVSetField(TIFF *tif, uint32 tag, va_list ap)
Definition: tif_dir.c:171
const TIFFFieldArray * _TIFFGetFields(void)
Definition: tif_dirinfo.c:305
static const TIFFFieldArray tiffFieldArray
Definition: tif_dirinfo.c:48
void _TIFFSetupFields(TIFF *tif, const TIFFFieldArray *fieldarray)
Definition: tif_dirinfo.c:317
void _TIFFNoPostDecode(TIFF *tif, uint8 *buf, tmsize_t cc)
Definition: tif_read.c:1603
#define COMPRESSION_NONE
Definition: tiff.h:158
#define YCBCRPOSITION_CENTERED
Definition: tiff.h:364
#define ORIENTATION_TOPLEFT
Definition: tiff.h:223
#define SAMPLEFORMAT_UINT
Definition: tiff.h:308
#define FILLORDER_MSB2LSB
Definition: tiff.h:215
#define RESUNIT_INCH
Definition: tiff.h:263
#define THRESHHOLD_BILEVEL
Definition: tiff.h:209
#define TIFFTAG_COMPRESSION
Definition: tiff.h:157

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

◆ TIFFFlushData1()

int TIFFFlushData1 ( TIFF tif)

Definition at line 803 of file tif_write.c.

804{
805 if (tif->tif_rawcc > 0 && tif->tif_flags & TIFF_BUF4WRITE ) {
806 if (!isFillOrder(tif, tif->tif_dir.td_fillorder) &&
807 (tif->tif_flags & TIFF_NOBITREV) == 0)
809 tif->tif_rawcc);
810 if (!TIFFAppendToStrip(tif,
811 isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip,
812 tif->tif_rawdata, tif->tif_rawcc))
813 {
814 /* We update those variables even in case of error since there's */
815 /* code that doesn't really check the return code of this */
816 /* function */
817 tif->tif_rawcc = 0;
818 tif->tif_rawcp = tif->tif_rawdata;
819 return (0);
820 }
821 tif->tif_rawcc = 0;
822 tif->tif_rawcp = tif->tif_rawdata;
823 }
824 return (1);
825}
tmsize_t tif_rawcc
Definition: tiffiop.h:200
uint32 tif_curstrip
Definition: tiffiop.h:161
uint32 tif_curtile
Definition: tiffiop.h:169
uint8 * tif_rawcp
Definition: tiffiop.h:199
uint8 * tif_rawdata
Definition: tiffiop.h:195
void TIFFReverseBits(uint8 *cp, tmsize_t n)
Definition: tif_swab.c:284
static int TIFFAppendToStrip(TIFF *tif, uint32 strip, uint8 *data, tmsize_t cc)
Definition: tif_write.c:728
#define isTiled(tif)
Definition: tiffiop.h:229
#define TIFF_BUF4WRITE
Definition: tiffiop.h:139
#define isFillOrder(tif, o)
Definition: tiffiop.h:231

Referenced by DumpModeEncode(), TIFFFlushData(), and TIFFWriteDirectorySec().

◆ TIFFInitCCITTFax3()

int TIFFInitCCITTFax3 ( TIFF ,
int   
)

◆ TIFFInitCCITTFax4()

int TIFFInitCCITTFax4 ( TIFF ,
int   
)

◆ TIFFInitCCITTRLE()

int TIFFInitCCITTRLE ( TIFF ,
int   
)

◆ TIFFInitCCITTRLEW()

int TIFFInitCCITTRLEW ( TIFF ,
int   
)

◆ TIFFInitDumpMode()

int TIFFInitDumpMode ( TIFF tif,
int  scheme 
)

Definition at line 123 of file tif_dumpmode.c.

124{
125 (void) scheme;
133 tif->tif_seek = DumpModeSeek;
134 return (1);
135}
DWORD scheme
static int DumpModeSeek(TIFF *tif, uint32 nrows)
Definition: tif_dumpmode.c:112
static int DumpModeDecode(TIFF *tif, uint8 *buf, tmsize_t cc, uint16 s)
Definition: tif_dumpmode.c:77
static int DumpFixupTags(TIFF *tif)
Definition: tif_dumpmode.c:34
static int DumpModeEncode(TIFF *tif, uint8 *pp, tmsize_t cc, uint16 s)
Definition: tif_dumpmode.c:44

◆ TIFFInitLZW()

int TIFFInitLZW ( TIFF ,
int   
)

◆ TIFFInitNeXT()

int TIFFInitNeXT ( TIFF ,
int   
)

◆ TIFFInitPackBits()

int TIFFInitPackBits ( TIFF ,
int   
)

◆ TIFFInitPixarLog()

int TIFFInitPixarLog ( TIFF ,
int   
)

◆ TIFFInitSGILog()

int TIFFInitSGILog ( TIFF ,
int   
)

◆ TIFFInitThunderScan()

int TIFFInitThunderScan ( TIFF ,
int   
)

◆ TIFFInitZIP()

int TIFFInitZIP ( TIFF ,
int   
)

◆ TIFFSetCompressionScheme()

int TIFFSetCompressionScheme ( TIFF tif,
int  scheme 
)

Definition at line 160 of file tif_compress.c.

161{
163
165 /*
166 * Don't treat an unknown compression scheme as an error.
167 * This permits applications to open files with data that
168 * the library does not have builtin support for, but which
169 * may still be meaningful.
170 */
171 return (c ? (*c->init)(tif, scheme) : 1);
172}
const GLubyte * c
Definition: glext.h:8905
void _TIFFSetDefaultCompressionState(TIFF *tif)
Definition: tif_compress.c:135
const TIFFCodec * TIFFFindCODEC(uint16 scheme)
Definition: tif_compress.c:186

Referenced by _TIFFVSetField().

◆ TIFFSetDefaultCompressionState()

int TIFFSetDefaultCompressionState ( TIFF tif)

Variable Documentation

◆ _TIFFBuiltinCODECS

TIFFCodec _TIFFBuiltinCODECS[]
extern

Definition at line 87 of file tif_codec.c.

Referenced by TIFFFindCODEC(), and TIFFGetConfiguredCODECs().

◆ _TIFFerrorHandler

TIFFErrorHandler _TIFFerrorHandler
extern

Definition at line 374 of file tif_unix.c.

Referenced by TIFFError(), TIFFErrorExt(), and TIFFSetErrorHandler().

◆ _TIFFerrorHandlerExt

TIFFErrorHandlerExt _TIFFerrorHandlerExt
extern

Definition at line 30 of file tif_error.c.

Referenced by TIFFError(), TIFFErrorExt(), and TIFFSetErrorHandlerExt().

◆ _TIFFwarningHandler

TIFFErrorHandler _TIFFwarningHandler
extern

Definition at line 364 of file tif_unix.c.

Referenced by TIFFSetWarningHandler(), TIFFWarning(), and TIFFWarningExt().

◆ _TIFFwarningHandlerExt

TIFFErrorHandlerExt _TIFFwarningHandlerExt
extern

Definition at line 30 of file tif_warning.c.

Referenced by TIFFSetWarningHandlerExt(), TIFFWarning(), and TIFFWarningExt().