tiffiop.h 20 KB

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