aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGerd Moellmann2000-09-11 19:54:11 +0000
committerGerd Moellmann2000-09-11 19:54:11 +0000
commit8ec8a5ec9e0f14936bf555aad26c54e033210250 (patch)
tree20f86d95fda9682cda261be1c9dce7b2564a1bc7 /src
parentcc0f95a474767a554832d03a23c3a9a7cba833e6 (diff)
downloademacs-8ec8a5ec9e0f14936bf555aad26c54e033210250.tar.gz
emacs-8ec8a5ec9e0f14936bf555aad26c54e033210250.zip
(png_load, jpeg_load): Declare some variables volatile
that might be clobbered by longjmp. (check_x_display_info, x_decode_color, create_frame_xic) (Fx_display_backing_store, Fx_display_visual_class) (x_build_heuristic_mask, pbm_scan_number): Avoid compiler warnings.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog7
-rw-r--r--src/xfns.c87
2 files changed, 63 insertions, 31 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 96eb512983a..324445f05a5 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,12 @@
12000-09-11 Gerd Moellmann <gerd@gnu.org> 12000-09-11 Gerd Moellmann <gerd@gnu.org>
2 2
3 * xfns.c (png_load, jpeg_load): Declare some variables volatile
4 that might be clobbered by longjmp.
5 (check_x_display_info, x_decode_color, create_frame_xic)
6 (Fx_display_backing_store, Fx_display_visual_class)
7 (x_build_heuristic_mask, pbm_scan_number): Avoid compiler
8 warnings.
9
3 * lread.c (init_lread): Set Vloads_in_progress to nil. 10 * lread.c (init_lread): Set Vloads_in_progress to nil.
4 (Fload): Show list of recursively loaded files, when signaling an 11 (Fload): Show list of recursively loaded files, when signaling an
5 error. 12 error.
diff --git a/src/xfns.c b/src/xfns.c
index ea7f3a06252..cd277a39e34 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -295,19 +295,21 @@ static struct x_display_info *
295check_x_display_info (frame) 295check_x_display_info (frame)
296 Lisp_Object frame; 296 Lisp_Object frame;
297{ 297{
298 struct x_display_info *dpyinfo = NULL;
299
298 if (NILP (frame)) 300 if (NILP (frame))
299 { 301 {
300 struct frame *sf = XFRAME (selected_frame); 302 struct frame *sf = XFRAME (selected_frame);
301 303
302 if (FRAME_X_P (sf) && FRAME_LIVE_P (sf)) 304 if (FRAME_X_P (sf) && FRAME_LIVE_P (sf))
303 return FRAME_X_DISPLAY_INFO (sf); 305 dpyinfo = FRAME_X_DISPLAY_INFO (sf);
304 else if (x_display_list != 0) 306 else if (x_display_list != 0)
305 return x_display_list; 307 dpyinfo = x_display_list;
306 else 308 else
307 error ("X windows are not in use or not initialized"); 309 error ("X windows are not in use or not initialized");
308 } 310 }
309 else if (STRINGP (frame)) 311 else if (STRINGP (frame))
310 return x_display_info_for_name (frame); 312 dpyinfo = x_display_info_for_name (frame);
311 else 313 else
312 { 314 {
313 FRAME_PTR f; 315 FRAME_PTR f;
@@ -316,8 +318,10 @@ check_x_display_info (frame)
316 f = XFRAME (frame); 318 f = XFRAME (frame);
317 if (! FRAME_X_P (f)) 319 if (! FRAME_X_P (f))
318 error ("Non-X frame used"); 320 error ("Non-X frame used");
319 return FRAME_X_DISPLAY_INFO (f); 321 dpyinfo = FRAME_X_DISPLAY_INFO (f);
320 } 322 }
323
324 return dpyinfo;
321} 325}
322 326
323 327
@@ -1288,8 +1292,8 @@ x_decode_color (f, color_name, mono_color)
1288 if (x_defined_color (f, XSTRING (color_name)->data, &cdef, 1)) 1292 if (x_defined_color (f, XSTRING (color_name)->data, &cdef, 1))
1289 return cdef.pixel; 1293 return cdef.pixel;
1290 1294
1291 Fsignal (Qerror, Fcons (build_string ("undefined color"), 1295 return Fsignal (Qerror, Fcons (build_string ("Undefined color"),
1292 Fcons (color_name, Qnil))); 1296 Fcons (color_name, Qnil)));
1293} 1297}
1294 1298
1295 1299
@@ -3264,7 +3268,7 @@ create_frame_xic (f)
3264 else 3268 else
3265 { 3269 {
3266 int len = strlen (ascii_font) + 1; 3270 int len = strlen (ascii_font) + 1;
3267 char *p1; 3271 char *p1 = NULL;
3268 3272
3269 for (i = 0, p = ascii_font; i < 8; p++) 3273 for (i = 0, p = ascii_font; i < 8; p++)
3270 { 3274 {
@@ -4581,21 +4585,28 @@ If omitted or nil, that stands for the selected frame's display.")
4581 Lisp_Object display; 4585 Lisp_Object display;
4582{ 4586{
4583 struct x_display_info *dpyinfo = check_x_display_info (display); 4587 struct x_display_info *dpyinfo = check_x_display_info (display);
4588 Lisp_Object result;
4584 4589
4585 switch (DoesBackingStore (dpyinfo->screen)) 4590 switch (DoesBackingStore (dpyinfo->screen))
4586 { 4591 {
4587 case Always: 4592 case Always:
4588 return intern ("always"); 4593 result = intern ("always");
4594 break;
4589 4595
4590 case WhenMapped: 4596 case WhenMapped:
4591 return intern ("when-mapped"); 4597 result = intern ("when-mapped");
4598 break;
4592 4599
4593 case NotUseful: 4600 case NotUseful:
4594 return intern ("not-useful"); 4601 result = intern ("not-useful");
4602 break;
4595 4603
4596 default: 4604 default:
4597 error ("Strange value for BackingStore parameter of screen"); 4605 error ("Strange value for BackingStore parameter of screen");
4606 result = Qnil;
4598 } 4607 }
4608
4609 return result;
4599} 4610}
4600 4611
4601DEFUN ("x-display-visual-class", Fx_display_visual_class, 4612DEFUN ("x-display-visual-class", Fx_display_visual_class,
@@ -4610,18 +4621,34 @@ If omitted or nil, that stands for the selected frame's display.")
4610 Lisp_Object display; 4621 Lisp_Object display;
4611{ 4622{
4612 struct x_display_info *dpyinfo = check_x_display_info (display); 4623 struct x_display_info *dpyinfo = check_x_display_info (display);
4624 Lisp_Object result;
4613 4625
4614 switch (dpyinfo->visual->class) 4626 switch (dpyinfo->visual->class)
4615 { 4627 {
4616 case StaticGray: return (intern ("static-gray")); 4628 case StaticGray:
4617 case GrayScale: return (intern ("gray-scale")); 4629 result = intern ("static-gray");
4618 case StaticColor: return (intern ("static-color")); 4630 break;
4619 case PseudoColor: return (intern ("pseudo-color")); 4631 case GrayScale:
4620 case TrueColor: return (intern ("true-color")); 4632 result = intern ("gray-scale");
4621 case DirectColor: return (intern ("direct-color")); 4633 break;
4634 case StaticColor:
4635 result = intern ("static-color");
4636 break;
4637 case PseudoColor:
4638 result = intern ("pseudo-color");
4639 break;
4640 case TrueColor:
4641 result = intern ("true-color");
4642 break;
4643 case DirectColor:
4644 result = intern ("direct-color");
4645 break;
4622 default: 4646 default:
4623 error ("Display has an unknown visual class"); 4647 error ("Display has an unknown visual class");
4648 result = Qnil;
4624 } 4649 }
4650
4651 return result;
4625} 4652}
4626 4653
4627DEFUN ("x-display-save-under", Fx_display_save_under, 4654DEFUN ("x-display-save-under", Fx_display_save_under,
@@ -7159,12 +7186,10 @@ x_laplace (f, img)
7159 7186
7160 for (x = 0; x < img->width - 2; ++x) 7187 for (x = 0; x < img->width - 2; ++x)
7161 { 7188 {
7162 int r = in[rowa][x].red + mv2 - in[rowb][x + 2].red; 7189 int r = 0xffff & (in[rowa][x].red + mv2 - in[rowb][x + 2].red);
7163 int g = in[rowa][x].green + mv2 - in[rowb][x + 2].green; 7190 int g = 0xffff & (in[rowa][x].green + mv2 - in[rowb][x + 2].green);
7164 int b = in[rowa][x].blue + mv2 - in[rowb][x + 2].blue; 7191 int b = 0xffff & (in[rowa][x].blue + mv2 - in[rowb][x + 2].blue);
7165 7192 out[x + 1] = lookup_rgb_color (f, r, g, b);
7166 out[x + 1] = lookup_rgb_color (f, r & 0xffff, g & 0xffff,
7167 b & 0xffff);
7168 } 7193 }
7169 7194
7170 x_laplace_write_row (f, out, img->width, oimg, out_y++); 7195 x_laplace_write_row (f, out, img->width, oimg, out_y++);
@@ -7208,7 +7233,7 @@ x_build_heuristic_mask (f, img, how)
7208 Display *dpy = FRAME_X_DISPLAY (f); 7233 Display *dpy = FRAME_X_DISPLAY (f);
7209 XImage *ximg, *mask_img; 7234 XImage *ximg, *mask_img;
7210 int x, y, rc, look_at_corners_p; 7235 int x, y, rc, look_at_corners_p;
7211 unsigned long bg; 7236 unsigned long bg = 0;
7212 7237
7213 BLOCK_INPUT; 7238 BLOCK_INPUT;
7214 7239
@@ -7381,7 +7406,7 @@ static int
7381pbm_scan_number (s, end) 7406pbm_scan_number (s, end)
7382 unsigned char **s, *end; 7407 unsigned char **s, *end;
7383{ 7408{
7384 int c, val = -1; 7409 int c = 0, val = -1;
7385 7410
7386 while (*s < end) 7411 while (*s < end)
7387 { 7412 {
@@ -7758,10 +7783,10 @@ png_load (f, img)
7758 struct gcpro gcpro1; 7783 struct gcpro gcpro1;
7759 png_struct *png_ptr = NULL; 7784 png_struct *png_ptr = NULL;
7760 png_info *info_ptr = NULL, *end_info = NULL; 7785 png_info *info_ptr = NULL, *end_info = NULL;
7761 FILE *fp = NULL; 7786 FILE *volatile fp = NULL;
7762 png_byte sig[8]; 7787 png_byte sig[8];
7763 png_byte *pixels = NULL; 7788 png_byte * volatile pixels = NULL;
7764 png_byte **rows = NULL; 7789 png_byte ** volatile rows = NULL;
7765 png_uint_32 width, height; 7790 png_uint_32 width, height;
7766 int bit_depth, color_type, interlace_type; 7791 int bit_depth, color_type, interlace_type;
7767 png_byte channels; 7792 png_byte channels;
@@ -8299,7 +8324,7 @@ jpeg_load (f, img)
8299 struct my_jpeg_error_mgr mgr; 8324 struct my_jpeg_error_mgr mgr;
8300 Lisp_Object file, specified_file; 8325 Lisp_Object file, specified_file;
8301 Lisp_Object specified_data; 8326 Lisp_Object specified_data;
8302 FILE *fp = NULL; 8327 FILE * volatile fp = NULL;
8303 JSAMPARRAY buffer; 8328 JSAMPARRAY buffer;
8304 int row_stride, x, y; 8329 int row_stride, x, y;
8305 XImage *ximg = NULL; 8330 XImage *ximg = NULL;
@@ -8351,7 +8376,7 @@ jpeg_load (f, img)
8351 8376
8352 /* Close the input file and destroy the JPEG object. */ 8377 /* Close the input file and destroy the JPEG object. */
8353 if (fp) 8378 if (fp)
8354 fclose (fp); 8379 fclose ((FILE *) fp);
8355 jpeg_destroy_decompress (&cinfo); 8380 jpeg_destroy_decompress (&cinfo);
8356 8381
8357 BLOCK_INPUT; 8382 BLOCK_INPUT;
@@ -8372,7 +8397,7 @@ jpeg_load (f, img)
8372 jpeg_create_decompress (&cinfo); 8397 jpeg_create_decompress (&cinfo);
8373 8398
8374 if (NILP (specified_data)) 8399 if (NILP (specified_data))
8375 jpeg_stdio_src (&cinfo, fp); 8400 jpeg_stdio_src (&cinfo, (FILE *) fp);
8376 else 8401 else
8377 jpeg_memory_src (&cinfo, XSTRING (specified_data)->data, 8402 jpeg_memory_src (&cinfo, XSTRING (specified_data)->data,
8378 STRING_BYTES (XSTRING (specified_data))); 8403 STRING_BYTES (XSTRING (specified_data)));
@@ -8448,7 +8473,7 @@ jpeg_load (f, img)
8448 jpeg_finish_decompress (&cinfo); 8473 jpeg_finish_decompress (&cinfo);
8449 jpeg_destroy_decompress (&cinfo); 8474 jpeg_destroy_decompress (&cinfo);
8450 if (fp) 8475 if (fp)
8451 fclose (fp); 8476 fclose ((FILE *) fp);
8452 8477
8453 /* Put the image into the pixmap. */ 8478 /* Put the image into the pixmap. */
8454 x_put_x_image (f, ximg, img->pixmap, width, height); 8479 x_put_x_image (f, ximg, img->pixmap, width, height);