BigTIFF upgrade in progress - widespread temp mess - does not compile now

This commit is contained in:
Joris Van Damme 2007-04-10 16:45:42 +00:00
parent ff1d8bf5c1
commit 8872f01002

View File

@ -1,4 +1,4 @@
/* $Id: tif_thunder.c,v 1.7 2007-03-31 01:41:11 joris Exp $ */
/* $Id: tif_thunder.c,v 1.8 2007-04-10 16:45:42 joris Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@ -60,19 +60,20 @@ static const int threebitdeltas[8] = { 0, 1, 2, 3, 0, -3, -2, -1 };
if (npixels++ & 1) \
*op++ |= lastpixel; \
else \
op[0] = (tidataval_t) (lastpixel << 4); \
op[0] = (uint8) (lastpixel << 4); \
}
static int
ThunderDecode(TIFF* tif, tidata_t op, tsize_t maxpixels)
ThunderDecode(TIFF* tif, uint8* op, tmsize_t maxpixels)
{
static const char module[] = "ThunderDecode";
register unsigned char *bp;
register tsize_t cc;
register tmsize_t cc;
unsigned int lastpixel;
tsize_t npixels;
tmsize_t npixels;
bp = (unsigned char *)tif->tif_rawcp;
cc = tif->tif_rawcc; ddd
cc = tif->tif_rawcc;
lastpixel = 0;
npixels = 0;
while (cc > 0 && npixels < maxpixels) {
@ -93,7 +94,7 @@ ThunderDecode(TIFF* tif, tidata_t op, tsize_t maxpixels)
npixels += n;
if (npixels < maxpixels) {
for (; n > 0; n -= 2)
*op++ = (tidataval_t) lastpixel;
*op++ = (uint8) lastpixel;
}
if (n == -1)
*--op &= 0xf0;
@ -118,29 +119,36 @@ ThunderDecode(TIFF* tif, tidata_t op, tsize_t maxpixels)
break;
}
}
tif->tif_rawcp = (tidata_t) bp;
tif->tif_rawcc = cc; ddd
tif->tif_rawcp = (uint8*) bp;
tif->tif_rawcc = cc;
if (npixels != maxpixels) {
TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
"ThunderDecode: %s data at scanline %ld (%lu != %lu)",
TIFFErrorExt(tif->tif_clientdata, module,
"%s data at scanline %lud (%llu != %llu)",
npixels < maxpixels ? "Not enough" : "Too much",
(long) tif->tif_row, (long) npixels, (long) maxpixels);
(unsigned long) tif->tif_row, (unsigned long long) npixels,
(unsigned long long) maxpixels);
return (0);
}
return (1);
}
static int
ThunderDecodeRow(TIFF* tif, tidata_t buf, tsize_t occ, uint16 s)
ThunderDecodeRow(TIFF* tif, uint8* buf, tmsize_t occ, uint16 s)
{
tidata_t row = buf;
static const char module[] = "ThunderDecodeRow";
uint8* row = buf;
(void) s;
while ((long)occ > 0) {
if (occ % tif->tif_scanlinesize)
{
TIFFErrorExt(tif->tif_clientdata, module, "Fractional scanlines cannot be read");
return (0);
}
while (occ > 0) {
if (!ThunderDecode(tif, row, tif->tif_dir.td_imagewidth))
return (0);
occ -= tif->tif_scanlinesize; ddd
row += tif->tif_scanlinesize; ddd
occ -= tif->tif_scanlinesize;
row += tif->tif_scanlinesize;
}
return (1);
}
@ -149,8 +157,8 @@ int
TIFFInitThunderScan(TIFF* tif, int scheme)
{
(void) scheme;
tif->tif_decoderow = ThunderDecodeRow; ddd
tif->tif_decodestrip = ThunderDecodeRow; ddd
tif->tif_decoderow = ThunderDecodeRow;
tif->tif_decodestrip = ThunderDecodeRow;
return (1);
}
#endif /* THUNDER_SUPPORT */