}
-/* Log error message with format string FORMAT and argument ARG.
+/* Log error message with format string FORMAT and trailing arguments.
Signaling an error, e.g. when an image cannot be loaded, is not a
good idea because this would interrupt redisplay, and the error
message display would lead to another redisplay. This function
therefore simply displays a message. */
static void
-image_error (const char *format, Lisp_Object arg1, Lisp_Object arg2)
+image_error (const char *format, ...)
{
- add_to_log (format, arg1, arg2);
+ va_list ap;
+ va_start (ap, format);
+ vadd_to_log (format, ap);
+ va_end (ap);
}
depth > 16 ? 32 : depth > 8 ? 16 : 8, 0);
if (*ximg == NULL)
{
- image_error ("Unable to allocate X image", Qnil, Qnil);
+ image_error ("Unable to allocate X image");
return 0;
}
{
x_destroy_x_image (*ximg);
*ximg = NULL;
- image_error ("Unable to create X pixmap", Qnil, Qnil);
+ image_error ("Unable to create X pixmap");
return 0;
}
if (depth != 1 && depth != 4 && depth != 8
&& depth != 16 && depth != 24 && depth != 32)
{
- image_error ("Invalid image bit depth specified", Qnil, Qnil);
+ image_error ("Invalid image bit depth specified");
return 0;
}
Lisp_Object errcode;
/* All system errors are < 10000, so the following is safe. */
XSETINT (errcode, err);
- image_error ("Unable to create bitmap, error code %d", errcode, Qnil);
+ image_error ("Unable to create bitmap, error code %d", errcode);
x_destroy_x_image (*ximg);
*ximg = NULL;
return 0;
if (*pixmap == 0)
{
*ximg = NULL;
- image_error ("Unable to allocate NSImage for XPM pixmap", Qnil, Qnil);
+ image_error ("Unable to allocate NSImage for XPM pixmap");
return 0;
}
*ximg = *pixmap;
if (!check_image_size (f, *width, *height))
{
if (!inhibit_image_error)
- image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil);
+ image_error ("Invalid image size (see `max-image-size')");
goto failure;
}
else if (data == NULL)
if (img->pixmap == NO_PIXMAP)
{
x_clear_image (f, img);
- image_error ("Unable to create X pixmap for `%s'", img->spec, Qnil);
+ image_error ("Unable to create X pixmap for `%s'", img->spec);
}
else
success_p = 1;
}
else
- image_error ("Error loading XBM image `%s'", img->spec, Qnil);
+ image_error ("Error loading XBM image `%s'", img->spec);
return success_p;
}
file = x_find_image_file (file_name);
if (!STRINGP (file))
{
- image_error ("Cannot find image file `%s'", file_name, Qnil);
+ image_error ("Cannot find image file `%s'", file_name);
return 0;
}
contents = slurp_file (SSDATA (file), &size);
if (contents == NULL)
{
- image_error ("Error loading XBM image `%s'", img->spec, Qnil);
+ image_error ("Error loading XBM image `%s'", img->spec);
return 0;
}
eassert (img->width > 0 && img->height > 0);
if (!check_image_size (f, img->width, img->height))
{
- image_error ("Invalid image size (see `max-image-size')",
- Qnil, Qnil);
+ image_error ("Invalid image size (see `max-image-size')");
return 0;
}
}
else
{
image_error ("Unable to create pixmap for XBM image `%s'",
- img->spec, Qnil);
+ img->spec);
x_clear_image (f, img);
}
Lisp_Object file = x_find_image_file (specified_file);
if (!STRINGP (file))
{
- image_error ("Cannot find image file `%s'", specified_file, Qnil);
+ image_error ("Cannot find image file `%s'", specified_file);
#ifdef ALLOC_XPM_COLORS
xpm_free_color_cache ();
#endif
Lisp_Object buffer = image_spec_value (img->spec, QCdata, NULL);
if (!STRINGP (buffer))
{
- image_error ("Invalid image data `%s'", buffer, Qnil);
+ image_error ("Invalid image data `%s'", buffer);
#ifdef ALLOC_XPM_COLORS
xpm_free_color_cache ();
#endif
switch (rc)
{
case XpmOpenFailed:
- image_error ("Error opening XPM file (%s)", img->spec, Qnil);
+ image_error ("Error opening XPM file (%s)", img->spec);
break;
case XpmFileInvalid:
- image_error ("Invalid XPM file (%s)", img->spec, Qnil);
+ image_error ("Invalid XPM file (%s)", img->spec);
break;
case XpmNoMemory:
- image_error ("Out of memory (%s)", img->spec, Qnil);
+ image_error ("Out of memory (%s)", img->spec);
break;
case XpmColorFailed:
- image_error ("Color allocation error (%s)", img->spec, Qnil);
+ image_error ("Color allocation error (%s)", img->spec);
break;
default:
- image_error ("Unknown error (%s)", img->spec, Qnil);
+ image_error ("Unknown error (%s)", img->spec);
break;
}
}
if (!check_image_size (f, width, height))
{
- image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil);
+ image_error ("Invalid image size (see `max-image-size')");
goto failure;
}
#endif
)
{
- image_error ("Image too large", Qnil, Qnil);
+ image_error ("Image too large");
goto failure;
}
return 1;
failure:
- image_error ("Invalid XPM file (%s)", img->spec, Qnil);
+ image_error ("Invalid XPM file (%s)", img->spec);
x_destroy_x_image (ximg);
x_destroy_x_image (mask_img);
x_clear_image (f, img);
file = x_find_image_file (file_name);
if (!STRINGP (file))
{
- image_error ("Cannot find image file `%s'", file_name, Qnil);
+ image_error ("Cannot find image file `%s'", file_name);
return 0;
}
contents = slurp_file (SSDATA (file), &size);
if (contents == NULL)
{
- image_error ("Error loading XPM image `%s'", img->spec, Qnil);
+ image_error ("Error loading XPM image `%s'", img->spec);
return 0;
}
data = image_spec_value (img->spec, QCdata, NULL);
if (!STRINGP (data))
{
- image_error ("Invalid image data `%s'", data, Qnil);
+ image_error ("Invalid image data `%s'", data);
return 0;
}
success_p = xpm_load_image (f, img, SDATA (data),
*pixel = *pixel & ~(1 << x % 8);
}
else
- image_error ("XPutPixel: palette image not supported", Qnil, Qnil);
+ image_error ("XPutPixel: palette image not supported");
}
#endif /* HAVE_NTGUI */
file = x_find_image_file (specified_file);
if (!STRINGP (file))
{
- image_error ("Cannot find image file `%s'", specified_file, Qnil);
+ image_error ("Cannot find image file `%s'", specified_file);
return 0;
}
contents = slurp_file (SSDATA (file), &size);
if (contents == NULL)
{
- image_error ("Error reading `%s'", file, Qnil);
+ image_error ("Error reading `%s'", file);
return 0;
}
data = image_spec_value (img->spec, QCdata, NULL);
if (!STRINGP (data))
{
- image_error ("Invalid image data `%s'", data, Qnil);
+ image_error ("Invalid image data `%s'", data);
return 0;
}
p = SDATA (data);
/* Check magic number. */
if (end - p < 2 || *p++ != 'P')
{
- image_error ("Not a PBM image: `%s'", img->spec, Qnil);
+ image_error ("Not a PBM image: `%s'", img->spec);
error:
xfree (contents);
img->pixmap = NO_PIXMAP;
break;
default:
- image_error ("Not a PBM image: `%s'", img->spec, Qnil);
+ image_error ("Not a PBM image: `%s'", img->spec);
goto error;
}
max_color_idx = pbm_scan_number (&p, end);
if (max_color_idx > 65535 || max_color_idx < 0)
{
- image_error ("Unsupported maximum PBM color value", Qnil, Qnil);
+ image_error ("Unsupported maximum PBM color value");
goto error;
}
}
if (!check_image_size (f, width, height))
{
- image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil);
+ image_error ("Invalid image size (see `max-image-size')");
goto error;
}
#endif
x_clear_image (f, img);
image_error ("Invalid image size in image `%s'",
- img->spec, Qnil);
+ img->spec);
goto error;
}
c = *p++;
#endif
x_clear_image (f, img);
image_error ("Invalid image size in image `%s'",
- img->spec, Qnil);
+ img->spec);
goto error;
}
x_destroy_x_image (ximg);
#endif
image_error ("Invalid pixel value in image `%s'",
- img->spec, Qnil);
+ img->spec);
goto error;
}
eassert (png_ptr != NULL);
/* Avoid compiler warning about deprecated direct access to
png_ptr's fields in libpng versions 1.4.x. */
- image_error ("PNG error: %s", build_string (msg), Qnil);
+ image_error ("PNG error: %s", build_string (msg));
PNG_LONGJMP (png_ptr);
}
my_png_warning (png_struct *png_ptr, const char *msg)
{
eassert (png_ptr != NULL);
- image_error ("PNG warning: %s", build_string (msg), Qnil);
+ image_error ("PNG warning: %s", build_string (msg));
}
/* Memory source for PNG decoding. */
file = x_find_image_file (specified_file);
if (!STRINGP (file))
{
- image_error ("Cannot find image file `%s'", specified_file, Qnil);
+ image_error ("Cannot find image file `%s'", specified_file);
return 0;
}
fp = emacs_fopen (SSDATA (file), "rb");
if (!fp)
{
- image_error ("Cannot open image file `%s'", file, Qnil);
+ image_error ("Cannot open image file `%s'", file);
return 0;
}
|| png_sig_cmp (sig, 0, sizeof sig))
{
fclose (fp);
- image_error ("Not a PNG file: `%s'", file, Qnil);
+ image_error ("Not a PNG file: `%s'", file);
return 0;
}
}
{
if (!STRINGP (specified_data))
{
- image_error ("Invalid image data `%s'", specified_data, Qnil);
+ image_error ("Invalid image data `%s'", specified_data);
return 0;
}
if (tbr.len < sizeof sig
|| png_sig_cmp (tbr.bytes, 0, sizeof sig))
{
- image_error ("Not a PNG image: `%s'", img->spec, Qnil);
+ image_error ("Not a PNG image: `%s'", img->spec);
return 0;
}
if (! (width <= INT_MAX && height <= INT_MAX
&& check_image_size (f, width, height)))
{
- image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil);
+ image_error ("Invalid image size (see `max-image-size')");
goto error;
}
file = x_find_image_file (specified_file);
if (!STRINGP (file))
{
- image_error ("Cannot find image file `%s'", specified_file, Qnil);
+ image_error ("Cannot find image file `%s'", specified_file);
return 0;
}
fp = emacs_fopen (SSDATA (file), "rb");
if (fp == NULL)
{
- image_error ("Cannot open `%s'", file, Qnil);
+ image_error ("Cannot open `%s'", file);
return 0;
}
}
else if (!STRINGP (specified_data))
{
- image_error ("Invalid image data `%s'", specified_data, Qnil);
+ image_error ("Invalid image data `%s'", specified_data);
return 0;
}
}
case MY_JPEG_INVALID_IMAGE_SIZE:
- image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil);
+ image_error ("Invalid image size (see `max-image-size')");
break;
case MY_JPEG_CANNOT_CREATE_X:
file = x_find_image_file (specified_file);
if (!STRINGP (file))
{
- image_error ("Cannot find image file `%s'", specified_file, Qnil);
+ image_error ("Cannot find image file `%s'", specified_file);
return 0;
}
# ifdef WINDOWSNT
tiff = TIFFOpen (SSDATA (file), "r");
if (tiff == NULL)
{
- image_error ("Cannot open `%s'", file, Qnil);
+ image_error ("Cannot open `%s'", file);
return 0;
}
}
{
if (!STRINGP (specified_data))
{
- image_error ("Invalid image data `%s'", specified_data, Qnil);
+ image_error ("Invalid image data `%s'", specified_data);
return 0;
}
if (!tiff)
{
- image_error ("Cannot open memory source for `%s'", img->spec, Qnil);
+ image_error ("Cannot open memory source for `%s'", img->spec);
return 0;
}
}
if (!check_image_size (f, width, height))
{
- image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil);
+ image_error ("Invalid image size (see `max-image-size')");
TIFFClose (tiff);
return 0;
}
TIFFClose (tiff);
if (!rc)
{
- image_error ("Error reading TIFF image `%s'", img->spec, Qnil);
+ image_error ("Error reading TIFF image `%s'", img->spec);
xfree (buf);
return 0;
}
file = x_find_image_file (specified_file);
if (!STRINGP (file))
{
- image_error ("Cannot find image file `%s'", specified_file, Qnil);
+ image_error ("Cannot find image file `%s'", specified_file);
return 0;
}
#ifdef WINDOWSNT
gif = DGifOpenFileName (SSDATA (file));
if (gif == NULL)
{
- image_error ("Cannot open `%s'", file, Qnil);
+ image_error ("Cannot open `%s'", file);
return 0;
}
#else
{
if (!STRINGP (specified_data))
{
- image_error ("Invalid image data `%s'", specified_data, Qnil);
+ image_error ("Invalid image data `%s'", specified_data);
return 0;
}
gif = DGifOpen (&memsrc, gif_read_from_memory);
if (!gif)
{
- image_error ("Cannot open memory source `%s'", img->spec, Qnil);
+ image_error ("Cannot open memory source `%s'", img->spec);
return 0;
}
#else
/* Before reading entire contents, check the declared image size. */
if (!check_image_size (f, gif->SWidth, gif->SHeight))
{
- image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil);
+ image_error ("Invalid image size (see `max-image-size')");
gif_close (gif, NULL);
return 0;
}
rc = DGifSlurp (gif);
if (rc == GIF_ERROR || gif->ImageCount <= 0)
{
- image_error ("Error reading `%s'", img->spec, Qnil);
+ image_error ("Error reading `%s'", img->spec);
gif_close (gif, NULL);
return 0;
}
if (!check_image_size (f, width, height))
{
- image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil);
+ image_error ("Invalid image size (see `max-image-size')");
gif_close (gif, NULL);
return 0;
}
&& 0 <= subimg_top && subimg_top <= height - subimg_height
&& 0 <= subimg_left && subimg_left <= width - subimg_width))
{
- image_error ("Subimage does not fit in image", Qnil, Qnil);
+ image_error ("Subimage does not fit in image");
gif_close (gif, NULL);
return 0;
}
image_error ("Error closing `%s': %s",
img->spec, build_string (error_text));
#else
- image_error ("Error closing `%s'", img->spec, Qnil);
+ image_error ("Error closing `%s'", img->spec);
#endif
}
ExceptionType severity;
description = MagickGetException (wand, &severity);
- image_error ("ImageMagick error: %s",
- build_string (description),
- Qnil);
+ image_error ("ImageMagick error: %s", build_string (description));
MagickRelinquishMemory (description);
}
DestroyMagickWand (composite_wand);
DestroyMagickWand (sub_wand);
cache->wand = NULL;
- image_error ("Imagemagick pixel iterator creation failed",
- Qnil, Qnil);
+ image_error ("Imagemagick pixel iterator creation failed");
return NULL;
}
DestroyMagickWand (sub_wand);
DestroyPixelIterator (source_iterator);
cache->wand = NULL;
- image_error ("Imagemagick pixel iterator creation failed",
- Qnil, Qnil);
+ image_error ("Imagemagick pixel iterator creation failed");
return NULL;
}
status = MagickScaleImage (image_wand, desired_width, desired_height);
if (status == MagickFalse)
{
- image_error ("Imagemagick scale failed", Qnil, Qnil);
+ image_error ("Imagemagick scale failed");
imagemagick_error (image_wand);
goto imagemagick_error;
}
status = MagickRotateImage (image_wand, bg_wand, rotation);
if (status == MagickFalse)
{
- image_error ("Imagemagick image rotate failed", Qnil, Qnil);
+ image_error ("Imagemagick image rotate failed");
imagemagick_error (image_wand);
goto imagemagick_error;
}
if (! (image_width <= INT_MAX && image_height <= INT_MAX
&& check_image_size (f, image_width, image_height)))
{
- image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil);
+ image_error ("Invalid image size (see `max-image-size')");
goto imagemagick_error;
}
#ifdef COLOR_TABLE_SUPPORT
free_color_table ();
#endif
- image_error ("Imagemagick X bitmap allocation failure", Qnil, Qnil);
+ image_error ("Imagemagick X bitmap allocation failure");
goto imagemagick_error;
}
#ifdef COLOR_TABLE_SUPPORT
free_color_table ();
#endif
- image_error ("Imagemagick X bitmap allocation failure", Qnil, Qnil);
+ image_error ("Imagemagick X bitmap allocation failure");
goto imagemagick_error;
}
free_color_table ();
#endif
x_destroy_x_image (ximg);
- image_error ("Imagemagick pixel iterator creation failed",
- Qnil, Qnil);
+ image_error ("Imagemagick pixel iterator creation failed");
goto imagemagick_error;
}
MagickWandTerminus ();
/* TODO more cleanup. */
- image_error ("Error parsing IMAGEMAGICK image `%s'", img->spec, Qnil);
+ image_error ("Error parsing IMAGEMAGICK image `%s'", img->spec);
return 0;
}
file = x_find_image_file (file_name);
if (!STRINGP (file))
{
- image_error ("Cannot find image file `%s'", file_name, Qnil);
+ image_error ("Cannot find image file `%s'", file_name);
return 0;
}
#ifdef WINDOWSNT
data = image_spec_value (img->spec, QCdata, NULL);
if (!STRINGP (data))
{
- image_error ("Invalid image data `%s'", data, Qnil);
+ image_error ("Invalid image data `%s'", data);
return 0;
}
success_p = imagemagick_load_image (f, img, SDATA (data),
file = x_find_image_file (file_name);
if (!STRINGP (file))
{
- image_error ("Cannot find image file `%s'", file_name, Qnil);
+ image_error ("Cannot find image file `%s'", file_name);
return 0;
}
contents = slurp_file (SSDATA (file), &size);
if (contents == NULL)
{
- image_error ("Error loading SVG image `%s'", img->spec, Qnil);
+ image_error ("Error loading SVG image `%s'", img->spec);
return 0;
}
/* If the file was slurped into memory properly, parse it. */
data = image_spec_value (img->spec, QCdata, NULL);
if (!STRINGP (data))
{
- image_error ("Invalid image data `%s'", data, Qnil);
+ image_error ("Invalid image data `%s'", data);
return 0;
}
original_filename = BVAR (current_buffer, filename);
rsvg_handle_get_dimensions (rsvg_handle, &dimension_data);
if (! check_image_size (f, dimension_data.width, dimension_data.height))
{
- image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil);
+ image_error ("Invalid image size (see `max-image-size')");
goto rsvg_error;
}
g_object_unref (rsvg_handle);
/* FIXME: Use error->message so the user knows what is the actual
problem with the image. */
- image_error ("Error parsing SVG image `%s'", img->spec, Qnil);
+ image_error ("Error parsing SVG image `%s'", img->spec);
g_error_free (err);
return 0;
}
if (! (in_width <= INT_MAX && in_height <= INT_MAX
&& check_image_size (f, in_width, in_height)))
{
- image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil);
+ image_error ("Invalid image size (see `max-image-size')");
return 0;
}
img->width = in_width;
if (!img->pixmap)
{
- image_error ("Unable to create pixmap for `%s'", img->spec, Qnil);
+ image_error ("Unable to create pixmap for `%s'", img->spec);
return 0;
}
}
else
image_error ("Cannot get X image of `%s'; colors will not be freed",
- img->spec, Qnil);
+ img->spec);
unblock_input ();
}