Another fix for the fetching SBYTE arrays by the TIFFFetchByteArray()

function. Should finally resolve
http://bugzilla.remotesensing.org/show_bug.cgi?id=52
This commit is contained in:
Andrey Kiselev 2002-10-02 08:46:54 +00:00
parent b7acbf192d
commit ff993722c9
2 changed files with 38 additions and 23 deletions

View File

@ -1,3 +1,10 @@
2002-10-02 Andrey Kiselev <dron@remotesensing.org>
* libtiff/tif_dirread.c: Another fix for the fetching SBYTE arrays
by the TIFFFetchByteArray() function. Should finally resolve
http://bugzilla.remotesensing.org/show_bug.cgi?id=52
2002-09-15 Andrey Kiselev <dron@remotesensing.org>
* Makefile.in, /man/{raw2tiff.1, Makefile.in, libtiff.3}: Added

View File

@ -1,4 +1,4 @@
/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_dirread.c,v 1.12 2002-09-08 18:01:20 warmerda Exp $ */
/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_dirread.c,v 1.13 2002-10-02 08:46:54 dron Exp $ */
/*
* Copyright (c) 1988-1997 Sam Leffler
@ -780,26 +780,34 @@ TIFFFetchByteArray(TIFF* tif, TIFFDirEntry* dir, uint16* v)
* Extract data from offset field.
*/
if (tif->tif_header.tiff_magic == TIFF_BIGENDIAN) {
if (dir->tdir_type == TIFF_SBYTE)
switch (dir->tdir_count) {
case 4: v[3] = (signed char)(dir->tdir_offset & 0xff);
case 3: v[2] = (signed char)((dir->tdir_offset >> 8) & 0xff);
case 2: v[1] = (signed char)((dir->tdir_offset >> 16) & 0xff);
case 1: v[0] = (signed char)(dir->tdir_offset >> 24);
}
else
switch (dir->tdir_count) {
case 4: v[3] = (uint16)(dir->tdir_offset & 0xff);
case 3: v[2] = (uint16)((dir->tdir_offset >> 8) & 0xff);
case 2: v[1] = (uint16)((dir->tdir_offset >> 16) & 0xff);
case 1:
if (dir->tdir_type == TIFF_SBYTE)
v[0] = (signed char)(dir->tdir_offset >> 24);
else
v[0] = (uint16)(dir->tdir_offset >> 24);
case 1: v[0] = (uint16)(dir->tdir_offset >> 24);
}
} else {
if (dir->tdir_type == TIFF_SBYTE)
switch (dir->tdir_count) {
case 4: v[3] = (signed char)(dir->tdir_offset >> 24);
case 3: v[2] = (signed char)((dir->tdir_offset >> 16) & 0xff);
case 2: v[1] = (signed char)((dir->tdir_offset >> 8) & 0xff);
case 1: v[0] = (signed char)(dir->tdir_offset & 0xff);
}
else
switch (dir->tdir_count) {
case 4: v[3] = (uint16)(dir->tdir_offset >> 24);
case 3: v[2] = (uint16)((dir->tdir_offset >> 16) & 0xff);
case 2: v[1] = (uint16)((dir->tdir_offset >> 8) & 0xff);
case 1:
if (dir->tdir_type == TIFF_SBYTE)
v[0] = (signed char)((dir->tdir_offset) & 0xff);
else
v[0] = (uint16)(dir->tdir_offset & 0xff);
case 1: v[0] = (uint16)(dir->tdir_offset & 0xff);
}
}
return (1);