changeset 22:69089d946a14

Set a dummy libtiff warning handler to silence useless warnings about unknown fields.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 27 Apr 2017 12:16:41 +0300
parents 0525128adebf
children d0ec05fbab88
files bpgenc.c
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/bpgenc.c	Thu Apr 27 10:50:45 2017 +0300
+++ b/bpgenc.c	Thu Apr 27 12:16:41 2017 +0300
@@ -947,6 +947,15 @@
 }
 
 
+void tiff_warning_handler(const char *module, const char *fmt, va_list ap)
+{
+    (void) module;
+    (void) fmt;
+    (void) ap;
+    // ignore errors and warnings
+}
+
+
 Image *read_tiff(BPGMetaData **pmd, const char *filename,
     BPGColorSpaceEnum color_space, int out_bit_depth,
     int limited_range, int premultiplied_alpha)
@@ -963,6 +972,9 @@
     ColorConvertState cvt;
     RGBConvertFunc *convert_func;
 
+    // Set warning handler to silence dubious warnings about unknown fields
+    TIFFSetWarningHandler(tiff_warning_handler);
+
     // Open and read TIFF header etc.
     if ((tif = TIFFOpen(filename, "rb")) == NULL)
     {