LibTIFF 4.7.2
TIFF library public API and implementation reference
Loading...
Searching...
No Matches
tiffiop.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 1988-1997 Sam Leffler
3 * Copyright (c) 1991-1997 Silicon Graphics, Inc.
4 *
5 * Permission to use, copy, modify, distribute, and sell this software and
6 * its documentation for any purpose is hereby granted without fee, provided
7 * that (i) the above copyright notices and this permission notice appear in
8 * all copies of the software and related documentation, and (ii) the names of
9 * Sam Leffler and Silicon Graphics may not be used in any advertising or
10 * publicity relating to the software without the specific, prior written
11 * permission of Sam Leffler and Silicon Graphics.
12 *
13 * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
14 * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
15 * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
16 *
17 * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
18 * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
19 * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
20 * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
21 * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
22 * OF THIS SOFTWARE.
23 */
24
30#ifndef _TIFFIOP_
31#define _TIFFIOP_
32/*
33 * ``Library-private'' definitions.
34 */
35
36#include "tif_config.h"
37
38#ifdef HAVE_FCNTL_H
39#include <fcntl.h>
40#endif
41
42#ifdef HAVE_SYS_TYPES_H
43#include <sys/types.h>
44#endif
45
46#include <math.h>
47#include <stdbool.h>
48#include <string.h>
49
50#ifdef HAVE_ASSERT_H
51#include <assert.h>
52#else
63#define assert(x)
64#endif
65
66#include "tif_hash_set.h"
67#include "tiffio.h"
68
69#include "tif_dir.h"
70
71#include "tiff_bounds_safety.h"
72
73#include <limits.h>
74
75#ifndef STRIP_SIZE_DEFAULT
80#define STRIP_SIZE_DEFAULT 8192
81#endif
82
83#ifndef TIFF_MAX_DIR_COUNT
88#define TIFF_MAX_DIR_COUNT 1048576
89#endif
90
95#define TIFF_NON_EXISTENT_DIR_NUMBER UINT_MAX
96
108#define streq(a, b) (strcmp(a, b) == 0)
124#define strneq(a, b, n) (strncmp(a, b, n) == 0)
125
126#ifndef TRUE
131#define TRUE 1
136#define FALSE 0
137#endif
138
147typedef struct client_info
148{
152 void *data;
154 char *name;
156
157/*
158 * Typedefs for ``method pointers'' used internally.
159 * these are deprecated and provided only for backwards compatibility.
160 */
165typedef unsigned char tidataval_t;
171
186typedef void (*TIFFVoidMethod)(TIFF *tif);
202typedef int (*TIFFBoolMethod)(TIFF *tif);
218typedef int (*TIFFPreMethod)(TIFF *tif, uint16_t sample);
241typedef int (*TIFFCodeMethod)(TIFF *tif, uint8_t *buf, tmsize_t size,
242 uint16_t sample);
259typedef int (*TIFFSeekMethod)(TIFF *tif, uint32_t nrows);
277typedef void (*TIFFPostMethod)(TIFF *tif, uint8_t *buf, tmsize_t size);
297typedef uint32_t (*TIFFStripMethod)(TIFF *tif, uint32_t request);
315typedef void (*TIFFTileMethod)(TIFF *tif, uint32_t *tw, uint32_t *th);
331typedef uint64_t (*TIFFGetMaxCompressionRatioMethod)(TIFF *tif);
332
351
369
388struct tiff
389{
394 char *tif_name;
404 uint32_t tif_flags;
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
553
558 uint64_t tif_diroff;
581
599 tdir_t tif_curdir; /* current directory (index) */
606 uint64_t tif_curoff;
613 uint64_t tif_dataoff;
614 /* SubIFD support */
616 uint16_t tif_nsubifd;
619 /* compression scheme hooks */
668 /* returns maximum compression ratio for current compression method */
675 uint8_t *tif_data;
676 /* input/output buffering */
681 uint8_t *tif_rawdata TIFF_COUNTED_BY_OR_NULL(tif_rawdatasize);
692 uint8_t *tif_rawcp;
697 /* memory-mapped file support */
703 uint8_t *tif_base;
710 /* input/output callback methods */
723 /* post-decoding support */
728 /* tag support */
748 /* Backward compatibility stuff. We need these two fields for
749 * setting up an old tag extension scheme. */
754 /* Error handler support */
778};
779
809
821#define isPseudoTag(t) (t > 0xffff) /* is tag value normal or pseudo */
822
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)))
979
980/*
981 * Default Read/Seek/Write definitions.
982 */
983#ifndef ReadOK
1000#define ReadOK(tif, buf, size) \
1001 (TIFFReadFile((tif), (buf), (size)) == (tmsize_t)(size))
1002#endif
1003#ifndef SeekOK
1017#define SeekOK(tif, off) _TIFFSeekOK(tif, off)
1018#endif
1019#ifndef WriteOK
1035#define WriteOK(tif, buf, size) \
1036 (TIFFWriteFile((tif), (buf), (size)) == (tmsize_t)(size))
1037#endif
1038
1039/* NB: the uint32_t casts are to silence certain ANSI-C compilers */
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))) \
1059 : 0U)
1060/* Variant of TIFFhowmany_32() that doesn't return 0 if x close to MAXUINT. */
1061/* Caution: TIFFhowmany_32_maxuint_compat(x,y)*y might overflow */
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)))
1143
1144/* Safe multiply which returns zero if there is an *unsigned* integer overflow.
1145 * This macro is not safe for *signed* integer types */
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))) \
1167 : (t)0)
1168
1169/*
1170 * Overflow-safe computation of uint32_t parameters: (index % count) *
1171 * dimension. Sets `result` to the product, or 0 when either operand is 0.
1172 * Evaluates to 0 on success, nonzero on overflow.
1173 */
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), \
1199 (module))) == 0))
1200
1213#define TIFFmax(A, B) ((A) > (B) ? (A) : (B))
1226#define TIFFmin(A, B) ((A) < (B) ? (A) : (B))
1227
1239#define TIFFArrayCount(a) (sizeof(a) / sizeof((a)[0]))
1240
1241/* Float/double equality macros that suppress -Wfloat-equal warnings */
1256#define TIFF_FLOAT_EQ(x, y) (!(fabsf((x) - (y)) > 0.0f))
1271#define TIFF_DOUBLE_EQ(x, y) (!(fabs((x) - (y)) > 0.0))
1272
1273/*
1274 Support for large files.
1275
1276 Windows read/write APIs support only 'unsigned int' rather than 'size_t'.
1277 Windows off_t is only 32-bit, even in 64-bit builds.
1278*/
1279#if defined(HAVE_FSEEKO)
1280/*
1281 Use fseeko() and ftello() if they are available since they use
1282 'off_t' rather than 'long'. It is wrong to use fseeko() and
1283 ftello() only on systems with special LFS support since some systems
1284 (e.g. FreeBSD) support a 64-bit off_t by default.
1285
1286 For MinGW, __MSVCRT_VERSION__ must be at least 0x800 to expose these
1287 interfaces. The MinGW compiler must support the requested version. MinGW
1288 does not distribute the CRT (it is supplied by Microsoft) so the correct CRT
1289 must be available on the target computer in order for the program to run.
1290*/
1291#if defined(HAVE_FSEEKO)
1307#define fseek(stream, offset, whence) fseeko(stream, offset, whence)
1321#define ftell(stream) ftello(stream)
1322#endif
1323#endif
1324#if defined(_WIN32) && \
1325 !(defined(__MSVCRT_VERSION__) && __MSVCRT_VERSION__ < 0x800)
1329typedef unsigned int TIFFIOSize_t;
1345#define _TIFF_lseek_f(fildes, offset, whence) \
1346 _lseeki64(fildes, /* __int64 */ offset, whence)
1347/* #define _TIFF_tell_f(fildes) /\* __int64 *\/ _telli64(fildes) */
1363#define _TIFF_fseek_f(stream, offset, whence) \
1364 _fseeki64(stream, /* __int64 */ offset, whence)
1379#define _TIFF_fstat_f(fildes, stat_buff) \
1380 _fstati64(fildes, /* struct _stati64 */ stat_buff)
1381/* #define _TIFF_ftell_f(stream) /\* __int64 *\/ _ftelli64(stream) */
1382/* #define _TIFF_stat_f(path,stat_buff) _stati64(path,/\* struct _stati64 *\/
1383 * stat_buff) */
1388#define _TIFF_stat_s struct _stati64
1393#define _TIFF_off_t __int64
1394#else
1398typedef size_t TIFFIOSize_t;
1414#define _TIFF_lseek_f(fildes, offset, whence) lseek(fildes, offset, whence)
1415/* #define _TIFF_tell_f(fildes) (_TIFF_lseek_f(fildes,0,SEEK_CUR)) */
1431#define _TIFF_fseek_f(stream, offset, whence) fseek(stream, offset, whence)
1446#define _TIFF_fstat_f(fildes, stat_buff) fstat(fildes, stat_buff)
1447/* #define _TIFF_ftell_f(stream) ftell(stream) */
1448/* #define _TIFF_stat_f(path,stat_buff) stat(path,stat_buff) */
1453#define _TIFF_stat_s struct stat
1458#define _TIFF_off_t off_t
1459#endif
1460
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")))
1470#else
1476#define TIFF_NOSANITIZE_UNSIGNED_INT_OVERFLOW
1477#endif
1478#else
1484#define TIFF_NOSANITIZE_UNSIGNED_INT_OVERFLOW
1485#endif
1486
1487#if defined(__cplusplus)
1488extern "C"
1489{
1490#endif
1504 extern int _tiffDummyMapProc(thandle_t fd, void **pbase, toff_t *psize);
1517 extern void _tiffDummyUnmapProc(thandle_t fd, void *base, toff_t size);
1537 extern int _TIFFgetMode(TIFFOpenOptions *opts, thandle_t clientdata,
1538 const char *mode, const char *module);
1556 extern int _TIFFNoRowEncode(TIFF *tif, uint8_t *pp, tmsize_t cc,
1557 uint16_t s);
1575 extern int _TIFFNoStripEncode(TIFF *tif, uint8_t *pp, tmsize_t cc,
1576 uint16_t s);
1594 extern int _TIFFNoTileEncode(TIFF *tif, uint8_t *pp, tmsize_t cc,
1595 uint16_t s);
1613 extern int _TIFFNoRowDecode(TIFF *tif, uint8_t *pp, tmsize_t cc,
1614 uint16_t s);
1632 extern int _TIFFNoStripDecode(TIFF *tif, uint8_t *pp, tmsize_t cc,
1633 uint16_t s);
1651 extern int _TIFFNoTileDecode(TIFF *tif, uint8_t *pp, tmsize_t cc,
1652 uint16_t s);
1664 extern void _TIFFNoPostDecode(TIFF *tif, uint8_t *buf, tmsize_t cc);
1677 extern int _TIFFNoPreCode(TIFF *tif, uint16_t s);
1692 extern int _TIFFNoSeek(TIFF *tif, uint32_t off);
1708 extern void _TIFFSwab16BitData(TIFF *tif, uint8_t *buf, tmsize_t cc);
1723 extern void _TIFFSwab24BitData(TIFF *tif, uint8_t *buf, tmsize_t cc);
1739 extern void _TIFFSwab32BitData(TIFF *tif, uint8_t *buf, tmsize_t cc);
1755 extern void _TIFFSwab64BitData(TIFF *tif, uint8_t *buf, tmsize_t cc);
1776 extern int _TIFFCheckPostDecodeLength(TIFF *tif,
1777 TIFFPostMethod tif_postdecode,
1778 tmsize_t cc, const char *modulename);
1796 extern int TIFFFlushData1(TIFF *tif);
1815 extern int TIFFDefaultDirectory(TIFF *tif);
1830 extern void _TIFFSetDefaultCompressionState(TIFF *tif);
1867 extern int _TIFFRewriteField(TIFF *tif, uint16_t tag,
1868 TIFFDataType in_datatype, tmsize_t count,
1869 void *data);
1891 extern int TIFFSetCompressionScheme(TIFF *tif, int scheme);
1927 extern uint32_t _TIFFDefaultStripSize(TIFF *tif, uint32_t s);
1944 extern void _TIFFDefaultTileSize(TIFF *tif, uint32_t *tw, uint32_t *th);
1945
1967 extern void _TIFFsetByteArray(void **vpp, const void *vp, uint32_t n);
1968
1994 extern void _TIFFsetByteArrayExt(TIFF *tif, void **vpp, const void *vp,
1995 uint32_t n);
1996
2018 extern void _TIFFsetShortArray(uint16_t **wpp, const uint16_t *wp,
2019 uint32_t n);
2020
2046 extern void _TIFFsetShortArrayExt(TIFF *tif, uint16_t **wpp,
2047 const uint16_t *wp, uint32_t n);
2048
2070 extern void _TIFFsetLongArray(uint32_t **lpp, const uint32_t *lp,
2071 uint32_t n);
2072
2098 extern void _TIFFsetLongArrayExt(TIFF *tif, uint32_t **lpp,
2099 const uint32_t *lp, uint32_t n);
2100
2122 extern void _TIFFsetFloatArray(float **fpp, const float *fp, uint32_t n);
2123
2149 extern void _TIFFsetFloatArrayExt(TIFF *tif, float **fpp, const float *fp,
2150 uint32_t n);
2151
2173 extern void _TIFFsetDoubleArray(double **dpp, const double *dp, uint32_t n);
2174
2200 extern void _TIFFsetDoubleArrayExt(TIFF *tif, double **dpp,
2201 const double *dp, uint32_t n);
2202
2224 extern void _TIFFprintAscii(FILE *fd, const char *cp);
2247 extern void _TIFFprintAsciiTag(FILE *fd, const char *name,
2248 const char *value);
2249
2314 void _TIFFErrorEarly(TIFFOpenOptions *opts, thandle_t clientdata,
2315 const char *module, const char *fmt, ...)
2316 TIFF_ATTRIBUTE((__format__(__printf__, 4, 5)));
2317
2337 extern uint32_t _TIFFMultiply32(TIFF *tif, uint32_t first, uint32_t second,
2338 const char *where);
2339
2356 extern uint32_t _TIFFParseUInt32(const char *str, uint32_t default_value,
2357 uint32_t max_value);
2358
2378 extern uint64_t _TIFFMultiply64(TIFF *tif, uint64_t first, uint64_t second,
2379 const char *where);
2380
2398 extern uint64_t _TIFFAdd64(TIFF *tif, uint64_t first, uint64_t second,
2399 const char *where);
2400
2419 extern tmsize_t _TIFFMultiplySSize(TIFF *tif, tmsize_t first,
2420 tmsize_t second, const char *where);
2421
2440 extern tmsize_t _TIFFAddSSize(TIFF *tif, tmsize_t first, tmsize_t second,
2441 const char *where);
2442
2459 extern tmsize_t _TIFFCastUInt64ToSSize(TIFF *tif, uint64_t val,
2460 const char *module);
2461
2478 extern uint32_t _TIFFCastUInt64ToUInt32(TIFF *tif, uint64_t val,
2479 const char *module);
2480
2506 extern uint32_t _TIFFMultiply32Ext(TIFF *tif, uint32_t first,
2507 uint32_t second, const char *where,
2508 bool *pOverflowed);
2509
2531 extern uint64_t _TIFFAdd64Ext(TIFF *tif, uint64_t first, uint64_t second,
2532 const char *where, bool *pOverflowed);
2533
2555 extern uint32_t _TIFFCastUInt64ToUInt32Ext(TIFF *tif, uint64_t val,
2556 const char *module,
2557 bool *pOverflowed);
2558
2586 extern uint32_t _TIFFComputeTileExt(TIFF *tif, uint32_t x, uint32_t y,
2587 uint32_t z, uint16_t s,
2588 bool *pOverflowed);
2589
2610 extern uint64_t _TIFFComputeRowSize64(TIFF *tif, uint32_t width,
2611 uint16_t spp, uint16_t bps,
2612 const char *where);
2613
2631 extern tmsize_t _TIFFComputeRowOffset(TIFF *tif, tmsize_t rowstride,
2632 uint32_t row, const char *where);
2633
2651 extern uint64_t _TIFFComputeBitOffset(TIFF *tif, uint32_t col, uint16_t spp,
2652 uint16_t bps, const char *where);
2653
2675 extern void _TIFFfreeExt(TIFF *tif, void *p);
2676
2700 extern void *_TIFFmallocExt(TIFF *tif, tmsize_t s) TIFF_ATTRIBUTE_MALLOC
2701 TIFF_ATTRIBUTE_ALLOC_SIZE(2) TIFF_ATTRIBUTE_DEALLOC(_TIFFfreeExt, 2);
2702
2728 extern void *_TIFFcallocExt(TIFF *tif, tmsize_t nmemb,
2729 tmsize_t siz) TIFF_ATTRIBUTE_MALLOC
2730 TIFF_ATTRIBUTE_ALLOC_SIZE2(2, 3)
2731 TIFF_ATTRIBUTE_DEALLOC(_TIFFfreeExt, 2);
2732
2759 extern void *_TIFFreallocExt(TIFF *tif, void *p, tmsize_t s)
2760 TIFF_ATTRIBUTE_ALLOC_SIZE(3) TIFF_ATTRIBUTE_DEALLOC(_TIFFfreeExt, 2);
2761
2786 /* Not marked TIFF_ATTRIBUTE_DEALLOC(_TIFFfreeExt, 2): the tools, which
2787 * cannot call the unexported _TIFFfreeExt(), release the result with
2788 * _TIFFfree(). */
2789 extern void *_TIFFCheckMalloc(TIFF *tif, tmsize_t nmemb, tmsize_t elem_size,
2790 const char *what) TIFF_ATTRIBUTE_MALLOC
2791 TIFF_ATTRIBUTE_ALLOC_SIZE2(2, 3);
2792
2820 extern void *_TIFFCheckRealloc(TIFF *tif, void *buffer, tmsize_t nmemb,
2821 tmsize_t elem_size, const char *what)
2822 TIFF_ATTRIBUTE_ALLOC_SIZE2(3, 4);
2823
2837 extern float _TIFFClampDoubleToFloat(double val);
2838
2851 extern uint32_t _TIFFClampDoubleToUInt32(double val);
2852
2864 extern void _TIFFCleanupIFDOffsetAndNumberMaps(TIFF *tif);
2865
2894 extern uint64_t _TIFFStrileSize64(TIFF *tif, uint32_t nrows, int isStrip);
2895
2931 uint32_t strip,
2932 void **buf,
2933 tmsize_t bufsizetoalloc,
2934 tmsize_t size_to_read);
2971 extern tmsize_t _TIFFReadEncodedTileAndAllocBuffer(TIFF *tif, uint32_t tile,
2972 void **buf,
2973 tmsize_t bufsizetoalloc,
2974 tmsize_t size_to_read);
3010 extern tmsize_t _TIFFReadTileAndAllocBuffer(TIFF *tif, void **buf,
3011 tmsize_t bufsizetoalloc,
3012 uint32_t x, uint32_t y,
3013 uint32_t z, uint16_t s);
3014
3030 extern int _TIFFSeekOK(TIFF *tif, toff_t off);
3031
3047 extern int TIFFInitDumpMode(TIFF *tif, int scheme);
3048#ifdef PACKBITS_SUPPORT
3064 extern int TIFFInitPackBits(TIFF *tif, int scheme);
3065#endif
3066#ifdef CCITT_SUPPORT
3085 extern int TIFFInitCCITTRLE(TIFF *tif, int scheme);
3104 extern int TIFFInitCCITTRLEW(TIFF *tif, int scheme);
3123 extern int TIFFInitCCITTFax3(TIFF *tif, int scheme);
3142 extern int TIFFInitCCITTFax4(TIFF *tif, int scheme);
3143#endif
3144#ifdef THUNDER_SUPPORT
3160 extern int TIFFInitThunderScan(TIFF *tif, int scheme);
3161#endif
3162#ifdef NEXT_SUPPORT
3178 extern int TIFFInitNeXT(TIFF *tif, int scheme);
3179#endif
3180#ifdef LZW_SUPPORT
3198 extern int TIFFInitLZW(TIFF *tif, int scheme);
3199#endif
3200#ifdef OJPEG_SUPPORT
3219 extern int TIFFInitOJPEG(TIFF *tif, int scheme);
3220#endif
3221#ifdef JPEG_SUPPORT
3240 extern int TIFFInitJPEG(TIFF *tif, int scheme);
3258 extern int TIFFJPEGIsFullStripRequired(TIFF *tif);
3259#endif
3260#ifdef JBIG_SUPPORT
3278 extern int TIFFInitJBIG(TIFF *tif, int scheme);
3279#endif
3280#ifdef ZIP_SUPPORT
3300 extern int TIFFInitZIP(TIFF *tif, int scheme);
3301#endif
3302#ifdef PIXARLOG_SUPPORT
3323 extern int TIFFInitPixarLog(TIFF *tif, int scheme);
3324#endif
3325#ifdef LOGLUV_SUPPORT
3345 extern int TIFFInitSGILog(TIFF *tif, int scheme);
3346#endif
3347#ifdef LERC_SUPPORT
3368 extern int TIFFInitLERC(TIFF *tif, int scheme);
3369#endif
3370#ifdef LZMA_SUPPORT
3390 extern int TIFFInitLZMA(TIFF *tif, int scheme);
3391#endif
3392#ifdef ZSTD_SUPPORT
3410 extern int TIFFInitZSTD(TIFF *tif, int scheme);
3411#endif
3412#ifdef WEBP_SUPPORT
3432 extern int TIFFInitWebP(TIFF *tif, int scheme);
3433#endif
3442 extern const TIFFCodec _TIFFBuiltinCODECS[];
3464 extern void TIFFCIELab16ToXYZ(TIFFCIELabToRGB *cielab, uint32_t l,
3465 int32_t a, int32_t b, float *X, float *Y,
3466 float *Z);
3467
3496
3519 extern enum TIFFReadDirEntryErr
3521 double *value);
3522
3523#if defined(__cplusplus)
3524}
3525#endif
3526#endif /* _TIFFIOP_ */
tmsize_t _TIFFAddSSize(TIFF *tif, tmsize_t first, tmsize_t second, const char *where)
Check and add two signed-size operands.
Definition tif_aux.c:116
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...
Definition tif_aux.c:166
uint32_t _TIFFClampDoubleToUInt32(double val)
Clamp and truncate a double to an unsigned 32-bit value.
Definition tif_aux.c:611
uint32_t _TIFFParseUInt32(const char *str, uint32_t default_value, uint32_t max_value)
Parse a decimal unsigned integer with a fallback value.
Definition tif_aux.c:58
int _TIFFSeekOK(TIFF *tif, toff_t off)
Test whether an allowed absolute client seek reaches its target.
Definition tif_aux.c:620
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.
Definition tif_aux.c:234
uint32_t _TIFFCastUInt64ToUInt32(TIFF *tif, uint64_t val, const char *module)
Convert an unsigned 64-bit value after checking the destination range.
Definition tif_aux.c:153
uint64_t _TIFFAdd64(TIFF *tif, uint64_t first, uint64_t second, const char *where)
Check and add two unsigned operands.
Definition tif_aux.c:85
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.
Definition tif_aux.c:213
uint32_t _TIFFMultiply32(TIFF *tif, uint32_t first, uint32_t second, const char *where)
Multiply two unsigned values with an overflow check.
Definition tif_aux.c:40
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...
Definition tif_aux.c:197
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.
Definition tif_aux.c:221
tmsize_t _TIFFCastUInt64ToSSize(TIFF *tif, uint64_t val, const char *module)
Convert an unsigned 64-bit value after checking the destination range.
Definition tif_aux.c:140
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.
Definition tif_aux.c:180
float _TIFFClampDoubleToFloat(double val)
Clamp a double to the finite float range before conversion.
Definition tif_aux.c:602
uint64_t _TIFFMultiply64(TIFF *tif, uint64_t first, uint64_t second, const char *where)
Multiply two unsigned values with an overflow check.
Definition tif_aux.c:46
tmsize_t _TIFFMultiplySSize(TIFF *tif, tmsize_t first, tmsize_t second, const char *where)
Check and multiply two signed-size operands.
Definition tif_aux.c:91
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.
Definition tif_next.c:262
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.
Definition tif_codec.c:91
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.
Definition tif_color.c:68
int TIFFInitZIP(TIFF *tif, int scheme)
Install predictor-aware Deflate codec and allocator hooks.
Definition tif_zip.c:1018
TIFFErrorHandler _TIFFwarningHandler
Store the global warning callback.
Definition tif_unix.c:530
TIFFErrorHandlerExt _TIFFerrorHandlerExt
Store the global extended error callback.
Definition tif_error.c:35
TIFFErrorHandlerExt _TIFFwarningHandlerExt
Store the global extended warning callback.
Definition tif_warning.c:35
TIFFErrorHandler _TIFFerrorHandler
Store the global error callback.
Definition tif_unix.c:553
int TIFFDefaultDirectory(TIFF *tif)
Install the image schema, default values, and core tag methods.
Definition tif_dir.c:2316
void _TIFFprintAsciiTag(FILE *fd, const char *name, const char *value)
Print a labelled quoted value using the private ASCII formatter.
Definition tif_print.c:906
void _TIFFprintAscii(FILE *fd, const char *cp)
Print a terminated string using the private ASCII escape convention.
Definition tif_print.c:856
int TIFFInitCCITTRLE(TIFF *tif, int scheme)
Install CCITTRLE fax callbacks and default mode.
Definition tif_fax3.c:2674
int TIFFInitCCITTRLEW(TIFF *tif, int scheme)
Install CCITTRLEW fax callbacks and default mode.
Definition tif_fax3.c:2693
int TIFFInitCCITTFax4(TIFF *tif, int scheme)
Install CCITTFax4 fax callbacks and default mode.
Definition tif_fax3.c:2512
int TIFFInitCCITTFax3(TIFF *tif, int scheme)
Install CCITTFax3 fax callbacks and default mode.
Definition tif_fax3.c:2263
TIFFReadDirEntryErr
Classify directory-entry decoding failures.
Definition tiffiop.h:3478
enum TIFFReadDirEntryErr _TIFFReadDirEntryCheckedRational(TIFF *tif, TIFFDirEntry *direntry, double *value)
Read a prevalidated rational value.
@ TIFFReadDirEntryErrPsdif
Per-sample values differ where uniform values are required.
Definition tiffiop.h:3490
@ TIFFReadDirEntryErrIo
Mapped extent, seek, or read failure.
Definition tiffiop.h:3486
@ TIFFReadDirEntryErrRange
Value cannot be represented by the target integer type.
Definition tiffiop.h:3488
@ TIFFReadDirEntryErrSizesan
Source or target array exceeds the configured sanity ceiling.
Definition tiffiop.h:3492
@ TIFFReadDirEntryErrAlloc
Allocation, policy, or large-request/file-size rejection.
Definition tiffiop.h:3494
@ TIFFReadDirEntryErrType
Unsupported source file data type.
Definition tiffiop.h:3484
@ TIFFReadDirEntryErrCount
Unsupported or inconsistent element count.
Definition tiffiop.h:3482
@ TIFFReadDirEntryErrOk
Successful or accepted empty conversion.
Definition tiffiop.h:3480
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.
Definition tif_tile.c:326
void(* TIFFTileMethod)(TIFF *tif, uint32_t *tw, uint32_t *th)
Adjust tile width and height for the current codec.
Definition tiffiop.h:315
uint64_t _TIFFStrileSize64(TIFF *tif, uint32_t nrows, int isStrip)
Compute row-aligned decoded storage for a strip or tile-height request.
Definition tif_strip.c:106
uint32_t _TIFFDefaultStripSize(TIFF *tif, uint32_t s)
Choose a default strip height near STRIP_SIZE_DEFAULT bytes.
Definition tif_strip.c:263
uint32_t(* TIFFStripMethod)(TIFF *tif, uint32_t request)
Recommend rows per strip for the current geometry and codec.
Definition tiffiop.h:297
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...
Definition tif_tile.c:52
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.
Definition tif_read.c:1373
int(* TIFFSeekMethod)(TIFF *tif, uint32_t nrows)
Advance codec decoding or encoding by a row count.
Definition tiffiop.h:259
int _TIFFCheckPostDecodeLength(TIFF *tif, TIFFPostMethod tif_postdecode, tmsize_t cc, const char *modulename)
Check the byte count for a byte-swapping postdecode method.
Definition tif_read.c:2260
int(* TIFFPreMethod)(TIFF *tif, uint16_t sample)
Prepare a codec for one sample plane.
Definition tiffiop.h:218
int(* TIFFCodeMethod)(TIFF *tif, uint8_t *buf, tmsize_t size, uint16_t sample)
Encode or decode a requested image-data extent.
Definition tiffiop.h:241
void _TIFFNoPostDecode(TIFF *tif, uint8_t *buf, tmsize_t cc)
Leave decoded bytes unchanged.
Definition tif_read.c:2209
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.
Definition tif_read.c:769
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.
Definition tif_read.c:1350
void(* TIFFPostMethod)(TIFF *tif, uint8_t *buf, tmsize_t size)
Transform image bytes in place after decoding or before encoding.
Definition tiffiop.h:277
void(* TIFFVoidMethod)(TIFF *tif)
Run a codec close or cleanup operation.
Definition tiffiop.h:186
void _TIFFSwab24BitData(TIFF *tif, uint8_t *buf, tmsize_t cc)
Swap each 3-byte sample in place.
Definition tif_read.c:2226
void _TIFFSwab16BitData(TIFF *tif, uint8_t *buf, tmsize_t cc)
Swap each 2-byte sample in place.
Definition tif_read.c:2216
int TIFFFlushData1(TIFF *tif)
Append buffered encoded bytes without invoking postencode recursively.
Definition tif_write.c:1213
uint64_t(* TIFFGetMaxCompressionRatioMethod)(TIFF *tif)
Return the codec allocation-sanity compression-ratio heuristic.
Definition tiffiop.h:331
void _TIFFSwab32BitData(TIFF *tif, uint8_t *buf, tmsize_t cc)
Swap each 4-byte sample in place.
Definition tif_read.c:2236
int(* TIFFBoolMethod)(TIFF *tif)
Run a codec setup or completion operation.
Definition tiffiop.h:202
void _TIFFSwab64BitData(TIFF *tif, uint8_t *buf, tmsize_t cc)
Swap each 8-byte sample in place.
Definition tif_read.c:2246
int TIFFInitJBIG(TIFF *tif, int scheme)
Install single-strip JBIG callbacks and mutable raw-input policy.
Definition tif_jbig.c:387
int TIFFJPEGIsFullStripRequired(TIFF *tif)
Probe whether cached JPEG input needs whole-strile decoding.
Definition tif_jpeg.c:2410
int TIFFInitJPEG(TIFF *tif, int scheme)
Allocate JPEG-in-TIFF codec state and install method chains.
Definition tif_jpeg.c:4724
int TIFFInitLERC(TIFF *tif, int scheme)
Allocate LERC staging state and install frame callbacks and pseudo-tags.
Definition tif_lerc.c:1863
void _TIFFCleanupIFDOffsetAndNumberMaps(TIFF *tif)
Release a handle's directory-offset/index lookup maps.
Definition tif_close.c:127
int _tiffDummyMapProc(thandle_t fd, void **pbase, toff_t *psize)
Decline mapping when the client supplies no mapping implementation.
Definition tif_open.c:45
void _TIFFErrorEarly(TIFFOpenOptions *opts, thandle_t clientdata, const char *module, const char *fmt,...)
Report an opening error before a complete TIFF handle is available.
Definition tif_error.c:85
int _TIFFgetMode(TIFFOpenOptions *opts, thandle_t clientdata, const char *mode, const char *module)
Translate the leading open-mode characters into OS access flags.
Definition tif_open.c:60
void _tiffDummyUnmapProc(thandle_t fd, void *base, toff_t size)
Provide a no-op unmapper when the client omits one.
Definition tif_open.c:53
int TIFFInitLZMA(TIFF *tif, int scheme)
Allocate predictor-aware LZMA2 codec state and install callbacks.
Definition tif_lzma.c:741
int TIFFInitLZW(TIFF *tif, int scheme)
Allocate LZW codec state and install predictor-aware methods.
Definition tif_lzw.c:1742
void _TIFFfreeExt(TIFF *tif, void *p)
Release a handle-aware allocation and its payload charge.
Definition tif_open.c:301
void _TIFFsetLongArray(uint32_t **lpp, const uint32_t *lp, uint32_t n)
Replace an owned long array with a copied array.
Definition tif_dir.c:141
void _TIFFsetLongArrayExt(TIFF *tif, uint32_t **lpp, const uint32_t *lp, uint32_t n)
Replace an owned long array with a copied array.
Definition tif_dir.c:145
void _TIFFsetByteArray(void **vpp, const void *vp, uint32_t n)
Replace an owned byte array with a copied array.
Definition tif_dir.c:103
void _TIFFsetFloatArrayExt(TIFF *tif, float **fpp, const float *fp, uint32_t n)
Replace an owned float array with a copied array.
Definition tif_dir.c:175
void _TIFFsetByteArrayExt(TIFF *tif, void **vpp, const void *vp, uint32_t n)
Replace an owned byte array with a copied array.
Definition tif_dir.c:107
void * _TIFFreallocExt(TIFF *tif, void *p, tmsize_t s)
Resize a handle-aware block or release it for a nonpositive size.
Definition tif_open.c:257
void _TIFFsetDoubleArray(double **dpp, const double *dp, uint32_t n)
Replace an owned double array with a copied array.
Definition tif_dir.c:180
void _TIFFsetDoubleArrayExt(TIFF *tif, double **dpp, const double *dp, uint32_t n)
Replace an owned double array with a copied array.
Definition tif_dir.c:184
void * _TIFFmallocExt(TIFF *tif, tmsize_t s)
Allocate uninitialised bytes under a handle's allocation policy.
Definition tif_open.c:195
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.
Definition tif_aux.c:249
void _TIFFsetShortArray(uint16_t **wpp, const uint16_t *wp, uint32_t n)
Replace an owned short array with a copied array.
Definition tif_dir.c:131
void * _TIFFCheckMalloc(TIFF *tif, tmsize_t nmemb, tmsize_t elem_size, const char *what)
Allocate a checked array with an allocation-failure diagnostic.
Definition tif_aux.c:274
void * _TIFFcallocExt(TIFF *tif, tmsize_t nmemb, tmsize_t siz)
Allocate a zero-filled array under a handle's allocation policy.
Definition tif_open.c:224
void _TIFFsetShortArrayExt(TIFF *tif, uint16_t **wpp, const uint16_t *wp, uint32_t n)
Replace an owned short array with a copied array.
Definition tif_dir.c:135
void _TIFFsetFloatArray(float **fpp, const float *fp, uint32_t n)
Replace an owned float array with a copied array.
Definition tif_dir.c:171
int TIFFInitOJPEG(TIFF *tif, int scheme)
Install the decode-only old-style JPEG codec.
Definition tif_ojpeg.c:1020
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.
Definition tif_luv.c:2981
unsigned char tidataval_t
Name a legacy internal image byte.
Definition tiffiop.h:165
size_t TIFFIOSize_t
Represent a native POSIX I/O byte count.
Definition tiffiop.h:1398
tidataval_t * tidata_t
Name a legacy pointer to internal image bytes.
Definition tiffiop.h:170
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.
Definition tif_webp.c:1167
int TIFFInitZSTD(TIFF *tif, int scheme)
Allocate ZSTD state and install predictor-aware streaming methods.
Definition tif_zstd.c:603
#define TIFF_ATTRIBUTE(x)
Expand a compiler attribute in a public declaration when supported.
Definition tiffio.h:764
void(* TIFFErrorHandlerExt)(thandle_t fd, const char *module, const char *fmt, va_list ap)
Handle a library-wide error or warning diagnostic.
Definition tiffio.h:858
void(* TIFFErrorHandler)(const char *module, const char *fmt, va_list ap)
Handle a library-wide error or warning diagnostic.
Definition tiffio.h:835
toff_t(* TIFFSeekProc)(thandle_t fd, toff_t off, int whence)
Change the current position of a client I/O resource.
Definition tiffio.h:933
int(* TIFFCloseProc)(thandle_t fd)
Release a client I/O resource or its adapter context.
Definition tiffio.h:951
void(* TIFFUnmapFileProc)(thandle_t fd, void *base, toff_t size)
Release a whole-file view supplied by a mapping callback.
Definition tiffio.h:1008
toff_t(* TIFFSizeProc)(thandle_t fd)
Query the byte length of a client I/O resource.
Definition tiffio.h:968
tmsize_t(* TIFFReadWriteProc)(thandle_t fd, void *buf, tmsize_t size)
Transfer bytes at the current position of a client I/O resource.
Definition tiffio.h:911
int(* TIFFMapFileProc)(thandle_t fd, void **base, toff_t *size)
Provide a readable whole-file view of a client resource.
Definition tiffio.h:989
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.
Definition tiffio.h:884
TIFF_SSIZE_T tmsize_t
Represent a signed memory or I/O size in bytes.
Definition tiffio.h:89
TIFFDataType
Identify the on-disk representation of a TIFF directory field.
Definition tiff.h:229
uint64_t toff_t
Represent an unsigned file byte offset independently of off_t.
Definition tiffio.h:94
uint32_t tdir_t
Represent a zero-based directory index, rather than a file offset.
Definition tiffio.h:96
void * thandle_t
Carry an opaque client I/O context through library callbacks.
Definition tiffio.h:161
Hold CIE L*a*b*-to-RGB conversion parameters and tables.
Definition tiffio.h:361
Describe a named compression scheme and its initialiser.
Definition tiffio.h:706
Represent a parsed directory entry before value conversion.
Definition tif_dir.h:82
Store the current directory values and image traversal state.
Definition tif_dir.h:143
Represent a BigTIFF header with a 64-bit directory offset.
Definition tiff.h:195
Represent a classic TIFF header with a 32-bit directory offset.
Definition tiff.h:181
Represent the common prefix of classic TIFF and BigTIFF headers.
Definition tiff.h:169
Pair a directory file offset with its main-IFD index.
Definition tiffiop.h:341
tdir_t dirNumber
Zero-based main-directory index associated with offset.
Definition tiffiop.h:345
uint64_t offset
Directory byte offset from the beginning of the file.
Definition tiffiop.h:343
Hold allocation limits and diagnostics used when opening a TIFF handle.
Definition tiffiop.h:791
void * errorhandler_user_data
Borrowed error-callback context, or NULL.
Definition tiffiop.h:795
tmsize_t max_cumulated_mem_alloc
Maximum tracked allocation total in bytes; zero means unlimited.
Definition tiffiop.h:805
TIFFErrorHandlerExtR errorhandler
Optional per-handle error callback, or NULL.
Definition tiffiop.h:793
int warn_about_unknown_tags
Nonzero to warn about unknown tags.
Definition tiffiop.h:807
TIFFErrorHandlerExtR warnhandler
Optional per-handle warning callback, or NULL.
Definition tiffiop.h:797
void * warnhandler_user_data
Borrowed warning-callback context, or NULL.
Definition tiffiop.h:799
tmsize_t max_single_mem_alloc
Maximum individual allocation in bytes; zero means unlimited.
Definition tiffiop.h:801
Collect a handle's tag-access and directory-print callbacks.
Definition tiffio.h:1573
Describe a borrowed schema or owned compatibility batch.
Definition tif_dir.h:962
Describe a field's file type and internal argument contract.
Definition tif_dir.h:993
Own bucket/node storage and record callback-defined element policy.
Link a named client-data association to a TIFF handle.
Definition tiffiop.h:148
void * data
Borrowed client payload; the library does not free it.
Definition tiffiop.h:152
struct client_info * next
Next handle-owned association node, or NULL.
Definition tiffiop.h:150
char * name
Owned copy of the null-terminated association name.
Definition tiffiop.h:154
Hold private state for one open TIFF library instance.
Definition tiffiop.h:389
TIFFReadWriteProc tif_readproc
Client read callback.
Definition tiffiop.h:714
int tif_warn_about_unknown_tags
Nonzero to emit warnings for unknown tags.
Definition tiffiop.h:777
TIFFReadWriteProc tif_writeproc
Client write callback.
Definition tiffiop.h:716
uint64_t tif_subifdoff
File byte offset at which the next SubIFD link is patched.
Definition tiffiop.h:618
const TIFFField * tif_foundfield
Borrowed cached field descriptor; valid only while that descriptor lives.
Definition tiffiop.h:740
tdir_t tif_curdircount
Cache the number of main IFDs in the file.
Definition tiffiop.h:604
TIFFTileMethod tif_deftilesize
Codec callback computing or constraining default tile dimensions.
Definition tiffiop.h:667
tmsize_t tif_max_single_mem_alloc
Single-allocation byte limit; zero means unlimited.
Definition tiffiop.h:769
TIFFCodeMethod tif_encodestrip
Codec callback encoding strip data.
Definition tiffiop.h:649
uint64_t tif_lastvalidoff
Last byte-offset boundary permitted for rewriting strip data in place.
Definition tiffiop.h:611
TIFFUnmapFileProc tif_unmapproc
Client callback releasing a mapped-file view.
Definition tiffiop.h:709
TIFFSeekProc tif_seekproc
Client seek callback.
Definition tiffiop.h:718
TIFFSeekMethod tif_seek
Codec callback advancing within a strip.
Definition tiffiop.h:659
TIFFCodeMethod tif_encodetile
Codec callback encoding tile data.
Definition tiffiop.h:653
TIFFTagMethods tif_tagmethods
Inline table of directory field and print callbacks.
Definition tiffiop.h:742
int tif_setdirectory_force_absolute
Nonzero to force absolute rather than relative directory stepping.
Definition tiffiop.h:570
TIFFErrorHandlerExtR tif_errorhandler
Per-handle error callback, or NULL for the default handling path.
Definition tiffiop.h:758
uint16_t tif_nsubifd
Number of remaining SubIFD links to write.
Definition tiffiop.h:616
TIFFPreMethod tif_preencode
Codec callback preparing a row, strip, or tile encode.
Definition tiffiop.h:639
TIFFBoolMethod tif_fixuptags
Codec callback for directory-dependent tag corrections.
Definition tiffiop.h:626
TIFFHashSet * tif_map_dir_number_to_offset
Handle-managed directory-index-to-offset lookup map.
Definition tiffiop.h:566
TIFFDirectory tif_customdir
Unused legacy member; custom directories are read into tif_dir.
Definition tiffiop.h:576
tmsize_t tif_rawdataloaded
Number of bytes loaded into the raw-buffer window.
Definition tiffiop.h:690
tmsize_t tif_rawcc
Raw-buffer byte count interpreted according to read/write state.
Definition tiffiop.h:696
TIFFPreMethod tif_predecode
Codec callback preparing a row, strip, or tile decode.
Definition tiffiop.h:630
uint64_t tif_curoff
Tracked current file byte offset for read/write operations.
Definition tiffiop.h:606
size_t tif_nfields
Number of entries in tif_fields.
Definition tiffiop.h:735
uint64_t tif_nextdiroff
Next directory byte offset from the current chain link.
Definition tiffiop.h:560
void * tif_errorhandler_user_data
Borrowed context passed to tif_errorhandler.
Definition tiffiop.h:760
TIFFCodeMethod tif_decodestrip
Codec callback decoding strip data.
Definition tiffiop.h:647
TIFFGetMaxCompressionRatioMethod tif_getmaxcompressionratio
Codec callback returning its maximum compression ratio.
Definition tiffiop.h:670
TIFFCloseProc tif_closeproc
Client I/O close callback.
Definition tiffiop.h:720
TIFFClientInfoLink * tif_clientinfo
Head of the owned named-association list; payloads remain borrowed.
Definition tiffiop.h:747
TIFFField ** tif_fields
Owned sorted array of field pointers; descriptors have mixed ownership.
Definition tiffiop.h:733
TIFFHashSet * tif_map_dir_offset_to_number
Handle-managed directory-offset-to-index lookup map.
Definition tiffiop.h:564
TIFFPostMethod tif_postdecode
Callback transforming decoded data, for example by byte swapping.
Definition tiffiop.h:727
thandle_t tif_clientdata
Client I/O context passed unchanged to the I/O callbacks.
Definition tiffiop.h:712
uint64_t tif_diroff
Current directory byte offset, or zero for an unlinked in-memory IFD.
Definition tiffiop.h:558
TIFFStripMethod tif_defstripsize
Codec callback computing or constraining a default strip size.
Definition tiffiop.h:663
char * tif_name
Current filename pointer; may refer to inline or client-supplied storage.
Definition tiffiop.h:394
TIFFCodeMethod tif_decoderow
Codec callback decoding a scanline.
Definition tiffiop.h:643
TIFFBoolMethod tif_setupencode
Codec setup callback run before preencode.
Definition tiffiop.h:632
TIFFDirectory tif_dir
Inline representation of the current image directory.
Definition tiffiop.h:572
TIFFBoolMethod tif_postencode
Codec callback completing buffered encoding.
Definition tiffiop.h:641
TIFFErrorHandlerExtR tif_warnhandler
Per-handle warning callback, or NULL for the default handling path.
Definition tiffiop.h:765
tmsize_t tif_size
Mapped-file region length in bytes.
Definition tiffiop.h:705
uint16_t tif_header_size
File-header length in bytes for the selected format.
Definition tiffiop.h:580
TIFFCodeMethod tif_encoderow
Codec callback encoding a scanline.
Definition tiffiop.h:645
TIFFVoidMethod tif_close
Codec close callback; distinct from the client I/O close callback.
Definition tiffiop.h:657
uint64_t tif_dataoff
Byte offset used when placing directory data in the file.
Definition tiffiop.h:613
tdir_t tif_curdir
Track the current or last-written directory index.
Definition tiffiop.h:599
tmsize_t tif_cur_cumulated_mem_alloc
Current tracked allocation total in bytes.
Definition tiffiop.h:775
int tif_decodestatus
Nonzero unless the selected scheme is a known but unconfigured codec; not a setup result.
Definition tiffiop.h:624
int tif_encodestatus
Nonzero unless the selected scheme is a known but unconfigured codec; never read.
Definition tiffiop.h:637
int tif_fd
File-descriptor metadata; client I/O still uses tif_clientdata.
Definition tiffiop.h:398
TIFFVoidMethod tif_cleanup
Codec callback releasing codec-private state.
Definition tiffiop.h:661
void * tif_warnhandler_user_data
Borrowed context passed to tif_warnhandler.
Definition tiffiop.h:767
uint8_t * tif_data
Codec-private storage; allocation and cleanup follow the selected codec.
Definition tiffiop.h:675
uint8_t * tif_rawcp
Borrowed current-position pointer into the raw buffer.
Definition tiffiop.h:692
TIFFMapFileProc tif_mapproc
Client callback providing a mapped-file view.
Definition tiffiop.h:707
TIFFBoolMethod tif_setupdecode
Codec setup callback run before predecode.
Definition tiffiop.h:628
uint8_t * tif_rawdata
Raw buffer; ownership/mapping follow TIFF_MYBUFFER and TIFF_BUFFERMMAP.
Definition tiffiop.h:681
TIFFHeaderUnion tif_header
Inline decoded classic TIFF or BigTIFF file header.
Definition tiffiop.h:578
tmsize_t tif_rawdatasize
Raw-buffer capacity in bytes; kept in step with tif_rawdata, including zero whenever tif_rawdata is N...
Definition tiffiop.h:686
tmsize_t tif_max_cumulated_mem_alloc
Cumulative tracked-allocation byte limit; zero means unlimited.
Definition tiffiop.h:773
tmsize_t tif_rawdataoff
Byte offset of the raw-buffer window within the strip.
Definition tiffiop.h:688
uint32_t tif_flags
Bitmask combining the TIFF_* handle-state flags declared below.
Definition tiffiop.h:404
size_t tif_nfieldscompat
Number of entries in tif_fieldscompat.
Definition tiffiop.h:753
uint64_t tif_lastdiroff
Byte offset of the last directory written so far.
Definition tiffiop.h:562
TIFFCodeMethod tif_decodetile
Codec callback decoding tile data.
Definition tiffiop.h:651
int tif_mode
Current access mode using the O_* constants.
Definition tiffiop.h:400
TIFFFieldArray * tif_fieldscompat
Owned array of legacy field-registration batches.
Definition tiffiop.h:751
TIFFSizeProc tif_sizeproc
Client file-size callback.
Definition tiffiop.h:722
uint8_t * tif_base
Mapped-file base provided by tif_mapproc; released through tif_unmapproc by TIFFCleanup() only while ...
Definition tiffiop.h:703
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.
Store either TIFF header layout in the library's in-memory state.
Definition tiffiop.h:361
TIFFHeaderCommon common
Shared byte-order and version fields.
Definition tiffiop.h:363
TIFFHeaderClassic classic
Header when version is TIFF_VERSION_CLASSIC.
Definition tiffiop.h:365
TIFFHeaderBig big
Header when version is TIFF_VERSION_BIG.
Definition tiffiop.h:367