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