From 8ce83e402f8fb348890a4d91092997a8ac1f274d Mon Sep 17 00:00:00 2001
From: Tom <[EMAIL REDACTED]>
Date: Mon, 18 Mar 2024 00:33:12 +1100
Subject: [PATCH] chore: use correct format specifiers
When building on my Mac, I get the following warnings:
libtiff/tools/tiffcp.c:154:24: warning: format specifies type 'unsigned short' but the argument has type 'tdir_t' (aka 'unsigned int') [-Wformat]
comma, nextImage);
^~~~~~~~~
libtiff/tools/tiffcp.c:1295:39: warning: format specifies type 'unsigned short' but the argument has type 'tdir_t' (aka 'unsigned int') [-Wformat]
TIFFFileName(bias), TIFFCurrentDirectory(bias),
^~~~~~~~~~~~~~~~~~~~~~~~~~
libtiff/tools/tiffcp.c:1296:37: warning: format specifies type 'unsigned short' but the argument has type 'tdir_t' (aka 'unsigned int') [-Wformat]
TIFFFileName(in), TIFFCurrentDirectory(in));
^~~~~~~~~~~~~~~~~~~~~~~~
libtiff/tools/tiffcp.c:1303:37: warning: format specifies type 'unsigned short' but the argument has type 'tdir_t' (aka 'unsigned int') [-Wformat]
TIFFFileName(in), TIFFCurrentDirectory(in));
^~~~~~~~~~~~~~~~~~~~~~~~
libtiff/tools/tiffsplit.c:174:21: warning: format specifies type 'long long' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
path_len);
^~~~~~~~
This updates the format specifiers from `PRIu16` to `PRIu32` for `tdir_t`
(which is a `typdef`ed `uint32_t`) and from `TIFF_SSIZE_FORMAT` to
`TIFF_SIZE_FORMAT` for `size_t`, which makes sense given that it's an unsigned
type.
---
tools/tiffcp.c | 8 ++++----
tools/tiffsplit.c | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/tools/tiffcp.c b/tools/tiffcp.c
index 789b9724..ebff4721 100644
--- a/tools/tiffcp.c
+++ b/tools/tiffcp.c
@@ -150,7 +150,7 @@ static int nextSrcImage(TIFF *tif, char **imageSpec)
}
if (TIFFSetDirectory(tif, nextImage))
return 1;
- fprintf(stderr, "%s%c%" PRIu16 " not found!\n", TIFFFileName(tif),
+ fprintf(stderr, "%s%c%" PRIu32 " not found!\n", TIFFFileName(tif),
comma, nextImage);
}
return 0;
@@ -1290,8 +1290,8 @@ DECLAREcpFunc(cpBiasedContig2Contig)
}
}
TIFFError(TIFFFileName(in),
- "Bias image %s,%" PRIu16
- "\nis not the same size as %s,%" PRIu16 "\n",
+ "Bias image %s,%" PRIu32
+ "\nis not the same size as %s,%" PRIu32 "\n",
TIFFFileName(bias), TIFFCurrentDirectory(bias),
TIFFFileName(in), TIFFCurrentDirectory(in));
return 0;
@@ -1299,7 +1299,7 @@ DECLAREcpFunc(cpBiasedContig2Contig)
else
{
TIFFError(TIFFFileName(in),
- "Can't bias %s,%" PRIu16 " as it has >1 Sample/Pixel\n",
+ "Can't bias %s,%" PRIu32 " as it has >1 Sample/Pixel\n",
TIFFFileName(in), TIFFCurrentDirectory(in));
return 0;
}
diff --git a/tools/tiffsplit.c b/tools/tiffsplit.c
index fcbec1d1..85a473f1 100644
--- a/tools/tiffsplit.c
+++ b/tools/tiffsplit.c
@@ -169,7 +169,7 @@ int main(int argc, char *argv[])
if (!path)
{
fprintf(stderr,
- "tiffsplit: Error: Can't allocate %" TIFF_SSIZE_FORMAT
+ "tiffsplit: Error: Can't allocate %" TIFF_SIZE_FORMAT
" bytes for path-variable.\n",
path_len);
TIFFClose(in);