summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Leigh <rleigh@codelibre.net>2021-02-05 20:28:11 +0000
committerRoger Leigh <rleigh@codelibre.net>2021-02-05 20:28:11 +0000
commit913d8f4cadd07da2abd48926749c0b95c38fd1ca (patch)
tree484286fc45d4cbaef47bbebb17560a44b04eb27b
parentefe3a84f4a55710257c5301897a8d0e7e3b54145 (diff)
parentce494741c3e80b58abc96495fb6b07b160df9cd4 (diff)
downloadlibtiff-git-913d8f4cadd07da2abd48926749c0b95c38fd1ca.tar.gz
Merge branch 'c99-ssize_t-fixes' into 'master'
C99 ssize_t fixes Closes #239 See merge request libtiff/libtiff!219
-rw-r--r--.gitignore1
-rw-r--r--CMakeLists.txt24
-rw-r--r--configure.ac2
-rw-r--r--libtiff/Makefile.vc2
-rw-r--r--libtiff/tif_aux.c2
-rw-r--r--libtiff/tif_config.h.cmake.in65
-rw-r--r--libtiff/tif_config.h.in168
-rw-r--r--libtiff/tif_config.vc.h5
-rw-r--r--libtiff/tif_dirread.c2
-rw-r--r--libtiff/tif_dumpmode.c2
-rw-r--r--libtiff/tif_fax3.c4
-rw-r--r--libtiff/tif_jbig.c4
-rw-r--r--libtiff/tif_luv.c6
-rw-r--r--libtiff/tif_lzma.c2
-rw-r--r--libtiff/tif_packbits.c4
-rw-r--r--libtiff/tif_pixarlog.c2
-rw-r--r--libtiff/tif_read.c14
-rw-r--r--libtiff/tif_webp.c2
-rw-r--r--tools/rgb2ycbcr.c2
-rw-r--r--tools/tiff2pdf.c55
-rw-r--r--tools/tiff2ps.c14
-rw-r--r--tools/tiff2rgba.c6
-rw-r--r--tools/tiffcp.c4
-rw-r--r--tools/tiffcrop.c7
24 files changed, 280 insertions, 119 deletions
diff --git a/.gitignore b/.gitignore
index ad4d4e3c..45562baa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -30,7 +30,6 @@ libtiff/mkg3states
libtiff/stamp-h1
libtiff/stamp-h2
libtiff/tif_config.h
-libtiff/tif_config.h.in
libtiff/tiffconf.h
libtool
m4/libtool.m4
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d058d67d..e3fdbd26 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -214,24 +214,12 @@ check_include_file(sys/time.h HAVE_SYS_TIME_H)
check_include_file(sys/types.h HAVE_SYS_TYPES_H)
check_include_file(unistd.h HAVE_UNISTD_H)
-# Check if sys/time.h and time.h allow use together
-check_c_source_compiles("
-#include <sys/time.h>
-#include <time.h>
-int main(void){return 0;}"
- TIME_WITH_SYS_TIME)
-
-# Check if struct tm is in sys/time.h
-check_c_source_compiles("
-#include <sys/types.h>
-#include <time.h>
-
-int main(void){
- struct tm tm;
- int *p = &tm.tm_sec;
- return !p;
-}"
- TM_IN_SYS_TIME)
+check_symbol_exists(optarg "getopt.h" HAVE_DECL_OPTARG)
+if (HAVE_DECL_OPTARG)
+ set(HAVE_DECL_OPTARG 1)
+else()
+ set(HAVE_DECL_OPTARG 0)
+endif()
# Disable deprecated features to ensure clean build
add_definitions(-DTIFF_DISABLE_DEPRECATED)
diff --git a/configure.ac b/configure.ac
index 0e09fbc3..dcbfbe15 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1021,7 +1021,7 @@ dnl ---------------------------------------------------------------------------
AC_SUBST(LIBDIR)
-AC_CONFIG_HEADERS([libtiff/tif_config.h libtiff/tiffconf.h])
+AC_CONFIG_HEADERS([config.h libtiff/tif_config.h libtiff/tiffconf.h])
AC_CONFIG_FILES([Makefile \
build/Makefile \
diff --git a/libtiff/Makefile.vc b/libtiff/Makefile.vc
index 5aac3310..7d79e132 100644
--- a/libtiff/Makefile.vc
+++ b/libtiff/Makefile.vc
@@ -78,7 +78,7 @@ OBJ = \
all: libtiff.lib $(DLLNAME)
-tif_config.h: tif_config.vc.h
+tif_config.h: tif_config.vc.h tiffconf.h
copy tif_config.vc.h tif_config.h
tiffconf.h: tiffconf.vc.h
diff --git a/libtiff/tif_aux.c b/libtiff/tif_aux.c
index 3910e61c..140f26c7 100644
--- a/libtiff/tif_aux.c
+++ b/libtiff/tif_aux.c
@@ -109,7 +109,7 @@ _TIFFCheckRealloc(TIFF* tif, void* buffer,
if (cp == NULL) {
TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
"Failed to allocate memory for %s "
- "(%"PRId64" elements of %"PRId64" bytes each)",
+ "(%"TIFF_SSIZE_FORMAT" elements of %"TIFF_SSIZE_FORMAT" bytes each)",
what, nmemb, elem_size);
}
diff --git a/libtiff/tif_config.h.cmake.in b/libtiff/tif_config.h.cmake.in
index 2b3d8d43..44d1240f 100644
--- a/libtiff/tif_config.h.cmake.in
+++ b/libtiff/tif_config.h.cmake.in
@@ -1,6 +1,8 @@
/* libtiff/tif_config.h.cmake.in. Not generated, but originated from autoheader. */
/* This file must be kept up-to-date with needed substitutions from libtiff/tif_config.h.in. */
+#include "tiffconf.h"
+
/* Support CCITT Group 3 & 4 algorithms */
#cmakedefine CCITT_SUPPORT 1
@@ -20,9 +22,15 @@
/* Define to 1 if you have the <assert.h> header file. */
#cmakedefine HAVE_ASSERT_H 1
+/* Define to 1 if you have the declaration of `optarg', and to 0 if you don't. */
+#cmakedefine HAVE_DECL_OPTARG 1
+
/* Define to 1 if you have the <fcntl.h> header file. */
#cmakedefine HAVE_FCNTL_H 1
+/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
+#cmakedefine HAVE_FSEEKO 1
+
/* Define to 1 if you have the `getopt' function. */
#cmakedefine HAVE_GETOPT 1
@@ -56,15 +64,9 @@
/* Define to 1 if you have the `setmode' function. */
#cmakedefine HAVE_SETMODE 1
-/* Define to 1 if you have the <stdint.h> header file. */
-#cmakedefine HAVE_STDINT_H 1
-
/* Define to 1 if you have the <strings.h> header file. */
#cmakedefine HAVE_STRINGS_H 1
-/* Define to 1 if you have the <sys/time.h> header file. */
-#cmakedefine HAVE_SYS_TIME_H 1
-
/* Define to 1 if you have the <sys/types.h> header file. */
#cmakedefine HAVE_SYS_TYPES_H 1
@@ -72,7 +74,7 @@
#cmakedefine HAVE_UNISTD_H 1
/* 8/12 bit libjpeg dual mode enabled */
-#cmakedefine JPEG_DUAL_MODE_8_12 1
+#cmakedefine JPEG_DUAL_MODE_8_12 1 1
/* 12bit libjpeg primary include file with path */
#define LIBJPEG_12_PATH @LIBJPEG_12_PATH@
@@ -80,12 +82,6 @@
/* Support LZMA2 compression */
#cmakedefine LZMA_SUPPORT 1
-/* Support ZSTD compression */
-#cmakedefine ZSTD_SUPPORT 1
-
-/* Support WEBP compression */
-#cmakedefine WEBP_SUPPORT 1
-
/* Name of package */
#define PACKAGE "@PACKAGE_NAME@"
@@ -107,24 +103,25 @@
/* Define to the version of this package. */
#define PACKAGE_VERSION "@PACKAGE_VERSION@"
+/* Size of size_t */
+#define SIZEOF_SIZE_T @SIZEOF_SIZE_T@
+
/* Default size of the strip in bytes (when strip chopping enabled) */
#define STRIP_SIZE_DEFAULT @STRIP_SIZE_DEFAULT@
-/* Signed size type formatter */
-#define TIFF_SSIZE_FORMAT @TIFF_SSIZE_FORMAT@
-
-/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
-#undef TIME_WITH_SYS_TIME
-
-/* Define to 1 if your <sys/time.h> declares `struct tm'. */
-#cmakedefine TM_IN_SYS_TIME 1
-
/* define to use win32 IO system */
#cmakedefine USE_WIN32_FILEIO 1
/* Version number of package */
#define VERSION "@PACKAGE_VERSION@"
+/* Support WEBP compression */
+#cmakedefine WEBP_SUPPORT 1
+
+/* Support ZSTD compression */
+#cmakedefine ZSTD_SUPPORT 1
+
+
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
#if defined AC_APPLE_UNIVERSAL_BUILD
@@ -137,11 +134,19 @@
# endif
#endif
-/* Number of bits in a file offset, on hosts where this is settable. */
-#define _FILE_OFFSET_BITS @FILE_OFFSET_BITS@
-
-/* Define to `long int' if <sys/types.h> does not define. */
-#undef off_t
-
-/* Define to `unsigned int' if <sys/types.h> does not define. */
-#undef size_t
+#if !defined(__MINGW32__)
+# define TIFF_SIZE_FORMAT "zu"
+#endif
+#if SIZEOF_SIZE_T == 8
+# define TIFF_SSIZE_FORMAT PRId64
+# if defined(__MINGW32__)
+# define TIFF_SIZE_FORMAT PRIu64
+# endif
+#elif SIZEOF_SIZE_T == 4
+# define TIFF_SSIZE_FORMAT PRId32
+# if defined(__MINGW32__)
+# define TIFF_SIZE_FORMAT PRIu32
+# endif
+#else
+# error "Unsupported size_t size; please submit a bug report"
+#endif
diff --git a/libtiff/tif_config.h.in b/libtiff/tif_config.h.in
new file mode 100644
index 00000000..b15b2b04
--- /dev/null
+++ b/libtiff/tif_config.h.in
@@ -0,0 +1,168 @@
+/* libtiff/tif_config.h.in. Not generated, but originated from autoheader. */
+
+#include "tiffconf.h"
+
+/* Support CCITT Group 3 & 4 algorithms */
+#undef CCITT_SUPPORT
+
+/* Pick up YCbCr subsampling info from the JPEG data stream to support files
+ lacking the tag (default enabled). */
+#undef CHECK_JPEG_YCBCR_SUBSAMPLING
+
+/* enable partial strip reading for large strips (experimental) */
+#undef CHUNKY_STRIP_READ_SUPPORT
+
+/* Support C++ stream API (requires C++ compiler) */
+#undef CXX_SUPPORT
+
+/* enable deferred strip/tile offset/size loading */
+#undef DEFER_STRILE_LOAD
+
+/* Define to 1 if you have the <assert.h> header file. */
+#undef HAVE_ASSERT_H
+
+/* Define to 1 if you have the declaration of `optarg', and to 0 if you don't.
+ */
+#undef HAVE_DECL_OPTARG
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
+
+/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
+#undef HAVE_FSEEKO
+
+/* Define to 1 if you have the `getopt' function. */
+#undef HAVE_GETOPT
+
+/* Define to 1 if you have the <GLUT/glut.h> header file. */
+#undef HAVE_GLUT_GLUT_H
+
+/* Define to 1 if you have the <GL/glut.h> header file. */
+#undef HAVE_GL_GLUT_H
+
+/* Define to 1 if you have the <GL/glu.h> header file. */
+#undef HAVE_GL_GLU_H
+
+/* Define to 1 if you have the <GL/gl.h> header file. */
+#undef HAVE_GL_GL_H
+
+/* Define to 1 if you have the <io.h> header file. */
+#undef HAVE_IO_H
+
+/* Define to 1 if you have the `jbg_newlen' function. */
+#undef HAVE_JBG_NEWLEN
+
+/* Define to 1 if you have the `mmap' function. */
+#undef HAVE_MMAP
+
+/* Define to 1 if you have the <OpenGL/glu.h> header file. */
+#undef HAVE_OPENGL_GLU_H
+
+/* Define to 1 if you have the <OpenGL/gl.h> header file. */
+#undef HAVE_OPENGL_GL_H
+
+/* Define to 1 if you have the `setmode' function. */
+#undef HAVE_SETMODE
+
+/* Define to 1 if you have the `snprintf' function. */
+#undef HAVE_SNPRINTF
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* 8/12 bit libjpeg dual mode enabled */
+#undef JPEG_DUAL_MODE_8_12
+
+/* 12bit libjpeg primary include file with path */
+#undef LIBJPEG_12_PATH
+
+/* Support LZMA2 compression */
+#undef LZMA_SUPPORT
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* The size of `size_t', as computed by sizeof. */
+#undef SIZEOF_SIZE_T
+
+/* Default size of the strip in bytes (when strip chopping enabled) */
+#undef STRIP_SIZE_DEFAULT
+
+/* define to use win32 IO system */
+#undef USE_WIN32_FILEIO
+
+/* Version number of package */
+#undef VERSION
+
+/* Support webp compression */
+#undef WEBP_SUPPORT
+
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+ significant byte first (like Motorola and SPARC, unlike Intel). */
+#if defined AC_APPLE_UNIVERSAL_BUILD
+# if defined __BIG_ENDIAN__
+# define WORDS_BIGENDIAN 1
+# endif
+#else
+# ifndef WORDS_BIGENDIAN
+# undef WORDS_BIGENDIAN
+# endif
+#endif
+
+/* Support zstd compression */
+#undef ZSTD_SUPPORT
+
+/* Enable large inode numbers on Mac OS X 10.5. */
+#ifndef _DARWIN_USE_64_BIT_INODE
+# define _DARWIN_USE_64_BIT_INODE 1
+#endif
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+#undef _FILE_OFFSET_BITS
+
+/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
+#undef _LARGEFILE_SOURCE
+
+/* Define for large files, on AIX-style hosts. */
+#undef _LARGE_FILES
+
+#if !defined(__MINGW32__)
+# define TIFF_SIZE_FORMAT "zu"
+#endif
+#if SIZEOF_SIZE_T == 8
+# define TIFF_SSIZE_FORMAT PRId64
+# if defined(__MINGW32__)
+# define TIFF_SIZE_FORMAT PRIu64
+# endif
+#elif SIZEOF_SIZE_T == 4
+# define TIFF_SSIZE_FORMAT PRId32
+# if defined(__MINGW32__)
+# define TIFF_SIZE_FORMAT PRIu32
+# endif
+#else
+# error "Unsupported size_t size; please submit a bug report"
+#endif
diff --git a/libtiff/tif_config.vc.h b/libtiff/tif_config.vc.h
index fafc422e..8a1b7de8 100644
--- a/libtiff/tif_config.vc.h
+++ b/libtiff/tif_config.vc.h
@@ -1,6 +1,8 @@
#ifndef _TIF_CONFIG_H_
#define _TIF_CONFIG_H_
+#include "tiffconf.h"
+
/* Define to 1 if you have the <assert.h> header file. */
#define HAVE_ASSERT_H 1
@@ -56,6 +58,9 @@
#endif
+/* Size type formatter */
+#define TIFF_SIZE_FORMAT "zu"
+
/* Set the native cpu bit order */
#define HOST_FILLORDER FILLORDER_LSB2MSB
diff --git a/libtiff/tif_dirread.c b/libtiff/tif_dirread.c
index 1543c3f4..11f94cf4 100644
--- a/libtiff/tif_dirread.c
+++ b/libtiff/tif_dirread.c
@@ -809,7 +809,7 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryDataAndRealloc(
{
TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
"Failed to allocate memory for %s "
- "(%"PRId64" elements of %"PRId64" bytes each)",
+ "(%"TIFF_SSIZE_FORMAT" elements of %"TIFF_SSIZE_FORMAT" bytes each)",
"TIFFReadDirEntryArray",
(tmsize_t) 1, already_read + to_read);
return TIFFReadDirEntryErrAlloc;
diff --git a/libtiff/tif_dumpmode.c b/libtiff/tif_dumpmode.c
index 8171ac4a..f1d3c4ad 100644
--- a/libtiff/tif_dumpmode.c
+++ b/libtiff/tif_dumpmode.c
@@ -79,7 +79,7 @@ DumpModeDecode(TIFF* tif, uint8_t* buf, tmsize_t cc, uint16_t s)
(void) s;
if (tif->tif_rawcc < cc) {
TIFFErrorExt(tif->tif_clientdata, module,
-"Not enough data for scanline %"PRIu32", expected a request for at most %"PRId64" bytes, got a request for %"PRId64" bytes",
+"Not enough data for scanline %"PRIu32", expected a request for at most %"TIFF_SSIZE_FORMAT" bytes, got a request for %"TIFF_SSIZE_FORMAT" bytes",
tif->tif_row,
tif->tif_rawcc,
cc);
diff --git a/libtiff/tif_fax3.c b/libtiff/tif_fax3.c
index 736daa24..a61362af 100644
--- a/libtiff/tif_fax3.c
+++ b/libtiff/tif_fax3.c
@@ -1462,7 +1462,7 @@ Fax4Decode(TIFF* tif, uint8_t* buf, tmsize_t occ, uint16_t s)
if (((lastx + 7) >> 3) > (int)occ) /* check for buffer overrun */
{
TIFFErrorExt(tif->tif_clientdata, module,
- "Buffer overrun detected : %"PRId64" bytes available, %d bits needed",
+ "Buffer overrun detected : %"TIFF_SSIZE_FORMAT" bytes available, %d bits needed",
occ, lastx);
return -1;
}
@@ -1484,7 +1484,7 @@ Fax4Decode(TIFF* tif, uint8_t* buf, tmsize_t occ, uint16_t s)
if (((lastx + 7) >> 3) > (int)occ) /* check for buffer overrun */
{
TIFFErrorExt(tif->tif_clientdata, module,
- "Buffer overrun detected : %"PRId64" bytes available, %d bits needed",
+ "Buffer overrun detected : %"TIFF_SSIZE_FORMAT" bytes available, %d bits needed",
occ, lastx);
return -1;
}
diff --git a/libtiff/tif_jbig.c b/libtiff/tif_jbig.c
index 093ff7f0..74086338 100644
--- a/libtiff/tif_jbig.c
+++ b/libtiff/tif_jbig.c
@@ -101,13 +101,13 @@ static int JBIGDecode(TIFF* tif, uint8_t* buffer, tmsize_t size, uint16_t s)
if( (tmsize_t)decodedSize < size )
{
TIFFWarningExt(tif->tif_clientdata, "JBIG",
- "Only decoded %lu bytes, whereas %"PRId64" requested",
+ "Only decoded %lu bytes, whereas %"TIFF_SSIZE_FORMAT" requested",
decodedSize, size);
}
else if( (tmsize_t)decodedSize > size )
{
TIFFErrorExt(tif->tif_clientdata, "JBIG",
- "Decoded %lu bytes, whereas %"PRId64" were requested",
+ "Decoded %lu bytes, whereas %"TIFF_SSIZE_FORMAT" were requested",
decodedSize, size);
jbg_dec_free(&decoder);
return 0;
diff --git a/libtiff/tif_luv.c b/libtiff/tif_luv.c
index de650b31..13765eab 100644
--- a/libtiff/tif_luv.c
+++ b/libtiff/tif_luv.c
@@ -232,7 +232,7 @@ LogL16Decode(TIFF* tif, uint8_t* op, tmsize_t occ, uint16_t s)
}
if (i != npixels) {
TIFFErrorExt(tif->tif_clientdata, module,
- "Not enough data at row %"PRIu32" (short %"PRId64" pixels)",
+ "Not enough data at row %"PRIu32" (short %"TIFF_SSIZE_FORMAT" pixels)",
tif->tif_row,
npixels - i);
tif->tif_rawcp = (uint8_t*) bp;
@@ -288,7 +288,7 @@ LogLuvDecode24(TIFF* tif, uint8_t* op, tmsize_t occ, uint16_t s)
tif->tif_rawcc = cc;
if (i != npixels) {
TIFFErrorExt(tif->tif_clientdata, module,
- "Not enough data at row %"PRIu32" (short %"PRId64" pixels)",
+ "Not enough data at row %"PRIu32" (short %"TIFF_SSIZE_FORMAT" pixels)",
tif->tif_row,
npixels - i);
return (0);
@@ -354,7 +354,7 @@ LogLuvDecode32(TIFF* tif, uint8_t* op, tmsize_t occ, uint16_t s)
}
if (i != npixels) {
TIFFErrorExt(tif->tif_clientdata, module,
- "Not enough data at row %"PRIu32" (short %"PRId64" pixels)",
+ "Not enough data at row %"PRIu32" (short %"TIFF_SSIZE_FORMAT" pixels)",
tif->tif_row,
npixels - i);
tif->tif_rawcp = (uint8_t*) bp;
diff --git a/libtiff/tif_lzma.c b/libtiff/tif_lzma.c
index a5770569..fc046475 100644
--- a/libtiff/tif_lzma.c
+++ b/libtiff/tif_lzma.c
@@ -213,7 +213,7 @@ LZMADecode(TIFF* tif, uint8_t* op, tmsize_t occ, uint16_t s)
} while (sp->stream.avail_out > 0);
if (sp->stream.avail_out != 0) {
TIFFErrorExt(tif->tif_clientdata, module,
- "Not enough data at scanline %"PRIu32" (short %zu bytes)",
+ "Not enough data at scanline %"PRIu32" (short %"TIFF_SIZE_FORMAT" bytes)",
tif->tif_row, sp->stream.avail_out);
return 0;
}
diff --git a/libtiff/tif_packbits.c b/libtiff/tif_packbits.c
index 010c09bf..76569ad7 100644
--- a/libtiff/tif_packbits.c
+++ b/libtiff/tif_packbits.c
@@ -238,7 +238,7 @@ PackBitsDecode(TIFF* tif, uint8_t* op, tmsize_t occ, uint16_t s)
if( occ < (tmsize_t)n )
{
TIFFWarningExt(tif->tif_clientdata, module,
- "Discarding %"PRId64" bytes to avoid buffer overrun",
+ "Discarding %"TIFF_SSIZE_FORMAT" bytes to avoid buffer overrun",
(tmsize_t)n - occ);
n = (long)occ;
}
@@ -257,7 +257,7 @@ PackBitsDecode(TIFF* tif, uint8_t* op, tmsize_t occ, uint16_t s)
if (occ < (tmsize_t)(n + 1))
{
TIFFWarningExt(tif->tif_clientdata, module,
- "Discarding %"PRId64" bytes to avoid buffer overrun",
+ "Discarding %"TIFF_SSIZE_FORMAT" bytes to avoid buffer overrun",
(tmsize_t)n - occ + 1);
n = (long)occ - 1;
}
diff --git a/libtiff/tif_pixarlog.c b/libtiff/tif_pixarlog.c
index 9686b7c5..87c67097 100644
--- a/libtiff/tif_pixarlog.c
+++ b/libtiff/tif_pixarlog.c
@@ -846,7 +846,7 @@ PixarLogDecode(TIFF* tif, uint8_t* op, tmsize_t occ, uint16_t s)
if (nsamples % llen) {
TIFFWarningExt(tif->tif_clientdata, module,
"stride %d is not a multiple of sample count, "
- "%"PRId64", data truncated.", llen, nsamples);
+ "%"TIFF_SSIZE_FORMAT", data truncated.", llen, nsamples);
nsamples -= nsamples % llen;
}
diff --git a/libtiff/tif_read.c b/libtiff/tif_read.c
index 8b174d9a..a4c60b4f 100644
--- a/libtiff/tif_read.c
+++ b/libtiff/tif_read.c
@@ -133,8 +133,8 @@ static int TIFFReadAndRealloc(TIFF* tif, tmsize_t size,
if( is_strip )
{
TIFFErrorExt(tif->tif_clientdata, module,
- "Read error at scanline %"PRIu32"; got %"PRId64" bytes, "
- "expected %"PRId64,
+ "Read error at scanline %"PRIu32"; got %"TIFF_SSIZE_FORMAT" bytes, "
+ "expected %"TIFF_SSIZE_FORMAT,
tif->tif_row,
already_read,
size);
@@ -143,7 +143,7 @@ static int TIFFReadAndRealloc(TIFF* tif, tmsize_t size,
{
TIFFErrorExt(tif->tif_clientdata, module,
"Read error at row %"PRIu32", col %"PRIu32", tile %"PRIu32"; "
- "got %"PRId64" bytes, expected %"PRId64"",
+ "got %"TIFF_SSIZE_FORMAT" bytes, expected %"TIFF_SSIZE_FORMAT"",
tif->tif_row,
tif->tif_col,
strip_or_tile,
@@ -599,7 +599,7 @@ TIFFReadRawStrip1(TIFF* tif, uint32_t strip, void* buf, tmsize_t size,
cc = TIFFReadFile(tif, buf, size);
if (cc != size) {
TIFFErrorExt(tif->tif_clientdata, module,
- "Read error at scanline %"PRIu32"; got %"PRId64" bytes, expected %"PRId64,
+ "Read error at scanline %"PRIu32"; got %"TIFF_SSIZE_FORMAT" bytes, expected %"TIFF_SSIZE_FORMAT,
tif->tif_row,
cc,
size);
@@ -627,7 +627,7 @@ TIFFReadRawStrip1(TIFF* tif, uint32_t strip, void* buf, tmsize_t size,
}
if (n!=size) {
TIFFErrorExt(tif->tif_clientdata, module,
- "Read error at scanline %"PRIu32", strip %"PRIu32"; got %"PRId64" bytes, expected %"PRId64,
+ "Read error at scanline %"PRIu32", strip %"PRIu32"; got %"TIFF_SSIZE_FORMAT" bytes, expected %"TIFF_SSIZE_FORMAT,
tif->tif_row,
strip,
n,
@@ -1043,7 +1043,7 @@ TIFFReadRawTile1(TIFF* tif, uint32_t tile, void* buf, tmsize_t size, const char*
cc = TIFFReadFile(tif, buf, size);
if (cc != size) {
TIFFErrorExt(tif->tif_clientdata, module,
- "Read error at row %"PRIu32", col %"PRIu32"; got %"PRId64" bytes, expected %"PRId64,
+ "Read error at row %"PRIu32", col %"PRIu32"; got %"TIFF_SSIZE_FORMAT" bytes, expected %"TIFF_SSIZE_FORMAT,
tif->tif_row,
tif->tif_col,
cc,
@@ -1063,7 +1063,7 @@ TIFFReadRawTile1(TIFF* tif, uint32_t tile, void* buf, tmsize_t size, const char*
n=size;
if (n!=size) {
TIFFErrorExt(tif->tif_clientdata, module,
-"Read error at row %"PRIu32", col %"PRIu32", tile %"PRIu32"; got %"PRId64" bytes, expected %"PRId64,
+"Read error at row %"PRIu32", col %"PRIu32", tile %"PRIu32"; got %"TIFF_SSIZE_FORMAT" bytes, expected %"TIFF_SSIZE_FORMAT,
tif->tif_row,
tif->tif_col,
tile,
diff --git a/libtiff/tif_webp.c b/libtiff/tif_webp.c
index 31412c84..50ffdce6 100644
--- a/libtiff/tif_webp.c
+++ b/libtiff/tif_webp.c
@@ -79,7 +79,7 @@ int TWebPDatasetWriter(const uint8_t* data, size_t data_size,
if ( (tif->tif_rawcc + (tmsize_t)data_size) > tif->tif_rawdatasize ) {
TIFFErrorExt(tif->tif_clientdata, module,
- "Buffer too small by %zu bytes.",
+ "Buffer too small by %"TIFF_SIZE_FORMAT" bytes.",
(size_t) (tif->tif_rawcc + data_size - tif->tif_rawdatasize));
return 0;
} else {
diff --git a/tools/rgb2ycbcr.c b/tools/rgb2ycbcr.c
index de23594b..0407cd69 100644
--- a/tools/rgb2ycbcr.c
+++ b/tools/rgb2ycbcr.c
@@ -313,7 +313,7 @@ tiffcvt(TIFF* in, TIFF* out)
"raster buffer");
if (raster == 0) {
TIFFError(TIFFFileName(in),
- "Failed to allocate buffer (%zu elements of %zu each)",
+ "Failed to allocate buffer (%"TIFF_SIZE_FORMAT" elements of %"TIFF_SIZE_FORMAT" each)",
pixel_count,
sizeof(uint32_t));
return (0);
diff --git a/tools/tiff2pdf.c b/tools/tiff2pdf.c
index 2f3317e2..6e956da4 100644
--- a/tools/tiff2pdf.c
+++ b/tools/tiff2pdf.c
@@ -24,9 +24,6 @@
* OF THIS SOFTWARE.
*/
-#include "tif_config.h"
-#include "libport.h"
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -49,6 +46,8 @@
#include "tiffiop.h"
#include "tiffio.h"
+#include "tif_config.h"
+#include "libport.h"
#ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0
@@ -956,7 +955,7 @@ T2P* t2p_init()
if(t2p==NULL){
TIFFError(
TIFF2PDF_MODULE,
- "Can't allocate %zu bytes of memory for t2p_init",
+ "Can't allocate %"TIFF_SIZE_FORMAT" bytes of memory for t2p_init",
sizeof(T2P));
return( (T2P*) NULL );
}
@@ -1080,7 +1079,7 @@ void t2p_read_tiff_init(T2P* t2p, TIFF* input){
if(t2p->tiff_pages==NULL){
TIFFError(
TIFF2PDF_MODULE,
- "Can't allocate %zu bytes of memory for tiff_pages array, %s",
+ "Can't allocate %"TIFF_SIZE_FORMAT" bytes of memory for tiff_pages array, %s",
sizeof(T2P_PAGE) * directorycount,
TIFFFileName(input));
t2p->t2p_error = T2P_ERR_ERROR;
@@ -1091,7 +1090,7 @@ void t2p_read_tiff_init(T2P* t2p, TIFF* input){
if(t2p->tiff_tiles==NULL){
TIFFError(
TIFF2PDF_MODULE,
- "Can't allocate %zu bytes of memory for tiff_tiles array, %s",
+ "Can't allocate %"TIFF_SIZE_FORMAT" bytes of memory for tiff_tiles array, %s",
sizeof(T2P_TILES) * directorycount,
TIFFFileName(input));
t2p->t2p_error = T2P_ERR_ERROR;
@@ -1264,7 +1263,7 @@ void t2p_read_tiff_init(T2P* t2p, TIFF* input){
if( t2p->tiff_tiles[i].tiles_tiles == NULL){
TIFFError(
TIFF2PDF_MODULE,
- "Can't allocate %zu bytes of memory for t2p_read_tiff_init, %s",
+ "Can't allocate %"TIFF_SIZE_FORMAT" bytes of memory for t2p_read_tiff_init, %s",
sizeof(T2P_TILE) * t2p->tiff_tiles[i].tiles_tilecount,
TIFFFileName(input));
t2p->t2p_error = T2P_ERR_ERROR;
@@ -2262,7 +2261,7 @@ tsize_t t2p_readwrite_pdf_image(T2P* t2p, TIFF* input, TIFF* output){
_TIFFmalloc(t2p->tiff_datasize);
if (buffer == NULL) {
TIFFError(TIFF2PDF_MODULE,
- "Can't allocate %"PRId64" bytes of memory for "
+ "Can't allocate %"TIFF_SSIZE_FORMAT" bytes of memory for "
"t2p_readwrite_pdf_image, %s",
t2p->tiff_datasize,
TIFFFileName(input));
@@ -2297,7 +2296,7 @@ tsize_t t2p_readwrite_pdf_image(T2P* t2p, TIFF* input, TIFF* output){
_TIFFmalloc(t2p->tiff_datasize);
if(buffer == NULL){
TIFFError(TIFF2PDF_MODULE,
- "Can't allocate %"PRId64" bytes of memory for t2p_readwrite_pdf_image, %s",
+ "Can't allocate %"TIFF_SSIZE_FORMAT" bytes of memory for t2p_readwrite_pdf_image, %s",
t2p->tiff_datasize,
TIFFFileName(input));
t2p->t2p_error = T2P_ERR_ERROR;
@@ -2329,7 +2328,7 @@ tsize_t t2p_readwrite_pdf_image(T2P* t2p, TIFF* input, TIFF* output){
_TIFFmalloc(t2p->tiff_datasize);
if(buffer == NULL) {
TIFFError(TIFF2PDF_MODULE,
- "Can't allocate %"PRId64" bytes of memory for t2p_readwrite_pdf_image, %s",
+ "Can't allocate %"TIFF_SSIZE_FORMAT" bytes of memory for t2p_readwrite_pdf_image, %s",
t2p->tiff_datasize,
TIFFFileName(input));
t2p->t2p_error = T2P_ERR_ERROR;
@@ -2405,7 +2404,7 @@ tsize_t t2p_readwrite_pdf_image(T2P* t2p, TIFF* input, TIFF* output){
_TIFFmalloc(t2p->tiff_datasize);
if(buffer==NULL){
TIFFError(TIFF2PDF_MODULE,
- "Can't allocate %"PRId64" bytes of memory for t2p_readwrite_pdf_image, %s",
+ "Can't allocate %"TIFF_SSIZE_FORMAT" bytes of memory for t2p_readwrite_pdf_image, %s",
t2p->tiff_datasize,
TIFFFileName(input));
t2p->t2p_error = T2P_ERR_ERROR;
@@ -2461,7 +2460,7 @@ tsize_t t2p_readwrite_pdf_image(T2P* t2p, TIFF* input, TIFF* output){
_TIFFmalloc(t2p->tiff_datasize);
if(buffer==NULL){
TIFFError(TIFF2PDF_MODULE,
- "Can't allocate %"PRId64" bytes of memory for t2p_readwrite_pdf_image, %s",
+ "Can't allocate %"TIFF_SSIZE_FORMAT" bytes of memory for t2p_readwrite_pdf_image, %s",
t2p->tiff_datasize,
TIFFFileName(input));
t2p->t2p_error = T2P_ERR_ERROR;
@@ -2531,7 +2530,7 @@ tsize_t t2p_readwrite_pdf_image(T2P* t2p, TIFF* input, TIFF* output){
buffer = (unsigned char*) _TIFFmalloc(t2p->tiff_datasize);
if(buffer==NULL){
TIFFError(TIFF2PDF_MODULE,
- "Can't allocate %"PRId64" bytes of memory for t2p_readwrite_pdf_image, %s",
+ "Can't allocate %"TIFF_SSIZE_FORMAT" bytes of memory for t2p_readwrite_pdf_image, %s",
t2p->tiff_datasize,
TIFFFileName(input));
t2p->t2p_error = T2P_ERR_ERROR;
@@ -2569,7 +2568,7 @@ tsize_t t2p_readwrite_pdf_image(T2P* t2p, TIFF* input, TIFF* output){
buffer = (unsigned char*) _TIFFmalloc(t2p->tiff_datasize);
if(buffer==NULL){
TIFFError(TIFF2PDF_MODULE,
- "Can't allocate %"PRId64" bytes of memory for t2p_readwrite_pdf_image, %s",
+ "Can't allocate %"TIFF_SSIZE_FORMAT" bytes of memory for t2p_readwrite_pdf_image, %s",
t2p->tiff_datasize,
TIFFFileName(input));
t2p->t2p_error = T2P_ERR_ERROR;
@@ -2579,7 +2578,7 @@ tsize_t t2p_readwrite_pdf_image(T2P* t2p, TIFF* input, TIFF* output){
samplebuffer = (unsigned char*) _TIFFmalloc(stripsize);
if(samplebuffer==NULL){
TIFFError(TIFF2PDF_MODULE,
- "Can't allocate %"PRId64" bytes of memory for t2p_readwrite_pdf_image, %s",
+ "Can't allocate %"TIFF_SSIZE_FORMAT" bytes of memory for t2p_readwrite_pdf_image, %s",
t2p->tiff_datasize,
TIFFFileName(input));
t2p->t2p_error = T2P_ERR_ERROR;
@@ -2619,7 +2618,7 @@ tsize_t t2p_readwrite_pdf_image(T2P* t2p, TIFF* input, TIFF* output){
buffer = (unsigned char*) _TIFFmalloc(t2p->tiff_datasize);
if(buffer==NULL){
TIFFError(TIFF2PDF_MODULE,
- "Can't allocate %"PRId64" bytes of memory for t2p_readwrite_pdf_image, %s",
+ "Can't allocate %"TIFF_SSIZE_FORMAT" bytes of memory for t2p_readwrite_pdf_image, %s",
t2p->tiff_datasize,
TIFFFileName(input));
t2p->t2p_error = T2P_ERR_ERROR;
@@ -2654,7 +2653,7 @@ tsize_t t2p_readwrite_pdf_image(T2P* t2p, TIFF* input, TIFF* output){
t2p->tiff_datasize * t2p->tiff_samplesperpixel);
if(samplebuffer==NULL){
TIFFError(TIFF2PDF_MODULE,
- "Can't allocate %"PRId64" bytes of memory for t2p_readwrite_pdf_image, %s",
+ "Can't allocate %"TIFF_SSIZE_FORMAT" bytes of memory for t2p_readwrite_pdf_image, %s",
t2p->tiff_datasize,
TIFFFileName(input));
t2p->t2p_error = T2P_ERR_ERROR;
@@ -2685,7 +2684,7 @@ tsize_t t2p_readwrite_pdf_image(T2P* t2p, TIFF* input, TIFF* output){
t2p->tiff_width*t2p->tiff_length*4);
if(samplebuffer==NULL){
TIFFError(TIFF2PDF_MODULE,
- "Can't allocate %"PRId64" bytes of memory for t2p_readwrite_pdf_image, %s",
+ "Can't allocate %"TIFF_SSIZE_FORMAT" bytes of memory for t2p_readwrite_pdf_image, %s",
t2p->tiff_datasize,
TIFFFileName(input));
t2p->t2p_error = T2P_ERR_ERROR;
@@ -2882,7 +2881,7 @@ tsize_t t2p_readwrite_pdf_image_tile(T2P* t2p, TIFF* input, TIFF* output, ttile_
buffer= (unsigned char*) _TIFFmalloc(t2p->tiff_datasize);
if(buffer==NULL){
TIFFError(TIFF2PDF_MODULE,
- "Can't allocate %"PRId64" bytes of memory "
+ "Can't allocate %"TIFF_SSIZE_FORMAT" bytes of memory "
"for t2p_readwrite_pdf_image_tile, %s",
t2p->tiff_datasize,
TIFFFileName(input));
@@ -2910,7 +2909,7 @@ tsize_t t2p_readwrite_pdf_image_tile(T2P* t2p, TIFF* input, TIFF* output, ttile_
buffer= (unsigned char*) _TIFFmalloc(t2p->tiff_datasize);
if(buffer==NULL){
TIFFError(TIFF2PDF_MODULE,
- "Can't allocate %"PRId64" bytes of memory "
+ "Can't allocate %"TIFF_SSIZE_FORMAT" bytes of memory "
"for t2p_readwrite_pdf_image_tile, %s",
t2p->tiff_datasize,
TIFFFileName(input));
@@ -2947,7 +2946,7 @@ tsize_t t2p_readwrite_pdf_image_tile(T2P* t2p, TIFF* input, TIFF* output, ttile_
buffer=(unsigned char*) _TIFFmalloc(t2p->tiff_datasize);
if(buffer==NULL){
TIFFError(TIFF2PDF_MODULE,
- "Can't allocate %"PRId64" bytes of memory "
+ "Can't allocate %"TIFF_SSIZE_FORMAT" bytes of memory "
"for t2p_readwrite_pdf_image, %s",
t2p->tiff_datasize,
TIFFFileName(input));
@@ -2995,7 +2994,7 @@ tsize_t t2p_readwrite_pdf_image_tile(T2P* t2p, TIFF* input, TIFF* output, ttile_
buffer= (unsigned char*) _TIFFmalloc(t2p->tiff_datasize);
if(buffer==NULL){
TIFFError(TIFF2PDF_MODULE,
- "Can't allocate %"PRId64" bytes of memory "
+ "Can't allocate %"TIFF_SSIZE_FORMAT" bytes of memory "
"for t2p_readwrite_pdf_image_tile, %s",
t2p->tiff_datasize,
TIFFFileName(input));
@@ -3044,7 +3043,7 @@ tsize_t t2p_readwrite_pdf_image_tile(T2P* t2p, TIFF* input, TIFF* output, ttile_
buffer = (unsigned char*) _TIFFmalloc(t2p->tiff_datasize);
if(buffer==NULL){
TIFFError(TIFF2PDF_MODULE,
- "Can't allocate %"PRId64" bytes of memory for "
+ "Can't allocate %"TIFF_SSIZE_FORMAT" bytes of memory for "
"t2p_readwrite_pdf_image_tile, %s",
t2p->tiff_datasize,
TIFFFileName(input));
@@ -3078,7 +3077,7 @@ tsize_t t2p_readwrite_pdf_image_tile(T2P* t2p, TIFF* input, TIFF* output, ttile_
buffer = (unsigned char*) _TIFFmalloc(t2p->tiff_datasize);
if(buffer==NULL){
TIFFError(TIFF2PDF_MODULE,
- "Can't allocate %"PRId64" bytes of memory "
+ "Can't allocate %"TIFF_SSIZE_FORMAT" bytes of memory "
"for t2p_readwrite_pdf_image_tile, %s",
t2p->tiff_datasize,
TIFFFileName(input));
@@ -3089,7 +3088,7 @@ tsize_t t2p_readwrite_pdf_image_tile(T2P* t2p, TIFF* input, TIFF* output, ttile_
samplebuffer = (unsigned char*) _TIFFmalloc(t2p->tiff_datasize);
if(samplebuffer==NULL){
TIFFError(TIFF2PDF_MODULE,
- "Can't allocate %"PRId64" bytes of memory "
+ "Can't allocate %"TIFF_SSIZE_FORMAT" bytes of memory "
"for t2p_readwrite_pdf_image_tile, %s",
t2p->tiff_datasize,
TIFFFileName(input));
@@ -3130,7 +3129,7 @@ tsize_t t2p_readwrite_pdf_image_tile(T2P* t2p, TIFF* input, TIFF* output, ttile_
buffer = (unsigned char*) _TIFFmalloc(t2p->tiff_datasize);
if(buffer==NULL){
TIFFError(TIFF2PDF_MODULE,
- "Can't allocate %"PRId64" bytes of memory "
+ "Can't allocate %"TIFF_SSIZE_FORMAT" bytes of memory "
"for t2p_readwrite_pdf_image_tile, %s",
t2p->tiff_datasize,
TIFFFileName(input));
@@ -4206,7 +4205,7 @@ tsize_t t2p_write_pdf_stream_length(tsize_t len, TIFF* output){
char buffer[32];
int buflen=0;
- buflen=snprintf(buffer, sizeof(buffer), "%"PRId64, len);
+ buflen=snprintf(buffer, sizeof(buffer), "%"TIFF_SSIZE_FORMAT, len);
check_snprintf_ret((T2P*)NULL, buflen, buffer);
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
written += t2pWriteFile(output, (tdata_t) "\n", 1);
@@ -5559,7 +5558,7 @@ tsize_t t2p_write_pdf(T2P* t2p, TIFF* input, TIFF* output){
if(t2p->pdf_xrefoffsets==NULL){
TIFFError(
TIFF2PDF_MODULE,
- "Can't allocate %zu bytes of memory for t2p_write_pdf",
+ "Can't allocate %"TIFF_SIZE_FORMAT" bytes of memory for t2p_write_pdf",
sizeof(uint32_t) * t2p->pdf_xrefcount);
t2p->t2p_error = T2P_ERR_ERROR;
return(written);
diff --git a/tools/tiff2ps.c b/tools/tiff2ps.c
index 9a093d25..cc5ef955 100644
--- a/tools/tiff2ps.c
+++ b/tools/tiff2ps.c
@@ -247,7 +247,7 @@ static void usage(int);
static void* limitMalloc(tmsize_t s)
{
if (maxMalloc && (s > maxMalloc)) {
- fprintf(stderr, "MemoryLimitError: allocation of %" PRId64 " bytes is forbidden. Limit is %" PRId64 ".\n",
+ fprintf(stderr, "MemoryLimitError: allocation of %" TIFF_SSIZE_FORMAT " bytes is forbidden. Limit is %" TIFF_SSIZE_FORMAT ".\n",
s, maxMalloc);
fprintf(stderr, " use -M option to change limit.\n");
return NULL;
@@ -2212,7 +2212,7 @@ PS_Lvl2page(FILE* fd, TIFF* tif, uint32_t w, uint32_t h)
}
buf_data = (unsigned char *)limitMalloc(chunk_size);
if (!buf_data) {
- TIFFError(filename, "Can't alloc %"PRId64" bytes for %s.",
+ TIFFError(filename, "Can't alloc %"TIFF_SSIZE_FORMAT" bytes for %s.",
chunk_size, tiled_image ? "tiles" : "strips");
return(FALSE);
}
@@ -2390,8 +2390,8 @@ PSpage(FILE* fd, TIFF* tif, uint32_t w, uint32_t h)
case PHOTOMETRIC_PALETTE:
fprintf(fd, "%s", RGBcolorimage);
PhotoshopBanner(fd, w, h, 1, 3, "false 3 colorimage");
- fprintf(fd, "/scanLine %"PRId64" string def\n",
- ps_bytesperrow * 3L);
+ fprintf(fd, "/scanLine %"TIFF_SSIZE_FORMAT" string def\n",
+ ps_bytesperrow * 3);
fprintf(fd, "%"PRIu32" %"PRIu32" 8\n",
w, h);
fprintf(fd, "[%"PRIu32" 0 0 -%"PRIu32" 0 %"PRIu32"]\n",
@@ -2403,7 +2403,7 @@ PSpage(FILE* fd, TIFF* tif, uint32_t w, uint32_t h)
case PHOTOMETRIC_MINISBLACK:
case PHOTOMETRIC_MINISWHITE:
PhotoshopBanner(fd, w, h, 1, 1, imageOp);
- fprintf(fd, "/scanLine %"PRId64" string def\n",
+ fprintf(fd, "/scanLine %"TIFF_SSIZE_FORMAT" string def\n",
ps_bytesperrow);
fprintf(fd, "%"PRIu32" %"PRIu32" %"PRIu16"\n",
w, h, bitspersample);
@@ -2423,7 +2423,7 @@ PSColorContigPreamble(FILE* fd, uint32_t w, uint32_t h, int nc)
{
ps_bytesperrow = nc * (tf_bytesperrow / samplesperpixel);
PhotoshopBanner(fd, w, h, 1, nc, "false %d colorimage");
- fprintf(fd, "/line %"PRId64" string def\n", ps_bytesperrow);
+ fprintf(fd, "/line %"TIFF_SSIZE_FORMAT" string def\n", ps_bytesperrow);
fprintf(fd, "%"PRIu32" %"PRIu32" %"PRIu16"\n",
w, h, bitspersample);
fprintf(fd, "[%"PRIu32" 0 0 -%"PRIu32" 0 %"PRIu32"]\n",
@@ -2439,7 +2439,7 @@ PSColorSeparatePreamble(FILE* fd, uint32_t w, uint32_t h, int nc)
PhotoshopBanner(fd, w, h, ps_bytesperrow, nc, "true %d colorimage");
for (i = 0; i < nc; i++)
- fprintf(fd, "/line%d %"PRId64" string def\n",
+ fprintf(fd, "/line%d %"TIFF_SSIZE_FORMAT" string def\n",
i, ps_bytesperrow);
fprintf(fd, "%"PRIu32" %"PRIu32" %"PRIu16"\n",
w, h, bitspersample);
diff --git a/tools/tiff2rgba.c b/tools/tiff2rgba.c
index e6202d69..e1495f14 100644
--- a/tools/tiff2rgba.c
+++ b/tools/tiff2rgba.c
@@ -411,7 +411,7 @@ cvt_whole_image( TIFF *in, TIFF *out )
}
if (maxMalloc != 0 && (tmsize_t)pixel_count * (tmsize_t)sizeof(uint32_t) > maxMalloc) {
TIFFError(TIFFFileName(in),
- "Raster size %zu over memory limit (%" PRId64 "), try -b option.",
+ "Raster size %"TIFF_SIZE_FORMAT" over memory limit (%" TIFF_SSIZE_FORMAT "), try -b option.",
pixel_count * sizeof(uint32_t), maxMalloc);
return 0;
}
@@ -421,7 +421,7 @@ cvt_whole_image( TIFF *in, TIFF *out )
raster = (uint32_t*)_TIFFCheckMalloc(in, pixel_count, sizeof(uint32_t), "raster buffer");
if (raster == 0) {
- TIFFError(TIFFFileName(in), "Failed to allocate buffer (%zu elements of %zu each)",
+ TIFFError(TIFFFileName(in), "Failed to allocate buffer (%"TIFF_SIZE_FORMAT" elements of %"TIFF_SIZE_FORMAT" each)",
pixel_count, sizeof(uint32_t));
return (0);
}
@@ -543,7 +543,7 @@ tiffcvt(TIFF* in, TIFF* out)
if (maxMalloc != 0 && TIFFStripSize(in) > maxMalloc)
{
TIFFError(TIFFFileName(in),
- "Strip Size %" PRId64 " over memory limit (%" PRId64 ")",
+ "Strip Size %" TIFF_SSIZE_FORMAT " over memory limit (%" TIFF_SSIZE_FORMAT ")",
TIFFStripSize(in), maxMalloc);
return 0;
}
diff --git a/tools/tiffcp.c b/tools/tiffcp.c
index f6b44813..e29ed333 100644
--- a/tools/tiffcp.c
+++ b/tools/tiffcp.c
@@ -107,7 +107,7 @@ static int pageInSeq = 0;
static void* limitMalloc(tmsize_t s)
{
if (maxMalloc && (s > maxMalloc)) {
- fprintf(stderr, "MemoryLimitError: allocation of %" PRId64 " bytes is forbidden. Limit is %" PRId64 ".\n",
+ fprintf(stderr, "MemoryLimitError: allocation of %" TIFF_SSIZE_FORMAT " bytes is forbidden. Limit is %" TIFF_SSIZE_FORMAT ".\n",
s, maxMalloc);
fprintf(stderr, " use -m option to change limit.\n");
return NULL;
@@ -1099,7 +1099,7 @@ DECLAREcpFunc(cpDecodedStrips)
return 1;
} else {
TIFFError(TIFFFileName(in),
- "Error, can't allocate memory buffer of size %"PRId64
+ "Error, can't allocate memory buffer of size %"TIFF_SSIZE_FORMAT
" to read strips", stripsize);
return 0;
}
diff --git a/tools/tiffcrop.c b/tools/tiffcrop.c
index 7751e866..c793d8e3 100644
--- a/tools/tiffcrop.c
+++ b/tools/tiffcrop.c
@@ -114,6 +114,7 @@ static char tiffcrop_rev_date[] = "12-13-2010";
#include <stdio.h>
#include <stdlib.h>
+#include <stdint.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
@@ -125,10 +126,6 @@ static char tiffcrop_rev_date[] = "12-13-2010";
# include <unistd.h>
#endif
-#ifdef HAVE_STDINT_H
-# include <stdint.h>
-#endif
-
#ifndef EXIT_SUCCESS
#define EXIT_SUCCESS 0
#endif
@@ -865,7 +862,7 @@ static int readContigTilesIntoBuffer (TIFF* in, uint8_t* buf,
if (tbytes < tilesize && !ignore)
{
TIFFError(TIFFFileName(in),
- "Error, can't read tile at row %"PRIu32" col %"PRIu32", Read %"PRId64" bytes of %"PRId64,
+ "Error, can't read tile at row %"PRIu32" col %"PRIu32", Read %"TIFF_SSIZE_FORMAT" bytes of %"TIFF_SSIZE_FORMAT,
col, row, tbytes, tilesize);
status = 0;
_TIFFfree(tilebuf);