2004.10.27 20:47 "[Tiff] Possible bug in tiff2ps", by Peter Fales

2004.10.27 20:47 "[Tiff] Possible bug in tiff2ps", by Peter Fales

tiff2ps (from 3.7.0) is failing on on my Darwin (Mac OS/X) system. It looks like the problem is in setupPageState() where the wrong value is returned from TIFFGetField(tif, TIFFTAG_XRESOLUTION, &xres)

xres is a double, but in TIFFGetField(), which in turn calls _TIFFVGetField, we eventually get to this line in tif_dir.c, where the pointer is being treated as a float.:

        case TIFFTAG_XRESOLUTION:
            *va_arg(ap, float*) = td->td_xresolution;
            break;

I'm not sure it's the best fix, but this works for me:

diff -ur tiff-3.7.0/tools/tiff2ps.c tiff-3.7.0.new/tools/tiff2ps.c
--- tiff-3.7.0/tools/tiff2ps.c  2004-10-14 12:53:28.000000000 -0500
+++ tiff-3.7.0.new/tools/tiff2ps.c      2004-10-27 15:36:18.000000000 -0500
@@ -411,7 +411,7 @@
 static void
 setupPageState(TIFF* tif, uint32* pw, uint32* ph, double* pprw, double* pprh)
 {
-       double xres = 0.0, yres = 0.0;
+       float xres = 0.0, yres = 0.0;

        TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, pw);
        TIFFGetField(tif, TIFFTAG_IMAGELENGTH, ph);

Peter Fales                       Lucent Technologies, Room 1C-436
N9IYJ                             2000 N Naperville Rd PO Box 3033
internet: psfales@lucent.com      Naperville, IL 60566-7033
                                  work: (630) 979-8031