changeset 39591:84263f0294b3

(tiff_error_handler, tiff_warning_handler): New functions. (tiff_load): Install them as error and warning handler.
author Gerd Moellmann <gerd@gnu.org>
date Fri, 05 Oct 2001 11:22:57 +0000
parents b7761d10bdc5
children e89bde7c2dd0
files src/xfns.c
diffstat 1 files changed, 31 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/xfns.c	Fri Oct 05 10:40:42 2001 +0000
+++ b/src/xfns.c	Fri Oct 05 11:22:57 2001 +0000
@@ -9474,6 +9474,34 @@
 }
 
 
+static void
+tiff_error_handler (title, format, ap)
+     const char *title, *format;
+     va_list ap;
+{
+  char buf[512];
+  int len;
+  
+  len = sprintf (buf, "TIFF error: %s ", title);
+  vsprintf (buf + len, format, ap);
+  add_to_log (buf, Qnil, Qnil);
+}
+
+
+static void
+tiff_warning_handler (title, format, ap)
+     const char *title, *format;
+     va_list ap;
+{
+  char buf[512];
+  int len;
+  
+  len = sprintf (buf, "TIFF warning: %s ", title);
+  vsprintf (buf + len, format, ap);
+  add_to_log (buf, Qnil, Qnil);
+}
+
+
 /* Load TIFF image IMG for use on frame F.  Value is non-zero if
    successful.  */
 
@@ -9497,6 +9525,9 @@
   file = Qnil;
   GCPRO1 (file);
 
+  TIFFSetErrorHandler (tiff_error_handler);
+  TIFFSetWarningHandler (tiff_warning_handler);
+
   if (NILP (specified_data))
     {
       /* Read from a file */