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_dataoff;      /* current offset for writing dir */
136 	/* SubIFD support */
137 	uint16_t               tif_nsubifd;      /* remaining subifds to write */
138 	uint64_t               tif_subifdoff;    /* offset for patching SubIFD link */
139 	/* tiling support */
140 	uint32_t               tif_col;          /* current column (offset by row too) */
141 	uint32_t               tif_curtile;      /* current tile for read/write */
142 	tmsize_t             tif_tilesize;     /* # of bytes in a tile */
143 	/* compression scheme hooks */
144 	int                  tif_decodestatus;
145 	TIFFBoolMethod       tif_fixuptags;    /* called in TIFFReadDirectory */
146 	TIFFBoolMethod       tif_setupdecode;  /* called once before predecode */
147 	TIFFPreMethod        tif_predecode;    /* pre- row/strip/tile decoding */
148 	TIFFBoolMethod       tif_setupencode;  /* called once before preencode */
149 	int                  tif_encodestatus;
150 	TIFFPreMethod        tif_preencode;    /* pre- row/strip/tile encoding */
151 	TIFFBoolMethod       tif_postencode;   /* post- row/strip/tile encoding */
152 	TIFFCodeMethod       tif_decoderow;    /* scanline decoding routine */
153 	TIFFCodeMethod       tif_encoderow;    /* scanline encoding routine */
154 	TIFFCodeMethod       tif_decodestrip;  /* strip decoding routine */
155 	TIFFCodeMethod       tif_encodestrip;  /* strip encoding routine */
156 	TIFFCodeMethod       tif_decodetile;   /* tile decoding routine */
157 	TIFFCodeMethod       tif_encodetile;   /* tile encoding routine */
158 	TIFFVoidMethod       tif_close;        /* cleanup-on-close routine */
159 	TIFFSeekMethod       tif_seek;         /* position within a strip routine */
160 	TIFFVoidMethod       tif_cleanup;      /* cleanup state routine */
161 	TIFFStripMethod      tif_defstripsize; /* calculate/constrain strip size */
162 	TIFFTileMethod       tif_deftilesize;  /* calculate/constrain tile size */
163 	uint8_t*               tif_data;         /* compression scheme private data */
164 	/* input/output buffering */
165 	tmsize_t             tif_scanlinesize; /* # of bytes in a scanline */
166 	tmsize_t             tif_scanlineskew; /* scanline skew for reading strips */
167 	uint8_t*               tif_rawdata;      /* raw data buffer */
168 	tmsize_t             tif_rawdatasize;  /* # of bytes in raw data buffer */
169         tmsize_t             tif_rawdataoff;   /* rawdata offset within strip */
170         tmsize_t             tif_rawdataloaded;/* amount of data in rawdata */
171 	uint8_t*               tif_rawcp;        /* current spot in raw buffer */
172 	tmsize_t             tif_rawcc;        /* bytes unread from raw buffer */
173 	/* memory-mapped file support */
174 	uint8_t*               tif_base;         /* base of mapped file */
175 	tmsize_t             tif_size;         /* size of mapped file region (bytes, thus tmsize_t) */
176 	TIFFMapFileProc      tif_mapproc;      /* map file method */
177 	TIFFUnmapFileProc    tif_unmapproc;    /* unmap file method */
178 	/* input/output callback methods */
179 	thandle_t            tif_clientdata;   /* callback parameter */
180 	TIFFReadWriteProc    tif_readproc;     /* read method */
181 	TIFFReadWriteProc    tif_writeproc;    /* write method */
182 	TIFFSeekProc         tif_seekproc;     /* lseek method */
183 	TIFFCloseProc        tif_closeproc;    /* close method */
184 	TIFFSizeProc         tif_sizeproc;     /* filesize method */
185 	/* post-decoding support */
186 	TIFFPostMethod       tif_postdecode;   /* post decoding routine */
187 	/* tag support */
188 	TIFFField**          tif_fields;       /* sorted table of registered tags */
189 	size_t               tif_nfields;      /* # entries in registered tag table */
190 	const TIFFField*     tif_foundfield;   /* cached pointer to already found tag */
191 	TIFFTagMethods       tif_tagmethods;   /* tag get/set/print routines */
192 	TIFFClientInfoLink*  tif_clientinfo;   /* extra client information. */
193 	/* Backward compatibility stuff. We need these two fields for
194 	 * setting up an old tag extension scheme. */
195 	TIFFFieldArray*      tif_fieldscompat;
196 	size_t               tif_nfieldscompat;
197 };
198 
199 #define isPseudoTag(t) (t > 0xffff)            /* is tag value normal or pseudo */
200 
201 #define isTiled(tif) (((tif)->tif_flags & TIFF_ISTILED) != 0)
202 #define isMapped(tif) (((tif)->tif_flags & TIFF_MAPPED) != 0)
203 #define isFillOrder(tif, o) (((tif)->tif_flags & (o)) != 0)
204 #define isUpSampled(tif) (((tif)->tif_flags & TIFF_UPSAMPLED) != 0)
205 #define TIFFReadFile(tif, buf, size) \
206 	((*(tif)->tif_readproc)((tif)->tif_clientdata,(buf),(size)))
207 #define TIFFWriteFile(tif, buf, size) \
208 	((*(tif)->tif_writeproc)((tif)->tif_clientdata,(buf),(size)))
209 #define TIFFSeekFile(tif, off, whence) \
210 	((*(tif)->tif_seekproc)((tif)->tif_clientdata,(off),(whence)))
211 #define TIFFCloseFile(tif) \
212 	((*(tif)->tif_closeproc)((tif)->tif_clientdata))
213 #define TIFFGetFileSize(tif) \
214 	((*(tif)->tif_sizeproc)((tif)->tif_clientdata))
215 #define TIFFMapFileContents(tif, paddr, psize) \
216 	((*(tif)->tif_mapproc)((tif)->tif_clientdata,(paddr),(psize)))
217 #define TIFFUnmapFileContents(tif, addr, size) \
218 	((*(tif)->tif_unmapproc)((tif)->tif_clientdata,(addr),(size)))
219 
220 /*
221  * Default Read/Seek/Write definitions.
222  */
223 #ifndef ReadOK
224 #define ReadOK(tif, buf, size) \
225 	(TIFFReadFile((tif),(buf),(size))==(size))
226 #endif
227 #ifndef SeekOK
228 #define SeekOK(tif, off) _TIFFSeekOK(tif, off)
229 #endif
230 #ifndef WriteOK
231 #define WriteOK(tif, buf, size) \
232 	(TIFFWriteFile((tif),(buf),(size))==(size))
233 #endif
234 
235 /* NB: the uint32_t casts are to silence certain ANSI-C compilers */
236 #define TIFFhowmany_32(x, y) (((uint32_t)x < (0xffffffff - (uint32_t)(y-1))) ? \
237 			   ((((uint32_t)(x))+(((uint32_t)(y))-1))/((uint32_t)(y))) : \
238 			   0U)
239 /* Variant of TIFFhowmany_32() that doesn't return 0 if x close to MAXUINT. */
240 /* Caution: TIFFhowmany_32_maxuint_compat(x,y)*y might overflow */
241 #define TIFFhowmany_32_maxuint_compat(x, y) \
242 			   (((uint32_t)(x) / (uint32_t)(y)) + ((((uint32_t)(x) % (uint32_t)(y)) != 0) ? 1 : 0))
243 #define TIFFhowmany8_32(x) (((x)&0x07)?((uint32_t)(x)>>3)+1:(uint32_t)(x)>>3)
244 #define TIFFroundup_32(x, y) (TIFFhowmany_32(x,y)*(y))
245 #define TIFFhowmany_64(x, y) ((((uint64_t)(x))+(((uint64_t)(y))-1))/((uint64_t)(y)))
246 #define TIFFhowmany8_64(x) (((x)&0x07)?((uint64_t)(x)>>3)+1:(uint64_t)(x)>>3)
247 #define TIFFroundup_64(x, y) (TIFFhowmany_64(x,y)*(y))
248 
249 /* Safe multiply which returns zero if there is an *unsigned* integer overflow. This macro is not safe for *signed* integer types */
250 #define TIFFSafeMultiply(t,v,m) ((((t)(m) != (t)0) && (((t)(((v)*(m))/(m))) == (t)(v))) ? (t)((v)*(m)) : (t)0)
251 
252 #define TIFFmax(A,B) ((A)>(B)?(A):(B))
253 #define TIFFmin(A,B) ((A)<(B)?(A):(B))
254 
255 #define TIFFArrayCount(a) (sizeof (a) / sizeof ((a)[0]))
256 
257 /*
258   Support for large files.
259 
260   Windows read/write APIs support only 'unsigned int' rather than 'size_t'.
261   Windows off_t is only 32-bit, even in 64-bit builds.
262 */
263 #if defined(HAVE_FSEEKO)
264 /*
265   Use fseeko() and ftello() if they are available since they use
266   'off_t' rather than 'long'.  It is wrong to use fseeko() and
267   ftello() only on systems with special LFS support since some systems
268   (e.g. FreeBSD) support a 64-bit off_t by default.
269 
270   For MinGW, __MSVCRT_VERSION__ must be at least 0x800 to expose these
271   interfaces. The MinGW compiler must support the requested version.  MinGW
272   does not distribute the CRT (it is supplied by Microsoft) so the correct CRT
273   must be available on the target computer in order for the program to run.
274 */
275 #if defined(HAVE_FSEEKO)
276 #  define fseek(stream,offset,whence)  fseeko(stream,offset,whence)
277 #  define ftell(stream,offset,whence)  ftello(stream,offset,whence)
278 #endif
279 #endif
280 #if defined(__WIN32__) && \
281         !(defined(_MSC_VER) && _MSC_VER < 1400) && \
282         !(defined(__MSVCRT_VERSION__) && __MSVCRT_VERSION__ < 0x800)
283 typedef unsigned int TIFFIOSize_t;
284 #define _TIFF_lseek_f(fildes,offset,whence)  _lseeki64(fildes,/* __int64 */ offset,whence)
285 /* #define _TIFF_tell_f(fildes) /\* __int64 *\/ _telli64(fildes) */
286 #define _TIFF_fseek_f(stream,offset,whence) _fseeki64(stream,/* __int64 */ offset,whence)
287 #define _TIFF_fstat_f(fildes,stat_buff) _fstati64(fildes,/* struct _stati64 */ stat_buff)
288 /* #define _TIFF_ftell_f(stream) /\* __int64 *\/ _ftelli64(stream) */
289 /* #define _TIFF_stat_f(path,stat_buff) _stati64(path,/\* struct _stati64 *\/ stat_buff) */
290 #define _TIFF_stat_s struct _stati64
291 #define _TIFF_off_t __int64
292 #else
293 typedef size_t TIFFIOSize_t;
294 #define _TIFF_lseek_f(fildes,offset,whence) lseek(fildes,offset,whence)
295 /* #define _TIFF_tell_f(fildes) (_TIFF_lseek_f(fildes,0,SEEK_CUR)) */
296 #define _TIFF_fseek_f(stream,offset,whence) fseek(stream,offset,whence)
297 #define _TIFF_fstat_f(fildes,stat_buff) fstat(fildes,stat_buff)
298 /* #define _TIFF_ftell_f(stream) ftell(stream) */
299 /* #define _TIFF_stat_f(path,stat_buff) stat(path,stat_buff) */
300 #define _TIFF_stat_s struct stat
301 #define _TIFF_off_t off_t
302 #endif
303 
304 #if defined(__has_attribute) && defined(__clang__)
305 #if __has_attribute(no_sanitize)
306 #define TIFF_NOSANITIZE_UNSIGNED_INT_OVERFLOW __attribute__((no_sanitize("unsigned-integer-overflow")))
307 #else
308 #define TIFF_NOSANITIZE_UNSIGNED_INT_OVERFLOW
309 #endif
310 #else
311 #define TIFF_NOSANITIZE_UNSIGNED_INT_OVERFLOW
312 #endif
313 
314 
315 #if defined(__cplusplus)
316 extern "C" {
317 #endif
318 extern int _TIFFgetMode(const char* mode, const char* module);
319 extern int _TIFFNoRowEncode(TIFF* tif, uint8_t* pp, tmsize_t cc, uint16_t s);
320 extern int _TIFFNoStripEncode(TIFF* tif, uint8_t* pp, tmsize_t cc, uint16_t s);
321 extern int _TIFFNoTileEncode(TIFF*, uint8_t* pp, tmsize_t cc, uint16_t s);
322 extern int _TIFFNoRowDecode(TIFF* tif, uint8_t* pp, tmsize_t cc, uint16_t s);
323 extern int _TIFFNoStripDecode(TIFF* tif, uint8_t* pp, tmsize_t cc, uint16_t s);
324 extern int _TIFFNoTileDecode(TIFF*, uint8_t* pp, tmsize_t cc, uint16_t s);
325 extern void _TIFFNoPostDecode(TIFF* tif, uint8_t* buf, tmsize_t cc);
326 extern int _TIFFNoPreCode(TIFF* tif, uint16_t s);
327 extern int _TIFFNoSeek(TIFF* tif, uint32_t off);
328 extern void _TIFFSwab16BitData(TIFF* tif, uint8_t* buf, tmsize_t cc);
329 extern void _TIFFSwab24BitData(TIFF* tif, uint8_t* buf, tmsize_t cc);
330 extern void _TIFFSwab32BitData(TIFF* tif, uint8_t* buf, tmsize_t cc);
331 extern void _TIFFSwab64BitData(TIFF* tif, uint8_t* buf, tmsize_t cc);
332 extern int TIFFFlushData1(TIFF* tif);
333 extern int TIFFDefaultDirectory(TIFF* tif);
334 extern void _TIFFSetDefaultCompressionState(TIFF* tif);
335 extern int _TIFFRewriteField(TIFF *, uint16_t, TIFFDataType, tmsize_t, void *);
336 extern int TIFFSetCompressionScheme(TIFF* tif, int scheme);
337 extern int TIFFSetDefaultCompressionState(TIFF* tif);
338 extern uint32_t _TIFFDefaultStripSize(TIFF* tif, uint32_t s);
339 extern void _TIFFDefaultTileSize(TIFF* tif, uint32_t* tw, uint32_t* th);
340 extern int _TIFFDataSize(TIFFDataType type);
341 
342 /*--: Rational2Double: Return size of TIFFSetGetFieldType in bytes. */
343 extern int _TIFFSetGetFieldSize(TIFFSetGetFieldType setgettype);
344 
345 extern void _TIFFsetByteArray(void**, void*, uint32_t);
346 extern void _TIFFsetString(char**, char*);
347 extern void _TIFFsetShortArray(uint16_t**, uint16_t*, uint32_t);
348 extern void _TIFFsetLongArray(uint32_t**, uint32_t*, uint32_t);
349 extern void _TIFFsetFloatArray(float**, float*, uint32_t);
350 extern void _TIFFsetDoubleArray(double**, double*, uint32_t);
351 
352 extern void _TIFFprintAscii(FILE*, const char*);
353 extern void _TIFFprintAsciiTag(FILE*, const char*, const char*);
354 
355 extern TIFFErrorHandler _TIFFwarningHandler;
356 extern TIFFErrorHandler _TIFFerrorHandler;
357 extern TIFFErrorHandlerExt _TIFFwarningHandlerExt;
358 extern TIFFErrorHandlerExt _TIFFerrorHandlerExt;
359 
360 extern uint32_t _TIFFMultiply32(TIFF*, uint32_t, uint32_t, const char*);
361 extern uint64_t _TIFFMultiply64(TIFF*, uint64_t, uint64_t, const char*);
362 extern tmsize_t _TIFFMultiplySSize(TIFF*, tmsize_t, tmsize_t, const char*);
363 extern tmsize_t _TIFFCastUInt64ToSSize(TIFF*, uint64_t, const char*);
364 extern void* _TIFFCheckMalloc(TIFF*, tmsize_t, tmsize_t, const char*);
365 extern void* _TIFFCheckRealloc(TIFF*, void*, tmsize_t, tmsize_t, const char*);
366 
367 extern double _TIFFUInt64ToDouble(uint64_t);
368 extern float _TIFFUInt64ToFloat(uint64_t);
369 
370 extern float _TIFFClampDoubleToFloat(double);
371 
372 extern tmsize_t
373 _TIFFReadEncodedStripAndAllocBuffer(TIFF* tif, uint32_t strip,
374                                     void **buf, tmsize_t bufsizetoalloc,
375                                     tmsize_t size_to_read);
376 extern tmsize_t
377 _TIFFReadEncodedTileAndAllocBuffer(TIFF* tif, uint32_t tile,
378                                    void **buf, tmsize_t bufsizetoalloc,
379                                    tmsize_t size_to_read);
380 extern tmsize_t
381 _TIFFReadTileAndAllocBuffer(TIFF* tif,
382                             void **buf, tmsize_t bufsizetoalloc,
383                             uint32_t x, uint32_t y, uint32_t z, uint16_t s);
384 extern int _TIFFSeekOK(TIFF* tif, toff_t off);
385 
386 extern int TIFFInitDumpMode(TIFF*, int);
387 #ifdef PACKBITS_SUPPORT
388 extern int TIFFInitPackBits(TIFF*, int);
389 #endif
390 #ifdef CCITT_SUPPORT
391 extern int TIFFInitCCITTRLE(TIFF*, int), TIFFInitCCITTRLEW(TIFF*, int);
392 extern int TIFFInitCCITTFax3(TIFF*, int), TIFFInitCCITTFax4(TIFF*, int);
393 #endif
394 #ifdef THUNDER_SUPPORT
395 extern int TIFFInitThunderScan(TIFF*, int);
396 #endif
397 #ifdef NEXT_SUPPORT
398 extern int TIFFInitNeXT(TIFF*, int);
399 #endif
400 #ifdef LZW_SUPPORT
401 extern int TIFFInitLZW(TIFF*, int);
402 #endif
403 #ifdef OJPEG_SUPPORT
404 extern int TIFFInitOJPEG(TIFF*, int);
405 #endif
406 #ifdef JPEG_SUPPORT
407 extern int TIFFInitJPEG(TIFF*, int);
408 extern int TIFFJPEGIsFullStripRequired(TIFF*);
409 #endif
410 #ifdef JBIG_SUPPORT
411 extern int TIFFInitJBIG(TIFF*, int);
412 #endif
413 #ifdef ZIP_SUPPORT
414 extern int TIFFInitZIP(TIFF*, int);
415 #endif
416 #ifdef PIXARLOG_SUPPORT
417 extern int TIFFInitPixarLog(TIFF*, int);
418 #endif
419 #ifdef LOGLUV_SUPPORT
420 extern int TIFFInitSGILog(TIFF*, int);
421 #endif
422 #ifdef LERC_SUPPORT
423 extern int TIFFInitLERC(TIFF* tif, int);
424 #endif
425 #ifdef LZMA_SUPPORT
426 extern int TIFFInitLZMA(TIFF*, int);
427 #endif
428 #ifdef ZSTD_SUPPORT
429 extern int TIFFInitZSTD(TIFF*, int);
430 #endif
431 #ifdef WEBP_SUPPORT
432 extern int TIFFInitWebP(TIFF*, int);
433 #endif
434 extern const TIFFCodec _TIFFBuiltinCODECS[];
435 
436 #if defined(__cplusplus)
437 }
438 #endif
439 #endif /* _TIFFIOP_ */
440 
441 /* vim: set ts=8 sts=8 sw=8 noet: */
442 /*
443  * Local Variables:
444  * mode: c
445  * c-basic-offset: 8
446  * fill-column: 78
447  * End:
448  */
449