42#ifdef HAVE_SYS_TYPES_H
75#ifndef STRIP_SIZE_DEFAULT
80#define STRIP_SIZE_DEFAULT 8192
83#ifndef TIFF_MAX_DIR_COUNT
88#define TIFF_MAX_DIR_COUNT 1048576
95#define TIFF_NON_EXISTENT_DIR_NUMBER UINT_MAX
108#define streq(a, b) (strcmp(a, b) == 0)
124#define strneq(a, b, n) (strncmp(a, b, n) == 0)
409#define TIFF_FILLORDER 0x00003U
416#define TIFF_DIRTYHEADER 0x00004U
421#define TIFF_DIRTYDIRECT 0x00008U
426#define TIFF_BUFFERSETUP 0x00010U
431#define TIFF_CODERSETUP 0x00020U
436#define TIFF_BEENWRITING 0x00040U
441#define TIFF_SWAB 0x00080U
446#define TIFF_NOBITREV 0x00100U
451#define TIFF_MYBUFFER 0x00200U
456#define TIFF_ISTILED 0x00400U
466#define TIFF_MAPPED 0x00800U
471#define TIFF_POSTENCODE 0x01000U
476#define TIFF_INSUBIFD 0x02000U
481#define TIFF_UPSAMPLED 0x04000U
486#define TIFF_STRIPCHOP 0x08000U
491#define TIFF_HEADERONLY 0x10000U
496#define TIFF_NOREADRAW 0x20000U
503#define TIFF_INCUSTOMIFD 0x40000U
508#define TIFF_BIGTIFF 0x80000U
513#define TIFF_BUF4WRITE 0x100000U
518#define TIFF_DIRTYSTRIP 0x200000U
523#define TIFF_PERSAMPLE 0x400000U
528#define TIFF_BUFFERMMAP 0x800000U
533#define TIFF_DEFERSTRILELOAD 0x1000000U
542#define TIFF_LAZYSTRILELOAD_DONE 0x2000000U
547#define TIFF_CHOPPEDUPARRAYS 0x4000000U
552#define TIFF_LAZYSTRILELOAD_ASKED 0x8000000U
821#define isPseudoTag(t) (t > 0xffff)
833#define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
845#define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
858#define isFillOrder(tif, o) (((tif)->tif_flags & (o)) != 0)
869#define isUpSampled(tif) (((tif)->tif_flags & TIFF_UPSAMPLED) != 0)
885#define TIFFReadFile(tif, buf, size) \
886 ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
902#define TIFFWriteFile(tif, buf, size) \
903 ((*(tif)->tif_writeproc)((tif)->tif_clientdata, (buf), (size)))
920#define TIFFSeekFile(tif, off, whence) \
921 ((*(tif)->tif_seekproc)((tif)->tif_clientdata, (off), (whence)))
934#define TIFFCloseFile(tif) ((*(tif)->tif_closeproc)((tif)->tif_clientdata))
946#define TIFFGetFileSize(tif) ((*(tif)->tif_sizeproc)((tif)->tif_clientdata))
962#define TIFFMapFileContents(tif, paddr, psize) \
963 ((*(tif)->tif_mapproc)((tif)->tif_clientdata, (paddr), (psize)))
977#define TIFFUnmapFileContents(tif, addr, size) \
978 ((*(tif)->tif_unmapproc)((tif)->tif_clientdata, (addr), (size)))
1000#define ReadOK(tif, buf, size) \
1001 (TIFFReadFile((tif), (buf), (size)) == (tmsize_t)(size))
1017#define SeekOK(tif, off) _TIFFSeekOK(tif, off)
1035#define WriteOK(tif, buf, size) \
1036 (TIFFWriteFile((tif), (buf), (size)) == (tmsize_t)(size))
1056#define TIFFhowmany_32(x, y) \
1057 (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1))) \
1058 ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y))) \
1074#define TIFFhowmany_32_maxuint_compat(x, y) \
1075 (((uint32_t)(x) / (uint32_t)(y)) + \
1076 ((((uint32_t)(x) % (uint32_t)(y)) != 0) ? 1 : 0))
1087#define TIFFhowmany8_32(x) \
1088 (((x) & 0x07) ? ((uint32_t)(x) >> 3) + 1 : (uint32_t)(x) >> 3)
1102#define TIFFroundup_32(x, y) ((uint32_t)(TIFFhowmany_32(x, y) * (uint32_t)(y)))
1115#define TIFFhowmany_64(x, y) \
1116 ((((uint64_t)(x)) + (((uint64_t)(y)) - 1)) / ((uint64_t)(y)))
1127#define TIFFhowmany8_64(x) \
1128 (((x) & 0x07) ? ((uint64_t)(x) >> 3) + 1 : (uint64_t)(x) >> 3)
1142#define TIFFroundup_64(x, y) ((uint64_t)(TIFFhowmany_64(x, y) * (uint64_t)(y)))
1164#define TIFFSafeMultiply(t, v, m) \
1165 ((((t)(m) != (t)0) && (((t)((((t)(v)) * ((t)(m))) / ((t)(m)))) == (t)(v))) \
1166 ? (t)(((t)(v)) * ((t)(m))) \
1195#define TIFFSafeModMul32(tif, module, index, count, dimension, result) \
1196 ((dimension) == 0 || ((index) % (count) == 0) \
1197 ? ((result) = 0, 0) \
1198 : (((result) = _TIFFMultiply32((tif), (index) % (count), (dimension), \
1213#define TIFFmax(A, B) ((A) > (B) ? (A) : (B))
1226#define TIFFmin(A, B) ((A) < (B) ? (A) : (B))
1239#define TIFFArrayCount(a) (sizeof(a) / sizeof((a)[0]))
1256#define TIFF_FLOAT_EQ(x, y) (!(fabsf((x) - (y)) > 0.0f))
1271#define TIFF_DOUBLE_EQ(x, y) (!(fabs((x) - (y)) > 0.0))
1279#if defined(HAVE_FSEEKO)
1291#if defined(HAVE_FSEEKO)
1307#define fseek(stream, offset, whence) fseeko(stream, offset, whence)
1321#define ftell(stream) ftello(stream)
1324#if defined(_WIN32) && \
1325 !(defined(__MSVCRT_VERSION__) && __MSVCRT_VERSION__ < 0x800)
1345#define _TIFF_lseek_f(fildes, offset, whence) \
1346 _lseeki64(fildes, offset, whence)
1363#define _TIFF_fseek_f(stream, offset, whence) \
1364 _fseeki64(stream, offset, whence)
1379#define _TIFF_fstat_f(fildes, stat_buff) \
1380 _fstati64(fildes, stat_buff)
1388#define _TIFF_stat_s struct _stati64
1393#define _TIFF_off_t __int64
1414#define _TIFF_lseek_f(fildes, offset, whence) lseek(fildes, offset, whence)
1431#define _TIFF_fseek_f(stream, offset, whence) fseek(stream, offset, whence)
1446#define _TIFF_fstat_f(fildes, stat_buff) fstat(fildes, stat_buff)
1453#define _TIFF_stat_s struct stat
1458#define _TIFF_off_t off_t
1461#if defined(__has_attribute) && defined(__clang__)
1462#if __has_attribute(no_sanitize)
1468#define TIFF_NOSANITIZE_UNSIGNED_INT_OVERFLOW \
1469 __attribute__((no_sanitize("unsigned-integer-overflow")))
1476#define TIFF_NOSANITIZE_UNSIGNED_INT_OVERFLOW
1484#define TIFF_NOSANITIZE_UNSIGNED_INT_OVERFLOW
1487#if defined(__cplusplus)
1538 const char *mode,
const char *module);
1778 tmsize_t cc,
const char *modulename);
2047 const uint16_t *wp, uint32_t n);
2099 const uint32_t *lp, uint32_t n);
2201 const double *dp, uint32_t n);
2315 const char *module,
const char *fmt, ...)
2357 uint32_t max_value);
2398 extern uint64_t
_TIFFAdd64(
TIFF *tif, uint64_t first, uint64_t second,
2420 tmsize_t second, const
char *where);
2460 const
char *module);
2479 const
char *module);
2507 uint32_t second, const
char *where,
2532 const
char *where,
bool *pOverflowed);
2587 uint32_t z, uint16_t s,
2611 uint16_t spp, uint16_t bps,
2632 uint32_t row, const
char *where);
2652 uint16_t bps, const
char *where);
2701 TIFF_ATTRIBUTE_ALLOC_SIZE(2) TIFF_ATTRIBUTE_DEALLOC(
_TIFFfreeExt, 2);
2729 tmsize_t siz) TIFF_ATTRIBUTE_MALLOC
2730 TIFF_ATTRIBUTE_ALLOC_SIZE2(2, 3)
2760 TIFF_ATTRIBUTE_ALLOC_SIZE(3) TIFF_ATTRIBUTE_DEALLOC(
_TIFFfreeExt, 2);
2790 const
char *what) TIFF_ATTRIBUTE_MALLOC
2791 TIFF_ATTRIBUTE_ALLOC_SIZE2(2, 3);
2821 tmsize_t elem_size, const
char *what)
2822 TIFF_ATTRIBUTE_ALLOC_SIZE2(3, 4);
3012 uint32_t x, uint32_t y,
3013 uint32_t z, uint16_t s);
3048#ifdef PACKBITS_SUPPORT
3144#ifdef THUNDER_SUPPORT
3302#ifdef PIXARLOG_SUPPORT
3325#ifdef LOGLUV_SUPPORT
3465 int32_t a, int32_t b,
float *X,
float *Y,
3523#if defined(__cplusplus)
tmsize_t _TIFFAddSSize(TIFF *tif, tmsize_t first, tmsize_t second, const char *where)
Check and add two signed-size operands.
uint32_t _TIFFMultiply32Ext(TIFF *tif, uint32_t first, uint32_t second, const char *where, bool *pOverflowed)
Multiply two unsigned values with an overflow check, and record an overflow in a caller-provided flag...
uint32_t _TIFFClampDoubleToUInt32(double val)
Clamp and truncate a double to an unsigned 32-bit value.
uint32_t _TIFFParseUInt32(const char *str, uint32_t default_value, uint32_t max_value)
Parse a decimal unsigned integer with a fallback value.
int _TIFFSeekOK(TIFF *tif, toff_t off)
Test whether an allowed absolute client seek reaches its target.
uint64_t _TIFFComputeRowSize64(TIFF *tif, uint32_t width, uint16_t spp, uint16_t bps, const char *where)
Compute a byte-rounded row size from width and sample geometry.
uint32_t _TIFFCastUInt64ToUInt32(TIFF *tif, uint64_t val, const char *module)
Convert an unsigned 64-bit value after checking the destination range.
uint64_t _TIFFAdd64(TIFF *tif, uint64_t first, uint64_t second, const char *where)
Check and add two unsigned operands.
tmsize_t _TIFFComputeRowOffset(TIFF *tif, tmsize_t rowstride, uint32_t row, const char *where)
Compute a checked byte offset for a row in a memory raster.
uint32_t _TIFFMultiply32(TIFF *tif, uint32_t first, uint32_t second, const char *where)
Multiply two unsigned values with an overflow check.
uint32_t _TIFFCastUInt64ToUInt32Ext(TIFF *tif, uint64_t val, const char *module, bool *pOverflowed)
Convert an unsigned 64-bit value after checking the destination range, and record a rejection in a ca...
uint64_t _TIFFComputeBitOffset(TIFF *tif, uint32_t col, uint16_t spp, uint16_t bps, const char *where)
Compute a checked packed-sample column offset in bits.
tmsize_t _TIFFCastUInt64ToSSize(TIFF *tif, uint64_t val, const char *module)
Convert an unsigned 64-bit value after checking the destination range.
uint64_t _TIFFAdd64Ext(TIFF *tif, uint64_t first, uint64_t second, const char *where, bool *pOverflowed)
Check and add two unsigned operands, and record an overflow in a caller-provided flag.
float _TIFFClampDoubleToFloat(double val)
Clamp a double to the finite float range before conversion.
uint64_t _TIFFMultiply64(TIFF *tif, uint64_t first, uint64_t second, const char *where)
Multiply two unsigned values with an overflow check.
tmsize_t _TIFFMultiplySSize(TIFF *tif, tmsize_t first, tmsize_t second, const char *where)
Check and multiply two signed-size operands.
int TIFFInitThunderScan(TIFF *tif, int scheme)
Install ThunderScan transfer callbacks.
int TIFFInitPackBits(TIFF *tif, int scheme)
Install PackBits transfer callbacks.
int TIFFInitNeXT(TIFF *tif, int scheme)
Install NeXT transfer callbacks.
int TIFFInitDumpMode(TIFF *tif, int scheme)
Install uncompressed transfer callbacks.
int TIFFSetCompressionScheme(TIFF *tif, int scheme)
Reset methods and install the selected compression implementation.
int _TIFFNoTileEncode(TIFF *tif, uint8_t *pp, tmsize_t cc, uint16_t s)
Report unsupported codec encoding.
void _TIFFSetDefaultCompressionState(TIFF *tif)
Install fallback codec callbacks and reset raw-access flags.
int _TIFFNoTileDecode(TIFF *tif, uint8_t *pp, tmsize_t cc, uint16_t s)
Report unsupported codec decoding.
int _TIFFNoRowDecode(TIFF *tif, uint8_t *pp, tmsize_t cc, uint16_t s)
Report unsupported codec decoding.
int _TIFFNoRowEncode(TIFF *tif, uint8_t *pp, tmsize_t cc, uint16_t s)
Report unsupported codec encoding.
int _TIFFNoStripEncode(TIFF *tif, uint8_t *pp, tmsize_t cc, uint16_t s)
Report unsupported codec encoding.
int _TIFFNoStripDecode(TIFF *tif, uint8_t *pp, tmsize_t cc, uint16_t s)
Report unsupported codec decoding.
const TIFFCodec _TIFFBuiltinCODECS[]
Describe built-in compression names and initialisers.
int _TIFFNoPreCode(TIFF *tif, uint16_t s)
Accept a no-op codec preparation.
int _TIFFNoSeek(TIFF *tif, uint32_t off)
Report unsupported codec seeking.
int TIFFSetDefaultCompressionState(TIFF *tif)
Retain an obsolete declaration with no library implementation.
void TIFFCIELab16ToXYZ(TIFFCIELabToRGB *cielab, uint32_t l, int32_t a, int32_t b, float *X, float *Y, float *Z)
Convert 16-bit TIFF CIE L*a*b* samples to XYZ.
int TIFFInitZIP(TIFF *tif, int scheme)
Install predictor-aware Deflate codec and allocator hooks.
TIFFErrorHandler _TIFFwarningHandler
Store the global warning callback.
TIFFErrorHandlerExt _TIFFerrorHandlerExt
Store the global extended error callback.
TIFFErrorHandlerExt _TIFFwarningHandlerExt
Store the global extended warning callback.
TIFFErrorHandler _TIFFerrorHandler
Store the global error callback.
int TIFFDefaultDirectory(TIFF *tif)
Install the image schema, default values, and core tag methods.
void _TIFFprintAsciiTag(FILE *fd, const char *name, const char *value)
Print a labelled quoted value using the private ASCII formatter.
void _TIFFprintAscii(FILE *fd, const char *cp)
Print a terminated string using the private ASCII escape convention.
int TIFFInitCCITTRLE(TIFF *tif, int scheme)
Install CCITTRLE fax callbacks and default mode.
int TIFFInitCCITTRLEW(TIFF *tif, int scheme)
Install CCITTRLEW fax callbacks and default mode.
int TIFFInitCCITTFax4(TIFF *tif, int scheme)
Install CCITTFax4 fax callbacks and default mode.
int TIFFInitCCITTFax3(TIFF *tif, int scheme)
Install CCITTFax3 fax callbacks and default mode.
TIFFReadDirEntryErr
Classify directory-entry decoding failures.
enum TIFFReadDirEntryErr _TIFFReadDirEntryCheckedRational(TIFF *tif, TIFFDirEntry *direntry, double *value)
Read a prevalidated rational value.
@ TIFFReadDirEntryErrPsdif
Per-sample values differ where uniform values are required.
@ TIFFReadDirEntryErrIo
Mapped extent, seek, or read failure.
@ TIFFReadDirEntryErrRange
Value cannot be represented by the target integer type.
@ TIFFReadDirEntryErrSizesan
Source or target array exceeds the configured sanity ceiling.
@ TIFFReadDirEntryErrAlloc
Allocation, policy, or large-request/file-size rejection.
@ TIFFReadDirEntryErrType
Unsupported source file data type.
@ TIFFReadDirEntryErrCount
Unsupported or inconsistent element count.
@ TIFFReadDirEntryErrOk
Successful or accepted empty conversion.
int _TIFFRewriteField(TIFF *tif, uint16_t tag, TIFFDataType in_datatype, tmsize_t count, void *data)
Patch an existing field in the current on-file IFD.
void _TIFFDefaultTileSize(TIFF *tif, uint32_t *tw, uint32_t *th)
Supply default tile dimensions and round them to multiples of sixteen.
void(* TIFFTileMethod)(TIFF *tif, uint32_t *tw, uint32_t *th)
Adjust tile width and height for the current codec.
uint64_t _TIFFStrileSize64(TIFF *tif, uint32_t nrows, int isStrip)
Compute row-aligned decoded storage for a strip or tile-height request.
uint32_t _TIFFDefaultStripSize(TIFF *tif, uint32_t s)
Choose a default strip height near STRIP_SIZE_DEFAULT bytes.
uint32_t(* TIFFStripMethod)(TIFF *tif, uint32_t request)
Recommend rows per strip for the current geometry and codec.
uint32_t _TIFFComputeTileExt(TIFF *tif, uint32_t x, uint32_t y, uint32_t z, uint16_t s, bool *pOverflowed)
Compute a tile index as TIFFComputeTile() does, and record an index overflow in a caller-provided fla...
tmsize_t _TIFFReadEncodedTileAndAllocBuffer(TIFF *tif, uint32_t tile, void **buf, tmsize_t bufsizetoalloc, tmsize_t size_to_read)
Decode after deferred allocation of caller-owned output storage.
int(* TIFFSeekMethod)(TIFF *tif, uint32_t nrows)
Advance codec decoding or encoding by a row count.
int _TIFFCheckPostDecodeLength(TIFF *tif, TIFFPostMethod tif_postdecode, tmsize_t cc, const char *modulename)
Check the byte count for a byte-swapping postdecode method.
int(* TIFFPreMethod)(TIFF *tif, uint16_t sample)
Prepare a codec for one sample plane.
int(* TIFFCodeMethod)(TIFF *tif, uint8_t *buf, tmsize_t size, uint16_t sample)
Encode or decode a requested image-data extent.
void _TIFFNoPostDecode(TIFF *tif, uint8_t *buf, tmsize_t cc)
Leave decoded bytes unchanged.
tmsize_t _TIFFReadEncodedStripAndAllocBuffer(TIFF *tif, uint32_t strip, void **buf, tmsize_t bufsizetoalloc, tmsize_t size_to_read)
Decode after deferred allocation of caller-owned output storage.
tmsize_t _TIFFReadTileAndAllocBuffer(TIFF *tif, void **buf, tmsize_t bufsizetoalloc, uint32_t x, uint32_t y, uint32_t z, uint16_t s)
Decode after deferred allocation of caller-owned output storage.
void(* TIFFPostMethod)(TIFF *tif, uint8_t *buf, tmsize_t size)
Transform image bytes in place after decoding or before encoding.
void(* TIFFVoidMethod)(TIFF *tif)
Run a codec close or cleanup operation.
void _TIFFSwab24BitData(TIFF *tif, uint8_t *buf, tmsize_t cc)
Swap each 3-byte sample in place.
void _TIFFSwab16BitData(TIFF *tif, uint8_t *buf, tmsize_t cc)
Swap each 2-byte sample in place.
int TIFFFlushData1(TIFF *tif)
Append buffered encoded bytes without invoking postencode recursively.
uint64_t(* TIFFGetMaxCompressionRatioMethod)(TIFF *tif)
Return the codec allocation-sanity compression-ratio heuristic.
void _TIFFSwab32BitData(TIFF *tif, uint8_t *buf, tmsize_t cc)
Swap each 4-byte sample in place.
int(* TIFFBoolMethod)(TIFF *tif)
Run a codec setup or completion operation.
void _TIFFSwab64BitData(TIFF *tif, uint8_t *buf, tmsize_t cc)
Swap each 8-byte sample in place.
int TIFFInitJBIG(TIFF *tif, int scheme)
Install single-strip JBIG callbacks and mutable raw-input policy.
int TIFFJPEGIsFullStripRequired(TIFF *tif)
Probe whether cached JPEG input needs whole-strile decoding.
int TIFFInitJPEG(TIFF *tif, int scheme)
Allocate JPEG-in-TIFF codec state and install method chains.
int TIFFInitLERC(TIFF *tif, int scheme)
Allocate LERC staging state and install frame callbacks and pseudo-tags.
void _TIFFCleanupIFDOffsetAndNumberMaps(TIFF *tif)
Release a handle's directory-offset/index lookup maps.
int _tiffDummyMapProc(thandle_t fd, void **pbase, toff_t *psize)
Decline mapping when the client supplies no mapping implementation.
void _TIFFErrorEarly(TIFFOpenOptions *opts, thandle_t clientdata, const char *module, const char *fmt,...)
Report an opening error before a complete TIFF handle is available.
int _TIFFgetMode(TIFFOpenOptions *opts, thandle_t clientdata, const char *mode, const char *module)
Translate the leading open-mode characters into OS access flags.
void _tiffDummyUnmapProc(thandle_t fd, void *base, toff_t size)
Provide a no-op unmapper when the client omits one.
int TIFFInitLZMA(TIFF *tif, int scheme)
Allocate predictor-aware LZMA2 codec state and install callbacks.
int TIFFInitLZW(TIFF *tif, int scheme)
Allocate LZW codec state and install predictor-aware methods.
void _TIFFfreeExt(TIFF *tif, void *p)
Release a handle-aware allocation and its payload charge.
void _TIFFsetLongArray(uint32_t **lpp, const uint32_t *lp, uint32_t n)
Replace an owned long array with a copied array.
void _TIFFsetLongArrayExt(TIFF *tif, uint32_t **lpp, const uint32_t *lp, uint32_t n)
Replace an owned long array with a copied array.
void _TIFFsetByteArray(void **vpp, const void *vp, uint32_t n)
Replace an owned byte array with a copied array.
void _TIFFsetFloatArrayExt(TIFF *tif, float **fpp, const float *fp, uint32_t n)
Replace an owned float array with a copied array.
void _TIFFsetByteArrayExt(TIFF *tif, void **vpp, const void *vp, uint32_t n)
Replace an owned byte array with a copied array.
void * _TIFFreallocExt(TIFF *tif, void *p, tmsize_t s)
Resize a handle-aware block or release it for a nonpositive size.
void _TIFFsetDoubleArray(double **dpp, const double *dp, uint32_t n)
Replace an owned double array with a copied array.
void _TIFFsetDoubleArrayExt(TIFF *tif, double **dpp, const double *dp, uint32_t n)
Replace an owned double array with a copied array.
void * _TIFFmallocExt(TIFF *tif, tmsize_t s)
Allocate uninitialised bytes under a handle's allocation policy.
void * _TIFFCheckRealloc(TIFF *tif, void *buffer, tmsize_t nmemb, tmsize_t elem_size, const char *what)
Resize a checked array with an allocation-failure diagnostic.
void _TIFFsetShortArray(uint16_t **wpp, const uint16_t *wp, uint32_t n)
Replace an owned short array with a copied array.
void * _TIFFCheckMalloc(TIFF *tif, tmsize_t nmemb, tmsize_t elem_size, const char *what)
Allocate a checked array with an allocation-failure diagnostic.
void * _TIFFcallocExt(TIFF *tif, tmsize_t nmemb, tmsize_t siz)
Allocate a zero-filled array under a handle's allocation policy.
void _TIFFsetShortArrayExt(TIFF *tif, uint16_t **wpp, const uint16_t *wp, uint32_t n)
Replace an owned short array with a copied array.
void _TIFFsetFloatArray(float **fpp, const float *fp, uint32_t n)
Replace an owned float array with a copied array.
int TIFFInitOJPEG(TIFF *tif, int scheme)
Install the decode-only old-style JPEG codec.
int TIFFInitPixarLog(TIFF *tif, int scheme)
Install PixarLog codec state methods and companding tables.
int TIFFInitSGILog(TIFF *tif, int scheme)
Allocate SGILog codec state and install row dispatch and tag hooks.
unsigned char tidataval_t
Name a legacy internal image byte.
size_t TIFFIOSize_t
Represent a native POSIX I/O byte count.
tidataval_t * tidata_t
Name a legacy pointer to internal image bytes.
struct client_info TIFFClientInfoLink
Link a named client-data association to a TIFF handle.
int TIFFInitWebP(TIFF *tif, int scheme)
Allocate WebP codec state and install buffered frame callbacks.
int TIFFInitZSTD(TIFF *tif, int scheme)
Allocate ZSTD state and install predictor-aware streaming methods.
#define TIFF_ATTRIBUTE(x)
Expand a compiler attribute in a public declaration when supported.
void(* TIFFErrorHandlerExt)(thandle_t fd, const char *module, const char *fmt, va_list ap)
Handle a library-wide error or warning diagnostic.
void(* TIFFErrorHandler)(const char *module, const char *fmt, va_list ap)
Handle a library-wide error or warning diagnostic.
toff_t(* TIFFSeekProc)(thandle_t fd, toff_t off, int whence)
Change the current position of a client I/O resource.
int(* TIFFCloseProc)(thandle_t fd)
Release a client I/O resource or its adapter context.
void(* TIFFUnmapFileProc)(thandle_t fd, void *base, toff_t size)
Release a whole-file view supplied by a mapping callback.
toff_t(* TIFFSizeProc)(thandle_t fd)
Query the byte length of a client I/O resource.
tmsize_t(* TIFFReadWriteProc)(thandle_t fd, void *buf, tmsize_t size)
Transfer bytes at the current position of a client I/O resource.
int(* TIFFMapFileProc)(thandle_t fd, void **base, toff_t *size)
Provide a readable whole-file view of a client resource.
int(* TIFFErrorHandlerExtR)(TIFF *tif, void *user_data, const char *module, const char *fmt, va_list ap)
Handle a diagnostic using a per-handle borrowed context.
TIFF_SSIZE_T tmsize_t
Represent a signed memory or I/O size in bytes.
TIFFDataType
Identify the on-disk representation of a TIFF directory field.
uint64_t toff_t
Represent an unsigned file byte offset independently of off_t.
uint32_t tdir_t
Represent a zero-based directory index, rather than a file offset.
void * thandle_t
Carry an opaque client I/O context through library callbacks.
Hold CIE L*a*b*-to-RGB conversion parameters and tables.
Describe a named compression scheme and its initialiser.
Represent a parsed directory entry before value conversion.
Store the current directory values and image traversal state.
Pair a directory file offset with its main-IFD index.
tdir_t dirNumber
Zero-based main-directory index associated with offset.
uint64_t offset
Directory byte offset from the beginning of the file.
Hold allocation limits and diagnostics used when opening a TIFF handle.
void * errorhandler_user_data
Borrowed error-callback context, or NULL.
tmsize_t max_cumulated_mem_alloc
Maximum tracked allocation total in bytes; zero means unlimited.
TIFFErrorHandlerExtR errorhandler
Optional per-handle error callback, or NULL.
int warn_about_unknown_tags
Nonzero to warn about unknown tags.
TIFFErrorHandlerExtR warnhandler
Optional per-handle warning callback, or NULL.
void * warnhandler_user_data
Borrowed warning-callback context, or NULL.
tmsize_t max_single_mem_alloc
Maximum individual allocation in bytes; zero means unlimited.
Collect a handle's tag-access and directory-print callbacks.
Describe a borrowed schema or owned compatibility batch.
Describe a field's file type and internal argument contract.
Own bucket/node storage and record callback-defined element policy.
Link a named client-data association to a TIFF handle.
void * data
Borrowed client payload; the library does not free it.
struct client_info * next
Next handle-owned association node, or NULL.
char * name
Owned copy of the null-terminated association name.
Hold private state for one open TIFF library instance.
TIFFReadWriteProc tif_readproc
Client read callback.
int tif_warn_about_unknown_tags
Nonzero to emit warnings for unknown tags.
TIFFReadWriteProc tif_writeproc
Client write callback.
uint64_t tif_subifdoff
File byte offset at which the next SubIFD link is patched.
const TIFFField * tif_foundfield
Borrowed cached field descriptor; valid only while that descriptor lives.
tdir_t tif_curdircount
Cache the number of main IFDs in the file.
TIFFTileMethod tif_deftilesize
Codec callback computing or constraining default tile dimensions.
tmsize_t tif_max_single_mem_alloc
Single-allocation byte limit; zero means unlimited.
TIFFCodeMethod tif_encodestrip
Codec callback encoding strip data.
uint64_t tif_lastvalidoff
Last byte-offset boundary permitted for rewriting strip data in place.
TIFFUnmapFileProc tif_unmapproc
Client callback releasing a mapped-file view.
TIFFSeekProc tif_seekproc
Client seek callback.
TIFFSeekMethod tif_seek
Codec callback advancing within a strip.
TIFFCodeMethod tif_encodetile
Codec callback encoding tile data.
TIFFTagMethods tif_tagmethods
Inline table of directory field and print callbacks.
int tif_setdirectory_force_absolute
Nonzero to force absolute rather than relative directory stepping.
TIFFErrorHandlerExtR tif_errorhandler
Per-handle error callback, or NULL for the default handling path.
uint16_t tif_nsubifd
Number of remaining SubIFD links to write.
TIFFPreMethod tif_preencode
Codec callback preparing a row, strip, or tile encode.
TIFFBoolMethod tif_fixuptags
Codec callback for directory-dependent tag corrections.
TIFFHashSet * tif_map_dir_number_to_offset
Handle-managed directory-index-to-offset lookup map.
TIFFDirectory tif_customdir
Unused legacy member; custom directories are read into tif_dir.
tmsize_t tif_rawdataloaded
Number of bytes loaded into the raw-buffer window.
tmsize_t tif_rawcc
Raw-buffer byte count interpreted according to read/write state.
TIFFPreMethod tif_predecode
Codec callback preparing a row, strip, or tile decode.
uint64_t tif_curoff
Tracked current file byte offset for read/write operations.
size_t tif_nfields
Number of entries in tif_fields.
uint64_t tif_nextdiroff
Next directory byte offset from the current chain link.
void * tif_errorhandler_user_data
Borrowed context passed to tif_errorhandler.
TIFFCodeMethod tif_decodestrip
Codec callback decoding strip data.
TIFFGetMaxCompressionRatioMethod tif_getmaxcompressionratio
Codec callback returning its maximum compression ratio.
TIFFCloseProc tif_closeproc
Client I/O close callback.
TIFFClientInfoLink * tif_clientinfo
Head of the owned named-association list; payloads remain borrowed.
TIFFField ** tif_fields
Owned sorted array of field pointers; descriptors have mixed ownership.
TIFFHashSet * tif_map_dir_offset_to_number
Handle-managed directory-offset-to-index lookup map.
TIFFPostMethod tif_postdecode
Callback transforming decoded data, for example by byte swapping.
thandle_t tif_clientdata
Client I/O context passed unchanged to the I/O callbacks.
uint64_t tif_diroff
Current directory byte offset, or zero for an unlinked in-memory IFD.
TIFFStripMethod tif_defstripsize
Codec callback computing or constraining a default strip size.
char * tif_name
Current filename pointer; may refer to inline or client-supplied storage.
TIFFCodeMethod tif_decoderow
Codec callback decoding a scanline.
TIFFBoolMethod tif_setupencode
Codec setup callback run before preencode.
TIFFDirectory tif_dir
Inline representation of the current image directory.
TIFFBoolMethod tif_postencode
Codec callback completing buffered encoding.
TIFFErrorHandlerExtR tif_warnhandler
Per-handle warning callback, or NULL for the default handling path.
tmsize_t tif_size
Mapped-file region length in bytes.
uint16_t tif_header_size
File-header length in bytes for the selected format.
TIFFCodeMethod tif_encoderow
Codec callback encoding a scanline.
TIFFVoidMethod tif_close
Codec close callback; distinct from the client I/O close callback.
uint64_t tif_dataoff
Byte offset used when placing directory data in the file.
tdir_t tif_curdir
Track the current or last-written directory index.
tmsize_t tif_cur_cumulated_mem_alloc
Current tracked allocation total in bytes.
int tif_decodestatus
Nonzero unless the selected scheme is a known but unconfigured codec; not a setup result.
int tif_encodestatus
Nonzero unless the selected scheme is a known but unconfigured codec; never read.
int tif_fd
File-descriptor metadata; client I/O still uses tif_clientdata.
TIFFVoidMethod tif_cleanup
Codec callback releasing codec-private state.
void * tif_warnhandler_user_data
Borrowed context passed to tif_warnhandler.
uint8_t * tif_data
Codec-private storage; allocation and cleanup follow the selected codec.
uint8_t * tif_rawcp
Borrowed current-position pointer into the raw buffer.
TIFFMapFileProc tif_mapproc
Client callback providing a mapped-file view.
TIFFBoolMethod tif_setupdecode
Codec setup callback run before predecode.
uint8_t * tif_rawdata
Raw buffer; ownership/mapping follow TIFF_MYBUFFER and TIFF_BUFFERMMAP.
TIFFHeaderUnion tif_header
Inline decoded classic TIFF or BigTIFF file header.
tmsize_t tif_rawdatasize
Raw-buffer capacity in bytes; kept in step with tif_rawdata, including zero whenever tif_rawdata is N...
tmsize_t tif_max_cumulated_mem_alloc
Cumulative tracked-allocation byte limit; zero means unlimited.
tmsize_t tif_rawdataoff
Byte offset of the raw-buffer window within the strip.
uint32_t tif_flags
Bitmask combining the TIFF_* handle-state flags declared below.
size_t tif_nfieldscompat
Number of entries in tif_fieldscompat.
uint64_t tif_lastdiroff
Byte offset of the last directory written so far.
TIFFCodeMethod tif_decodetile
Codec callback decoding tile data.
int tif_mode
Current access mode using the O_* constants.
TIFFFieldArray * tif_fieldscompat
Owned array of legacy field-registration batches.
TIFFSizeProc tif_sizeproc
Client file-size callback.
uint8_t * tif_base
Mapped-file base provided by tif_mapproc; released through tif_unmapproc by TIFFCleanup() only while ...
Define private build features, platform probes, and formatting helpers.
Define private directory storage, field schemas, and presence bits.
Declare the private callback-driven hash-set interface.
Define portability macros for optional bounds-safety annotations.
Declare the public C library interface and its supporting types.