comparison src/xfns.c @ 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 0e0c30478fe3
children 1e12db2b25f0
comparison
equal deleted inserted replaced
39590:b7761d10bdc5 39591:84263f0294b3
9472 { 9472 {
9473 return ((tiff_memory_source *) data)->len; 9473 return ((tiff_memory_source *) data)->len;
9474 } 9474 }
9475 9475
9476 9476
9477 static void
9478 tiff_error_handler (title, format, ap)
9479 const char *title, *format;
9480 va_list ap;
9481 {
9482 char buf[512];
9483 int len;
9484
9485 len = sprintf (buf, "TIFF error: %s ", title);
9486 vsprintf (buf + len, format, ap);
9487 add_to_log (buf, Qnil, Qnil);
9488 }
9489
9490
9491 static void
9492 tiff_warning_handler (title, format, ap)
9493 const char *title, *format;
9494 va_list ap;
9495 {
9496 char buf[512];
9497 int len;
9498
9499 len = sprintf (buf, "TIFF warning: %s ", title);
9500 vsprintf (buf + len, format, ap);
9501 add_to_log (buf, Qnil, Qnil);
9502 }
9503
9504
9477 /* Load TIFF image IMG for use on frame F. Value is non-zero if 9505 /* Load TIFF image IMG for use on frame F. Value is non-zero if
9478 successful. */ 9506 successful. */
9479 9507
9480 static int 9508 static int
9481 tiff_load (f, img) 9509 tiff_load (f, img)
9494 9522
9495 specified_file = image_spec_value (img->spec, QCfile, NULL); 9523 specified_file = image_spec_value (img->spec, QCfile, NULL);
9496 specified_data = image_spec_value (img->spec, QCdata, NULL); 9524 specified_data = image_spec_value (img->spec, QCdata, NULL);
9497 file = Qnil; 9525 file = Qnil;
9498 GCPRO1 (file); 9526 GCPRO1 (file);
9527
9528 TIFFSetErrorHandler (tiff_error_handler);
9529 TIFFSetWarningHandler (tiff_warning_handler);
9499 9530
9500 if (NILP (specified_data)) 9531 if (NILP (specified_data))
9501 { 9532 {
9502 /* Read from a file */ 9533 /* Read from a file */
9503 file = x_find_image_file (specified_file); 9534 file = x_find_image_file (specified_file);