aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2015-08-18 23:04:58 -0700
committerPaul Eggert2015-08-18 23:14:08 -0700
commit87fbe1a6cb6d212c69546bd10864288fcf034cc1 (patch)
treebfb6defd964894b8f8077cdaa245fe8e6da86d7e /src
parent67de1b6fa752df913ae00537234d1a18bca2543f (diff)
downloademacs-87fbe1a6cb6d212c69546bd10864288fcf034cc1.tar.gz
emacs-87fbe1a6cb6d212c69546bd10864288fcf034cc1.zip
Use new q ‘format’ flag when fixing quotes in C
* src/image.c (image_size_error): New function. All uses of image_error with "Invalid image size ..." changed to use it. * src/image.c (image_size_error, xbm_load_image, xbm_load) (xpm_load, xpm_load_image, xpm_load, pbm_load, png_load_body) (jpeg_load_body, tiff_load, gif_load, imagemagick_load_image) (imagemagick_load, svg_load, svg_load_image, gs_load) (x_kill_gs_process): * src/lread.c (load_warn_old_style_backquotes): * src/xfaces.c (load_pixmap): * src/xselect.c (x_clipboard_manager_error_1): Use %qs, not uLSQM and uRSQM. * src/syntax.c (Finternal_describe_syntax_value): Prefer Fsubstitute_command_keys to Fformat, as this lets us use AUTO_STRING. * src/xdisp.c (vadd_to_log): Use AUTO_STRING on the format argument, as it's now guaranteed to be ASCII. * src/xselect.c (x_clipboard_manager_error_2): Avoid grave accent in low-level stderr diagnostic.
Diffstat (limited to 'src')
-rw-r--r--src/image.c158
-rw-r--r--src/lread.c3
-rw-r--r--src/syntax.c9
-rw-r--r--src/xdisp.c10
-rw-r--r--src/xfaces.c2
-rw-r--r--src/xselect.c13
6 files changed, 91 insertions, 104 deletions
diff --git a/src/image.c b/src/image.c
index 8f9b06cc284..63089a9a8fb 100644
--- a/src/image.c
+++ b/src/image.c
@@ -644,6 +644,11 @@ image_error (const char *format, ...)
644 va_end (ap); 644 va_end (ap);
645} 645}
646 646
647static void
648image_size_error (void)
649{
650 image_error ("Invalid image size (see %qs)", "max-image-size");
651}
647 652
648 653
649/*********************************************************************** 654/***********************************************************************
@@ -2802,7 +2807,7 @@ xbm_read_bitmap_data (struct frame *f, unsigned char *contents, unsigned char *e
2802 if (!check_image_size (f, *width, *height)) 2807 if (!check_image_size (f, *width, *height))
2803 { 2808 {
2804 if (!inhibit_image_error) 2809 if (!inhibit_image_error)
2805 image_error ("Invalid image size (see "uLSQM"max-image-size"uRSQM")"); 2810 image_size_error ();
2806 goto failure; 2811 goto failure;
2807 } 2812 }
2808 else if (data == NULL) 2813 else if (data == NULL)
@@ -2947,14 +2952,13 @@ xbm_load_image (struct frame *f, struct image *img, unsigned char *contents,
2947 if (img->pixmap == NO_PIXMAP) 2952 if (img->pixmap == NO_PIXMAP)
2948 { 2953 {
2949 x_clear_image (f, img); 2954 x_clear_image (f, img);
2950 image_error ("Unable to create X pixmap for "uLSQM"%s"uRSQM, 2955 image_error ("Unable to create X pixmap for %qs", img->spec);
2951 img->spec);
2952 } 2956 }
2953 else 2957 else
2954 success_p = 1; 2958 success_p = 1;
2955 } 2959 }
2956 else 2960 else
2957 image_error ("Error loading XBM image "uLSQM"%s"uRSQM, img->spec); 2961 image_error ("Error loading XBM image %qs", img->spec);
2958 2962
2959 return success_p; 2963 return success_p;
2960} 2964}
@@ -2992,7 +2996,7 @@ xbm_load (struct frame *f, struct image *img)
2992 Lisp_Object file = x_find_image_fd (file_name, &fd); 2996 Lisp_Object file = x_find_image_fd (file_name, &fd);
2993 if (!STRINGP (file)) 2997 if (!STRINGP (file))
2994 { 2998 {
2995 image_error ("Cannot find image file "uLSQM"%s"uRSQM, file_name); 2999 image_error ("Cannot find image file %qs", file_name);
2996 return 0; 3000 return 0;
2997 } 3001 }
2998 3002
@@ -3000,7 +3004,7 @@ xbm_load (struct frame *f, struct image *img)
3000 unsigned char *contents = slurp_file (fd, &size); 3004 unsigned char *contents = slurp_file (fd, &size);
3001 if (contents == NULL) 3005 if (contents == NULL)
3002 { 3006 {
3003 image_error ("Error loading XBM image "uLSQM"%s"uRSQM, file); 3007 image_error ("Error loading XBM image %qs", file);
3004 return 0; 3008 return 0;
3005 } 3009 }
3006 3010
@@ -3035,8 +3039,7 @@ xbm_load (struct frame *f, struct image *img)
3035 eassert (img->width > 0 && img->height > 0); 3039 eassert (img->width > 0 && img->height > 0);
3036 if (!check_image_size (f, img->width, img->height)) 3040 if (!check_image_size (f, img->width, img->height))
3037 { 3041 {
3038 image_error ("Invalid image size (see " 3042 image_size_error ();
3039 uLSQM"max-image-size"uRSQM")");
3040 return 0; 3043 return 0;
3041 } 3044 }
3042 } 3045 }
@@ -3113,8 +3116,7 @@ xbm_load (struct frame *f, struct image *img)
3113 success_p = 1; 3116 success_p = 1;
3114 else 3117 else
3115 { 3118 {
3116 image_error (("Unable to create pixmap for XBM image " 3119 image_error ("Unable to create pixmap for XBM image %qs",
3117 uLSQM"%s"uRSQM),
3118 img->spec); 3120 img->spec);
3119 x_clear_image (f, img); 3121 x_clear_image (f, img);
3120 } 3122 }
@@ -3637,8 +3639,7 @@ xpm_load (struct frame *f, struct image *img)
3637 Lisp_Object file = x_find_image_file (specified_file); 3639 Lisp_Object file = x_find_image_file (specified_file);
3638 if (!STRINGP (file)) 3640 if (!STRINGP (file))
3639 { 3641 {
3640 image_error ("Cannot find image file "uLSQM"%s"uRSQM, 3642 image_error ("Cannot find image file %qs", specified_file);
3641 specified_file);
3642#ifdef ALLOC_XPM_COLORS 3643#ifdef ALLOC_XPM_COLORS
3643 xpm_free_color_cache (); 3644 xpm_free_color_cache ();
3644#endif 3645#endif
@@ -3670,7 +3671,7 @@ xpm_load (struct frame *f, struct image *img)
3670 Lisp_Object buffer = image_spec_value (img->spec, QCdata, NULL); 3671 Lisp_Object buffer = image_spec_value (img->spec, QCdata, NULL);
3671 if (!STRINGP (buffer)) 3672 if (!STRINGP (buffer))
3672 { 3673 {
3673 image_error ("Invalid image data "uLSQM"%s"uRSQM, buffer); 3674 image_error ("Invalid image data %qs", buffer);
3674#ifdef ALLOC_XPM_COLORS 3675#ifdef ALLOC_XPM_COLORS
3675 xpm_free_color_cache (); 3676 xpm_free_color_cache ();
3676#endif 3677#endif
@@ -4114,7 +4115,7 @@ xpm_load_image (struct frame *f,
4114 4115
4115 if (!check_image_size (f, width, height)) 4116 if (!check_image_size (f, width, height))
4116 { 4117 {
4117 image_error ("Invalid image size (see "uLSQM"max-image-size"uRSQM")"); 4118 image_size_error ();
4118 goto failure; 4119 goto failure;
4119 } 4120 }
4120 4121
@@ -4301,7 +4302,7 @@ xpm_load (struct frame *f,
4301 Lisp_Object file = x_find_image_fd (file_name, &fd); 4302 Lisp_Object file = x_find_image_fd (file_name, &fd);
4302 if (!STRINGP (file)) 4303 if (!STRINGP (file))
4303 { 4304 {
4304 image_error ("Cannot find image file "uLSQM"%s"uRSQM, file_name); 4305 image_error ("Cannot find image file %qs", file_name);
4305 return 0; 4306 return 0;
4306 } 4307 }
4307 4308
@@ -4309,7 +4310,7 @@ xpm_load (struct frame *f,
4309 unsigned char *contents = slurp_file (fd, &size); 4310 unsigned char *contents = slurp_file (fd, &size);
4310 if (contents == NULL) 4311 if (contents == NULL)
4311 { 4312 {
4312 image_error ("Error loading XPM image "uLSQM"%s"uRSQM, file); 4313 image_error ("Error loading XPM image %qs", file);
4313 return 0; 4314 return 0;
4314 } 4315 }
4315 4316
@@ -4323,7 +4324,7 @@ xpm_load (struct frame *f,
4323 data = image_spec_value (img->spec, QCdata, NULL); 4324 data = image_spec_value (img->spec, QCdata, NULL);
4324 if (!STRINGP (data)) 4325 if (!STRINGP (data))
4325 { 4326 {
4326 image_error ("Invalid image data "uLSQM"%s"uRSQM, data); 4327 image_error ("Invalid image data %qs", data);
4327 return 0; 4328 return 0;
4328 } 4329 }
4329 success_p = xpm_load_image (f, img, SDATA (data), 4330 success_p = xpm_load_image (f, img, SDATA (data),
@@ -5277,8 +5278,7 @@ pbm_load (struct frame *f, struct image *img)
5277 Lisp_Object file = x_find_image_fd (specified_file, &fd); 5278 Lisp_Object file = x_find_image_fd (specified_file, &fd);
5278 if (!STRINGP (file)) 5279 if (!STRINGP (file))
5279 { 5280 {
5280 image_error ("Cannot find image file "uLSQM"%s"uRSQM, 5281 image_error ("Cannot find image file %qs", specified_file);
5281 specified_file);
5282 return 0; 5282 return 0;
5283 } 5283 }
5284 5284
@@ -5286,7 +5286,7 @@ pbm_load (struct frame *f, struct image *img)
5286 contents = slurp_file (fd, &size); 5286 contents = slurp_file (fd, &size);
5287 if (contents == NULL) 5287 if (contents == NULL)
5288 { 5288 {
5289 image_error ("Error reading "uLSQM"%s"uRSQM, file); 5289 image_error ("Error reading %qs", file);
5290 return 0; 5290 return 0;
5291 } 5291 }
5292 5292
@@ -5299,7 +5299,7 @@ pbm_load (struct frame *f, struct image *img)
5299 data = image_spec_value (img->spec, QCdata, NULL); 5299 data = image_spec_value (img->spec, QCdata, NULL);
5300 if (!STRINGP (data)) 5300 if (!STRINGP (data))
5301 { 5301 {
5302 image_error ("Invalid image data "uLSQM"%s"uRSQM, data); 5302 image_error ("Invalid image data %qs", data);
5303 return 0; 5303 return 0;
5304 } 5304 }
5305 p = SDATA (data); 5305 p = SDATA (data);
@@ -5309,7 +5309,7 @@ pbm_load (struct frame *f, struct image *img)
5309 /* Check magic number. */ 5309 /* Check magic number. */
5310 if (end - p < 2 || *p++ != 'P') 5310 if (end - p < 2 || *p++ != 'P')
5311 { 5311 {
5312 image_error ("Not a PBM image: "uLSQM"%s"uRSQM, img->spec); 5312 image_error ("Not a PBM image: %qs", img->spec);
5313 error: 5313 error:
5314 xfree (contents); 5314 xfree (contents);
5315 img->pixmap = NO_PIXMAP; 5315 img->pixmap = NO_PIXMAP;
@@ -5343,7 +5343,7 @@ pbm_load (struct frame *f, struct image *img)
5343 break; 5343 break;
5344 5344
5345 default: 5345 default:
5346 image_error ("Not a PBM image: "uLSQM"%s"uRSQM, img->spec); 5346 image_error ("Not a PBM image: %qs", img->spec);
5347 goto error; 5347 goto error;
5348 } 5348 }
5349 5349
@@ -5369,7 +5369,7 @@ pbm_load (struct frame *f, struct image *img)
5369 5369
5370 if (!check_image_size (f, width, height)) 5370 if (!check_image_size (f, width, height))
5371 { 5371 {
5372 image_error ("Invalid image size (see "uLSQM"max-image-size"uRSQM")"); 5372 image_size_error ();
5373 goto error; 5373 goto error;
5374 } 5374 }
5375 5375
@@ -5442,8 +5442,7 @@ pbm_load (struct frame *f, struct image *img)
5442 x_destroy_x_image (ximg); 5442 x_destroy_x_image (ximg);
5443#endif 5443#endif
5444 x_clear_image (f, img); 5444 x_clear_image (f, img);
5445 image_error (("Invalid image size in image " 5445 image_error ("Invalid image size in image %qs",
5446 uLSQM"%s"uRSQM),
5447 img->spec); 5446 img->spec);
5448 goto error; 5447 goto error;
5449 } 5448 }
@@ -5478,8 +5477,7 @@ pbm_load (struct frame *f, struct image *img)
5478 x_destroy_x_image (ximg); 5477 x_destroy_x_image (ximg);
5479#endif 5478#endif
5480 x_clear_image (f, img); 5479 x_clear_image (f, img);
5481 image_error ("Invalid image size in image "uLSQM"%s"uRSQM, 5480 image_error ("Invalid image size in image %qs", img->spec);
5482 img->spec);
5483 goto error; 5481 goto error;
5484 } 5482 }
5485 5483
@@ -5522,8 +5520,7 @@ pbm_load (struct frame *f, struct image *img)
5522#else 5520#else
5523 x_destroy_x_image (ximg); 5521 x_destroy_x_image (ximg);
5524#endif 5522#endif
5525 image_error ("Invalid pixel value in image "uLSQM"%s"uRSQM, 5523 image_error ("Invalid pixel value in image %qs", img->spec);
5526 img->spec);
5527 goto error; 5524 goto error;
5528 } 5525 }
5529 5526
@@ -5919,8 +5916,7 @@ png_load_body (struct frame *f, struct image *img, struct png_load_context *c)
5919 Lisp_Object file = x_find_image_fd (specified_file, &fd); 5916 Lisp_Object file = x_find_image_fd (specified_file, &fd);
5920 if (!STRINGP (file)) 5917 if (!STRINGP (file))
5921 { 5918 {
5922 image_error ("Cannot find image file "uLSQM"%s"uRSQM, 5919 image_error ("Cannot find image file %qs", specified_file);
5923 specified_file);
5924 return 0; 5920 return 0;
5925 } 5921 }
5926 5922
@@ -5928,7 +5924,7 @@ png_load_body (struct frame *f, struct image *img, struct png_load_context *c)
5928 fp = fdopen (fd, "rb"); 5924 fp = fdopen (fd, "rb");
5929 if (!fp) 5925 if (!fp)
5930 { 5926 {
5931 image_error ("Cannot open image file "uLSQM"%s"uRSQM, file); 5927 image_error ("Cannot open image file %qs", file);
5932 return 0; 5928 return 0;
5933 } 5929 }
5934 5930
@@ -5937,7 +5933,7 @@ png_load_body (struct frame *f, struct image *img, struct png_load_context *c)
5937 || png_sig_cmp (sig, 0, sizeof sig)) 5933 || png_sig_cmp (sig, 0, sizeof sig))
5938 { 5934 {
5939 fclose (fp); 5935 fclose (fp);
5940 image_error ("Not a PNG file: "uLSQM"%s"uRSQM, file); 5936 image_error ("Not a PNG file: %qs", file);
5941 return 0; 5937 return 0;
5942 } 5938 }
5943 } 5939 }
@@ -5945,7 +5941,7 @@ png_load_body (struct frame *f, struct image *img, struct png_load_context *c)
5945 { 5941 {
5946 if (!STRINGP (specified_data)) 5942 if (!STRINGP (specified_data))
5947 { 5943 {
5948 image_error ("Invalid image data "uLSQM"%s"uRSQM, specified_data); 5944 image_error ("Invalid image data %qs", specified_data);
5949 return 0; 5945 return 0;
5950 } 5946 }
5951 5947
@@ -5958,7 +5954,7 @@ png_load_body (struct frame *f, struct image *img, struct png_load_context *c)
5958 if (tbr.len < sizeof sig 5954 if (tbr.len < sizeof sig
5959 || png_sig_cmp (tbr.bytes, 0, sizeof sig)) 5955 || png_sig_cmp (tbr.bytes, 0, sizeof sig))
5960 { 5956 {
5961 image_error ("Not a PNG image: "uLSQM"%s"uRSQM, img->spec); 5957 image_error ("Not a PNG image: %qs", img->spec);
5962 return 0; 5958 return 0;
5963 } 5959 }
5964 5960
@@ -6026,7 +6022,7 @@ png_load_body (struct frame *f, struct image *img, struct png_load_context *c)
6026 if (! (width <= INT_MAX && height <= INT_MAX 6022 if (! (width <= INT_MAX && height <= INT_MAX
6027 && check_image_size (f, width, height))) 6023 && check_image_size (f, width, height)))
6028 { 6024 {
6029 image_error ("Invalid image size (see "uLSQM"max-image-size"uRSQM")"); 6025 image_size_error ();
6030 goto error; 6026 goto error;
6031 } 6027 }
6032 6028
@@ -6685,21 +6681,20 @@ jpeg_load_body (struct frame *f, struct image *img,
6685 Lisp_Object file = x_find_image_fd (specified_file, &fd); 6681 Lisp_Object file = x_find_image_fd (specified_file, &fd);
6686 if (!STRINGP (file)) 6682 if (!STRINGP (file))
6687 { 6683 {
6688 image_error ("Cannot find image file "uLSQM"%s"uRSQM, 6684 image_error ("Cannot find image file %qs", specified_file);
6689 specified_file);
6690 return 0; 6685 return 0;
6691 } 6686 }
6692 6687
6693 fp = fdopen (fd, "rb"); 6688 fp = fdopen (fd, "rb");
6694 if (fp == NULL) 6689 if (fp == NULL)
6695 { 6690 {
6696 image_error ("Cannot open "uLSQM"%s"uRSQM, file); 6691 image_error ("Cannot open %qs", file);
6697 return 0; 6692 return 0;
6698 } 6693 }
6699 } 6694 }
6700 else if (!STRINGP (specified_data)) 6695 else if (!STRINGP (specified_data))
6701 { 6696 {
6702 image_error ("Invalid image data "uLSQM"%s"uRSQM, specified_data); 6697 image_error ("Invalid image data %qs", specified_data);
6703 return 0; 6698 return 0;
6704 } 6699 }
6705 6700
@@ -6715,14 +6710,13 @@ jpeg_load_body (struct frame *f, struct image *img,
6715 { 6710 {
6716 char buf[JMSG_LENGTH_MAX]; 6711 char buf[JMSG_LENGTH_MAX];
6717 mgr->cinfo.err->format_message ((j_common_ptr) &mgr->cinfo, buf); 6712 mgr->cinfo.err->format_message ((j_common_ptr) &mgr->cinfo, buf);
6718 image_error ("Error reading JPEG image "uLSQM"%s"uRSQM": %s", 6713 image_error ("Error reading JPEG image %qs: %s",
6719 img->spec, build_string (buf)); 6714 img->spec, build_string (buf));
6720 break; 6715 break;
6721 } 6716 }
6722 6717
6723 case MY_JPEG_INVALID_IMAGE_SIZE: 6718 case MY_JPEG_INVALID_IMAGE_SIZE:
6724 image_error ("Invalid image size (see " 6719 image_size_error ();
6725 uLSQM"max-image-size"uRSQM")");
6726 break; 6720 break;
6727 6721
6728 case MY_JPEG_CANNOT_CREATE_X: 6722 case MY_JPEG_CANNOT_CREATE_X:
@@ -7202,8 +7196,7 @@ tiff_load (struct frame *f, struct image *img)
7202 Lisp_Object file = x_find_image_file (specified_file); 7196 Lisp_Object file = x_find_image_file (specified_file);
7203 if (!STRINGP (file)) 7197 if (!STRINGP (file))
7204 { 7198 {
7205 image_error ("Cannot find image file "uLSQM"%s"uRSQM, 7199 image_error ("Cannot find image file %qs", specified_file);
7206 specified_file);
7207 return 0; 7200 return 0;
7208 } 7201 }
7209 7202
@@ -7216,7 +7209,7 @@ tiff_load (struct frame *f, struct image *img)
7216 tiff = TIFFOpen (SSDATA (encoded_file), "r"); 7209 tiff = TIFFOpen (SSDATA (encoded_file), "r");
7217 if (tiff == NULL) 7210 if (tiff == NULL)
7218 { 7211 {
7219 image_error ("Cannot open "uLSQM"%s"uRSQM, file); 7212 image_error ("Cannot open %qs", file);
7220 return 0; 7213 return 0;
7221 } 7214 }
7222 } 7215 }
@@ -7224,7 +7217,7 @@ tiff_load (struct frame *f, struct image *img)
7224 { 7217 {
7225 if (!STRINGP (specified_data)) 7218 if (!STRINGP (specified_data))
7226 { 7219 {
7227 image_error ("Invalid image data "uLSQM"%s"uRSQM, specified_data); 7220 image_error ("Invalid image data %qs", specified_data);
7228 return 0; 7221 return 0;
7229 } 7222 }
7230 7223
@@ -7244,8 +7237,7 @@ tiff_load (struct frame *f, struct image *img)
7244 7237
7245 if (!tiff) 7238 if (!tiff)
7246 { 7239 {
7247 image_error ("Cannot open memory source for "uLSQM"%s"uRSQM, 7240 image_error ("Cannot open memory source for %qs", img->spec);
7248 img->spec);
7249 return 0; 7241 return 0;
7250 } 7242 }
7251 } 7243 }
@@ -7257,9 +7249,8 @@ tiff_load (struct frame *f, struct image *img)
7257 if (! (TYPE_MINIMUM (tdir_t) <= ino && ino <= TYPE_MAXIMUM (tdir_t) 7249 if (! (TYPE_MINIMUM (tdir_t) <= ino && ino <= TYPE_MAXIMUM (tdir_t)
7258 && TIFFSetDirectory (tiff, ino))) 7250 && TIFFSetDirectory (tiff, ino)))
7259 { 7251 {
7260 image_error 7252 image_error ("Invalid image number %qs in image %qs",
7261 ("Invalid image number "uLSQM"%s"uRSQM" in image "uLSQM"%s"uRSQM, 7253 image, img->spec);
7262 image, img->spec);
7263 TIFFClose (tiff); 7254 TIFFClose (tiff);
7264 return 0; 7255 return 0;
7265 } 7256 }
@@ -7272,7 +7263,7 @@ tiff_load (struct frame *f, struct image *img)
7272 7263
7273 if (!check_image_size (f, width, height)) 7264 if (!check_image_size (f, width, height))
7274 { 7265 {
7275 image_error ("Invalid image size (see "uLSQM"max-image-size"uRSQM")"); 7266 image_size_error ();
7276 TIFFClose (tiff); 7267 TIFFClose (tiff);
7277 return 0; 7268 return 0;
7278 } 7269 }
@@ -7302,7 +7293,7 @@ tiff_load (struct frame *f, struct image *img)
7302 TIFFClose (tiff); 7293 TIFFClose (tiff);
7303 if (!rc) 7294 if (!rc)
7304 { 7295 {
7305 image_error ("Error reading TIFF image "uLSQM"%s"uRSQM, img->spec); 7296 image_error ("Error reading TIFF image %qs", img->spec);
7306 xfree (buf); 7297 xfree (buf);
7307 return 0; 7298 return 0;
7308 } 7299 }
@@ -7638,8 +7629,7 @@ gif_load (struct frame *f, struct image *img)
7638 Lisp_Object file = x_find_image_file (specified_file); 7629 Lisp_Object file = x_find_image_file (specified_file);
7639 if (!STRINGP (file)) 7630 if (!STRINGP (file))
7640 { 7631 {
7641 image_error ("Cannot find image file "uLSQM"%s"uRSQM, 7632 image_error ("Cannot find image file %qs", specified_file);
7642 specified_file);
7643 return 0; 7633 return 0;
7644 } 7634 }
7645 7635
@@ -7653,14 +7643,14 @@ gif_load (struct frame *f, struct image *img)
7653 gif = DGifOpenFileName (SSDATA (encoded_file)); 7643 gif = DGifOpenFileName (SSDATA (encoded_file));
7654 if (gif == NULL) 7644 if (gif == NULL)
7655 { 7645 {
7656 image_error ("Cannot open "uLSQM"%s"uRSQM, file); 7646 image_error ("Cannot open %qs", file);
7657 return 0; 7647 return 0;
7658 } 7648 }
7659#else 7649#else
7660 gif = DGifOpenFileName (SSDATA (encoded_file), &gif_err); 7650 gif = DGifOpenFileName (SSDATA (encoded_file), &gif_err);
7661 if (gif == NULL) 7651 if (gif == NULL)
7662 { 7652 {
7663 image_error ("Cannot open "uLSQM"%s"uRSQM": %s", 7653 image_error ("Cannot open %qs: %s",
7664 file, build_string (GifErrorString (gif_err))); 7654 file, build_string (GifErrorString (gif_err)));
7665 return 0; 7655 return 0;
7666 } 7656 }
@@ -7670,7 +7660,7 @@ gif_load (struct frame *f, struct image *img)
7670 { 7660 {
7671 if (!STRINGP (specified_data)) 7661 if (!STRINGP (specified_data))
7672 { 7662 {
7673 image_error ("Invalid image data "uLSQM"%s"uRSQM, specified_data); 7663 image_error ("Invalid image data %qs", specified_data);
7674 return 0; 7664 return 0;
7675 } 7665 }
7676 7666
@@ -7684,14 +7674,14 @@ gif_load (struct frame *f, struct image *img)
7684 gif = DGifOpen (&memsrc, gif_read_from_memory); 7674 gif = DGifOpen (&memsrc, gif_read_from_memory);
7685 if (!gif) 7675 if (!gif)
7686 { 7676 {
7687 image_error ("Cannot open memory source "uLSQM"%s"uRSQM, img->spec); 7677 image_error ("Cannot open memory source %qs", img->spec);
7688 return 0; 7678 return 0;
7689 } 7679 }
7690#else 7680#else
7691 gif = DGifOpen (&memsrc, gif_read_from_memory, &gif_err); 7681 gif = DGifOpen (&memsrc, gif_read_from_memory, &gif_err);
7692 if (!gif) 7682 if (!gif)
7693 { 7683 {
7694 image_error ("Cannot open memory source "uLSQM"%s"uRSQM": %s", 7684 image_error ("Cannot open memory source %qs: %s",
7695 img->spec, build_string (GifErrorString (gif_err))); 7685 img->spec, build_string (GifErrorString (gif_err)));
7696 return 0; 7686 return 0;
7697 } 7687 }
@@ -7701,7 +7691,7 @@ gif_load (struct frame *f, struct image *img)
7701 /* Before reading entire contents, check the declared image size. */ 7691 /* Before reading entire contents, check the declared image size. */
7702 if (!check_image_size (f, gif->SWidth, gif->SHeight)) 7692 if (!check_image_size (f, gif->SWidth, gif->SHeight))
7703 { 7693 {
7704 image_error ("Invalid image size (see "uLSQM"max-image-size"uRSQM")"); 7694 image_size_error ();
7705 gif_close (gif, NULL); 7695 gif_close (gif, NULL);
7706 return 0; 7696 return 0;
7707 } 7697 }
@@ -7710,7 +7700,7 @@ gif_load (struct frame *f, struct image *img)
7710 rc = DGifSlurp (gif); 7700 rc = DGifSlurp (gif);
7711 if (rc == GIF_ERROR || gif->ImageCount <= 0) 7701 if (rc == GIF_ERROR || gif->ImageCount <= 0)
7712 { 7702 {
7713 image_error ("Error reading "uLSQM"%s"uRSQM, img->spec); 7703 image_error ("Error reading %qs", img->spec);
7714 gif_close (gif, NULL); 7704 gif_close (gif, NULL);
7715 return 0; 7705 return 0;
7716 } 7706 }
@@ -7721,9 +7711,8 @@ gif_load (struct frame *f, struct image *img)
7721 idx = INTEGERP (image_number) ? XFASTINT (image_number) : 0; 7711 idx = INTEGERP (image_number) ? XFASTINT (image_number) : 0;
7722 if (idx < 0 || idx >= gif->ImageCount) 7712 if (idx < 0 || idx >= gif->ImageCount)
7723 { 7713 {
7724 image_error 7714 image_error ("Invalid image number %qs in image %qs",
7725 ("Invalid image number "uLSQM"%s"uRSQM" in image "uLSQM"%s"uRSQM, 7715 image_number, img->spec);
7726 image_number, img->spec);
7727 gif_close (gif, NULL); 7716 gif_close (gif, NULL);
7728 return 0; 7717 return 0;
7729 } 7718 }
@@ -7741,7 +7730,7 @@ gif_load (struct frame *f, struct image *img)
7741 7730
7742 if (!check_image_size (f, width, height)) 7731 if (!check_image_size (f, width, height))
7743 { 7732 {
7744 image_error ("Invalid image size (see "uLSQM"max-image-size"uRSQM")"); 7733 image_size_error ();
7745 gif_close (gif, NULL); 7734 gif_close (gif, NULL);
7746 return 0; 7735 return 0;
7747 } 7736 }
@@ -7995,10 +7984,10 @@ gif_load (struct frame *f, struct image *img)
7995 char *error_text = GifErrorString (gif_err); 7984 char *error_text = GifErrorString (gif_err);
7996 7985
7997 if (error_text) 7986 if (error_text)
7998 image_error ("Error closing "uLSQM"%s"uRSQM": %s", 7987 image_error ("Error closing %qs: %s",
7999 img->spec, build_string (error_text)); 7988 img->spec, build_string (error_text));
8000#else 7989#else
8001 image_error ("Error closing "uLSQM"%s"uRSQM, img->spec); 7990 image_error ("Error closing %qs", img->spec);
8002#endif 7991#endif
8003 } 7992 }
8004 7993
@@ -8539,9 +8528,7 @@ imagemagick_load_image (struct frame *f, struct image *img,
8539 8528
8540 if (ino < 0 || ino >= MagickGetNumberImages (image_wand)) 8529 if (ino < 0 || ino >= MagickGetNumberImages (image_wand))
8541 { 8530 {
8542 image_error 8531 image_error ("Invalid image number %qs in image %qs", image, img->spec);
8543 ("Invalid image number "uLSQM"%s"uRSQM" in image "uLSQM"%s"uRSQM,
8544 image, img->spec);
8545 DestroyMagickWand (image_wand); 8532 DestroyMagickWand (image_wand);
8546 return 0; 8533 return 0;
8547 } 8534 }
@@ -8675,7 +8662,7 @@ imagemagick_load_image (struct frame *f, struct image *img,
8675 if (! (image_width <= INT_MAX && image_height <= INT_MAX 8662 if (! (image_width <= INT_MAX && image_height <= INT_MAX
8676 && check_image_size (f, image_width, image_height))) 8663 && check_image_size (f, image_width, image_height)))
8677 { 8664 {
8678 image_error ("Invalid image size (see "uLSQM"max-image-size"uRSQM")"); 8665 image_size_error ();
8679 goto imagemagick_error; 8666 goto imagemagick_error;
8680 } 8667 }
8681 8668
@@ -8810,7 +8797,7 @@ imagemagick_load_image (struct frame *f, struct image *img,
8810 8797
8811 MagickWandTerminus (); 8798 MagickWandTerminus ();
8812 /* TODO more cleanup. */ 8799 /* TODO more cleanup. */
8813 image_error ("Error parsing IMAGEMAGICK image "uLSQM"%s"uRSQM, img->spec); 8800 image_error ("Error parsing IMAGEMAGICK image %qs", img->spec);
8814 return 0; 8801 return 0;
8815} 8802}
8816 8803
@@ -8832,7 +8819,7 @@ imagemagick_load (struct frame *f, struct image *img)
8832 Lisp_Object file = x_find_image_file (file_name); 8819 Lisp_Object file = x_find_image_file (file_name);
8833 if (!STRINGP (file)) 8820 if (!STRINGP (file))
8834 { 8821 {
8835 image_error ("Cannot find image file "uLSQM"%s"uRSQM, file_name); 8822 image_error ("Cannot find image file %qs", file_name);
8836 return 0; 8823 return 0;
8837 } 8824 }
8838 file = ENCODE_FILE (file); 8825 file = ENCODE_FILE (file);
@@ -8850,7 +8837,7 @@ imagemagick_load (struct frame *f, struct image *img)
8850 data = image_spec_value (img->spec, QCdata, NULL); 8837 data = image_spec_value (img->spec, QCdata, NULL);
8851 if (!STRINGP (data)) 8838 if (!STRINGP (data))
8852 { 8839 {
8853 image_error ("Invalid image data "uLSQM"%s"uRSQM, data); 8840 image_error ("Invalid image data %qs", data);
8854 return 0; 8841 return 0;
8855 } 8842 }
8856 success_p = imagemagick_load_image (f, img, SDATA (data), 8843 success_p = imagemagick_load_image (f, img, SDATA (data),
@@ -9111,7 +9098,7 @@ svg_load (struct frame *f, struct image *img)
9111 Lisp_Object file = x_find_image_fd (file_name, &fd); 9098 Lisp_Object file = x_find_image_fd (file_name, &fd);
9112 if (!STRINGP (file)) 9099 if (!STRINGP (file))
9113 { 9100 {
9114 image_error ("Cannot find image file "uLSQM"%s"uRSQM, file_name); 9101 image_error ("Cannot find image file %qs", file_name);
9115 return 0; 9102 return 0;
9116 } 9103 }
9117 9104
@@ -9120,7 +9107,7 @@ svg_load (struct frame *f, struct image *img)
9120 unsigned char *contents = slurp_file (fd, &size); 9107 unsigned char *contents = slurp_file (fd, &size);
9121 if (contents == NULL) 9108 if (contents == NULL)
9122 { 9109 {
9123 image_error ("Error loading SVG image "uLSQM"%s"uRSQM, file); 9110 image_error ("Error loading SVG image %qs", file);
9124 return 0; 9111 return 0;
9125 } 9112 }
9126 /* If the file was slurped into memory properly, parse it. */ 9113 /* If the file was slurped into memory properly, parse it. */
@@ -9137,7 +9124,7 @@ svg_load (struct frame *f, struct image *img)
9137 data = image_spec_value (img->spec, QCdata, NULL); 9124 data = image_spec_value (img->spec, QCdata, NULL);
9138 if (!STRINGP (data)) 9125 if (!STRINGP (data))
9139 { 9126 {
9140 image_error ("Invalid image data "uLSQM"%s"uRSQM, data); 9127 image_error ("Invalid image data %qs", data);
9141 return 0; 9128 return 0;
9142 } 9129 }
9143 original_filename = BVAR (current_buffer, filename); 9130 original_filename = BVAR (current_buffer, filename);
@@ -9204,7 +9191,7 @@ svg_load_image (struct frame *f, /* Pointer to emacs frame structure. *
9204 rsvg_handle_get_dimensions (rsvg_handle, &dimension_data); 9191 rsvg_handle_get_dimensions (rsvg_handle, &dimension_data);
9205 if (! check_image_size (f, dimension_data.width, dimension_data.height)) 9192 if (! check_image_size (f, dimension_data.width, dimension_data.height))
9206 { 9193 {
9207 image_error ("Invalid image size (see "uLSQM"max-image-size"uRSQM")"); 9194 image_size_error ();
9208 goto rsvg_error; 9195 goto rsvg_error;
9209 } 9196 }
9210 9197
@@ -9336,7 +9323,7 @@ svg_load_image (struct frame *f, /* Pointer to emacs frame structure. *
9336 g_object_unref (rsvg_handle); 9323 g_object_unref (rsvg_handle);
9337 /* FIXME: Use error->message so the user knows what is the actual 9324 /* FIXME: Use error->message so the user knows what is the actual
9338 problem with the image. */ 9325 problem with the image. */
9339 image_error ("Error parsing SVG image "uLSQM"%s"uRSQM, img->spec); 9326 image_error ("Error parsing SVG image %qs", img->spec);
9340 g_error_free (err); 9327 g_error_free (err);
9341 return 0; 9328 return 0;
9342} 9329}
@@ -9489,7 +9476,7 @@ gs_load (struct frame *f, struct image *img)
9489 if (! (in_width <= INT_MAX && in_height <= INT_MAX 9476 if (! (in_width <= INT_MAX && in_height <= INT_MAX
9490 && check_image_size (f, in_width, in_height))) 9477 && check_image_size (f, in_width, in_height)))
9491 { 9478 {
9492 image_error ("Invalid image size (see "uLSQM"max-image-size"uRSQM")"); 9479 image_size_error ();
9493 return 0; 9480 return 0;
9494 } 9481 }
9495 img->width = in_width; 9482 img->width = in_width;
@@ -9510,7 +9497,7 @@ gs_load (struct frame *f, struct image *img)
9510 9497
9511 if (!img->pixmap) 9498 if (!img->pixmap)
9512 { 9499 {
9513 image_error ("Unable to create pixmap for "uLSQM"%s"uRSQM, img->spec); 9500 image_error ("Unable to create pixmap for %qs" , img->spec);
9514 return 0; 9501 return 0;
9515 } 9502 }
9516 9503
@@ -9622,8 +9609,7 @@ x_kill_gs_process (Pixmap pixmap, struct frame *f)
9622#endif 9609#endif
9623 } 9610 }
9624 else 9611 else
9625 image_error (("Cannot get X image of "uLSQM"%s"uRSQM";" 9612 image_error ("Cannot get X image of %qs; colors will not be freed",
9626 " colors will not be freed"),
9627 img->spec); 9613 img->spec);
9628 9614
9629 unblock_input (); 9615 unblock_input ();
diff --git a/src/lread.c b/src/lread.c
index 77a62118a39..c342218c532 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -947,8 +947,7 @@ load_warn_old_style_backquotes (Lisp_Object file)
947{ 947{
948 if (!NILP (Vold_style_backquotes)) 948 if (!NILP (Vold_style_backquotes))
949 { 949 {
950 Lisp_Object format = build_string ("Loading "uLSQM"%s"uRSQM 950 AUTO_STRING (format, "Loading %qs: old-style backquotes detected!");
951 ": old-style backquotes detected!");
952 CALLN (Fmessage, format, file); 951 CALLN (Fmessage, format, file);
953 } 952 }
954} 953}
diff --git a/src/syntax.c b/src/syntax.c
index d543a5f9823..30560affdf0 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -1333,10 +1333,11 @@ DEFUN ("internal-describe-syntax-value", Finternal_describe_syntax_value,
1333 insert_string (" (nestable)"); 1333 insert_string (" (nestable)");
1334 1334
1335 if (prefix) 1335 if (prefix)
1336 insert1 (CALLN (Fformat, 1336 {
1337 (build_string 1337 AUTO_STRING (prefixdoc,
1338 (",\n\t is a prefix character for " 1338 ",\n\t is a prefix character for `backward-prefix-chars'");
1339 uLSQM"backward-prefix-chars"uRSQM)))); 1339 insert1 (Fsubstitute_command_keys (prefixdoc));
1340 }
1340 1341
1341 return syntax; 1342 return syntax;
1342} 1343}
diff --git a/src/xdisp.c b/src/xdisp.c
index 88e6c8d1613..8be74977b43 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -9826,16 +9826,18 @@ add_to_log (const char *format, ...)
9826void 9826void
9827vadd_to_log (char const *format, va_list ap) 9827vadd_to_log (char const *format, va_list ap)
9828{ 9828{
9829 ptrdiff_t nargs = 1 + format_nargs (format); 9829 ptrdiff_t form_nargs = format_nargs (format);
9830 ptrdiff_t nargs = 1 + form_nargs;
9830 Lisp_Object args[10]; 9831 Lisp_Object args[10];
9831 eassert (nargs <= ARRAYELTS (args)); 9832 eassert (nargs <= ARRAYELTS (args));
9832 args[0] = build_string (format); 9833 AUTO_STRING (args0, format);
9834 args[0] = args0;
9833 for (ptrdiff_t i = 1; i <= nargs; i++) 9835 for (ptrdiff_t i = 1; i <= nargs; i++)
9834 args[i] = va_arg (ap, Lisp_Object); 9836 args[i] = va_arg (ap, Lisp_Object);
9835 Lisp_Object msg = Qnil; 9837 Lisp_Object msg = Qnil;
9836 struct gcpro gcpro1, gcpro2; 9838 struct gcpro gcpro1, gcpro2;
9837 GCPRO2 (args, msg); 9839 GCPRO2 (args[1], msg);
9838 gcpro1.nvars = nargs; 9840 gcpro1.nvars = form_nargs;
9839 msg = Fformat (nargs, args); 9841 msg = Fformat (nargs, args);
9840 9842
9841 ptrdiff_t len = SBYTES (msg) + 1; 9843 ptrdiff_t len = SBYTES (msg) + 1;
diff --git a/src/xfaces.c b/src/xfaces.c
index d519578198b..b599e6af715 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -797,7 +797,7 @@ load_pixmap (struct frame *f, Lisp_Object name)
797 797
798 if (bitmap_id < 0) 798 if (bitmap_id < 0)
799 { 799 {
800 add_to_log ("Invalid or undefined bitmap "uLSQM"%s"uRSQM, name); 800 add_to_log ("Invalid or undefined bitmap %qs", name);
801 bitmap_id = 0; 801 bitmap_id = 0;
802 } 802 }
803 else 803 else
diff --git a/src/xselect.c b/src/xselect.c
index b54ddd83237..d4d4dc04b8d 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -2147,11 +2147,10 @@ x_clipboard_manager_save (Lisp_Object frame)
2147static Lisp_Object 2147static Lisp_Object
2148x_clipboard_manager_error_1 (Lisp_Object err) 2148x_clipboard_manager_error_1 (Lisp_Object err)
2149{ 2149{
2150 Lisp_Object format 2150 AUTO_STRING (format, "X clipboard manager error: %s\n\
2151 = build_string ("X clipboard manager error: %s\n" 2151If the problem persists, set %qs to nil.");
2152 "If the problem persists, set " 2152 AUTO_STRING (varname, "x-select-enable-clipboard-manager");
2153 uLSQM"x-select-enable-clipboard-manager"uRSQM" to nil."); 2153 CALLN (Fmessage, format, CAR (CDR (err)), varname);
2154 CALLN (Fmessage, format, CAR (CDR (err)));
2155 return Qnil; 2154 return Qnil;
2156} 2155}
2157 2156
@@ -2161,8 +2160,8 @@ static Lisp_Object
2161x_clipboard_manager_error_2 (Lisp_Object err) 2160x_clipboard_manager_error_2 (Lisp_Object err)
2162{ 2161{
2163 fprintf (stderr, "Error saving to X clipboard manager.\n\ 2162 fprintf (stderr, "Error saving to X clipboard manager.\n\
2164If the problem persists, set `x-select-enable-clipboard-manager' \ 2163If the problem persists, set '%s' \
2165to nil.\n"); 2164to nil.\n", "x-select-enable-clipboard-manager");
2166 return Qnil; 2165 return Qnil;
2167} 2166}
2168 2167