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