From 7bc7b77e78d8cdbb7a8b46aea587514d56ecbcd1 Mon Sep 17 00:00:00 2001 From: Bob Friesenhahn Date: Sun, 6 Sep 2015 18:24:27 +0000 Subject: [PATCH] * tools/tiff2pdf.c: Fix compiler warning about unused function when JPEG is not available. * tools/fax2ps.c (main): Detect failure to write to temporary file. --- ChangeLog | 8 ++++++++ tools/fax2ps.c | 12 +++++++++--- tools/tiff2pdf.c | 6 +++++- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5a95692b..857ebb91 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2015-09-06 Bob Friesenhahn + + * tools/tiff2pdf.c: Fix compiler warning about unused function + when JPEG is not available. + + * tools/fax2ps.c (main): Detect failure to write to temporary + file. + 2015-09-05 Bob Friesenhahn * libtiff/tif_dirread.c (TIFFReadDirEntryCheckRangeSlongSlong8): diff --git a/tools/fax2ps.c b/tools/fax2ps.c index d565f80c..c4953315 100644 --- a/tools/fax2ps.c +++ b/tools/fax2ps.c @@ -1,4 +1,4 @@ -/* $Id: fax2ps.c,v 1.30 2015-08-19 02:31:04 bfriesen Exp $" */ +/* $Id: fax2ps.c,v 1.31 2015-09-06 18:24:27 bfriesen Exp $" */ /* * Copyright (c) 1991-1997 Sam Leffler @@ -398,8 +398,14 @@ main(int argc, char** argv) #if defined(HAVE_SETMODE) && defined(O_BINARY) setmode(fileno(stdin), O_BINARY); #endif - while ((n = read(fileno(stdin), buf, sizeof (buf))) > 0) - write(fileno(fd), buf, n); + while ((n = read(fileno(stdin), buf, sizeof (buf))) > 0) { + if (write(fileno(fd), buf, n) != n) { + fclose(fd); + fprintf(stderr, + "Could not copy stdin to temporary file.\n"); + exit(-2); + } + } _TIFF_lseek_f(fileno(fd), 0, SEEK_SET); #if defined(_WIN32) && defined(USE_WIN32_FILEIO) tif = TIFFFdOpen(_get_osfhandle(fileno(fd)), "temp", "r"); diff --git a/tools/tiff2pdf.c b/tools/tiff2pdf.c index 14b16b1c..00bf8508 100644 --- a/tools/tiff2pdf.c +++ b/tools/tiff2pdf.c @@ -1,4 +1,4 @@ -/* $Id: tiff2pdf.c,v 1.90 2015-08-19 02:31:04 bfriesen Exp $ +/* $Id: tiff2pdf.c,v 1.91 2015-09-06 18:24:27 bfriesen Exp $ * * tiff2pdf - converts a TIFF image to a PDF document * @@ -358,6 +358,7 @@ t2p_enable(TIFF *tif) * Procs for TIFFClientOpen */ +#ifdef OJPEG_SUPPORT static tmsize_t t2pReadFile(TIFF *tif, tdata_t data, tmsize_t size) { @@ -367,6 +368,7 @@ t2pReadFile(TIFF *tif, tdata_t data, tmsize_t size) return proc(client, data, size); return -1; } +#endif /* OJPEG_SUPPORT */ static tmsize_t t2pWriteFile(TIFF *tif, tdata_t data, tmsize_t size) @@ -443,6 +445,7 @@ t2p_unmapproc(thandle_t handle, void *data, toff_t offset) (void) handle, (void) data, (void) offset; } +#if defined(OJPEG_SUPPORT) || defined(JPEG_SUPPORT) static uint64 checkAdd64(uint64 summand1, uint64 summand2, T2P* t2p) { @@ -456,6 +459,7 @@ checkAdd64(uint64 summand1, uint64 summand2, T2P* t2p) return bytes; } +#endif /* defined(OJPEG_SUPPORT) || defined(JPEG_SUPPORT) */ static uint64 checkMultiply64(uint64 first, uint64 second, T2P* t2p)