va_end (ap);
}
+static void
+image_size_error (void)
+{
+ image_error ("Invalid image size (see %qs)", "max-image-size");
+}
\f
/***********************************************************************
if (!check_image_size (f, *width, *height))
{
if (!inhibit_image_error)
- image_error ("Invalid image size (see "uLSQM"max-image-size"uRSQM")");
+ image_size_error ();
goto failure;
}
else if (data == NULL)
if (img->pixmap == NO_PIXMAP)
{
x_clear_image (f, img);
- image_error ("Unable to create X pixmap for "uLSQM"%s"uRSQM,
- img->spec);
+ image_error ("Unable to create X pixmap for %qs", img->spec);
}
else
success_p = 1;
}
else
- image_error ("Error loading XBM image "uLSQM"%s"uRSQM, img->spec);
+ image_error ("Error loading XBM image %qs", img->spec);
return success_p;
}
Lisp_Object file = x_find_image_fd (file_name, &fd);
if (!STRINGP (file))
{
- image_error ("Cannot find image file "uLSQM"%s"uRSQM, file_name);
+ image_error ("Cannot find image file %qs", file_name);
return 0;
}
unsigned char *contents = slurp_file (fd, &size);
if (contents == NULL)
{
- image_error ("Error loading XBM image "uLSQM"%s"uRSQM, file);
+ image_error ("Error loading XBM image %qs", file);
return 0;
}
eassert (img->width > 0 && img->height > 0);
if (!check_image_size (f, img->width, img->height))
{
- image_error ("Invalid image size (see "
- uLSQM"max-image-size"uRSQM")");
+ image_size_error ();
return 0;
}
}
success_p = 1;
else
{
- image_error (("Unable to create pixmap for XBM image "
- uLSQM"%s"uRSQM),
+ image_error ("Unable to create pixmap for XBM image %qs",
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 "uLSQM"%s"uRSQM,
- specified_file);
+ image_error ("Cannot find image file %qs", 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 "uLSQM"%s"uRSQM, buffer);
+ image_error ("Invalid image data %qs", buffer);
#ifdef ALLOC_XPM_COLORS
xpm_free_color_cache ();
#endif
if (!check_image_size (f, width, height))
{
- image_error ("Invalid image size (see "uLSQM"max-image-size"uRSQM")");
+ image_size_error ();
goto failure;
}
Lisp_Object file = x_find_image_fd (file_name, &fd);
if (!STRINGP (file))
{
- image_error ("Cannot find image file "uLSQM"%s"uRSQM, file_name);
+ image_error ("Cannot find image file %qs", file_name);
return 0;
}
unsigned char *contents = slurp_file (fd, &size);
if (contents == NULL)
{
- image_error ("Error loading XPM image "uLSQM"%s"uRSQM, file);
+ image_error ("Error loading XPM image %qs", file);
return 0;
}
data = image_spec_value (img->spec, QCdata, NULL);
if (!STRINGP (data))
{
- image_error ("Invalid image data "uLSQM"%s"uRSQM, data);
+ image_error ("Invalid image data %qs", data);
return 0;
}
success_p = xpm_load_image (f, img, SDATA (data),
Lisp_Object file = x_find_image_fd (specified_file, &fd);
if (!STRINGP (file))
{
- image_error ("Cannot find image file "uLSQM"%s"uRSQM,
- specified_file);
+ image_error ("Cannot find image file %qs", specified_file);
return 0;
}
contents = slurp_file (fd, &size);
if (contents == NULL)
{
- image_error ("Error reading "uLSQM"%s"uRSQM, file);
+ image_error ("Error reading %qs", file);
return 0;
}
data = image_spec_value (img->spec, QCdata, NULL);
if (!STRINGP (data))
{
- image_error ("Invalid image data "uLSQM"%s"uRSQM, data);
+ image_error ("Invalid image data %qs", data);
return 0;
}
p = SDATA (data);
/* Check magic number. */
if (end - p < 2 || *p++ != 'P')
{
- image_error ("Not a PBM image: "uLSQM"%s"uRSQM, img->spec);
+ image_error ("Not a PBM image: %qs", img->spec);
error:
xfree (contents);
img->pixmap = NO_PIXMAP;
break;
default:
- image_error ("Not a PBM image: "uLSQM"%s"uRSQM, img->spec);
+ image_error ("Not a PBM image: %qs", img->spec);
goto error;
}
if (!check_image_size (f, width, height))
{
- image_error ("Invalid image size (see "uLSQM"max-image-size"uRSQM")");
+ image_size_error ();
goto error;
}
x_destroy_x_image (ximg);
#endif
x_clear_image (f, img);
- image_error (("Invalid image size in image "
- uLSQM"%s"uRSQM),
+ image_error ("Invalid image size in image %qs",
img->spec);
goto error;
}
x_destroy_x_image (ximg);
#endif
x_clear_image (f, img);
- image_error ("Invalid image size in image "uLSQM"%s"uRSQM,
- img->spec);
+ image_error ("Invalid image size in image %qs", img->spec);
goto error;
}
#else
x_destroy_x_image (ximg);
#endif
- image_error ("Invalid pixel value in image "uLSQM"%s"uRSQM,
- img->spec);
+ image_error ("Invalid pixel value in image %qs", img->spec);
goto error;
}
Lisp_Object file = x_find_image_fd (specified_file, &fd);
if (!STRINGP (file))
{
- image_error ("Cannot find image file "uLSQM"%s"uRSQM,
- specified_file);
+ image_error ("Cannot find image file %qs", specified_file);
return 0;
}
fp = fdopen (fd, "rb");
if (!fp)
{
- image_error ("Cannot open image file "uLSQM"%s"uRSQM, file);
+ image_error ("Cannot open image file %qs", file);
return 0;
}
|| png_sig_cmp (sig, 0, sizeof sig))
{
fclose (fp);
- image_error ("Not a PNG file: "uLSQM"%s"uRSQM, file);
+ image_error ("Not a PNG file: %qs", file);
return 0;
}
}
{
if (!STRINGP (specified_data))
{
- image_error ("Invalid image data "uLSQM"%s"uRSQM, specified_data);
+ image_error ("Invalid image data %qs", specified_data);
return 0;
}
if (tbr.len < sizeof sig
|| png_sig_cmp (tbr.bytes, 0, sizeof sig))
{
- image_error ("Not a PNG image: "uLSQM"%s"uRSQM, img->spec);
+ image_error ("Not a PNG image: %qs", img->spec);
return 0;
}
if (! (width <= INT_MAX && height <= INT_MAX
&& check_image_size (f, width, height)))
{
- image_error ("Invalid image size (see "uLSQM"max-image-size"uRSQM")");
+ image_size_error ();
goto error;
}
Lisp_Object file = x_find_image_fd (specified_file, &fd);
if (!STRINGP (file))
{
- image_error ("Cannot find image file "uLSQM"%s"uRSQM,
- specified_file);
+ image_error ("Cannot find image file %qs", specified_file);
return 0;
}
fp = fdopen (fd, "rb");
if (fp == NULL)
{
- image_error ("Cannot open "uLSQM"%s"uRSQM, file);
+ image_error ("Cannot open %qs", file);
return 0;
}
}
else if (!STRINGP (specified_data))
{
- image_error ("Invalid image data "uLSQM"%s"uRSQM, specified_data);
+ image_error ("Invalid image data %qs", specified_data);
return 0;
}
{
char buf[JMSG_LENGTH_MAX];
mgr->cinfo.err->format_message ((j_common_ptr) &mgr->cinfo, buf);
- image_error ("Error reading JPEG image "uLSQM"%s"uRSQM": %s",
+ image_error ("Error reading JPEG image %qs: %s",
img->spec, build_string (buf));
break;
}
case MY_JPEG_INVALID_IMAGE_SIZE:
- image_error ("Invalid image size (see "
- uLSQM"max-image-size"uRSQM")");
+ image_size_error ();
break;
case MY_JPEG_CANNOT_CREATE_X:
Lisp_Object file = x_find_image_file (specified_file);
if (!STRINGP (file))
{
- image_error ("Cannot find image file "uLSQM"%s"uRSQM,
- specified_file);
+ image_error ("Cannot find image file %qs", specified_file);
return 0;
}
tiff = TIFFOpen (SSDATA (encoded_file), "r");
if (tiff == NULL)
{
- image_error ("Cannot open "uLSQM"%s"uRSQM, file);
+ image_error ("Cannot open %qs", file);
return 0;
}
}
{
if (!STRINGP (specified_data))
{
- image_error ("Invalid image data "uLSQM"%s"uRSQM, specified_data);
+ image_error ("Invalid image data %qs", specified_data);
return 0;
}
if (!tiff)
{
- image_error ("Cannot open memory source for "uLSQM"%s"uRSQM,
- img->spec);
+ image_error ("Cannot open memory source for %qs", img->spec);
return 0;
}
}
if (! (TYPE_MINIMUM (tdir_t) <= ino && ino <= TYPE_MAXIMUM (tdir_t)
&& TIFFSetDirectory (tiff, ino)))
{
- image_error
- ("Invalid image number "uLSQM"%s"uRSQM" in image "uLSQM"%s"uRSQM,
- image, img->spec);
+ image_error ("Invalid image number %qs in image %qs",
+ image, img->spec);
TIFFClose (tiff);
return 0;
}
if (!check_image_size (f, width, height))
{
- image_error ("Invalid image size (see "uLSQM"max-image-size"uRSQM")");
+ image_size_error ();
TIFFClose (tiff);
return 0;
}
TIFFClose (tiff);
if (!rc)
{
- image_error ("Error reading TIFF image "uLSQM"%s"uRSQM, img->spec);
+ image_error ("Error reading TIFF image %qs", img->spec);
xfree (buf);
return 0;
}
Lisp_Object file = x_find_image_file (specified_file);
if (!STRINGP (file))
{
- image_error ("Cannot find image file "uLSQM"%s"uRSQM,
- specified_file);
+ image_error ("Cannot find image file %qs", specified_file);
return 0;
}
gif = DGifOpenFileName (SSDATA (encoded_file));
if (gif == NULL)
{
- image_error ("Cannot open "uLSQM"%s"uRSQM, file);
+ image_error ("Cannot open %qs", file);
return 0;
}
#else
gif = DGifOpenFileName (SSDATA (encoded_file), &gif_err);
if (gif == NULL)
{
- image_error ("Cannot open "uLSQM"%s"uRSQM": %s",
+ image_error ("Cannot open %qs: %s",
file, build_string (GifErrorString (gif_err)));
return 0;
}
{
if (!STRINGP (specified_data))
{
- image_error ("Invalid image data "uLSQM"%s"uRSQM, specified_data);
+ image_error ("Invalid image data %qs", specified_data);
return 0;
}
gif = DGifOpen (&memsrc, gif_read_from_memory);
if (!gif)
{
- image_error ("Cannot open memory source "uLSQM"%s"uRSQM, img->spec);
+ image_error ("Cannot open memory source %qs", img->spec);
return 0;
}
#else
gif = DGifOpen (&memsrc, gif_read_from_memory, &gif_err);
if (!gif)
{
- image_error ("Cannot open memory source "uLSQM"%s"uRSQM": %s",
+ image_error ("Cannot open memory source %qs: %s",
img->spec, build_string (GifErrorString (gif_err)));
return 0;
}
/* Before reading entire contents, check the declared image size. */
if (!check_image_size (f, gif->SWidth, gif->SHeight))
{
- image_error ("Invalid image size (see "uLSQM"max-image-size"uRSQM")");
+ image_size_error ();
gif_close (gif, NULL);
return 0;
}
rc = DGifSlurp (gif);
if (rc == GIF_ERROR || gif->ImageCount <= 0)
{
- image_error ("Error reading "uLSQM"%s"uRSQM, img->spec);
+ image_error ("Error reading %qs", img->spec);
gif_close (gif, NULL);
return 0;
}
idx = INTEGERP (image_number) ? XFASTINT (image_number) : 0;
if (idx < 0 || idx >= gif->ImageCount)
{
- image_error
- ("Invalid image number "uLSQM"%s"uRSQM" in image "uLSQM"%s"uRSQM,
- image_number, img->spec);
+ image_error ("Invalid image number %qs in image %qs",
+ image_number, img->spec);
gif_close (gif, NULL);
return 0;
}
if (!check_image_size (f, width, height))
{
- image_error ("Invalid image size (see "uLSQM"max-image-size"uRSQM")");
+ image_size_error ();
gif_close (gif, NULL);
return 0;
}
char *error_text = GifErrorString (gif_err);
if (error_text)
- image_error ("Error closing "uLSQM"%s"uRSQM": %s",
+ image_error ("Error closing %qs: %s",
img->spec, build_string (error_text));
#else
- image_error ("Error closing "uLSQM"%s"uRSQM, img->spec);
+ image_error ("Error closing %qs", img->spec);
#endif
}
if (ino < 0 || ino >= MagickGetNumberImages (image_wand))
{
- image_error
- ("Invalid image number "uLSQM"%s"uRSQM" in image "uLSQM"%s"uRSQM,
- image, img->spec);
+ image_error ("Invalid image number %qs in image %qs", image, img->spec);
DestroyMagickWand (image_wand);
return 0;
}
if (! (image_width <= INT_MAX && image_height <= INT_MAX
&& check_image_size (f, image_width, image_height)))
{
- image_error ("Invalid image size (see "uLSQM"max-image-size"uRSQM")");
+ image_size_error ();
goto imagemagick_error;
}
MagickWandTerminus ();
/* TODO more cleanup. */
- image_error ("Error parsing IMAGEMAGICK image "uLSQM"%s"uRSQM, img->spec);
+ image_error ("Error parsing IMAGEMAGICK image %qs", img->spec);
return 0;
}
Lisp_Object file = x_find_image_file (file_name);
if (!STRINGP (file))
{
- image_error ("Cannot find image file "uLSQM"%s"uRSQM, file_name);
+ image_error ("Cannot find image file %qs", file_name);
return 0;
}
file = ENCODE_FILE (file);
data = image_spec_value (img->spec, QCdata, NULL);
if (!STRINGP (data))
{
- image_error ("Invalid image data "uLSQM"%s"uRSQM, data);
+ image_error ("Invalid image data %qs", data);
return 0;
}
success_p = imagemagick_load_image (f, img, SDATA (data),
Lisp_Object file = x_find_image_fd (file_name, &fd);
if (!STRINGP (file))
{
- image_error ("Cannot find image file "uLSQM"%s"uRSQM, file_name);
+ image_error ("Cannot find image file %qs", file_name);
return 0;
}
unsigned char *contents = slurp_file (fd, &size);
if (contents == NULL)
{
- image_error ("Error loading SVG image "uLSQM"%s"uRSQM, file);
+ image_error ("Error loading SVG image %qs", file);
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 "uLSQM"%s"uRSQM, data);
+ image_error ("Invalid image data %qs", 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 "uLSQM"max-image-size"uRSQM")");
+ image_size_error ();
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 "uLSQM"%s"uRSQM, img->spec);
+ image_error ("Error parsing SVG image %qs", 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 "uLSQM"max-image-size"uRSQM")");
+ image_size_error ();
return 0;
}
img->width = in_width;
if (!img->pixmap)
{
- image_error ("Unable to create pixmap for "uLSQM"%s"uRSQM, img->spec);
+ image_error ("Unable to create pixmap for %qs" , img->spec);
return 0;
}
#endif
}
else
- image_error (("Cannot get X image of "uLSQM"%s"uRSQM";"
- " colors will not be freed"),
+ image_error ("Cannot get X image of %qs; colors will not be freed",
img->spec);
unblock_input ();