Hylafax Mailing List Archives

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Hylafax and FreeBSD Ports



Folks,

somewhen in February I mailed to this list about the incompatibility
between the Hylafax and the libtiff-3.5.x ports in FreeBSD-3.4. We did
observe 8-Byte-long received files while faxgetty hanging and consuming
100% CPU, or faxq hanging and consuming 100% CPU.

My solution at that time was to go back to libtiff-3.4.

Note that this does apply to any system and is *not* specific to
FreeBSD. Linux boxes with Hylafax 4.0PL2 are affected as well!

Recently Robert Colquhoun submitted tiff-3.5-interfaces.patch which
solves the problem for Hylafax 4.1beta. This patch however does not
easily apply to Hylafax 4.0PL2, as it leaves some rejected patch lines
around. Fortunately it is straightforward to make the patch apply: Just
substitute all occurrences of "bool" by "fxBool" (in the patch file, not
in the sources!), and it will apply without errors to Hylafax 4.0PL2.

With FreeBSD, you most conveniently place this modified patch file in
/usr/ports/comms/hylafax/patches/patch-tiff-3.5, then reinstall hylafax,
and you're done. For your convenience I have attached this new patch, as
it's only 8k.

Hope this helps,
Helge
# modified for hylafax-4.0 PL2 (hmo19apr00)

# tiff-3.5-interfaces.patch
# Robert Colquhoun <rjc@trump.net.au> Wed, 22 Mar 2000 09:57:00
#
# Attached is a patch so that hylafax works with tiff 3.5.  The tiff 
# maintainers changed a few of the internal interfaces to achieve large
# run lengths (from 16 to 32 bits).  Hylafax uses one of libtiffs header 
# files(faxd/tif_fax3.h) for some undocumented macros and interfaces and
# was only expecting 16 bits, and broke.
#
# I successfully sent one fax with this patch and libtiff 3.5...anything
# more complicated might or might not work ;-)
#
# Instructions: From main source directory run command :
# patch -bp0 --verbose <tiff-3.5-interfaces.patch

--- faxd/CopyQuality.c++	1999/09/02 10:16:22	1.4
+++ faxd/CopyQuality.c++	2000/03/22 12:32:01
@@ -50,7 +50,7 @@
     setupDecoder(conf.recvFillOrder, params.is2D());
 
     u_int rowpixels = params.pageWidth();	// NB: assume rowpixels <= 2432
-    uint16 runs[2*2432];			// run arrays for cur+ref rows
+    uint32 runs[2*2432];			// run arrays for cur+ref rows
     setRuns(runs, runs+2432, rowpixels);
 
     recvEOLCount = 0;				// count of EOL codes
--- faxd/G3Decoder.c++	1999/06/13 07:41:03	1.2
+++ faxd/G3Decoder.c++	2000/03/22 12:32:04
@@ -41,13 +41,13 @@
     DECLARE_STATE_EOL();						\
     int a0;				/* reference element */		\
     int RunLength;			/* length of current run */	\
-    uint16* pa;				/* place to stuff next run */	\
-    uint16* thisrun;			/* current row's run array */	\
+    uint32* pa;				/* place to stuff next run */	\
+    uint32* thisrun;			/* current row's run array */	\
     const TIFFFaxTabEnt* TabEnt
 #define	DECLARE_STATE_2D()						\
     DECLARE_STATE();							\
     int b1;				/* next change on prev line */	\
-    uint16* pb				/* next run in reference line */
+    uint32* pb				/* next run in reference line */
 /*
  * Load any state that may be changed during decoding.
  */
@@ -113,7 +113,7 @@
 }
 
 void
-G3Decoder::setRuns(uint16* cr, uint16* rr, int w)
+G3Decoder::setRuns(uint32* cr, uint32* rr, int w)
 {
     curruns = cr;
     if (refruns = rr) {
@@ -134,7 +134,7 @@
 {
     u_int rowbytes = howmany(w, 8);
     if (curruns == NULL) {
-	uint16 runs[2*2432];		// run arrays for cur+ref rows
+	uint32 runs[2*2432];		// run arrays for cur+ref rows
 	setRuns(runs, runs+2432, w);
 	while (h-- > 0) {
 	    decodeRow(raster, w);
@@ -235,7 +235,7 @@
 	_TIFFFax3fillruns((u_char*) scanline, thisrun, pa, lastx);
     if (is2D) {
 	SETVAL(0);			// imaginary change for reference
-	SWAP(uint16*, curruns, refruns);
+	SWAP(uint32*, curruns, refruns);
     }
     rowref++;
     UNCACHE_STATE();
--- faxd/G3Decoder.h	1999/06/13 07:41:03	1.2
+++ faxd/G3Decoder.h	2000/03/22 12:32:05
@@ -43,8 +43,8 @@
     int		RTCrun;		// count of consecutive zero-length rows
     int		rowref;		// reference count of rows decoded
     int		RTCrow;		// row number of start of RTC
-    uint16*	refruns;	// runs for reference line
-    uint16*	curruns;	// runs for current line
+    uint32*	refruns;	// runs for reference line
+    uint32*	curruns;	// runs for current line
     const u_char* bitmap;	// bit reversal table
 protected:
     G3Decoder();
@@ -68,8 +68,8 @@
     virtual ~G3Decoder();
 
     void	setupDecoder(u_int fillorder, fxBool is2D);
-    void	setRuns(uint16*, uint16*, int);
-    uint16*	lastRuns();
+    void	setRuns(uint32*, uint32*, int);
+    uint32*	lastRuns();
 
     void	decode(void* raster, u_int w, u_int h);
     fxBool	decodeRow(void* scanline, u_int w);
@@ -92,7 +92,7 @@
 #define	EOFraised()		(sigsetjmp(jmpEOF, 0) != 0)
 #define	RTCraised()		(sigsetjmp(jmpRTC, 0) != 0)
 
-inline uint16* G3Decoder::lastRuns()	{ return is2D ? refruns : curruns; }
+inline uint32* G3Decoder::lastRuns()	{ return is2D ? refruns : curruns; }
 inline const u_char* G3Decoder::getBitmap()	{ return bitmap; }
 inline int G3Decoder::getPendingBits() const	{ return bit; }
 inline fxBool G3Decoder::seenRTC() const	{ return (RTCrow != -1); }
--- faxd/TagLine.c++	1999/08/23 11:19:34	1.4
+++ faxd/TagLine.c++	2000/03/22 12:32:13
@@ -208,7 +208,7 @@
      */
     TagLineMemoryDecoder dec(buf);
     dec.setupDecoder(fillorder,  params.is2D());
-    uint16 runs[2*2432];		// run arrays for cur+ref rows
+    uint32 runs[2*2432];		// run arrays for cur+ref rows
     dec.setRuns(runs, runs+2432, w);
 
     dec.decode(NULL, w, th);		// discard decoded data
--- faxd/choptest.c++	1999/06/13 07:41:05	1.2
+++ faxd/choptest.c++	2000/03/22 12:32:14
@@ -70,7 +70,7 @@
 }
 
 static fxBool
-isBlank(uint16* runs, u_int rowpixels)
+isBlank(uint32* runs, u_int rowpixels)
 {
     u_int x = 0;
     for (;;) {
@@ -89,7 +89,7 @@
 {
     setupDecoder(fillorder,  params.is2D());
     u_int rowpixels = params.pageWidth();	// NB: assume rowpixels <= 2432
-    uint16 runs[2*2432];			// run arrays for cur+ref rows
+    uint32 runs[2*2432];			// run arrays for cur+ref rows
     setRuns(runs, runs+2432, rowpixels);
 
     if (!RTCraised()) {
--- faxd/cqtest.c++	1999/09/02 10:16:22	1.4
+++ faxd/cqtest.c++	2000/03/22 12:32:16
@@ -144,7 +144,7 @@
     setupDecoder(recvFillOrder, params.is2D());
 
     u_int rowpixels = params.pageWidth();	// NB: assume rowpixels <= 2432
-    uint16 runs[2*2432];			// run arrays for cur+ref rows
+    uint32 runs[2*2432];			// run arrays for cur+ref rows
     setRuns(runs, runs+2432, rowpixels);
 
     recvEOLCount = 0;				// count of EOL codes
--- faxd/faxQueueApp.c++	2000/03/08 13:44:06	1.7
+++ faxd/faxQueueApp.c++	2000/03/22 12:32:43
@@ -805,7 +805,7 @@
 }
 
 static fxBool
-isBlank(uint16* runs, u_int rowpixels)
+isBlank(uint32* runs, u_int rowpixels)
 {
     u_int x = 0;
     for (;;) {
@@ -824,7 +824,7 @@
 {
     setupDecoder(fillorder,  params.is2D());
     u_int rowpixels = params.pageWidth();	// NB: assume rowpixels <= 2432
-    uint16 runs[2*2432];			// run arrays for cur+ref rows
+    uint32 runs[2*2432];			// run arrays for cur+ref rows
     setRuns(runs, runs+2432, rowpixels);
 
     if (!RTCraised()) {
--- faxd/tagtest.c++	1999/08/23 11:19:35	1.4
+++ faxd/tagtest.c++	2000/03/22 12:32:47
@@ -236,7 +236,7 @@
      */
     MemoryDecoder dec(buf);
     dec.setupDecoder(fillorder,  params.is2D());
-    uint16 runs[2*2432];		// run arrays for cur+ref rows
+    uint32 runs[2*2432];		// run arrays for cur+ref rows
     dec.setRuns(runs, runs+2432, w);
 
     u_int row;
--- faxd/tif_fax3.h	1998/10/12 20:47:49	1.1.1.1
+++ faxd/tif_fax3.h	2000/03/22 12:32:51
@@ -1,8 +1,8 @@
-/* $Id: tiff-3.5-interfaces.patch,v 1.1 2000/04/11 10:11:27 philw Exp $ */
+/* $Id: tiff-3.5-interfaces.patch,v 1.1 2000/04/11 10:11:27 philw Exp $ */
 
 /*
- * Copyright (c) 1990-1996 Sam Leffler
- * Copyright (c) 1991-1996 Silicon Graphics, Inc.
+ * Copyright (c) 1990-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
  *
  * Permission to use, copy, modify, distribute, and sell this software and 
  * its documentation for any purpose is hereby granted without fee, provided
@@ -43,7 +43,7 @@
  * The routine must have the type signature given below;
  * for example:
  *
- * fillruns(unsigned char* buf, uint16* runs, uint16* erun, uint32 lastx)
+ * fillruns(unsigned char* buf, uint32* runs, uint32* erun, uint32 lastx)
  *
  * where buf is place to set the bits, runs is the array of b&w run
  * lengths (white then black), erun is the last run in the array, and
@@ -52,7 +52,7 @@
  * data in the run array as needed (e.g. to append zero runs to bring
  * the count up to a nice multiple).
  */
-typedef	void (*TIFFFaxFillFunc)(unsigned char*, uint16*, uint16*, uint32);
+typedef	void (*TIFFFaxFillFunc)(unsigned char*, uint32*, uint32*, uint32);
 
 /*
  * The default run filler; made external for other decoders.
@@ -60,7 +60,7 @@
 #if defined(__cplusplus)
 extern "C" {
 #endif
-extern	void _TIFFFax3fillruns(unsigned char*, uint16*, uint16*, uint32);
+extern	void _TIFFFax3fillruns(unsigned char*, uint32*, uint32*, uint32);
 #if defined(__cplusplus)
 }
 #endif
@@ -84,7 +84,7 @@
 typedef struct {		/* state table entry */
 	unsigned char State;	/* see above */
 	unsigned char Width;	/* width of code in bits */
-	uint16	Param;		/* unsigned 16-bit run length in bits */
+	uint32	Param;		/* unsigned 32-bit run length in bits */
 } TIFFFaxTabEnt;
 
 extern	const TIFFFaxTabEnt TIFFFaxMainTable[];


Home
Report any problems to webmaster@hylafax.org

HylaFAX is a trademark of Silicon Graphics Corporation.
Internet connectivity for hylafax.org is provided by:
VirtuALL Private Host Services