libtiff: Merge branch 'fix_480' into 'master'

From 226345c23e396619aa33271b7ff9cfb9de97c528 Mon Sep 17 00:00:00 2001
From: Even Rouault <[EMAIL REDACTED]>
Date: Wed, 19 Oct 2022 18:30:54 +0200
Subject: [PATCH] Fix incorrect printf() formatters introduced in recent
 commits (fixes #480)

---
 libtiff/tif_dir.c     | 4 ++--
 libtiff/tif_dirread.c | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/libtiff/tif_dir.c b/libtiff/tif_dir.c
index 4c454069..d09754fd 100644
--- a/libtiff/tif_dir.c
+++ b/libtiff/tif_dir.c
@@ -1771,8 +1771,8 @@ TIFFAdvanceDirectory(TIFF* tif, uint64_t* nextdiroff, uint64_t* off, uint16_t* n
 		(*nextdirnum)++;
 		/* Check next directory for IFD looping and if so, set it as last directory. */
 		if (!_TIFFCheckDirNumberAndOffset(tif, *nextdirnum, *nextdiroff)) {
-			TIFFWarningExt(tif->tif_clientdata, module, "the next directory %"PRIu16" at offset 0x%"PRIx64" (%"PRIu64") might be an IFD loop. Treating directory %"PRIu16" as last directory",
-				*nextdirnum, *nextdiroff, *nextdiroff, *nextdirnum-1);
+			TIFFWarningExt(tif->tif_clientdata, module, "the next directory %"PRIu16" at offset 0x%"PRIx64" (%"PRIu64") might be an IFD loop. Treating directory %d as last directory",
+				*nextdirnum, *nextdiroff, *nextdiroff, (int)(*nextdirnum) - 1);
 			*nextdiroff = 0;
 			(*nextdirnum)--;
 		}
diff --git a/libtiff/tif_dirread.c b/libtiff/tif_dirread.c
index 467e759e..6e859e46 100644
--- a/libtiff/tif_dirread.c
+++ b/libtiff/tif_dirread.c
@@ -5038,8 +5038,8 @@ _TIFFCheckDirNumberAndOffset(TIFF *tif, uint16_t dirn, uint64_t diroff)
 				return 1;
 			} else {
 				TIFFWarningExt(tif->tif_clientdata, "_TIFFCheckDirNumberAndOffset",
-					"TIFF directory %"PRIu16" has IFD looping to directory %"PRIu16" at offset 0x%"PRIx64" (%"PRIu64")",
-					dirn-1, tif->tif_dirlistdirn[n], diroff, diroff);
+					"TIFF directory %d has IFD looping to directory %"PRIu16" at offset 0x%"PRIx64" (%"PRIu64")",
+					(int)dirn-1, tif->tif_dirlistdirn[n], diroff, diroff);
 				return 0;
 			}
 		}
@@ -5441,7 +5441,7 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
 	{
 		case TIFF_SETGET_UNDEFINED:
 				TIFFErrorExt(tif->tif_clientdata, "TIFFFetchNormalTag",
-					"Defined set_field_type of custom tag %"PRIu16" (%s) is TIFF_SETGET_UNDEFINED and thus tag is not read from file",
+					"Defined set_field_type of custom tag %u (%s) is TIFF_SETGET_UNDEFINED and thus tag is not read from file",
 					fip->field_tag, fip->field_name);
 			break;
 		case TIFF_SETGET_ASCII: