42#define NOSTRIP ((uint32)(-1))
43#define NOTILE ((uint32)(-1))
45#define INITIAL_THRESHOLD (1024 * 1024)
46#define THRESHOLD_MULTIPLIER 10
47#define MAX_THRESHOLD (THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER * INITIAL_THRESHOLD)
49#define TIFF_INT64_MAX ((((int64)0x7FFFFFFF) << 32) | 0xFFFFFFFF)
55 int is_strip,
uint32 strip_or_tile,
67 if(
size > 1000 * 1000 * 1000 )
73 "Chunk size requested is larger than file size.");
85 while( already_read <
size )
104 "Invalid buffer size");
109 if( new_rawdata == 0 )
112 "No space for data buffer at scanline %lu",
129 already_read += bytes_read;
133#if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
137 "Read error at scanline %lu; got %I64u bytes, "
140 (
unsigned __int64) already_read,
146 "Read error at row %lu, col %lu, tile %lu; "
147 "got %I64u bytes, expected %I64u",
150 (
unsigned long) strip_or_tile,
151 (
unsigned __int64) already_read,
158 "Read error at scanline %lu; got %llu bytes, "
161 (
unsigned long long) already_read,
162 (
unsigned long long)
size);
167 "Read error at row %lu, col %lu, tile %lu; "
168 "got %llu bytes, expected %llu",
171 (
unsigned long) strip_or_tile,
172 (
unsigned long long) already_read,
173 (
unsigned long long)
size);
186 static const char module[] =
"TIFFFillStripPartial";
205 read_ahead_mod = read_ahead * 2;
207 read_ahead_mod = read_ahead;
214 "Data buffer too small to hold part of strip %lu",
215 (
unsigned long) strip);
235 if( unused_data > 0 )
247 if (!
SeekOK(tif, read_offset)) {
249 "Seek error at scanline %lu, strip %lu",
250 (
unsigned long) tif->
tif_row, (
unsigned long) strip);
258 to_read = read_ahead_mod - unused_data;
305 if( TIFFJPEGIsFullStripRequired(tif) )
341 "%lu: Row out of range, max %lu",
349 "%lu: Sample out of range, max %lu",
361#if defined(CHUNKY_STRIP_READ_SUPPORT)
412 else if( !whole_strip )
422 if (row < tif->tif_row) {
480 return (
e > 0 ? 1 : -1);
490 static const char module[] =
"TIFFReadEncodedStrip";
502 "%lu: Strip out of range, max %lu",(
unsigned long)strip,
511 stripinplane=(strip%stripsperplane);
512 if( pplane ) *pplane=(
uint16)(strip/stripsperplane);
514 if (rows>rowsperstrip)
529 static const char module[] =
"TIFFReadEncodedStrip";
585 if (this_stripsize==((
tmsize_t)(-1)))
588 if ((size_to_read!=(
tmsize_t)(-1))&&(size_to_read<this_stripsize))
589 this_stripsize=size_to_read;
603 return(this_stripsize);
618 "Seek error at scanline %lu, strip %lu",
619 (
unsigned long) tif->
tif_row, (
unsigned long) strip);
624#if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
626 "Read error at scanline %lu; got %I64u bytes, expected %I64u",
632 "Read error at scanline %lu; got %llu bytes, expected %llu",
634 (
unsigned long long)
cc,
635 (
unsigned long long)
size);
660#if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
662 "Read error at scanline %lu, strip %lu; got %I64u bytes, expected %I64u",
664 (
unsigned long) strip,
669 "Read error at scanline %lu, strip %lu; got %llu bytes, expected %llu",
671 (
unsigned long) strip,
672 (
unsigned long long)
n,
673 (
unsigned long long)
size);
694 "Seek error at scanline %lu, strip %lu",
696 (
unsigned long) strip_or_tile);
701 "Seek error at row %lu, col %lu, tile %lu",
704 (
unsigned long) strip_or_tile);
724 static const char module[] =
"TIFFReadRawStrip";
733 "%lu: Strip out of range, max %lu",
734 (
unsigned long) strip,
741 "Compression scheme does not support access to raw uncompressed data");
749 if( bytecountm == 0 ) {
768 static const char module[] =
"TIFFFillStrip";
775#if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
777 "Invalid strip byte count %I64u, strip %lu",
779 (
unsigned long) strip);
782 "Invalid strip byte count %llu, strip %lu",
783 (
unsigned long long) bytecount,
784 (
unsigned long) strip);
792 if( bytecount > 1024 * 1024 )
797 if( stripsize != 0 &&
798 (bytecount - 4096) / 10 > (
uint64)stripsize )
803#if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
805 "Too large strip byte count %I64u, strip %lu. Limiting to %I64u",
807 (
unsigned long) strip,
808 (
unsigned __int64) newbytecount);
811 "Too large strip byte count %llu, strip %lu. Limiting to %llu",
812 (
unsigned long long) bytecount,
813 (
unsigned long) strip,
814 (
unsigned long long) newbytecount);
816 bytecount = newbytecount;
838#if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
841 "Read error on strip %lu; "
842 "got %I64u bytes, expected %I64u",
843 (
unsigned long) strip,
849 "Read error on strip %lu; "
850 "got %llu bytes, expected %llu",
851 (
unsigned long) strip,
853 (
unsigned long long) bytecount);
900 if ((
uint64)bytecountm!=bytecount)
909 "Data buffer too small to hold strip %lu",
910 (
unsigned long) strip);
929 bytecountm,
module) != bytecountm)
937 bytecountm,
module) != bytecountm)
980 static const char module[] =
"TIFFReadEncodedTile";
988 "%lu: Tile out of range, max %lu",
989 (
unsigned long) tile, (
unsigned long) td->
td_nstrips);
1012 else if (
size > tilesize)
1037 buf, bufsizetoalloc,
1052 static const char module[] =
"_TIFFReadEncodedTileAndAllocBuffer";
1065 "%lu: Tile out of range, max %lu",
1066 (
unsigned long) tile, (
unsigned long) td->
td_nstrips);
1076 "No space for tile buffer");
1081 if (size_to_read == (
tmsize_t)(-1))
1082 size_to_read = tilesize;
1083 else if (size_to_read > tilesize)
1084 size_to_read = tilesize;
1088 return (size_to_read);
1102 "Seek error at row %lu, col %lu, tile %lu",
1105 (
unsigned long) tile);
1110#if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
1112 "Read error at row %lu, col %lu; got %I64u bytes, expected %I64u",
1119 "Read error at row %lu, col %lu; got %llu bytes, expected %llu",
1122 (
unsigned long long)
cc,
1123 (
unsigned long long)
size);
1139#if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
1141"Read error at row %lu, col %lu, tile %lu; got %I64u bytes, expected %I64u",
1144 (
unsigned long) tile,
1149"Read error at row %lu, col %lu, tile %lu; got %llu bytes, expected %llu",
1152 (
unsigned long) tile,
1153 (
unsigned long long)
n,
1154 (
unsigned long long)
size);
1169 static const char module[] =
"TIFFReadRawTile";
1178 "%lu: Tile out of range, max %lu",
1179 (
unsigned long) tile, (
unsigned long) td->
td_nstrips);
1185 "Compression scheme does not support access to raw uncompressed data");
1193 if( bytecountm == 0 ) {
1206 static const char module[] =
"TIFFFillTile";
1213#if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
1215 "%I64u: Invalid tile byte count, tile %lu",
1217 (
unsigned long) tile);
1220 "%llu: Invalid tile byte count, tile %lu",
1221 (
unsigned long long) bytecount,
1222 (
unsigned long) tile);
1230 if( bytecount > 1024 * 1024 )
1235 if( stripsize != 0 &&
1236 (bytecount - 4096) / 10 > (
uint64)stripsize )
1241#if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
1243 "Too large tile byte count %I64u, tile %lu. Limiting to %I64u",
1245 (
unsigned long) tile,
1246 (
unsigned __int64) newbytecount);
1249 "Too large tile byte count %llu, tile %lu. Limiting to %llu",
1250 (
unsigned long long) bytecount,
1251 (
unsigned long) tile,
1252 (
unsigned long long) newbytecount);
1254 bytecount = newbytecount;
1311 if ((
uint64)bytecountm!=bytecount)
1320 "Data buffer too small to hold tile %lu",
1321 (
unsigned long) tile);
1340 bytecountm,
module) != bytecountm)
1348 bytecountm,
module) != bytecountm)
1380 static const char module[] =
"TIFFReadBufferSetup";
1399 "Invalid buffer size");
1409 "No space for data buffer at scanline %lu",
1410 (
unsigned long) tif->
tif_row);
1459 static const char module[] =
"TIFFStartTile";
1470 if (howmany32 == 0) {
1476 if (howmany32 == 0) {
1508 "Can not read tiles from a striped image" :
1509 "Can not read scanlines from a tiled image");
1528 static const char module[] =
"TIFFReadFromUserBuffer";
1542 "Compression scheme does not support access to raw uncompressed data");
1577 (
uint16)(strile/stripsperplane)) )
void restart(int argc, const char *argv[])
struct png_info_def *typedef unsigned char **typedef struct png_info_def *typedef struct png_info_def *typedef struct png_info_def *typedef unsigned char ** row
GLint GLint GLint GLint GLint x
GLint GLint GLint GLint GLint GLint y
GLboolean GLboolean GLboolean b
GLenum GLuint GLenum GLsizei const GLchar * buf
GLboolean GLboolean GLboolean GLboolean a
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint GLenum GLenum GLenum GLint GLuint GLenum GLenum GLfloat GLenum GLfloat GLenum GLint const GLfloat GLenum GLint const GLushort GLint GLint GLsizei GLsizei GLenum GLsizei GLsizei GLenum GLenum const GLvoid GLenum plane
const unsigned char size_t insize
unsigned char size_t * outsize
#define memmove(s1, s2, n)
uint16 td_samplesperpixel
tmsize_t tif_scanlinesize
tmsize_t tif_rawdataloaded
TIFFPreMethod tif_predecode
TIFFCodeMethod tif_decodestrip
TIFFPostMethod tif_postdecode
TIFFCodeMethod tif_decoderow
TIFFBoolMethod tif_setupdecode
TIFFCodeMethod tif_decodetile
tmsize_t _TIFFCastUInt64ToSSize(TIFF *tif, uint64 val, const char *module)
uint64 TIFFGetStrileOffset(TIFF *tif, uint32 strile)
uint64 TIFFGetStrileByteCount(TIFF *tif, uint32 strile)
void TIFFErrorExt(thandle_t fd, const char *module, const char *fmt,...)
const char * TIFFFileName(TIFF *tif)
int TIFFIsTiled(TIFF *tif)
static tmsize_t TIFFReadEncodedStripGetStripSize(TIFF *tif, uint32 strip, uint16 *pplane)
tmsize_t _TIFFReadEncodedStripAndAllocBuffer(TIFF *tif, uint32 strip, void **buf, tmsize_t bufsizetoalloc, tmsize_t size_to_read)
tmsize_t TIFFReadTile(TIFF *tif, void *buf, uint32 x, uint32 y, uint32 z, uint16 s)
void _TIFFNoPostDecode(TIFF *tif, uint8 *buf, tmsize_t cc)
#define INITIAL_THRESHOLD
int TIFFReadBufferSetup(TIFF *tif, void *bp, tmsize_t size)
static int TIFFStartStrip(TIFF *tif, uint32 strip)
int TIFFReadFromUserBuffer(TIFF *tif, uint32 strile, void *inbuf, tmsize_t insize, void *outbuf, tmsize_t outsize)
static tmsize_t TIFFReadRawStrip1(TIFF *tif, uint32 strip, void *buf, tmsize_t size, const char *module)
void _TIFFSwab32BitData(TIFF *tif, uint8 *buf, tmsize_t cc)
void _TIFFSwab16BitData(TIFF *tif, uint8 *buf, tmsize_t cc)
static int TIFFStartTile(TIFF *tif, uint32 tile)
tmsize_t TIFFReadRawTile(TIFF *tif, uint32 tile, void *buf, tmsize_t size)
void _TIFFSwab64BitData(TIFF *tif, uint8 *buf, tmsize_t cc)
tmsize_t TIFFReadEncodedStrip(TIFF *tif, uint32 strip, void *buf, tmsize_t size)
void _TIFFSwab24BitData(TIFF *tif, uint8 *buf, tmsize_t cc)
static int TIFFSeek(TIFF *tif, uint32 row, uint16 sample)
static tmsize_t TIFFReadRawStripOrTile2(TIFF *tif, uint32 strip_or_tile, int is_strip, tmsize_t size, const char *module)
tmsize_t TIFFReadEncodedTile(TIFF *tif, uint32 tile, void *buf, tmsize_t size)
tmsize_t TIFFReadRawStrip(TIFF *tif, uint32 strip, void *buf, tmsize_t size)
static int TIFFCheckRead(TIFF *, int)
static tmsize_t TIFFReadRawTile1(TIFF *tif, uint32 tile, void *buf, tmsize_t size, const char *module)
#define THRESHOLD_MULTIPLIER
tmsize_t _TIFFReadEncodedTileAndAllocBuffer(TIFF *tif, uint32 tile, void **buf, tmsize_t bufsizetoalloc, tmsize_t size_to_read)
tmsize_t _TIFFReadTileAndAllocBuffer(TIFF *tif, void **buf, tmsize_t bufsizetoalloc, uint32 x, uint32 y, uint32 z, uint16 s)
static int TIFFReadAndRealloc(TIFF *tif, tmsize_t size, tmsize_t rawdata_offset, int is_strip, uint32 strip_or_tile, const char *module)
static TIFF_NOSANITIZE_UNSIGNED_INT_OVERFLOW uint64 NoSantizeSubUInt64(uint64 a, uint64 b)
int TIFFFillStrip(TIFF *tif, uint32 strip)
int TIFFFillTile(TIFF *tif, uint32 tile)
int TIFFReadScanline(TIFF *tif, void *buf, uint32 row, uint16 sample)
static int TIFFFillStripPartial(TIFF *tif, int strip, tmsize_t read_ahead, int restart)
tmsize_t TIFFStripSize(TIFF *tif)
tmsize_t TIFFVStripSize(TIFF *tif, uint32 nrows)
void TIFFSwabArrayOfShort(register uint16 *wp, tmsize_t n)
void TIFFSwabArrayOfDouble(double *dp, tmsize_t n)
void TIFFReverseBits(uint8 *cp, tmsize_t n)
void TIFFSwabArrayOfTriples(register uint8 *tp, tmsize_t n)
void TIFFSwabArrayOfLong(register uint32 *lp, tmsize_t n)
tmsize_t TIFFTileSize(TIFF *tif)
int TIFFCheckTile(TIFF *tif, uint32 x, uint32 y, uint32 z, uint16 s)
uint32 TIFFComputeTile(TIFF *tif, uint32 x, uint32 y, uint32 z, uint16 s)
void * _TIFFcalloc(tmsize_t nmemb, tmsize_t siz)
void _TIFFmemset(void *p, int v, tmsize_t c)
void * _TIFFmalloc(tmsize_t s)
void _TIFFmemcpy(void *d, const void *s, tmsize_t c)
void * _TIFFrealloc(void *p, tmsize_t s)
void TIFFWarningExt(thandle_t fd, const char *module, const char *fmt,...)
#define PLANARCONFIG_SEPARATE
#define TIFFroundup_64(x, y)
#define TIFFReadFile(tif, buf, size)
#define TIFF_NOSANITIZE_UNSIGNED_INT_OVERFLOW
#define TIFFhowmany_32_maxuint_compat(x, y)
#define TIFF_TMSIZE_T_MAX
#define isFillOrder(tif, o)
#define TIFFGetFileSize(tif)
#define TIFFhowmany_32(x, y)