}
#
-# Check if TIFF library is compatible. If successful,
-# set $tiff_runlen_t on exit to "uint16" or "uint32"
+# Check if TIFF library is compatible, checking:
+# $tiff_runlen_t: "uint16" or "uint32"
+# $tiff_offset_t: "uint32" or "uint64"
+# $tiff_bytecount_t: "uint32" or "uint64"
+# "Classic" structure names
#
CheckLibtiff()
{
Note "... checking TIFF library version"
tiff_runlen_t=""
+ tiff_offset_t=""
+ tiff_bytecount_t=""
cat>t.c<<EOF
#include <stdio.h>
#include "tiffio.h"
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" ;;
+ 3.4) tiff_runlen_t="uint16"
+ tiff_offset_t="uint32"
+ tiff_bytecount_t="uint32"
+ ;;
+ 3.[56789]) tiff_runlen_t="uint32"
+ tiff_offset_t="uint32"
+ tiff_bytecount_t="uint32"
+ ;;
+ 4.[0]) tiff_runlen_t="uint32"
+ tiff_offset_t="uint64"
+ tiff_bytecount_t="uint64"
+ echo '#define TIFFHeader TIFFHeaderClassic'
+ echo '#define TIFF_VERSION TIFF_VERSION_CLASSIC'
+ echo '#define NEED_TIFFDIRENTRY'
+ ;;
esac
fi
else
fi
if [ "${tiff_runlen_t}" != "" ]; then
export tiff_runlen_t
+ export tiff_offset_t
+ export tiff_bytecount_t
return 0
else
cat 1>&2 <<EOF
fi
CheckTermioFuncDecls termios.h
if CheckLibtiff; then
- Note "... add declaration for tiff_runlen_t"
+ Note "... add declaration for tiff compatibility"
echo "#define tiff_runlen_t ${tiff_runlen_t}"
+ echo "#define tiff_offset_t ${tiff_offset_t}"
+ echo "#define tiff_bytecount_t ${tiff_bytecount_t}"
fi
if [ "x$LIBPAM" != "x" ]; then
CheckPAMType
* Calculate total amount of space needed to read
* the image into memory (in its encoded format).
*/
- uint32* stripbytecount;
+ tiff_bytecount_t* stripbytecount;
(void) TIFFGetField(tif, TIFFTAG_STRIPBYTECOUNTS, &stripbytecount);
tstrip_t strip;
u_long totdata = 0;
* Calculate total amount of space needed to read
* the image into memory (in its encoded format).
*/
- uint32* stripbytecount;
+ tiff_bytecount_t* stripbytecount;
(void) TIFFGetField(tif, TIFFTAG_STRIPBYTECOUNTS, &stripbytecount);
tstrip_t strip;
u_long totdata = 0;
u_char* recvRow; // current receive row raster
u_char* recvPageStart; // pointer to start of page buffer
u_long* savedWriteOff; // file offset at start of page data
- u_long* savedStripByteCounts; // byte counts at start of page data
+ tiff_bytecount_t* savedStripByteCounts; // byte counts at start of page data
int decodedPixels; // number of pixels decoded with error
int decoderFd[2]; // file descriptors for the decoder pipe
int counterFd[2]; // file descriptors for the counter pipe
uint16 fillorder;
TIFFGetFieldDefaulted(tif, TIFFTAG_FILLORDER, &fillorder);
- uint32* stripbytecount;
+ tiff_bytecount_t* stripbytecount;
(void) TIFFGetField(tif, TIFFTAG_STRIPBYTECOUNTS, &stripbytecount);
u_int totbytes = (u_int) stripbytecount[0];
cq.recvSetupTIFF(tifout, 0, cq.recvFillOrder, params);
- uint32* stripbytecount;
+ tiff_bytecount_t* stripbytecount;
(void) TIFFGetField(tif, TIFFTAG_STRIPBYTECOUNTS, &stripbytecount);
for (u_int strip = 0; strip < TIFFNumberOfStrips(tif); strip++) {
u_int totbytes = (u_int) stripbytecount[strip];
TIFF* tif, const Class2Params& params, fxStr& pagehandling)
{
tstrip_t s = TIFFNumberOfStrips(tif)-1;
- uint32* stripbytecount;
+ tiff_bytecount_t* stripbytecount;
(void) TIFFGetField(tif, TIFFTAG_STRIPBYTECOUNTS, &stripbytecount);
u_int stripSize = (u_int) stripbytecount[s];
if (stripSize == 0)
uint16 fillorder;
TIFFGetFieldDefaulted(tif, TIFFTAG_FILLORDER, &fillorder);
- uint32* stripbytecount;
+ tiff_bytecount_t* stripbytecount;
(void) TIFFGetField(tif, TIFFTAG_STRIPBYTECOUNTS, &stripbytecount);
bool firstStrip = setupTagLineSlop(params);
#endif /* CHAR_BIT */
+#ifdef NEED_TIFFDIRENTRY
+/*
+ * we don't pass these to libtiff anywhere, but HylaFAX uses it to keep track
+ * of the info it has read from the TIFFGetField functions when constructin
+ * and writing a single-directory TIFF FILE read from an existing TIFF fax.
+ */
+typedef struct {
+ uint16 tdir_tag;
+ uint16 tdir_type; /* data type */
+ uint32 tdir_count; /* number of items; length in spec */
+ uint32 tdir_offset; /* byte offset to field data */
+} TIFFDirEntry;
+#endif
+
+
static struct {
const char* name; // protocol token name
bool supported; // true if format is supported
* amount of image data and then adding in
* the expected data for the TIFF headers.
*/
- uint32* sb;
+ tiff_bytecount_t* sb;
TIFFGetField(tif, TIFFTAG_STRIPBYTECOUNTS, &sb);
file_size = sizeof (DirTemplate) +
sizeof (TIFFHeader) + sizeof (uint16);
bool
HylaFAXServer::sendITIFFData(TIFF* tif, int fdout)
{
- uint32* sb;
+ tiff_bytecount_t* sb;
(void) TIFFGetField(tif, TIFFTAG_STRIPBYTECOUNTS, &sb);
tdata_t buf = _TIFFmalloc(sb[0]);
tsize_t bsize = sb[0];