File hylafax-6.0.5-TIFF-4.0.patch of Package hylafax

diff -purN hylafax-6.0.5.orig//configure hylafax-6.0.5//configure
--- hylafax-6.0.5.orig//configure	2010-09-15 16:42:36.000000000 +0200
+++ hylafax-6.0.5//configure	2012-01-27 05:42:50.514762593 +0100
@@ -2548,11 +2548,8 @@ EOF
                        header_ver=\1;lib_ver=\2/p'`
 	Note "  Found tiffio.h version ${header_ver}"
 	Note "  Found libtiff version ${lib_ver}"
-	if [ ${header_ver} -ge 19960307 ]; then
-	    case ${lib_ver} in
-		3.4)		tiff_runlen_t="uint16" ;;
-		3.[56789])	tiff_runlen_t="uint32" ;;
-	    esac
+	if [ ${header_ver} -ge 20111221 ]; then
+		tiff_runlen_t="uint32"
 	fi
     else
 	cat 1>&2 <<EOF
@@ -2587,8 +2584,8 @@ EOF
 
 Incompatible TIFF Library.
 
-HylaFAX ${VERSION} requires TIFF software distribution versions 3.4 through
-3.9.  If you do not have up to date TIFF software on your system
+Patched HylaFAX ${VERSION} requires TIFF software distribution version 4.0.
+If you do not have up to date TIFF software on your system
 then you can retrieve it from the location where you obtained this software.
 The Home Page for version 3.5 and later is http://www.remotesensing.org/libtiff/
 EOF
diff -purN hylafax-6.0.5.orig//hfaxd/FileTransfer.c++ hylafax-6.0.5//hfaxd/FileTransfer.c++
--- hylafax-6.0.5.orig//hfaxd/FileTransfer.c++	2010-09-15 16:42:36.000000000 +0200
+++ hylafax-6.0.5//hfaxd/FileTransfer.c++	2012-01-27 05:16:21.458720699 +0100
@@ -47,6 +47,15 @@
 #endif
 #endif /* CHAR_BIT */
 
+/*
+ * Copied from libtiff-3.9 as libtiff-4.0 does not provide it anymore.
+ */
+typedef struct {
+	uint16		tdir_tag;	/* see below */
+	uint16		tdir_type;	/* data type; see below */
+	uint32		tdir_count;	/* number of items; length in spec */
+	uint32		tdir_offset;	/* byte offset to field data */
+} OldClassicTIFFDirEntry;
 
 static struct {
     const char*	name;		// protocol token name
@@ -69,7 +78,7 @@ static 	const char* modenames[] =  { "St
 
 
 static bool
-isTIFF(const TIFFHeader& h)
+isTIFF(const TIFFHeaderClassic& h)
 {
     if (h.tiff_magic != TIFF_BIGENDIAN && h.tiff_magic != TIFF_LITTLEENDIAN)
 	return (false);
@@ -82,7 +91,7 @@ isTIFF(const TIFFHeader& h)
     // byte swap version stamp if opposite byte order
     if ((u.c[0] == 0) ^ (h.tiff_magic == TIFF_BIGENDIAN))
 	TIFFSwabShort(&version);
-    return (version == TIFF_VERSION);
+    return (version == TIFFLIB_VERSION);
 }
 
 
@@ -164,26 +173,26 @@ HylaFAXServer::retrieveCmd(const char* n
  * a single IFD/image from a TIFF file.
  */
 typedef struct {
-    TIFFDirEntry	SubFileType;
-    TIFFDirEntry	ImageWidth;
-    TIFFDirEntry	ImageLength;
-    TIFFDirEntry	BitsPerSample;
-    TIFFDirEntry	Compression;
-    TIFFDirEntry	Photometric;
-    TIFFDirEntry	FillOrder;
-    TIFFDirEntry	StripOffsets;
-    TIFFDirEntry	Orientation;
-    TIFFDirEntry	SamplesPerPixel;
-    TIFFDirEntry	RowsPerStrip;
-    TIFFDirEntry	StripByteCounts;
-    TIFFDirEntry	XResolution;
-    TIFFDirEntry	YResolution;
-    TIFFDirEntry	Options;		// T4 or T6
-    TIFFDirEntry	ResolutionUnit;
-    TIFFDirEntry	PageNumber;
-    TIFFDirEntry	BadFaxLines;
-    TIFFDirEntry	CleanFaxData;
-    TIFFDirEntry	ConsecutiveBadFaxLines;
+    OldClassicTIFFDirEntry	SubFileType;
+    OldClassicTIFFDirEntry	ImageWidth;
+    OldClassicTIFFDirEntry	ImageLength;
+    OldClassicTIFFDirEntry	BitsPerSample;
+    OldClassicTIFFDirEntry	Compression;
+    OldClassicTIFFDirEntry	Photometric;
+    OldClassicTIFFDirEntry	FillOrder;
+    OldClassicTIFFDirEntry	StripOffsets;
+    OldClassicTIFFDirEntry	Orientation;
+    OldClassicTIFFDirEntry	SamplesPerPixel;
+    OldClassicTIFFDirEntry	RowsPerStrip;
+    OldClassicTIFFDirEntry	StripByteCounts;
+    OldClassicTIFFDirEntry	XResolution;
+    OldClassicTIFFDirEntry	YResolution;
+    OldClassicTIFFDirEntry	Options;		// T4 or T6
+    OldClassicTIFFDirEntry	ResolutionUnit;
+    OldClassicTIFFDirEntry	PageNumber;
+    OldClassicTIFFDirEntry	BadFaxLines;
+    OldClassicTIFFDirEntry	CleanFaxData;
+    OldClassicTIFFDirEntry	ConsecutiveBadFaxLines;
     uint32		link;			// offset to next directory
     uint32		xres[2];		// X resolution indirect value
     uint32		yres[2];		// Y resolution indirect value
@@ -229,7 +238,7 @@ HylaFAXServer::retrievePageCmd(const cha
 		uint32* sb;
 		TIFFGetField(tif, TIFFTAG_STRIPBYTECOUNTS, &sb);
 		file_size = sizeof (DirTemplate) +
-		    sizeof (TIFFHeader) + sizeof (uint16);
+		    sizeof (TIFFHeaderClassic) + sizeof (uint16);
 		for (tstrip_t s = 0, ns = TIFFNumberOfStrips(tif); s < ns; s++)
 		    file_size += sb[s];
 		reply(code, "%s for %s (%lu bytes).",
@@ -261,10 +270,10 @@ HylaFAXServer::openTIFF(const char* name
 	if (fd >= 0) {
 	    union {
 		char buf[512];
-		TIFFHeader h;
+		TIFFHeaderClassic h;
 	    } b;
 	    ssize_t cc = Sys::read(fd, (char*) &b, sizeof (b));
-	    if (cc > (ssize_t)sizeof (b.h) && b.h.tiff_version == TIFF_VERSION &&
+	    if (cc > (ssize_t)sizeof (b.h) && b.h.tiff_version == TIFFLIB_VERSION &&
 	      (b.h.tiff_magic == TIFF_BIGENDIAN ||
 	       b.h.tiff_magic == TIFF_LITTLEENDIAN)) {
 		(void) lseek(fd, 0L, SEEK_SET);		// rewind
@@ -318,12 +327,12 @@ HylaFAXServer::sendTIFFData(TIFF* tif, F
 }
 
 static void
-getLong(TIFF* tif, TIFFDirEntry& de)
+getLong(TIFF* tif, OldClassicTIFFDirEntry& de)
 {
     TIFFGetField(tif, de.tdir_tag, &de.tdir_offset);
 }
 static void
-getShort(TIFF* tif, TIFFDirEntry& de)
+getShort(TIFF* tif, OldClassicTIFFDirEntry& de)
 {
     uint16 v;
     TIFFGetField(tif, de.tdir_tag, &v);
@@ -343,7 +352,7 @@ HylaFAXServer::sendTIFFHeader(TIFF* tif,
 {
     static DirTemplate templ = {
 #define	TIFFdiroff(v) \
-    (uint32) (sizeof (TIFFHeader) + sizeof (uint16) + \
+    (uint32) (sizeof (TIFFHeaderClassic) + sizeof (uint16) + \
       (intptr_t) &(((DirTemplate*) 0)->v))
 	{ TIFFTAG_SUBFILETYPE,		TIFF_LONG,	1 },
 	{ TIFFTAG_IMAGEWIDTH,		TIFF_LONG,	1 },
@@ -368,7 +377,7 @@ HylaFAXServer::sendTIFFHeader(TIFF* tif,
 	0,					// next directory
 	{ 0, 1 }, { 0, 1 },			// x+y resolutions
     };
-#define	NTAGS	((TIFFdiroff(link)-TIFFdiroff(SubFileType)) / sizeof (TIFFDirEntry))
+#define	NTAGS	((TIFFdiroff(link)-TIFFdiroff(SubFileType)) / sizeof (OldClassicTIFFDirEntry))
     /*
      * Construct the TIFF header for this IFD using
      * the preconstructed template above.  We extract
@@ -377,14 +386,14 @@ HylaFAXServer::sendTIFFHeader(TIFF* tif,
      * of things about the contents of the TIFF file.
      */
     struct {
-	TIFFHeader h;
+	TIFFHeaderClassic h;
 	uint16	dircount;
 	u_char	dirstuff[sizeof (templ)];
     } buf;
     union { int32 i; char c[4]; } u; u.i = 1;
     buf.h.tiff_magic = (u.c[0] == 0 ? TIFF_BIGENDIAN : TIFF_LITTLEENDIAN);
-    buf.h.tiff_version = TIFF_VERSION;
-    buf.h.tiff_diroff = sizeof (TIFFHeader);
+    buf.h.tiff_version = TIFFLIB_VERSION;
+    buf.h.tiff_diroff = sizeof (TIFFHeaderClassic);
     buf.dircount = (uint16) NTAGS;
     getLong(tif, templ.SubFileType);
     getLong(tif, templ.ImageWidth);
@@ -412,7 +421,7 @@ HylaFAXServer::sendTIFFHeader(TIFF* tif,
     getShort(tif, templ.CleanFaxData);
     getLong(tif, templ.ConsecutiveBadFaxLines);
     if (buf.h.tiff_magic == TIFF_BIGENDIAN) {
-	TIFFDirEntry* dp = &templ.SubFileType;
+	OldClassicTIFFDirEntry* dp = &templ.SubFileType;
 	for (u_int i = 0; i < NTAGS; i++) {
 	    if (dp->tdir_type == TIFF_SHORT)
 		dp->tdir_offset <<= 16;
@@ -957,7 +966,7 @@ HylaFAXServer::docType(const char* docna
 	if (FileCache::lookup(docname, sb) && S_ISREG(sb.st_mode)) {
 	    union {
 		char buf[512];
-		TIFFHeader h;
+		TIFFHeaderClassic h;
 	    } b;
 	    ssize_t cc = Sys::read(fd, (char*) &b, sizeof (b));
 	    if (cc > 2 && b.buf[0] == '%' && b.buf[1] == '!')

openSUSE Build Service is sponsored by