diff options
Diffstat (limited to 'tiff/libtiff/tif_thunder.c')
-rw-r--r-- | tiff/libtiff/tif_thunder.c | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/tiff/libtiff/tif_thunder.c b/tiff/libtiff/tif_thunder.c index b56e3c35..3e703d8b 100644 --- a/tiff/libtiff/tif_thunder.c +++ b/tiff/libtiff/tif_thunder.c @@ -61,7 +61,7 @@ static const int threebitdeltas[8] = { 0, 1, 2, 3, 0, -3, -2, -1 }; if (npixels++ & 1) \ *op++ |= lastpixel; \ else \ - op[0] = (uint8) (lastpixel << 4); \ + op[0] = (uint8_t) (lastpixel << 4); \ } \ } @@ -83,7 +83,7 @@ ThunderSetupDecode(TIFF* tif) } static int -ThunderDecode(TIFF* tif, uint8* op, tmsize_t maxpixels) +ThunderDecode(TIFF* tif, uint8_t* op, tmsize_t maxpixels) { static const char module[] = "ThunderDecode"; register unsigned char *bp; @@ -112,10 +112,10 @@ ThunderDecode(TIFF* tif, uint8* op, tmsize_t maxpixels) } else lastpixel |= lastpixel << 4; npixels += n; - if (npixels > maxpixels) - n -= npixels - maxpixels; - for (; n > 0; n -= 2) - *op++ = (uint8) lastpixel; + if (npixels < maxpixels) { + for (; n > 0; n -= 2) + *op++ = (uint8_t) lastpixel; + } if (n == -1) *--op &= 0xf0; lastpixel &= 0xf; @@ -139,24 +139,15 @@ ThunderDecode(TIFF* tif, uint8* op, tmsize_t maxpixels) break; } } - tif->tif_rawcp = (uint8*) bp; + tif->tif_rawcp = (uint8_t*) bp; tif->tif_rawcc = cc; if (npixels != maxpixels) { -#if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__)) TIFFErrorExt(tif->tif_clientdata, module, - "%s data at scanline %lu (%I64u != %I64u)", + "%s data at scanline %lu (%"PRIu64" != %"PRIu64")", npixels < maxpixels ? "Not enough" : "Too much", (unsigned long) tif->tif_row, - (unsigned __int64) npixels, - (unsigned __int64) maxpixels); -#else - TIFFErrorExt(tif->tif_clientdata, module, - "%s data at scanline %lu (%llu != %llu)", - npixels < maxpixels ? "Not enough" : "Too much", - (unsigned long) tif->tif_row, - (unsigned long long) npixels, - (unsigned long long) maxpixels); -#endif + (uint64_t) npixels, + (uint64_t) maxpixels); return (0); } @@ -164,10 +155,10 @@ ThunderDecode(TIFF* tif, uint8* op, tmsize_t maxpixels) } static int -ThunderDecodeRow(TIFF* tif, uint8* buf, tmsize_t occ, uint16 s) +ThunderDecodeRow(TIFF* tif, uint8_t* buf, tmsize_t occ, uint16_t s) { static const char module[] = "ThunderDecodeRow"; - uint8* row = buf; + uint8_t* row = buf; (void) s; if (occ % tif->tif_scanlinesize) |