1993.10.19 11:17 "Patches for running v3.3beta003 on DEC Alpha", by Jean-Daniel Fekete
It seems to work for most files. It needs more testing though. I had a (maybe bad) idea concerning type checking. Most errors are due to calls to TIFFGetField with a pointer of the wrong type. Wouldn't it be possible to use the table described in tif_dirinfo.c and generate a header file and a c file with properly prototyped functions. These function would look like:
int TIFFGet<tag name>(TIFF*, <tag type>*);
and the c function would look like:
int TIFFGet<tag name>(TIFF* tiff, <tag type>* t)
{
return TIFFGetField(tiff, TIFFTAG_<TAG NAME>, t);
}
It would certainly be even more valuable to have a C++ class wrapper defined this way, using only inline functions of a TIFF class.
Maybe deriving the pointer type from the tiffFieldInfo is not that easy?
Anyway, here are the diffs.
___ 0 Jean-Daniel Fekete uucp : jdf@lri.lri.fr
/ \ / LRI - Bat 490 bitnet: jdf@FRLRI61.bitnet
/ _/ / Universite de Paris-Sud voice : +33 (1) 69 41 65 91
/__ \/ F-91405 ORSAY Cedex +33 (1) 69 41 66 29
/^//-\/-\/| 2001 S.A.
/ | || | | 2, rue de la Renaissance voice : +33 (1) 46 66 54 54
/_ \_/\_/ | F-92160 ANTONY fax : +33 (1) 46 66 59 50
diff -cr tiff-v3.3beta002.orig/contrib/dbs/xtiff/xtiff.c tiff-v3.3beta002/contrib/dbs/xtiff/xtiff.c
*** tiff-v3.3beta002.orig/contrib/dbs/xtiff/xtiff.c Fri Feb 7 20:55:51 1992
--- tiff-v3.3beta002/contrib/dbs/xtiff/xtiff.c Mon Oct 11 14:59:09 1993
***************
*** 454,460 ****
*/
switch (tfPhotometricInterpretation) {
case PHOTOMETRIC_RGB:
! if (!TIFFGetField(tfFile, TIFFTAG_COLORRESPONSECURVE,
&redMap, &greenMap, &blueMap)) {
redMap = (u_short *) malloc(colormapSize * sizeof(u_short));
greenMap = (u_short *) malloc(colormapSize * sizeof(u_short));
--- 454,460 ----
*/
switch (tfPhotometricInterpretation) {
case PHOTOMETRIC_RGB:
! if (!TIFFGetField(tfFile, TIFFTAG_COLORMAP,
&redMap, &greenMap, &blueMap)) {
redMap = (u_short *) malloc(colormapSize * sizeof(u_short));
greenMap = (u_short *) malloc(colormapSize * sizeof(u_short));
diff -cr tiff-v3.3beta002.orig/libtiff/tif_dirwrite.c tiff-v3.3beta002/libtiff/tif_dirwrite.c
*** tiff-v3.3beta002.orig/libtiff/tif_dirwrite.c Fri Aug 27 03:27:30 1993
--- tiff-v3.3beta002/libtiff/tif_dirwrite.c Mon Oct 11 14:43:54 1993
***************
*** 148,154 ****
if (tif->tif_diroff == 0 && !TIFFLinkDirectory(tif))
goto bad;
tif->tif_dataoff =
! tif->tif_diroff + sizeof (short) + dirsize + sizeof (long);
if (tif->tif_dataoff & 1)
tif->tif_dataoff++;
(void) TIFFSeekFile(tif, tif->tif_dataoff, L_SET);
--- 148,154 ----
if (tif->tif_diroff == 0 && !TIFFLinkDirectory(tif))
goto bad;
tif->tif_dataoff =
! tif->tif_diroff + sizeof (int16) + dirsize + sizeof (int32);
if (tif->tif_dataoff & 1)
tif->tif_dataoff++;
(void) TIFFSeekFile(tif, tif->tif_dataoff, L_SET);
***************
*** 295,301 ****
TIFFError(tif->tif_name, "Error writing directory contents");
goto bad;
}
! if (!WriteOK(tif, &tif->tif_nextdiroff, sizeof (long))) {
TIFFError(tif->tif_name, "Error writing directory link");
goto bad;
}
--- 295,301 ----
TIFFError(tif->tif_name, "Error writing directory contents");
goto bad;
}
! if (!WriteOK(tif, &tif->tif_nextdiroff, sizeof (int32))) {
TIFFError(tif->tif_name, "Error writing directory link");
goto bad;
}
diff -cr tiff-v3.3beta002.orig/libtiff/tif_unix.c tiff-v3.3beta002/libtiff/tif_unix.c
*** tiff-v3.3beta002.orig/libtiff/tif_unix.c Fri Aug 27 03:27:41 1993
--- tiff-v3.3beta002/libtiff/tif_unix.c Mon Oct 11 14:50:18 1993
***************
*** 46,52 ****
}
static toff_t
! _tiffSeekProc(thandle_t fd, off_t off, int whence)
{
return ((toff_t) lseek((int) fd, (off_t) off, whence));
}
--- 46,52 ----
}
static toff_t
! _tiffSeekProc(thandle_t fd, toff_t off, int whence)
{
return ((toff_t) lseek((int) fd, (off_t) off, whence));
}
diff -cr tiff-v3.3beta002.orig/libtiff/tif_write.c tiff-v3.3beta002/libtiff/tif_write.c
*** tiff-v3.3beta002.orig/libtiff/tif_write.c Fri Aug 27 03:27:44 1993
--- tiff-v3.3beta002/libtiff/tif_write.c Mon Oct 11 14:46:08 1993
***************
*** 561,567 ****
* appended to the end of the file.
*/
void
! TIFFSetWriteOffset(TIFF* tif, off_t off)
{
tif->tif_curoff = off;
}
--- 561,567 ----
* appended to the end of the file.
*/
void
! TIFFSetWriteOffset(TIFF* tif, toff_t off)
{
tif->tif_curoff = off;
}
diff -cr tiff-v3.3beta002.orig/tools/tiff2ps.c tiff-v3.3beta002/tools/tiff2ps.c
*** tiff-v3.3beta002.orig/tools/tiff2ps.c Fri Aug 27 03:27:55 1993
--- tiff-v3.3beta002/tools/tiff2ps.c Mon Oct 11 14:52:40 1993
***************
*** 239,245 ****
uint32 subfiletype;
uint16* sampleinfo;
int npages;
! long t;
if (!TIFFGetField(tif, TIFFTAG_XPOSITION, &ox))
ox = 0;
--- 239,245 ----
uint32 subfiletype;
uint16* sampleinfo;
int npages;
! time_t t;
if (!TIFFGetField(tif, TIFFTAG_XPOSITION, &ox))
ox = 0;
diff -cr tiff-v3.3beta002.orig/tools/tiffcp.c tiff-v3.3beta002/tools/tiffcp.c
*** tiff-v3.3beta002.orig/tools/tiffcp.c Fri Aug 27 03:27:56 1993
--- tiff-v3.3beta002/tools/tiffcp.c Mon Oct 11 14:53:09 1993
***************
*** 32,38 ****
--- 32,40 ----
#include "tiffio.h"
+ #ifndef __alpha
typedef unsigned char u_char;
+ #endif
#if defined(VMS)
#define unlink delete