diff options
author | Even Rouault <even.rouault@spatialys.com> | 2019-05-08 08:36:34 +0000 |
---|---|---|
committer | Even Rouault <even.rouault@spatialys.com> | 2019-05-08 08:36:34 +0000 |
commit | b9b93f661ed56fda222ce686a6e6ef03ee84bc3d (patch) | |
tree | b684d0016c6359cbf809ae474ac8225b2f66ec5e | |
parent | 9acff86b565bad9fc86637fd67ff32d25cba9f0c (diff) | |
parent | 933575f50501c1b2e3bd382918de9bc37adfd9f4 (diff) | |
download | libtiff-git-b9b93f661ed56fda222ce686a6e6ef03ee84bc3d.tar.gz |
Merge branch 'bug2799' into 'master'
fix fax2tiff
See merge request libtiff/libtiff!55
-rw-r--r-- | test/CMakeLists.txt | 2 | ||||
-rw-r--r-- | test/Makefile.am | 2 | ||||
-rwxr-xr-x | test/fax2tiff.sh | 16 | ||||
-rw-r--r-- | test/images/README.txt | 3 | ||||
-rw-r--r-- | test/images/miniswhite-1c-1b.g3 | bin | 0 -> 9687 bytes | |||
-rw-r--r-- | tools/fax2tiff.c | 18 |
6 files changed, 30 insertions, 11 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 266e3fcf..bfcc3b0a 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -35,6 +35,7 @@ set(TESTSCRIPTS ppm2tiff_pbm.sh ppm2tiff_pgm.sh ppm2tiff_ppm.sh + fax2tiff.sh tiffcp-g3.sh tiffcp-g3-1d.sh tiffcp-g3-1d-fill.sh @@ -151,6 +152,7 @@ set(UNCOMPRESSEDIMAGES # files which are not currently used by the tests. set(IMAGES_EXTRA_DIST images/README.txt + images/miniswhite-1c-1b.g3 ${BMPIMAGES} ${GIFIMAGES} ${PNMIMAGES} diff --git a/test/Makefile.am b/test/Makefile.am index 8992ef04..cc3fb683 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -71,6 +71,7 @@ TESTSCRIPTS = \ ppm2tiff_pbm.sh \ ppm2tiff_pgm.sh \ ppm2tiff_ppm.sh \ + fax2tiff.sh \ tiffcp-g3.sh \ tiffcp-g3-1d.sh \ tiffcp-g3-1d-fill.sh \ @@ -181,6 +182,7 @@ PNMIMAGES = \ # files which are not currently used by the tests. IMAGES_EXTRA_DIST = \ images/README.txt \ + images/miniswhite-1c-1b.g3 \ $(PNMIMAGES) \ $(TIFFIMAGES) diff --git a/test/fax2tiff.sh b/test/fax2tiff.sh new file mode 100755 index 00000000..fc0a95d7 --- /dev/null +++ b/test/fax2tiff.sh @@ -0,0 +1,16 @@ +#!/bin/sh +# +# Basic sanity check for fax2tiff +# +. ${srcdir:-.}/common.sh +infile="${IMAGES}/miniswhite-1c-1b.g3" +outfile="o-fax2tiff.tiff" +echo "$MEMCHECK ${FAX2TIFF} -M -o $outfile $infile" +eval "$MEMCHECK" "${FAX2TIFF}" "-M" "-o" "$outfile" "$infile" +status=$? +if [ $status != 0 ] ; then + echo "Returned failed status $status!" + echo "Output (if any) is in \"${outfile}\"." + exit $status +fi +f_tiffinfo_validate $outfile diff --git a/test/images/README.txt b/test/images/README.txt index 17f6292e..b6447d8e 100644 --- a/test/images/README.txt +++ b/test/images/README.txt @@ -27,3 +27,6 @@ PNM files: minisblack-1c-8b.pgm miniswhite-1c-1b.pbm rgb-3c-8b.ppm + +G3 Fax files : + miniswhite-1c-1b.g3 diff --git a/test/images/miniswhite-1c-1b.g3 b/test/images/miniswhite-1c-1b.g3 Binary files differnew file mode 100644 index 00000000..9f00ce16 --- /dev/null +++ b/test/images/miniswhite-1c-1b.g3 diff --git a/tools/fax2tiff.c b/tools/fax2tiff.c index 2098b2ab..21223131 100644 --- a/tools/fax2tiff.c +++ b/tools/fax2tiff.c @@ -74,14 +74,10 @@ static void usage(void); Struct to carry client data. Note that it does not appear that the client data is actually used in this program. */ -typedef struct _FAX_Client_Data +typedef union _FAX_Client_Data { -#if defined(_WIN32) && defined(USE_WIN32_FILEIO) - intptr_t fh; /* Operating system file handle */ -#else - int fd; /* Integer file descriptor */ -#endif - + thandle_t fh; /* Operating system file handle */ + int fd; /* Integer file descriptor */ } FAX_Client_Data; int @@ -89,7 +85,7 @@ main(int argc, char* argv[]) { FILE *in; TIFF *out = NULL; - FAX_Client_Data client_data; + FAX_Client_Data client_data; TIFFErrorHandler whandler = NULL; int compression_in = COMPRESSION_CCITTFAX3; int compression_out = COMPRESSION_CCITTFAX3; @@ -280,11 +276,11 @@ main(int argc, char* argv[]) continue; } #if defined(_WIN32) && defined(USE_WIN32_FILEIO) - client_data.fh = _get_osfhandle(fileno(in)); + client_data.fh = (thandle_t)_get_osfhandle(fileno(in)); #else - client_data.fd = fileno(in); + client_data.fd = fileno(in); #endif - TIFFSetClientdata(faxTIFF, (thandle_t) &client_data); + TIFFSetClientdata(faxTIFF, client_data.fh); TIFFSetFileName(faxTIFF, (const char*)argv[optind]); TIFFSetField(out, TIFFTAG_IMAGEWIDTH, xsize); TIFFSetField(out, TIFFTAG_BITSPERSAMPLE, 1); |