diff options
author | Roger Leigh <rleigh@codelibre.net> | 2021-02-02 22:00:42 +0000 |
---|---|---|
committer | Roger Leigh <rleigh@codelibre.net> | 2021-02-04 18:07:45 +0000 |
commit | d7afc8c14f379f1e7dcf91d9c57cb9b2d1f2d926 (patch) | |
tree | b58d7ae2d1964ad8b7267461827554b9d1ef99b9 | |
parent | d7c68ae450623e6e8a436ed51467d5d215713d34 (diff) | |
download | libtiff-git-d7afc8c14f379f1e7dcf91d9c57cb9b2d1f2d926.tar.gz |
Use TIFF_SSIZE_FORMAT for formatting tmsize_t
-rw-r--r-- | libtiff/tif_aux.c | 2 | ||||
-rw-r--r-- | libtiff/tif_config.h.cmake.in | 14 | ||||
-rw-r--r-- | libtiff/tif_dirread.c | 2 | ||||
-rw-r--r-- | libtiff/tif_dumpmode.c | 2 | ||||
-rw-r--r-- | libtiff/tif_fax3.c | 4 | ||||
-rw-r--r-- | libtiff/tif_luv.c | 6 | ||||
-rw-r--r-- | libtiff/tif_packbits.c | 4 | ||||
-rw-r--r-- | libtiff/tif_read.c | 14 | ||||
-rw-r--r-- | tools/tiff2pdf.c | 31 | ||||
-rw-r--r-- | tools/tiff2ps.c | 14 | ||||
-rw-r--r-- | tools/tiff2rgba.c | 4 | ||||
-rw-r--r-- | tools/tiffcp.c | 4 | ||||
-rw-r--r-- | tools/tiffcrop.c | 2 |
13 files changed, 55 insertions, 48 deletions
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..d239a6b7 100644 --- a/libtiff/tif_config.h.cmake.in +++ b/libtiff/tif_config.h.cmake.in @@ -107,12 +107,12 @@ /* 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 @@ -140,6 +140,14 @@ /* Number of bits in a file offset, on hosts where this is settable. */ #define _FILE_OFFSET_BITS @FILE_OFFSET_BITS@ +#if SIZEOF_SIZE_T == 8 +# define TIFF_SSIZE_FORMAT PRId64 +#elif SIZEOF_SIZE_T == 8 +# define TIFF_SSIZE_FORMAT PRId32 +#else +# error "Unsupported size_t size; please submit a bug report" +#endif + /* Define to `long int' if <sys/types.h> does not define. */ #undef off_t 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_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_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_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/tools/tiff2pdf.c b/tools/tiff2pdf.c index 2f3317e2..4cdf0f90 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 @@ -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)); @@ -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)); @@ -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); 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..e0dbcc45 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 %zu over memory limit (%" TIFF_SSIZE_FORMAT "), try -b option.", pixel_count * sizeof(uint32_t), maxMalloc); 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..06a2c148 100644 --- a/tools/tiffcrop.c +++ b/tools/tiffcrop.c @@ -865,7 +865,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); |