summaryrefslogtreecommitdiff
path: root/tools/tiff2pdf.c
diff options
context:
space:
mode:
authorBob Friesenhahn <bfriesen@simple.dallas.tx.us>2018-11-03 13:27:20 -0500
committerBob Friesenhahn <bfriesen@simple.dallas.tx.us>2018-11-03 13:27:20 -0500
commit2480971bba0595c7f560813f2cbb1695cceb389e (patch)
tree065e8f4e8b834274be98faf2b76d0a1f7baa4fee /tools/tiff2pdf.c
parent2d25c90327bfd61ae3e2700fd8193885d8c2ed8c (diff)
downloadlibtiff-git-2480971bba0595c7f560813f2cbb1695cceb389e.tar.gz
tiff2pdf: Eliminate compiler warning about snprintf output truncation when formatting pdf_datetime.
Diffstat (limited to 'tools/tiff2pdf.c')
-rw-r--r--tools/tiff2pdf.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/tools/tiff2pdf.c b/tools/tiff2pdf.c
index 832a2475..13f693dc 100644
--- a/tools/tiff2pdf.c
+++ b/tools/tiff2pdf.c
@@ -4251,13 +4251,13 @@ void t2p_pdf_currenttime(T2P* t2p)
currenttime = localtime(&timenow);
snprintf(t2p->pdf_datetime, sizeof(t2p->pdf_datetime),
- "D:%.4d%.2d%.2d%.2d%.2d%.2d",
- (currenttime->tm_year + 1900) % 65536,
- (currenttime->tm_mon + 1) % 256,
- (currenttime->tm_mday) % 256,
- (currenttime->tm_hour) % 256,
- (currenttime->tm_min) % 256,
- (currenttime->tm_sec) % 256);
+ "D:%.4u%.2u%.2u%.2u%.2u%.2u",
+ TIFFmin((unsigned) currenttime->tm_year + 1900U,9999U),
+ TIFFmin((unsigned) currenttime->tm_mon + 1U,12U), /* 0-11 + 1 */
+ TIFFmin((unsigned) currenttime->tm_mday,31U), /* 1-31 */
+ TIFFmin((unsigned) currenttime->tm_hour,23U), /* 0-23 */
+ TIFFmin((unsigned) currenttime->tm_min,59U), /* 0-59 */
+ TIFFmin((unsigned) (currenttime->tm_sec),60U)); /* 0-60 */
return;
}