diff options
author | Liang Qi <liang.qi@digia.com> | 2013-03-04 10:22:52 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-04-05 11:07:49 +0200 |
commit | 8b2b1b0f63d258ec5ea753cd44531731c0bdece8 (patch) | |
tree | 2c651bf7ba4d34ff8314d180eec11c7a7c3bbd52 /src/3rdparty/libtiff/libtiff/tif_next.c | |
parent | 7a10649ea7b8963d66c14a0391b7356fc7d9ce9d (diff) |
Upgrading libtiff: Adding clean copy of libtiff 4.0.3
This commit removes the previous version of the bundled libtiff
(3.9.2), as well as all local modifications to it. It adds an
unmodified copy of the official libtiff source distribution, except
that various extraneous files have been removed, as usual.
The patches required to build it in Qt will follow in separate
commit(s).
Task-number: QTBUG-25409
Change-Id: If47e02c25ce1a2b3b47eff94a875e2abea0c7e1c
Reviewed-by: aavit <eirik.aavitsland@digia.com>
Diffstat (limited to 'src/3rdparty/libtiff/libtiff/tif_next.c')
-rw-r--r-- | src/3rdparty/libtiff/libtiff/tif_next.c | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/src/3rdparty/libtiff/libtiff/tif_next.c b/src/3rdparty/libtiff/libtiff/tif_next.c index 0e1842d..524e127 100644 --- a/src/3rdparty/libtiff/libtiff/tif_next.c +++ b/src/3rdparty/libtiff/libtiff/tif_next.c @@ -1,4 +1,4 @@ -/* $Id: tif_next.c,v 1.8 2006/10/12 15:00:49 dron Exp $ */ +/* $Id: tif_next.c,v 1.13 2010-03-10 18:56:48 bfriesen Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -46,12 +46,13 @@ #define WHITE ((1<<2)-1) static int -NeXTDecode(TIFF* tif, tidata_t buf, tsize_t occ, tsample_t s) +NeXTDecode(TIFF* tif, uint8* buf, tmsize_t occ, uint16 s) { + static const char module[] = "NeXTDecode"; unsigned char *bp, *op; - tsize_t cc; - tidata_t row; - tsize_t scanline, n; + tmsize_t cc; + uint8* row; + tmsize_t scanline, n; (void) s; /* @@ -59,12 +60,17 @@ NeXTDecode(TIFF* tif, tidata_t buf, tsize_t occ, tsample_t s) * white (we assume a PhotometricInterpretation * of ``min-is-black''). */ - for (op = buf, cc = occ; cc-- > 0;) + for (op = (unsigned char*) buf, cc = occ; cc-- > 0;) *op++ = 0xff; bp = (unsigned char *)tif->tif_rawcp; cc = tif->tif_rawcc; scanline = tif->tif_scanlinesize; + if (occ % scanline) + { + TIFFErrorExt(tif->tif_clientdata, module, "Fractional scanlines cannot be read"); + return (0); + } for (row = buf; occ > 0; occ -= scanline, row += scanline) { n = *bp++, cc--; switch (n) { @@ -79,7 +85,7 @@ NeXTDecode(TIFF* tif, tidata_t buf, tsize_t occ, tsample_t s) cc -= scanline; break; case LITERALSPAN: { - tsize_t off; + tmsize_t off; /* * The scanline has a literal span that begins at some * offset. @@ -105,7 +111,7 @@ NeXTDecode(TIFF* tif, tidata_t buf, tsize_t occ, tsample_t s) */ op = row; for (;;) { - grey = (n>>6) & 0x3; + grey = (uint32)((n>>6) & 0x3); n &= 0x3f; /* * Ensure the run does not exceed the scanline @@ -124,11 +130,11 @@ NeXTDecode(TIFF* tif, tidata_t buf, tsize_t occ, tsample_t s) } } } - tif->tif_rawcp = (tidata_t) bp; + tif->tif_rawcp = (uint8*) bp; tif->tif_rawcc = cc; return (1); bad: - TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "NeXTDecode: Not enough data for scanline %ld", + TIFFErrorExt(tif->tif_clientdata, module, "Not enough data for scanline %ld", (long) tif->tif_row); return (0); } @@ -137,11 +143,18 @@ int TIFFInitNeXT(TIFF* tif, int scheme) { (void) scheme; - tif->tif_decoderow = NeXTDecode; - tif->tif_decodestrip = NeXTDecode; + tif->tif_decoderow = NeXTDecode; + tif->tif_decodestrip = NeXTDecode; tif->tif_decodetile = NeXTDecode; return (1); } #endif /* NEXT_SUPPORT */ /* vim: set ts=8 sts=8 sw=8 noet: */ +/* + * Local Variables: + * mode: c + * c-basic-offset: 8 + * fill-column: 78 + * End: + */ |