include/mscvpdb.h: Use flexible array members for the rest of structures.
[wine.git] / libs / tiff / libtiff / tiffiop.h
blobfbf7b0700bf641214397fcf1e8d55c9ce27c62d4
1 /*
2 * Copyright (c) 1988-1997 Sam Leffler
3 * Copyright (c) 1991-1997 Silicon Graphics, Inc.
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.
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.
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.
25 #ifndef _TIFFIOP_
26 #define _TIFFIOP_
28 * ``Library-private'' definitions.
31 #include "tif_config.h"
33 #ifdef HAVE_FCNTL_H
34 #include <fcntl.h>
35 #endif
37 #ifdef HAVE_SYS_TYPES_H
38 #include <sys/types.h>
39 #endif
41 #include <string.h>
43 #ifdef HAVE_ASSERT_H
44 #include <assert.h>
45 #else
46 #define assert(x)
47 #endif
49 #include "tif_hash_set.h"
50 #include "tiffio.h"
52 #include "tif_dir.h"
54 #include <limits.h>
56 #ifndef STRIP_SIZE_DEFAULT
57 #define STRIP_SIZE_DEFAULT 8192
58 #endif
60 #ifndef TIFF_MAX_DIR_COUNT
61 #define TIFF_MAX_DIR_COUNT 1048576
62 #endif
64 #define TIFF_NON_EXISTENT_DIR_NUMBER UINT_MAX
66 #define streq(a, b) (strcmp(a, b) == 0)
67 #define strneq(a, b, n) (strncmp(a, b, n) == 0)
69 #ifndef TRUE
70 #define TRUE 1
71 #define FALSE 0
72 #endif
74 typedef struct client_info
76 struct client_info *next;
77 void *data;
78 char *name;
79 } TIFFClientInfoLink;
82 * Typedefs for ``method pointers'' used internally.
83 * these are deprecated and provided only for backwards compatibility.
85 typedef unsigned char tidataval_t; /* internal image data value type */
86 typedef tidataval_t *tidata_t; /* reference to internal image data */
88 typedef void (*TIFFVoidMethod)(TIFF *);
89 typedef int (*TIFFBoolMethod)(TIFF *);
90 typedef int (*TIFFPreMethod)(TIFF *, uint16_t);
91 typedef int (*TIFFCodeMethod)(TIFF *tif, uint8_t *buf, tmsize_t size,
92 uint16_t sample);
93 typedef int (*TIFFSeekMethod)(TIFF *, uint32_t);
94 typedef void (*TIFFPostMethod)(TIFF *tif, uint8_t *buf, tmsize_t size);
95 typedef uint32_t (*TIFFStripMethod)(TIFF *, uint32_t);
96 typedef void (*TIFFTileMethod)(TIFF *, uint32_t *, uint32_t *);
98 struct TIFFOffsetAndDirNumber
100 uint64_t offset;
101 tdir_t dirNumber;
103 typedef struct TIFFOffsetAndDirNumber TIFFOffsetAndDirNumber;
105 struct tiff
107 char *tif_name; /* name of open file */
108 int tif_fd; /* open file descriptor */
109 int tif_mode; /* open mode (O_*) */
110 uint32_t tif_flags;
111 #define TIFF_FILLORDER 0x00003U /* natural bit fill order for machine */
112 #define TIFF_DIRTYHEADER 0x00004U /* header must be written on close */
113 #define TIFF_DIRTYDIRECT 0x00008U /* current directory must be written */
114 #define TIFF_BUFFERSETUP 0x00010U /* data buffers setup */
115 #define TIFF_CODERSETUP 0x00020U /* encoder/decoder setup done */
116 #define TIFF_BEENWRITING 0x00040U /* written 1+ scanlines to file */
117 #define TIFF_SWAB 0x00080U /* byte swap file information */
118 #define TIFF_NOBITREV 0x00100U /* inhibit bit reversal logic */
119 #define TIFF_MYBUFFER 0x00200U /* my raw data buffer; free on close */
120 #define TIFF_ISTILED 0x00400U /* file is tile, not strip- based */
121 #define TIFF_MAPPED 0x00800U /* file is mapped into memory */
122 #define TIFF_POSTENCODE 0x01000U /* need call to postencode routine */
123 #define TIFF_INSUBIFD 0x02000U /* currently writing a subifd */
124 #define TIFF_UPSAMPLED 0x04000U /* library is doing data up-sampling */
125 #define TIFF_STRIPCHOP 0x08000U /* enable strip chopping support */
126 #define TIFF_HEADERONLY \
127 0x10000U /* read header only, do not process the first directory */
128 #define TIFF_NOREADRAW \
129 0x20000U /* skip reading of raw uncompressed image data */
130 #define TIFF_INCUSTOMIFD 0x40000U /* currently writing a custom IFD */
131 #define TIFF_BIGTIFF 0x80000U /* read/write bigtiff */
132 #define TIFF_BUF4WRITE 0x100000U /* rawcc bytes are for writing */
133 #define TIFF_DIRTYSTRIP 0x200000U /* stripoffsets/stripbytecount dirty*/
134 #define TIFF_PERSAMPLE 0x400000U /* get/set per sample tags as arrays */
135 #define TIFF_BUFFERMMAP \
136 0x800000U /* read buffer (tif_rawdata) points into mmap() memory */
137 #define TIFF_DEFERSTRILELOAD \
138 0x1000000U /* defer strip/tile offset/bytecount array loading. */
139 #define TIFF_LAZYSTRILELOAD \
140 0x2000000U /* lazy/ondemand loading of strip/tile offset/bytecount values. \
141 Only used if TIFF_DEFERSTRILELOAD is set and in read-only \
142 mode */
143 #define TIFF_CHOPPEDUPARRAYS \
144 0x4000000U /* set when allocChoppedUpStripArrays() has modified strip \
145 array */
146 uint64_t tif_diroff; /* file offset of current directory */
147 uint64_t tif_nextdiroff; /* file offset of following directory */
148 uint64_t tif_lastdiroff; /* file offset of last directory written so far */
149 TIFFHashSet *tif_map_dir_offset_to_number;
150 TIFFHashSet *tif_map_dir_number_to_offset;
151 int tif_setdirectory_force_absolute; /* switch between relative and absolute
152 stepping in TIFFSetDirectory() */
153 TIFFDirectory tif_dir; /* internal rep of current directory */
154 TIFFDirectory
155 tif_customdir; /* custom IFDs are separated from the main ones */
156 union
158 TIFFHeaderCommon common;
159 TIFFHeaderClassic classic;
160 TIFFHeaderBig big;
161 } tif_header;
162 uint16_t tif_header_size; /* file's header block and its length */
163 uint32_t tif_row; /* current scanline */
164 tdir_t tif_curdir; /* current directory (index) */
165 uint32_t tif_curstrip; /* current strip for read/write */
166 uint64_t tif_curoff; /* current offset for read/write */
167 uint64_t tif_lastvalidoff; /* last valid offset allowed for rewrite in
168 place. Used only by TIFFAppendToStrip() */
169 uint64_t tif_dataoff; /* current offset for writing dir */
170 /* SubIFD support */
171 uint16_t tif_nsubifd; /* remaining subifds to write */
172 uint64_t tif_subifdoff; /* offset for patching SubIFD link */
173 /* tiling support */
174 uint32_t tif_col; /* current column (offset by row too) */
175 uint32_t tif_curtile; /* current tile for read/write */
176 tmsize_t tif_tilesize; /* # of bytes in a tile */
177 /* compression scheme hooks */
178 int tif_decodestatus;
179 TIFFBoolMethod tif_fixuptags; /* called in TIFFReadDirectory */
180 TIFFBoolMethod tif_setupdecode; /* called once before predecode */
181 TIFFPreMethod tif_predecode; /* pre- row/strip/tile decoding */
182 TIFFBoolMethod tif_setupencode; /* called once before preencode */
183 int tif_encodestatus;
184 TIFFPreMethod tif_preencode; /* pre- row/strip/tile encoding */
185 TIFFBoolMethod tif_postencode; /* post- row/strip/tile encoding */
186 TIFFCodeMethod tif_decoderow; /* scanline decoding routine */
187 TIFFCodeMethod tif_encoderow; /* scanline encoding routine */
188 TIFFCodeMethod tif_decodestrip; /* strip decoding routine */
189 TIFFCodeMethod tif_encodestrip; /* strip encoding routine */
190 TIFFCodeMethod tif_decodetile; /* tile decoding routine */
191 TIFFCodeMethod tif_encodetile; /* tile encoding routine */
192 TIFFVoidMethod tif_close; /* cleanup-on-close routine */
193 TIFFSeekMethod tif_seek; /* position within a strip routine */
194 TIFFVoidMethod tif_cleanup; /* cleanup state routine */
195 TIFFStripMethod tif_defstripsize; /* calculate/constrain strip size */
196 TIFFTileMethod tif_deftilesize; /* calculate/constrain tile size */
197 uint8_t *tif_data; /* compression scheme private data */
198 /* input/output buffering */
199 tmsize_t tif_scanlinesize; /* # of bytes in a scanline */
200 tmsize_t tif_scanlineskew; /* scanline skew for reading strips */
201 uint8_t *tif_rawdata; /* raw data buffer */
202 tmsize_t tif_rawdatasize; /* # of bytes in raw data buffer */
203 tmsize_t tif_rawdataoff; /* rawdata offset within strip */
204 tmsize_t tif_rawdataloaded; /* amount of data in rawdata */
205 uint8_t *tif_rawcp; /* current spot in raw buffer */
206 tmsize_t tif_rawcc; /* bytes unread from raw buffer */
207 /* memory-mapped file support */
208 uint8_t *tif_base; /* base of mapped file */
209 tmsize_t tif_size; /* size of mapped file region (bytes, thus tmsize_t) */
210 TIFFMapFileProc tif_mapproc; /* map file method */
211 TIFFUnmapFileProc tif_unmapproc; /* unmap file method */
212 /* input/output callback methods */
213 thandle_t tif_clientdata; /* callback parameter */
214 TIFFReadWriteProc tif_readproc; /* read method */
215 TIFFReadWriteProc tif_writeproc; /* write method */
216 TIFFSeekProc tif_seekproc; /* lseek method */
217 TIFFCloseProc tif_closeproc; /* close method */
218 TIFFSizeProc tif_sizeproc; /* filesize method */
219 /* post-decoding support */
220 TIFFPostMethod tif_postdecode; /* post decoding routine */
221 /* tag support */
222 TIFFField **tif_fields; /* sorted table of registered tags */
223 size_t tif_nfields; /* # entries in registered tag table */
224 const TIFFField *tif_foundfield; /* cached pointer to already found tag */
225 TIFFTagMethods tif_tagmethods; /* tag get/set/print routines */
226 TIFFClientInfoLink *tif_clientinfo; /* extra client information. */
227 /* Backward compatibility stuff. We need these two fields for
228 * setting up an old tag extension scheme. */
229 TIFFFieldArray *tif_fieldscompat;
230 size_t tif_nfieldscompat;
231 /* Error handler support */
232 TIFFErrorHandlerExtR tif_errorhandler;
233 void *tif_errorhandler_user_data;
234 TIFFErrorHandlerExtR tif_warnhandler;
235 void *tif_warnhandler_user_data;
236 tmsize_t tif_max_single_mem_alloc; /* in bytes. 0 for unlimited */
239 struct TIFFOpenOptions
241 TIFFErrorHandlerExtR errorhandler; /* may be NULL */
242 void *errorhandler_user_data; /* may be NULL */
243 TIFFErrorHandlerExtR warnhandler; /* may be NULL */
244 void *warnhandler_user_data; /* may be NULL */
245 tmsize_t max_single_mem_alloc; /* in bytes. 0 for unlimited */
248 #define isPseudoTag(t) (t > 0xffff) /* is tag value normal or pseudo */
250 #define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
251 #define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
252 #define isFillOrder(tif, o) (((tif)->tif_flags & (o)) != 0)
253 #define isUpSampled(tif) (((tif)->tif_flags & TIFF_UPSAMPLED) != 0)
254 #define TIFFReadFile(tif, buf, size) \
255 ((*(tif)->tif_readproc)((tif)->tif_clientdata, (buf), (size)))
256 #define TIFFWriteFile(tif, buf, size) \
257 ((*(tif)->tif_writeproc)((tif)->tif_clientdata, (buf), (size)))
258 #define TIFFSeekFile(tif, off, whence) \
259 ((*(tif)->tif_seekproc)((tif)->tif_clientdata, (off), (whence)))
260 #define TIFFCloseFile(tif) ((*(tif)->tif_closeproc)((tif)->tif_clientdata))
261 #define TIFFGetFileSize(tif) ((*(tif)->tif_sizeproc)((tif)->tif_clientdata))
262 #define TIFFMapFileContents(tif, paddr, psize) \
263 ((*(tif)->tif_mapproc)((tif)->tif_clientdata, (paddr), (psize)))
264 #define TIFFUnmapFileContents(tif, addr, size) \
265 ((*(tif)->tif_unmapproc)((tif)->tif_clientdata, (addr), (size)))
268 * Default Read/Seek/Write definitions.
270 #ifndef ReadOK
271 #define ReadOK(tif, buf, size) (TIFFReadFile((tif), (buf), (size)) == (size))
272 #endif
273 #ifndef SeekOK
274 #define SeekOK(tif, off) _TIFFSeekOK(tif, off)
275 #endif
276 #ifndef WriteOK
277 #define WriteOK(tif, buf, size) (TIFFWriteFile((tif), (buf), (size)) == (size))
278 #endif
280 /* NB: the uint32_t casts are to silence certain ANSI-C compilers */
281 #define TIFFhowmany_32(x, y) \
282 (((uint32_t)x < (0xffffffff - (uint32_t)(y - 1))) \
283 ? ((((uint32_t)(x)) + (((uint32_t)(y)) - 1)) / ((uint32_t)(y))) \
284 : 0U)
285 /* Variant of TIFFhowmany_32() that doesn't return 0 if x close to MAXUINT. */
286 /* Caution: TIFFhowmany_32_maxuint_compat(x,y)*y might overflow */
287 #define TIFFhowmany_32_maxuint_compat(x, y) \
288 (((uint32_t)(x) / (uint32_t)(y)) + \
289 ((((uint32_t)(x) % (uint32_t)(y)) != 0) ? 1 : 0))
290 #define TIFFhowmany8_32(x) \
291 (((x)&0x07) ? ((uint32_t)(x) >> 3) + 1 : (uint32_t)(x) >> 3)
292 #define TIFFroundup_32(x, y) (TIFFhowmany_32(x, y) * (y))
293 #define TIFFhowmany_64(x, y) \
294 ((((uint64_t)(x)) + (((uint64_t)(y)) - 1)) / ((uint64_t)(y)))
295 #define TIFFhowmany8_64(x) \
296 (((x)&0x07) ? ((uint64_t)(x) >> 3) + 1 : (uint64_t)(x) >> 3)
297 #define TIFFroundup_64(x, y) (TIFFhowmany_64(x, y) * (y))
299 /* Safe multiply which returns zero if there is an *unsigned* integer overflow.
300 * This macro is not safe for *signed* integer types */
301 #define TIFFSafeMultiply(t, v, m) \
302 ((((t)(m) != (t)0) && (((t)(((v) * (m)) / (m))) == (t)(v))) \
303 ? (t)((v) * (m)) \
304 : (t)0)
306 #define TIFFmax(A, B) ((A) > (B) ? (A) : (B))
307 #define TIFFmin(A, B) ((A) < (B) ? (A) : (B))
309 #define TIFFArrayCount(a) (sizeof(a) / sizeof((a)[0]))
312 Support for large files.
314 Windows read/write APIs support only 'unsigned int' rather than 'size_t'.
315 Windows off_t is only 32-bit, even in 64-bit builds.
317 #if defined(HAVE_FSEEKO)
319 Use fseeko() and ftello() if they are available since they use
320 'off_t' rather than 'long'. It is wrong to use fseeko() and
321 ftello() only on systems with special LFS support since some systems
322 (e.g. FreeBSD) support a 64-bit off_t by default.
324 For MinGW, __MSVCRT_VERSION__ must be at least 0x800 to expose these
325 interfaces. The MinGW compiler must support the requested version. MinGW
326 does not distribute the CRT (it is supplied by Microsoft) so the correct CRT
327 must be available on the target computer in order for the program to run.
329 #if defined(HAVE_FSEEKO)
330 #define fseek(stream, offset, whence) fseeko(stream, offset, whence)
331 #define ftell(stream, offset, whence) ftello(stream, offset, whence)
332 #endif
333 #endif
334 #if defined(__WIN32__) && !(defined(_MSC_VER) && _MSC_VER < 1400) && \
335 !(defined(__MSVCRT_VERSION__) && __MSVCRT_VERSION__ < 0x800)
336 typedef unsigned int TIFFIOSize_t;
337 #define _TIFF_lseek_f(fildes, offset, whence) \
338 _lseeki64(fildes, /* __int64 */ offset, whence)
339 /* #define _TIFF_tell_f(fildes) /\* __int64 *\/ _telli64(fildes) */
340 #define _TIFF_fseek_f(stream, offset, whence) \
341 _fseeki64(stream, /* __int64 */ offset, whence)
342 #define _TIFF_fstat_f(fildes, stat_buff) \
343 _fstati64(fildes, /* struct _stati64 */ stat_buff)
344 /* #define _TIFF_ftell_f(stream) /\* __int64 *\/ _ftelli64(stream) */
345 /* #define _TIFF_stat_f(path,stat_buff) _stati64(path,/\* struct _stati64 *\/
346 * stat_buff) */
347 #define _TIFF_stat_s struct _stati64
348 #define _TIFF_off_t __int64
349 #else
350 typedef size_t TIFFIOSize_t;
351 #define _TIFF_lseek_f(fildes, offset, whence) lseek(fildes, offset, whence)
352 /* #define _TIFF_tell_f(fildes) (_TIFF_lseek_f(fildes,0,SEEK_CUR)) */
353 #define _TIFF_fseek_f(stream, offset, whence) fseek(stream, offset, whence)
354 #define _TIFF_fstat_f(fildes, stat_buff) fstat(fildes, stat_buff)
355 /* #define _TIFF_ftell_f(stream) ftell(stream) */
356 /* #define _TIFF_stat_f(path,stat_buff) stat(path,stat_buff) */
357 #define _TIFF_stat_s struct stat
358 #define _TIFF_off_t off_t
359 #endif
361 #if defined(__has_attribute) && defined(__clang__)
362 #if __has_attribute(no_sanitize)
363 #define TIFF_NOSANITIZE_UNSIGNED_INT_OVERFLOW \
364 __attribute__((no_sanitize("unsigned-integer-overflow")))
365 #else
366 #define TIFF_NOSANITIZE_UNSIGNED_INT_OVERFLOW
367 #endif
368 #else
369 #define TIFF_NOSANITIZE_UNSIGNED_INT_OVERFLOW
370 #endif
372 #if defined(__cplusplus)
373 extern "C"
375 #endif
376 extern int _TIFFgetMode(TIFFOpenOptions *opts, thandle_t clientdata,
377 const char *mode, const char *module);
378 extern int _TIFFNoRowEncode(TIFF *tif, uint8_t *pp, tmsize_t cc,
379 uint16_t s);
380 extern int _TIFFNoStripEncode(TIFF *tif, uint8_t *pp, tmsize_t cc,
381 uint16_t s);
382 extern int _TIFFNoTileEncode(TIFF *, uint8_t *pp, tmsize_t cc, uint16_t s);
383 extern int _TIFFNoRowDecode(TIFF *tif, uint8_t *pp, tmsize_t cc,
384 uint16_t s);
385 extern int _TIFFNoStripDecode(TIFF *tif, uint8_t *pp, tmsize_t cc,
386 uint16_t s);
387 extern int _TIFFNoTileDecode(TIFF *, uint8_t *pp, tmsize_t cc, uint16_t s);
388 extern void _TIFFNoPostDecode(TIFF *tif, uint8_t *buf, tmsize_t cc);
389 extern int _TIFFNoPreCode(TIFF *tif, uint16_t s);
390 extern int _TIFFNoSeek(TIFF *tif, uint32_t off);
391 extern void _TIFFSwab16BitData(TIFF *tif, uint8_t *buf, tmsize_t cc);
392 extern void _TIFFSwab24BitData(TIFF *tif, uint8_t *buf, tmsize_t cc);
393 extern void _TIFFSwab32BitData(TIFF *tif, uint8_t *buf, tmsize_t cc);
394 extern void _TIFFSwab64BitData(TIFF *tif, uint8_t *buf, tmsize_t cc);
395 extern int TIFFFlushData1(TIFF *tif);
396 extern int TIFFDefaultDirectory(TIFF *tif);
397 extern void _TIFFSetDefaultCompressionState(TIFF *tif);
398 extern int _TIFFRewriteField(TIFF *, uint16_t, TIFFDataType, tmsize_t,
399 void *);
400 extern int TIFFSetCompressionScheme(TIFF *tif, int scheme);
401 extern int TIFFSetDefaultCompressionState(TIFF *tif);
402 extern uint32_t _TIFFDefaultStripSize(TIFF *tif, uint32_t s);
403 extern void _TIFFDefaultTileSize(TIFF *tif, uint32_t *tw, uint32_t *th);
405 extern void _TIFFsetByteArray(void **, const void *, uint32_t);
406 extern void _TIFFsetByteArrayExt(TIFF *, void **, const void *, uint32_t);
407 extern void _TIFFsetShortArray(uint16_t **, const uint16_t *, uint32_t);
408 extern void _TIFFsetShortArrayExt(TIFF *, uint16_t **, const uint16_t *,
409 uint32_t);
410 extern void _TIFFsetLongArray(uint32_t **, const uint32_t *, uint32_t);
411 extern void _TIFFsetLongArrayExt(TIFF *, uint32_t **, const uint32_t *,
412 uint32_t);
413 extern void _TIFFsetFloatArray(float **, const float *, uint32_t);
414 extern void _TIFFsetFloatArrayExt(TIFF *, float **, const float *,
415 uint32_t);
416 extern void _TIFFsetDoubleArray(double **, const double *, uint32_t);
417 extern void _TIFFsetDoubleArrayExt(TIFF *, double **, const double *,
418 uint32_t);
420 extern void _TIFFprintAscii(FILE *, const char *);
421 extern void _TIFFprintAsciiTag(FILE *, const char *, const char *);
423 extern TIFFErrorHandler _TIFFwarningHandler;
424 extern TIFFErrorHandler _TIFFerrorHandler;
425 extern TIFFErrorHandlerExt _TIFFwarningHandlerExt;
426 extern TIFFErrorHandlerExt _TIFFerrorHandlerExt;
427 void _TIFFErrorEarly(TIFFOpenOptions *opts, thandle_t clientdata,
428 const char *module, const char *fmt, ...)
429 TIFF_ATTRIBUTE((__format__(__printf__, 4, 5)));
431 extern uint32_t _TIFFMultiply32(TIFF *, uint32_t, uint32_t, const char *);
432 extern uint64_t _TIFFMultiply64(TIFF *, uint64_t, uint64_t, const char *);
433 extern tmsize_t _TIFFMultiplySSize(TIFF *, tmsize_t, tmsize_t,
434 const char *);
435 extern tmsize_t _TIFFCastUInt64ToSSize(TIFF *, uint64_t, const char *);
436 extern void *_TIFFCheckMalloc(TIFF *, tmsize_t, tmsize_t, const char *);
437 extern void *_TIFFCheckRealloc(TIFF *, void *, tmsize_t, tmsize_t,
438 const char *);
440 extern double _TIFFUInt64ToDouble(uint64_t);
441 extern float _TIFFUInt64ToFloat(uint64_t);
443 extern float _TIFFClampDoubleToFloat(double);
444 extern uint32_t _TIFFClampDoubleToUInt32(double);
446 extern void _TIFFCleanupIFDOffsetAndNumberMaps(TIFF *tif);
448 extern tmsize_t _TIFFReadEncodedStripAndAllocBuffer(TIFF *tif,
449 uint32_t strip,
450 void **buf,
451 tmsize_t bufsizetoalloc,
452 tmsize_t size_to_read);
453 extern tmsize_t _TIFFReadEncodedTileAndAllocBuffer(TIFF *tif, uint32_t tile,
454 void **buf,
455 tmsize_t bufsizetoalloc,
456 tmsize_t size_to_read);
457 extern tmsize_t _TIFFReadTileAndAllocBuffer(TIFF *tif, void **buf,
458 tmsize_t bufsizetoalloc,
459 uint32_t x, uint32_t y,
460 uint32_t z, uint16_t s);
461 extern int _TIFFSeekOK(TIFF *tif, toff_t off);
463 extern int TIFFInitDumpMode(TIFF *, int);
464 #ifdef PACKBITS_SUPPORT
465 extern int TIFFInitPackBits(TIFF *, int);
466 #endif
467 #ifdef CCITT_SUPPORT
468 extern int TIFFInitCCITTRLE(TIFF *, int), TIFFInitCCITTRLEW(TIFF *, int);
469 extern int TIFFInitCCITTFax3(TIFF *, int), TIFFInitCCITTFax4(TIFF *, int);
470 #endif
471 #ifdef THUNDER_SUPPORT
472 extern int TIFFInitThunderScan(TIFF *, int);
473 #endif
474 #ifdef NEXT_SUPPORT
475 extern int TIFFInitNeXT(TIFF *, int);
476 #endif
477 #ifdef LZW_SUPPORT
478 extern int TIFFInitLZW(TIFF *, int);
479 #endif
480 #ifdef OJPEG_SUPPORT
481 extern int TIFFInitOJPEG(TIFF *, int);
482 #endif
483 #ifdef JPEG_SUPPORT
484 extern int TIFFInitJPEG(TIFF *, int);
485 extern int TIFFJPEGIsFullStripRequired(TIFF *);
486 #endif
487 #ifdef JBIG_SUPPORT
488 extern int TIFFInitJBIG(TIFF *, int);
489 #endif
490 #ifdef ZIP_SUPPORT
491 extern int TIFFInitZIP(TIFF *, int);
492 #endif
493 #ifdef PIXARLOG_SUPPORT
494 extern int TIFFInitPixarLog(TIFF *, int);
495 #endif
496 #ifdef LOGLUV_SUPPORT
497 extern int TIFFInitSGILog(TIFF *, int);
498 #endif
499 #ifdef LERC_SUPPORT
500 extern int TIFFInitLERC(TIFF *tif, int);
501 #endif
502 #ifdef LZMA_SUPPORT
503 extern int TIFFInitLZMA(TIFF *, int);
504 #endif
505 #ifdef ZSTD_SUPPORT
506 extern int TIFFInitZSTD(TIFF *, int);
507 #endif
508 #ifdef WEBP_SUPPORT
509 extern int TIFFInitWebP(TIFF *, int);
510 #endif
511 extern const TIFFCodec _TIFFBuiltinCODECS[];
512 extern void TIFFCIELab16ToXYZ(TIFFCIELabToRGB *, uint32_t l, int32_t a,
513 int32_t b, float *, float *, float *);
515 extern void *_TIFFmallocExt(TIFF *tif, tmsize_t s);
516 extern void *_TIFFcallocExt(TIFF *tif, tmsize_t nmemb, tmsize_t siz);
517 extern void *_TIFFreallocExt(TIFF *tif, void *p, tmsize_t s);
518 extern void _TIFFfreeExt(TIFF *tif, void *p);
520 #if defined(__cplusplus)
522 #endif
523 #endif /* _TIFFIOP_ */