aboutsummaryrefslogtreecommitdiffstats
path: root/src/image.c
diff options
context:
space:
mode:
authorDmitry Antipov2012-06-28 11:50:27 +0400
committerDmitry Antipov2012-06-28 11:50:27 +0400
commita54e2c050b9cf161cbccc3dd4628f8ef6b64f519 (patch)
tree447eb906b698dee37a17779ea15f448079b8f54b /src/image.c
parent1c9bd87017e4b5f7f56e734277ff6e0a0ebb51d6 (diff)
downloademacs-a54e2c050b9cf161cbccc3dd4628f8ef6b64f519.tar.gz
emacs-a54e2c050b9cf161cbccc3dd4628f8ef6b64f519.zip
Generalize run-time debugging checks.
* configure.in (ENABLE_CHECKING): Update comment. * src/dispextern.h (XASSERTS): Remove. * src/fontset.c (xassert): Remove. Convert from xassert to eassert. * src/alloc.c: Convert from xassert to eassert. * src/bidi.c: Likewise. * src/dispnew.c: Likewise. * src/fns.c: Likewise. * src/fringe.c: Likewise. * src/ftfont.c: Likewise. * src/gtkutil.c: Likewise. * src/image.c: Likewise. * src/keyboard.c: Likewise. * src/menu.c: Likewise. * src/process.c: Likewise. * src/scroll.c: Likewise. * src/sound.c: Likewise. * src/term.c: Likewise. * src/w32console.c: Likewise. * src/w32fns.c: Likewise. * src/w32term.c: Likewise. * src/window.c: Likewise. * src/xdisp.c: Likewise. * src/xfaces.c: Likewise. * src/xfns.c: Likewise. * src/xselect.c: Likewise. * src/xterm.c: Likewise.
Diffstat (limited to 'src/image.c')
-rw-r--r--src/image.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/src/image.c b/src/image.c
index cc0ddbb77e4..63bac9a8a79 100644
--- a/src/image.c
+++ b/src/image.c
@@ -522,7 +522,7 @@ x_create_bitmap_mask (struct frame *f, ptrdiff_t id)
522 } 522 }
523 } 523 }
524 524
525 xassert (interrupt_input_blocked); 525 eassert (interrupt_input_blocked);
526 gc = XCreateGC (FRAME_X_DISPLAY (f), mask, 0, NULL); 526 gc = XCreateGC (FRAME_X_DISPLAY (f), mask, 0, NULL);
527 XPutImage (FRAME_X_DISPLAY (f), mask, gc, mask_img, 0, 0, 0, 0, 527 XPutImage (FRAME_X_DISPLAY (f), mask, gc, mask_img, 0, 0, 0, 0,
528 width, height); 528 width, height);
@@ -874,7 +874,7 @@ image_spec_value (Lisp_Object spec, Lisp_Object key, int *found)
874{ 874{
875 Lisp_Object tail; 875 Lisp_Object tail;
876 876
877 xassert (valid_image_p (spec)); 877 eassert (valid_image_p (spec));
878 878
879 for (tail = XCDR (spec); 879 for (tail = XCDR (spec);
880 CONSP (tail) && CONSP (XCDR (tail)); 880 CONSP (tail) && CONSP (XCDR (tail));
@@ -986,11 +986,11 @@ make_image (Lisp_Object spec, EMACS_UINT hash)
986 struct image *img = (struct image *) xmalloc (sizeof *img); 986 struct image *img = (struct image *) xmalloc (sizeof *img);
987 Lisp_Object file = image_spec_value (spec, QCfile, NULL); 987 Lisp_Object file = image_spec_value (spec, QCfile, NULL);
988 988
989 xassert (valid_image_p (spec)); 989 eassert (valid_image_p (spec));
990 memset (img, 0, sizeof *img); 990 memset (img, 0, sizeof *img);
991 img->dependencies = NILP (file) ? Qnil : list1 (file); 991 img->dependencies = NILP (file) ? Qnil : list1 (file);
992 img->type = lookup_image_type (image_spec_value (spec, QCtype, NULL)); 992 img->type = lookup_image_type (image_spec_value (spec, QCtype, NULL));
993 xassert (img->type != NULL); 993 eassert (img->type != NULL);
994 img->spec = spec; 994 img->spec = spec;
995 img->lisp_data = Qnil; 995 img->lisp_data = Qnil;
996 img->ascent = DEFAULT_IMAGE_ASCENT; 996 img->ascent = DEFAULT_IMAGE_ASCENT;
@@ -1349,7 +1349,7 @@ x_alloc_image_color (struct frame *f, struct image *img, Lisp_Object color_name,
1349 XColor color; 1349 XColor color;
1350 unsigned long result; 1350 unsigned long result;
1351 1351
1352 xassert (STRINGP (color_name)); 1352 eassert (STRINGP (color_name));
1353 1353
1354 if (x_defined_color (f, SSDATA (color_name), &color, 1) 1354 if (x_defined_color (f, SSDATA (color_name), &color, 1)
1355 && img->ncolors < min (min (PTRDIFF_MAX, SIZE_MAX) / sizeof *img->colors, 1355 && img->ncolors < min (min (PTRDIFF_MAX, SIZE_MAX) / sizeof *img->colors,
@@ -1461,7 +1461,7 @@ free_image_cache (struct frame *f)
1461 ptrdiff_t i; 1461 ptrdiff_t i;
1462 1462
1463 /* Cache should not be referenced by any frame when freed. */ 1463 /* Cache should not be referenced by any frame when freed. */
1464 xassert (c->refcount == 0); 1464 eassert (c->refcount == 0);
1465 1465
1466 for (i = 0; i < c->used; ++i) 1466 for (i = 0; i < c->used; ++i)
1467 free_image (f, c->images[i]); 1467 free_image (f, c->images[i]);
@@ -1708,8 +1708,8 @@ lookup_image (struct frame *f, Lisp_Object spec)
1708 1708
1709 /* F must be a window-system frame, and SPEC must be a valid image 1709 /* F must be a window-system frame, and SPEC must be a valid image
1710 specification. */ 1710 specification. */
1711 xassert (FRAME_WINDOW_P (f)); 1711 eassert (FRAME_WINDOW_P (f));
1712 xassert (valid_image_p (spec)); 1712 eassert (valid_image_p (spec));
1713 1713
1714 /* Look up SPEC in the hash table of the image cache. */ 1714 /* Look up SPEC in the hash table of the image cache. */
1715 hash = sxhash (spec, 0); 1715 hash = sxhash (spec, 0);
@@ -1947,7 +1947,7 @@ x_create_x_image_and_pixmap (struct frame *f, int width, int height, int depth,
1947 Window window = FRAME_X_WINDOW (f); 1947 Window window = FRAME_X_WINDOW (f);
1948 Screen *screen = FRAME_X_SCREEN (f); 1948 Screen *screen = FRAME_X_SCREEN (f);
1949 1949
1950 xassert (interrupt_input_blocked); 1950 eassert (interrupt_input_blocked);
1951 1951
1952 if (depth <= 0) 1952 if (depth <= 0)
1953 depth = DefaultDepthOfScreen (screen); 1953 depth = DefaultDepthOfScreen (screen);
@@ -2085,7 +2085,7 @@ x_create_x_image_and_pixmap (struct frame *f, int width, int height, int depth,
2085static void 2085static void
2086x_destroy_x_image (XImagePtr ximg) 2086x_destroy_x_image (XImagePtr ximg)
2087{ 2087{
2088 xassert (interrupt_input_blocked); 2088 eassert (interrupt_input_blocked);
2089 if (ximg) 2089 if (ximg)
2090 { 2090 {
2091#ifdef HAVE_X_WINDOWS 2091#ifdef HAVE_X_WINDOWS
@@ -2114,7 +2114,7 @@ x_put_x_image (struct frame *f, XImagePtr ximg, Pixmap pixmap, int width, int he
2114#ifdef HAVE_X_WINDOWS 2114#ifdef HAVE_X_WINDOWS
2115 GC gc; 2115 GC gc;
2116 2116
2117 xassert (interrupt_input_blocked); 2117 eassert (interrupt_input_blocked);
2118 gc = XCreateGC (FRAME_X_DISPLAY (f), pixmap, 0, NULL); 2118 gc = XCreateGC (FRAME_X_DISPLAY (f), pixmap, 0, NULL);
2119 XPutImage (FRAME_X_DISPLAY (f), pixmap, gc, ximg, 0, 0, 0, 0, width, height); 2119 XPutImage (FRAME_X_DISPLAY (f), pixmap, gc, ximg, 0, 0, 0, 0, width, height);
2120 XFreeGC (FRAME_X_DISPLAY (f), gc); 2120 XFreeGC (FRAME_X_DISPLAY (f), gc);
@@ -2129,7 +2129,7 @@ x_put_x_image (struct frame *f, XImagePtr ximg, Pixmap pixmap, int width, int he
2129#endif /* HAVE_NTGUI */ 2129#endif /* HAVE_NTGUI */
2130 2130
2131#ifdef HAVE_NS 2131#ifdef HAVE_NS
2132 xassert (ximg == pixmap); 2132 eassert (ximg == pixmap);
2133 ns_retain_object (ximg); 2133 ns_retain_object (ximg);
2134#endif 2134#endif
2135} 2135}
@@ -2319,7 +2319,7 @@ xbm_image_p (Lisp_Object object)
2319 if (!parse_image_spec (object, kw, XBM_LAST, Qxbm)) 2319 if (!parse_image_spec (object, kw, XBM_LAST, Qxbm))
2320 return 0; 2320 return 0;
2321 2321
2322 xassert (EQ (kw[XBM_TYPE].value, Qxbm)); 2322 eassert (EQ (kw[XBM_TYPE].value, Qxbm));
2323 2323
2324 if (kw[XBM_FILE].count) 2324 if (kw[XBM_FILE].count)
2325 { 2325 {
@@ -2780,7 +2780,7 @@ xbm_load_image (struct frame *f, struct image *img, unsigned char *contents,
2780 int non_default_colors = 0; 2780 int non_default_colors = 0;
2781 Lisp_Object value; 2781 Lisp_Object value;
2782 2782
2783 xassert (img->width > 0 && img->height > 0); 2783 eassert (img->width > 0 && img->height > 0);
2784 2784
2785 /* Get foreground and background colors, maybe allocate colors. */ 2785 /* Get foreground and background colors, maybe allocate colors. */
2786 value = image_spec_value (img->spec, QCforeground, NULL); 2786 value = image_spec_value (img->spec, QCforeground, NULL);
@@ -2840,7 +2840,7 @@ xbm_load (struct frame *f, struct image *img)
2840 int success_p = 0; 2840 int success_p = 0;
2841 Lisp_Object file_name; 2841 Lisp_Object file_name;
2842 2842
2843 xassert (xbm_image_p (img->spec)); 2843 eassert (xbm_image_p (img->spec));
2844 2844
2845 /* If IMG->spec specifies a file name, create a non-file spec from it. */ 2845 /* If IMG->spec specifies a file name, create a non-file spec from it. */
2846 file_name = image_spec_value (img->spec, QCfile, NULL); 2846 file_name = image_spec_value (img->spec, QCfile, NULL);
@@ -2886,14 +2886,14 @@ xbm_load (struct frame *f, struct image *img)
2886 memcpy (fmt, xbm_format, sizeof fmt); 2886 memcpy (fmt, xbm_format, sizeof fmt);
2887 parsed_p = parse_image_spec (img->spec, fmt, XBM_LAST, Qxbm); 2887 parsed_p = parse_image_spec (img->spec, fmt, XBM_LAST, Qxbm);
2888 (void) parsed_p; 2888 (void) parsed_p;
2889 xassert (parsed_p); 2889 eassert (parsed_p);
2890 2890
2891 /* Get specified width, and height. */ 2891 /* Get specified width, and height. */
2892 if (!in_memory_file_p) 2892 if (!in_memory_file_p)
2893 { 2893 {
2894 img->width = XFASTINT (fmt[XBM_WIDTH].value); 2894 img->width = XFASTINT (fmt[XBM_WIDTH].value);
2895 img->height = XFASTINT (fmt[XBM_HEIGHT].value); 2895 img->height = XFASTINT (fmt[XBM_HEIGHT].value);
2896 xassert (img->width > 0 && img->height > 0); 2896 eassert (img->width > 0 && img->height > 0);
2897 if (!check_image_size (f, img->width, img->height)) 2897 if (!check_image_size (f, img->width, img->height))
2898 { 2898 {
2899 image_error ("Invalid image size (see `max-image-size')", 2899 image_error ("Invalid image size (see `max-image-size')",
@@ -3580,7 +3580,7 @@ xpm_load (struct frame *f, struct image *img)
3580 3580
3581 img->width = attrs.width; 3581 img->width = attrs.width;
3582 img->height = attrs.height; 3582 img->height = attrs.height;
3583 xassert (img->width > 0 && img->height > 0); 3583 eassert (img->width > 0 && img->height > 0);
3584 3584
3585 /* The call to XpmFreeAttributes below frees attrs.alloc_pixels. */ 3585 /* The call to XpmFreeAttributes below frees attrs.alloc_pixels. */
3586#ifdef HAVE_NTGUI 3586#ifdef HAVE_NTGUI
@@ -5551,7 +5551,7 @@ init_png_functions (Lisp_Object libraries)
5551static _Noreturn void 5551static _Noreturn void
5552my_png_error (png_struct *png_ptr, const char *msg) 5552my_png_error (png_struct *png_ptr, const char *msg)
5553{ 5553{
5554 xassert (png_ptr != NULL); 5554 eassert (png_ptr != NULL);
5555 /* Avoid compiler warning about deprecated direct access to 5555 /* Avoid compiler warning about deprecated direct access to
5556 png_ptr's fields in libpng versions 1.4.x. */ 5556 png_ptr's fields in libpng versions 1.4.x. */
5557 image_error ("PNG error: %s", build_string (msg), Qnil); 5557 image_error ("PNG error: %s", build_string (msg), Qnil);
@@ -5562,7 +5562,7 @@ my_png_error (png_struct *png_ptr, const char *msg)
5562static void 5562static void
5563my_png_warning (png_struct *png_ptr, const char *msg) 5563my_png_warning (png_struct *png_ptr, const char *msg)
5564{ 5564{
5565 xassert (png_ptr != NULL); 5565 eassert (png_ptr != NULL);
5566 image_error ("PNG warning: %s", build_string (msg), Qnil); 5566 image_error ("PNG warning: %s", build_string (msg), Qnil);
5567} 5567}
5568 5568
@@ -5832,7 +5832,7 @@ png_load (struct frame *f, struct image *img)
5832 images with alpha channel, i.e. RGBA. If conversions above were 5832 images with alpha channel, i.e. RGBA. If conversions above were
5833 sufficient we should only have 3 or 4 channels here. */ 5833 sufficient we should only have 3 or 4 channels here. */
5834 channels = fn_png_get_channels (png_ptr, info_ptr); 5834 channels = fn_png_get_channels (png_ptr, info_ptr);
5835 xassert (channels == 3 || channels == 4); 5835 eassert (channels == 3 || channels == 4);
5836 5836
5837 /* Number of bytes needed for one row of the image. */ 5837 /* Number of bytes needed for one row of the image. */
5838 row_bytes = fn_png_get_rowbytes (png_ptr, info_ptr); 5838 row_bytes = fn_png_get_rowbytes (png_ptr, info_ptr);
@@ -8540,7 +8540,7 @@ gs_load (struct frame *f, struct image *img)
8540 img->height = in_height; 8540 img->height = in_height;
8541 8541
8542 /* Create the pixmap. */ 8542 /* Create the pixmap. */
8543 xassert (img->pixmap == NO_PIXMAP); 8543 eassert (img->pixmap == NO_PIXMAP);
8544 8544
8545 if (x_check_image_size (0, img->width, img->height)) 8545 if (x_check_image_size (0, img->width, img->height))
8546 { 8546 {
@@ -8611,7 +8611,7 @@ x_kill_gs_process (Pixmap pixmap, struct frame *f)
8611 /* Kill the GS process. We should have found PIXMAP in the image 8611 /* Kill the GS process. We should have found PIXMAP in the image
8612 cache and its image should contain a process object. */ 8612 cache and its image should contain a process object. */
8613 img = c->images[i]; 8613 img = c->images[i];
8614 xassert (PROCESSP (img->lisp_data)); 8614 eassert (PROCESSP (img->lisp_data));
8615 Fkill_process (img->lisp_data, Qnil); 8615 Fkill_process (img->lisp_data, Qnil);
8616 img->lisp_data = Qnil; 8616 img->lisp_data = Qnil;
8617 8617