aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog38
-rw-r--r--src/dispextern.h14
-rw-r--r--src/image.c386
-rw-r--r--src/indent.c65
-rw-r--r--src/indent.h6
-rw-r--r--src/lisp.h2
-rw-r--r--src/nsimage.m2
-rw-r--r--src/nsterm.h10
-rw-r--r--src/nsterm.m10
-rw-r--r--src/xfaces.c14
-rw-r--r--src/xfns.c12
-rw-r--r--src/xterm.c28
-rw-r--r--src/xterm.h10
13 files changed, 293 insertions, 304 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 56a9c0a17ce..500411da531 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,41 @@
12012-09-24 Paul Eggert <eggert@cs.ucla.edu>
2
3 image.c, indent.c: Use bool for booleans.
4 * dispextern.h (struct image_type): Members valid_p, load, init
5 now return bool, not int. All uses changed.
6 * image.c: Omit unnecessary static decls.
7 (x_create_bitmap_mask, x_build_heuristic_mask):
8 Return void, not int, since callers don't care about the return value.
9 (x_create_bitmap_mask, define_image_type, valid_image_p)
10 (struct image_keyword, parse_image_spec, image_spec_value)
11 (check_image_size, image_background)
12 (image_background_transparent, x_clear_image_1)
13 (postprocess_image, lookup_image, x_check_image_size)
14 (x_create_x_image_and_pixmap, xbm_image_p)
15 (Create_Pixmap_From_Bitmap_Data, xbm_read_bitmap_data)
16 (xbm_load_image, xbm_file_p, xbm_load, xpm_lookup_color)
17 (init_xpm_functions, xpm_valid_color_symbols_p, xpm_image_p)
18 (xpm_load, xpm_load_image, lookup_rgb_color, lookup_pixel_color)
19 (x_to_xcolors, x_build_heuristic_mask, pbm_image_p, pbm_load)
20 (png_image_p, init_png_functions, png_load_body, png_load)
21 (jpeg_image_p, init_jpeg_functions, jpeg_load_body, jpeg_load)
22 (tiff_image_p, init_tiff_functions, tiff_load, gif_image_p)
23 (init_gif_functions, gif_load, imagemagick_image_p)
24 (imagemagick_load_image, imagemagick_load, svg_image_p)
25 (init_svg_functions, svg_load, svg_load_image, gs_image_p)
26 (gs_load):
27 * nsimage.m (ns_load_image):
28 * nsterm.m (ns_defined_color):
29 * xfaces.c (tty_lookup_color, tty_defined_color, defined_color):
30 * xfns.c (x_defined_color):
31 * xterm.c (x_alloc_lighter_color_for_widget)
32 (x_alloc_nearest_color_1, x_alloc_nearest_color)
33 (x_alloc_lighter_color):
34 * indent.c (disptab_matches_widthtab, current_column)
35 (scan_for_column, string_display_width, indented_beyond_p)
36 (compute_motion, vmotion, Fvertical_motion):
37 Use bool for booleans.
38
12012-09-24 Chong Yidong <cyd@gnu.org> 392012-09-24 Chong Yidong <cyd@gnu.org>
2 40
3 * chartab.c (Fset_char_table_default): Obsolete function removed. 41 * chartab.c (Fset_char_table_default): Obsolete function removed.
diff --git a/src/dispextern.h b/src/dispextern.h
index bb894520a4d..3c42d7abb9d 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -2757,19 +2757,19 @@ struct image_type
2757 Lisp_Object *type; 2757 Lisp_Object *type;
2758 2758
2759 /* Check that SPEC is a valid image specification for the given 2759 /* Check that SPEC is a valid image specification for the given
2760 image type. Value is non-zero if SPEC is valid. */ 2760 image type. Value is true if SPEC is valid. */
2761 int (* valid_p) (Lisp_Object spec); 2761 bool (* valid_p) (Lisp_Object spec);
2762 2762
2763 /* Load IMG which is used on frame F from information contained in 2763 /* Load IMG which is used on frame F from information contained in
2764 IMG->spec. Value is non-zero if successful. */ 2764 IMG->spec. Value is true if successful. */
2765 int (* load) (struct frame *f, struct image *img); 2765 bool (* load) (struct frame *f, struct image *img);
2766 2766
2767 /* Free resources of image IMG which is used on frame F. */ 2767 /* Free resources of image IMG which is used on frame F. */
2768 void (* free) (struct frame *f, struct image *img); 2768 void (* free) (struct frame *f, struct image *img);
2769 2769
2770 /* Initialization function (used for dynamic loading of image 2770 /* Initialization function (used for dynamic loading of image
2771 libraries on Windows), or NULL if none. */ 2771 libraries on Windows), or NULL if none. */
2772 int (* init) (void); 2772 bool (* init) (void);
2773 2773
2774 /* Next in list of all supported image types. */ 2774 /* Next in list of all supported image types. */
2775 struct image_type *next; 2775 struct image_type *next;
@@ -3169,7 +3169,7 @@ extern ptrdiff_t x_create_bitmap_from_xpm_data (struct frame *, const char **);
3169extern void x_destroy_bitmap (struct frame *, ptrdiff_t); 3169extern void x_destroy_bitmap (struct frame *, ptrdiff_t);
3170#endif 3170#endif
3171extern void x_destroy_all_bitmaps (Display_Info *); 3171extern void x_destroy_all_bitmaps (Display_Info *);
3172extern int x_create_bitmap_mask (struct frame *, ptrdiff_t); 3172extern void x_create_bitmap_mask (struct frame *, ptrdiff_t);
3173extern Lisp_Object x_find_image_file (Lisp_Object); 3173extern Lisp_Object x_find_image_file (Lisp_Object);
3174 3174
3175void x_kill_gs_process (Pixmap, struct frame *); 3175void x_kill_gs_process (Pixmap, struct frame *);
@@ -3177,7 +3177,7 @@ struct image_cache *make_image_cache (void);
3177void free_image_cache (struct frame *); 3177void free_image_cache (struct frame *);
3178void clear_image_caches (Lisp_Object); 3178void clear_image_caches (Lisp_Object);
3179void mark_image_cache (struct image_cache *); 3179void mark_image_cache (struct image_cache *);
3180int valid_image_p (Lisp_Object); 3180bool valid_image_p (Lisp_Object);
3181void prepare_image_for_display (struct frame *, struct image *); 3181void prepare_image_for_display (struct frame *, struct image *);
3182ptrdiff_t lookup_image (struct frame *, Lisp_Object); 3182ptrdiff_t lookup_image (struct frame *, Lisp_Object);
3183 3183
diff --git a/src/image.c b/src/image.c
index 1c9b262c8cb..b9adf4ad480 100644
--- a/src/image.c
+++ b/src/image.c
@@ -429,6 +429,9 @@ x_destroy_all_bitmaps (Display_Info *dpyinfo)
429 dpyinfo->bitmaps_last = 0; 429 dpyinfo->bitmaps_last = 0;
430} 430}
431 431
432static bool x_create_x_image_and_pixmap (struct frame *, int, int, int,
433 XImagePtr *, Pixmap *);
434static void x_destroy_x_image (XImagePtr ximg);
432 435
433#ifdef HAVE_X_WINDOWS 436#ifdef HAVE_X_WINDOWS
434 437
@@ -440,23 +443,17 @@ static unsigned long four_corners_best (XImagePtr ximg,
440 unsigned long width, 443 unsigned long width,
441 unsigned long height); 444 unsigned long height);
442 445
443static int x_create_x_image_and_pixmap (struct frame *f, int width, int height,
444 int depth, XImagePtr *ximg,
445 Pixmap *pixmap);
446
447static void x_destroy_x_image (XImagePtr ximg);
448
449 446
450/* Create a mask of a bitmap. Note is this not a perfect mask. 447/* Create a mask of a bitmap. Note is this not a perfect mask.
451 It's nicer with some borders in this context */ 448 It's nicer with some borders in this context */
452 449
453int 450void
454x_create_bitmap_mask (struct frame *f, ptrdiff_t id) 451x_create_bitmap_mask (struct frame *f, ptrdiff_t id)
455{ 452{
456 Pixmap pixmap, mask; 453 Pixmap pixmap, mask;
457 XImagePtr ximg, mask_img; 454 XImagePtr ximg, mask_img;
458 unsigned long width, height; 455 unsigned long width, height;
459 int result; 456 bool result;
460 unsigned long bg; 457 unsigned long bg;
461 unsigned long x, y, xp, xm, yp, ym; 458 unsigned long x, y, xp, xm, yp, ym;
462 GC gc; 459 GC gc;
@@ -464,7 +461,7 @@ x_create_bitmap_mask (struct frame *f, ptrdiff_t id)
464 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 461 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
465 462
466 if (!(id > 0)) 463 if (!(id > 0))
467 return -1; 464 return;
468 465
469 pixmap = x_bitmap_pixmap (f, id); 466 pixmap = x_bitmap_pixmap (f, id);
470 width = x_bitmap_width (f, id); 467 width = x_bitmap_width (f, id);
@@ -477,7 +474,7 @@ x_create_bitmap_mask (struct frame *f, ptrdiff_t id)
477 if (!ximg) 474 if (!ximg)
478 { 475 {
479 unblock_input (); 476 unblock_input ();
480 return -1; 477 return;
481 } 478 }
482 479
483 result = x_create_x_image_and_pixmap (f, width, height, 1, &mask_img, &mask); 480 result = x_create_x_image_and_pixmap (f, width, height, 1, &mask_img, &mask);
@@ -486,7 +483,7 @@ x_create_bitmap_mask (struct frame *f, ptrdiff_t id)
486 if (!result) 483 if (!result)
487 { 484 {
488 XDestroyImage (ximg); 485 XDestroyImage (ximg);
489 return -1; 486 return;
490 } 487 }
491 488
492 bg = four_corners_best (ximg, NULL, width, height); 489 bg = four_corners_best (ximg, NULL, width, height);
@@ -525,8 +522,6 @@ x_create_bitmap_mask (struct frame *f, ptrdiff_t id)
525 522
526 XDestroyImage (ximg); 523 XDestroyImage (ximg);
527 x_destroy_x_image (mask_img); 524 x_destroy_x_image (mask_img);
528
529 return 0;
530} 525}
531 526
532#endif /* HAVE_X_WINDOWS */ 527#endif /* HAVE_X_WINDOWS */
@@ -559,15 +554,13 @@ static Lisp_Object QCcrop, QCrotation;
559static Lisp_Object Qcount, Qextension_data, Qdelay; 554static Lisp_Object Qcount, Qextension_data, Qdelay;
560static Lisp_Object Qlaplace, Qemboss, Qedge_detection, Qheuristic; 555static Lisp_Object Qlaplace, Qemboss, Qedge_detection, Qheuristic;
561 556
562/* Function prototypes. */ 557/* Forward function prototypes. */
563 558
564static struct image_type *define_image_type (struct image_type *);
565static struct image_type *lookup_image_type (Lisp_Object); 559static struct image_type *lookup_image_type (Lisp_Object);
566static void image_error (const char *format, Lisp_Object, Lisp_Object);
567static void x_laplace (struct frame *, struct image *); 560static void x_laplace (struct frame *, struct image *);
568static void x_emboss (struct frame *, struct image *); 561static void x_emboss (struct frame *, struct image *);
569static int x_build_heuristic_mask (struct frame *, struct image *, 562static void x_build_heuristic_mask (struct frame *, struct image *,
570 Lisp_Object); 563 Lisp_Object);
571#ifdef HAVE_NTGUI 564#ifdef HAVE_NTGUI
572#define CACHE_IMAGE_TYPE(type, status) \ 565#define CACHE_IMAGE_TYPE(type, status) \
573 do { Vlibrary_cache = Fcons (Fcons (type, status), Vlibrary_cache); } while (0) 566 do { Vlibrary_cache = Fcons (Fcons (type, status), Vlibrary_cache); } while (0)
@@ -586,7 +579,7 @@ define_image_type (struct image_type *type)
586{ 579{
587 struct image_type *p = NULL; 580 struct image_type *p = NULL;
588 Lisp_Object target_type = *type->type; 581 Lisp_Object target_type = *type->type;
589 int type_valid = 1; 582 bool type_valid = 1;
590 583
591 block_input (); 584 block_input ();
592 585
@@ -625,17 +618,17 @@ define_image_type (struct image_type *type)
625} 618}
626 619
627 620
628/* Value is non-zero if OBJECT is a valid Lisp image specification. A 621/* Value is true if OBJECT is a valid Lisp image specification. A
629 valid image specification is a list whose car is the symbol 622 valid image specification is a list whose car is the symbol
630 `image', and whose rest is a property list. The property list must 623 `image', and whose rest is a property list. The property list must
631 contain a value for key `:type'. That value must be the name of a 624 contain a value for key `:type'. That value must be the name of a
632 supported image type. The rest of the property list depends on the 625 supported image type. The rest of the property list depends on the
633 image type. */ 626 image type. */
634 627
635int 628bool
636valid_image_p (Lisp_Object object) 629valid_image_p (Lisp_Object object)
637{ 630{
638 int valid_p = 0; 631 bool valid_p = 0;
639 632
640 if (IMAGEP (object)) 633 if (IMAGEP (object))
641 { 634 {
@@ -705,8 +698,8 @@ struct image_keyword
705 /* The type of value allowed. */ 698 /* The type of value allowed. */
706 enum image_value_type type; 699 enum image_value_type type;
707 700
708 /* Non-zero means key must be present. */ 701 /* True means key must be present. */
709 int mandatory_p; 702 bool mandatory_p;
710 703
711 /* Used to recognize duplicate keywords in a property list. */ 704 /* Used to recognize duplicate keywords in a property list. */
712 int count; 705 int count;
@@ -716,18 +709,13 @@ struct image_keyword
716}; 709};
717 710
718 711
719static int parse_image_spec (Lisp_Object, struct image_keyword *,
720 int, Lisp_Object);
721static Lisp_Object image_spec_value (Lisp_Object, Lisp_Object, int *);
722
723
724/* Parse image spec SPEC according to KEYWORDS. A valid image spec 712/* Parse image spec SPEC according to KEYWORDS. A valid image spec
725 has the format (image KEYWORD VALUE ...). One of the keyword/ 713 has the format (image KEYWORD VALUE ...). One of the keyword/
726 value pairs must be `:type TYPE'. KEYWORDS is a vector of 714 value pairs must be `:type TYPE'. KEYWORDS is a vector of
727 image_keywords structures of size NKEYWORDS describing other 715 image_keywords structures of size NKEYWORDS describing other
728 allowed keyword/value pairs. Value is non-zero if SPEC is valid. */ 716 allowed keyword/value pairs. Value is true if SPEC is valid. */
729 717
730static int 718static bool
731parse_image_spec (Lisp_Object spec, struct image_keyword *keywords, 719parse_image_spec (Lisp_Object spec, struct image_keyword *keywords,
732 int nkeywords, Lisp_Object type) 720 int nkeywords, Lisp_Object type)
733{ 721{
@@ -859,11 +847,11 @@ parse_image_spec (Lisp_Object spec, struct image_keyword *keywords,
859 847
860 848
861/* Return the value of KEY in image specification SPEC. Value is nil 849/* Return the value of KEY in image specification SPEC. Value is nil
862 if KEY is not present in SPEC. if FOUND is not null, set *FOUND 850 if KEY is not present in SPEC. Set *FOUND depending on whether KEY
863 to 1 if KEY was found in SPEC, set it to 0 otherwise. */ 851 was found in SPEC. */
864 852
865static Lisp_Object 853static Lisp_Object
866image_spec_value (Lisp_Object spec, Lisp_Object key, int *found) 854image_spec_value (Lisp_Object spec, Lisp_Object key, bool *found)
867{ 855{
868 Lisp_Object tail; 856 Lisp_Object tail;
869 857
@@ -967,8 +955,6 @@ or omitted means use the selected frame. */)
967 Image type independent image structures 955 Image type independent image structures
968 ***********************************************************************/ 956 ***********************************************************************/
969 957
970static void free_image (struct frame *f, struct image *img);
971
972#define MAX_IMAGE_SIZE 10.0 958#define MAX_IMAGE_SIZE 10.0
973/* Allocate and return a new image structure for image specification 959/* Allocate and return a new image structure for image specification
974 SPEC. SPEC has a hash value of HASH. */ 960 SPEC. SPEC has a hash value of HASH. */
@@ -1018,10 +1004,9 @@ free_image (struct frame *f, struct image *img)
1018 } 1004 }
1019} 1005}
1020 1006
1021/* Return 1 if the given widths and heights are valid for display; 1007/* Return true if the given widths and heights are valid for display. */
1022 otherwise, return 0. */
1023 1008
1024static int 1009static bool
1025check_image_size (struct frame *f, int width, int height) 1010check_image_size (struct frame *f, int width, int height)
1026{ 1011{
1027 int w, h; 1012 int w, h;
@@ -1060,7 +1045,7 @@ prepare_image_for_display (struct frame *f, struct image *img)
1060 /* If IMG doesn't have a pixmap yet, load it now, using the image 1045 /* If IMG doesn't have a pixmap yet, load it now, using the image
1061 type dependent loader function. */ 1046 type dependent loader function. */
1062 if (img->pixmap == NO_PIXMAP && !img->load_failed_p) 1047 if (img->pixmap == NO_PIXMAP && !img->load_failed_p)
1063 img->load_failed_p = img->type->load (f, img) == 0; 1048 img->load_failed_p = ! img->type->load (f, img);
1064 1049
1065} 1050}
1066 1051
@@ -1193,7 +1178,7 @@ image_background (struct image *img, struct frame *f, XImagePtr_or_DC ximg)
1193 if (! img->background_valid) 1178 if (! img->background_valid)
1194 /* IMG doesn't have a background yet, try to guess a reasonable value. */ 1179 /* IMG doesn't have a background yet, try to guess a reasonable value. */
1195 { 1180 {
1196 int free_ximg = !ximg; 1181 bool free_ximg = !ximg;
1197#ifdef HAVE_NTGUI 1182#ifdef HAVE_NTGUI
1198 HGDIOBJ prev; 1183 HGDIOBJ prev;
1199#endif /* HAVE_NTGUI */ 1184#endif /* HAVE_NTGUI */
@@ -1234,7 +1219,7 @@ image_background_transparent (struct image *img, struct frame *f, XImagePtr_or_D
1234 { 1219 {
1235 if (img->mask) 1220 if (img->mask)
1236 { 1221 {
1237 int free_mask = !mask; 1222 bool free_mask = !mask;
1238#ifdef HAVE_NTGUI 1223#ifdef HAVE_NTGUI
1239 HGDIOBJ prev; 1224 HGDIOBJ prev;
1240#endif /* HAVE_NTGUI */ 1225#endif /* HAVE_NTGUI */
@@ -1272,23 +1257,13 @@ image_background_transparent (struct image *img, struct frame *f, XImagePtr_or_D
1272 Helper functions for X image types 1257 Helper functions for X image types
1273 ***********************************************************************/ 1258 ***********************************************************************/
1274 1259
1275static void x_clear_image_1 (struct frame *, struct image *, int, 1260/* Clear X resources of image IMG on frame F. PIXMAP_P means free the
1276 int, int); 1261 pixmap if any. MASK_P means clear the mask pixmap if any.
1277static void x_clear_image (struct frame *f, struct image *img); 1262 COLORS_P means free colors allocated for the image, if any. */
1278static unsigned long x_alloc_image_color (struct frame *f,
1279 struct image *img,
1280 Lisp_Object color_name,
1281 unsigned long dflt);
1282
1283
1284/* Clear X resources of image IMG on frame F. PIXMAP_P non-zero means
1285 free the pixmap if any. MASK_P non-zero means clear the mask
1286 pixmap if any. COLORS_P non-zero means free colors allocated for
1287 the image, if any. */
1288 1263
1289static void 1264static void
1290x_clear_image_1 (struct frame *f, struct image *img, int pixmap_p, int mask_p, 1265x_clear_image_1 (struct frame *f, struct image *img, bool pixmap_p,
1291 int colors_p) 1266 bool mask_p, bool colors_p)
1292{ 1267{
1293 if (pixmap_p && img->pixmap) 1268 if (pixmap_p && img->pixmap)
1294 { 1269 {
@@ -1368,7 +1343,6 @@ x_alloc_image_color (struct frame *f, struct image *img, Lisp_Object color_name,
1368 ***********************************************************************/ 1343 ***********************************************************************/
1369 1344
1370static void cache_image (struct frame *f, struct image *img); 1345static void cache_image (struct frame *f, struct image *img);
1371static void postprocess_image (struct frame *, struct image *);
1372 1346
1373/* Return a new, initialized image cache that is allocated from the 1347/* Return a new, initialized image cache that is allocated from the
1374 heap. Call free_image_cache to free an image cache. */ 1348 heap. Call free_image_cache to free an image cache. */
@@ -1641,7 +1615,7 @@ postprocess_image (struct frame *f, struct image *img)
1641 x_build_heuristic_mask (f, img, mask); 1615 x_build_heuristic_mask (f, img, mask);
1642 else 1616 else
1643 { 1617 {
1644 int found_p; 1618 bool found_p;
1645 1619
1646 mask = image_spec_value (spec, QCmask, &found_p); 1620 mask = image_spec_value (spec, QCmask, &found_p);
1647 1621
@@ -1714,7 +1688,7 @@ lookup_image (struct frame *f, Lisp_Object spec)
1714 block_input (); 1688 block_input ();
1715 img = make_image (spec, hash); 1689 img = make_image (spec, hash);
1716 cache_image (f, img); 1690 cache_image (f, img);
1717 img->load_failed_p = img->type->load (f, img) == 0; 1691 img->load_failed_p = ! img->type->load (f, img);
1718 img->frame_foreground = FRAME_FOREGROUND_PIXEL (f); 1692 img->frame_foreground = FRAME_FOREGROUND_PIXEL (f);
1719 img->frame_background = FRAME_BACKGROUND_PIXEL (f); 1693 img->frame_background = FRAME_BACKGROUND_PIXEL (f);
1720 1694
@@ -1873,16 +1847,11 @@ mark_image_cache (struct image_cache *c)
1873 1847
1874#endif /* HAVE_NTGUI */ 1848#endif /* HAVE_NTGUI */
1875 1849
1876static int x_create_x_image_and_pixmap (struct frame *, int, int, int, 1850/* Return true if XIMG's size WIDTH x HEIGHT doesn't break the
1877 XImagePtr *, Pixmap *);
1878static void x_destroy_x_image (XImagePtr);
1879static void x_put_x_image (struct frame *, XImagePtr, Pixmap, int, int);
1880
1881/* Return nonzero if XIMG's size WIDTH x HEIGHT doesn't break the
1882 windowing system. 1851 windowing system.
1883 WIDTH and HEIGHT must both be positive. 1852 WIDTH and HEIGHT must both be positive.
1884 If XIMG is null, assume it is a bitmap. */ 1853 If XIMG is null, assume it is a bitmap. */
1885static int 1854static bool
1886x_check_image_size (XImagePtr ximg, int width, int height) 1855x_check_image_size (XImagePtr ximg, int width, int height)
1887{ 1856{
1888#ifdef HAVE_X_WINDOWS 1857#ifdef HAVE_X_WINDOWS
@@ -1921,12 +1890,12 @@ x_check_image_size (XImagePtr ximg, int width, int height)
1921 frame F. Set *XIMG and *PIXMAP to the XImage and Pixmap created. 1890 frame F. Set *XIMG and *PIXMAP to the XImage and Pixmap created.
1922 Set (*XIMG)->data to a raster of WIDTH x HEIGHT pixels allocated 1891 Set (*XIMG)->data to a raster of WIDTH x HEIGHT pixels allocated
1923 via xmalloc. Print error messages via image_error if an error 1892 via xmalloc. Print error messages via image_error if an error
1924 occurs. Value is non-zero if successful. 1893 occurs. Value is true if successful.
1925 1894
1926 On W32, a DEPTH of zero signifies a 24 bit image, otherwise DEPTH 1895 On W32, a DEPTH of zero signifies a 24 bit image, otherwise DEPTH
1927 should indicate the bit depth of the image. */ 1896 should indicate the bit depth of the image. */
1928 1897
1929static int 1898static bool
1930x_create_x_image_and_pixmap (struct frame *f, int width, int height, int depth, 1899x_create_x_image_and_pixmap (struct frame *f, int width, int height, int depth,
1931 XImagePtr *ximg, Pixmap *pixmap) 1900 XImagePtr *ximg, Pixmap *pixmap)
1932{ 1901{
@@ -2198,15 +2167,9 @@ slurp_file (char *file, ptrdiff_t *size)
2198 XBM images 2167 XBM images
2199 ***********************************************************************/ 2168 ***********************************************************************/
2200 2169
2201static int xbm_scan (unsigned char **, unsigned char *, char *, int *); 2170static bool xbm_load (struct frame *f, struct image *img);
2202static int xbm_load (struct frame *f, struct image *img); 2171static bool xbm_image_p (Lisp_Object object);
2203static int xbm_load_image (struct frame *f, struct image *img, 2172static bool xbm_file_p (Lisp_Object);
2204 unsigned char *, unsigned char *);
2205static int xbm_image_p (Lisp_Object object);
2206static int xbm_read_bitmap_data (struct frame *f,
2207 unsigned char *, unsigned char *,
2208 int *, int *, char **, int);
2209static int xbm_file_p (Lisp_Object);
2210 2173
2211 2174
2212/* Indices of image specification fields in xbm_format, below. */ 2175/* Indices of image specification fields in xbm_format, below. */
@@ -2270,10 +2233,10 @@ enum xbm_token
2270}; 2233};
2271 2234
2272 2235
2273/* Return non-zero if OBJECT is a valid XBM-type image specification. 2236/* Return true if OBJECT is a valid XBM-type image specification.
2274 A valid specification is a list starting with the symbol `image' 2237 A valid specification is a list starting with the symbol `image'
2275 The rest of the list is a property list which must contain an 2238 The rest of the list is a property list which must contain an
2276 entry `:type xbm.. 2239 entry `:type xbm'.
2277 2240
2278 If the specification specifies a file to load, it must contain 2241 If the specification specifies a file to load, it must contain
2279 an entry `:file FILENAME' where FILENAME is a string. 2242 an entry `:file FILENAME' where FILENAME is a string.
@@ -2299,7 +2262,7 @@ enum xbm_token
2299 foreground and background of the frame on which the image is 2262 foreground and background of the frame on which the image is
2300 displayed is used. */ 2263 displayed is used. */
2301 2264
2302static int 2265static bool
2303xbm_image_p (Lisp_Object object) 2266xbm_image_p (Lisp_Object object)
2304{ 2267{
2305 struct image_keyword kw[XBM_LAST]; 2268 struct image_keyword kw[XBM_LAST];
@@ -2557,7 +2520,7 @@ convert_mono_to_color_image (struct frame *f, struct image *img,
2557static void 2520static void
2558Create_Pixmap_From_Bitmap_Data (struct frame *f, struct image *img, char *data, 2521Create_Pixmap_From_Bitmap_Data (struct frame *f, struct image *img, char *data,
2559 RGB_PIXEL_COLOR fg, RGB_PIXEL_COLOR bg, 2522 RGB_PIXEL_COLOR fg, RGB_PIXEL_COLOR bg,
2560 int non_default_colors) 2523 bool non_default_colors)
2561{ 2524{
2562#ifdef HAVE_NTGUI 2525#ifdef HAVE_NTGUI
2563 img->pixmap 2526 img->pixmap
@@ -2589,20 +2552,20 @@ Create_Pixmap_From_Bitmap_Data (struct frame *f, struct image *img, char *data,
2589 X versions. CONTENTS is a pointer to a buffer to parse; END is the 2552 X versions. CONTENTS is a pointer to a buffer to parse; END is the
2590 buffer's end. Set *WIDTH and *HEIGHT to the width and height of 2553 buffer's end. Set *WIDTH and *HEIGHT to the width and height of
2591 the image. Return in *DATA the bitmap data allocated with xmalloc. 2554 the image. Return in *DATA the bitmap data allocated with xmalloc.
2592 Value is non-zero if successful. DATA null means just test if 2555 Value is true if successful. DATA null means just test if
2593 CONTENTS looks like an in-memory XBM file. If INHIBIT_IMAGE_ERROR 2556 CONTENTS looks like an in-memory XBM file. If INHIBIT_IMAGE_ERROR,
2594 is non-zero, inhibit the call to image_error when the image size is 2557 inhibit the call to image_error when the image size is invalid (the
2595 invalid (the bitmap remains unread). */ 2558 bitmap remains unread). */
2596 2559
2597static int 2560static bool
2598xbm_read_bitmap_data (struct frame *f, unsigned char *contents, unsigned char *end, 2561xbm_read_bitmap_data (struct frame *f, unsigned char *contents, unsigned char *end,
2599 int *width, int *height, char **data, 2562 int *width, int *height, char **data,
2600 int inhibit_image_error) 2563 bool inhibit_image_error)
2601{ 2564{
2602 unsigned char *s = contents; 2565 unsigned char *s = contents;
2603 char buffer[BUFSIZ]; 2566 char buffer[BUFSIZ];
2604 int padding_p = 0; 2567 bool padding_p = 0;
2605 int v10 = 0; 2568 bool v10 = 0;
2606 int bytes_per_line, i, nbytes; 2569 int bytes_per_line, i, nbytes;
2607 char *p; 2570 char *p;
2608 int value; 2571 int value;
@@ -2749,16 +2712,16 @@ xbm_read_bitmap_data (struct frame *f, unsigned char *contents, unsigned char *e
2749 2712
2750 2713
2751/* Load XBM image IMG which will be displayed on frame F from buffer 2714/* Load XBM image IMG which will be displayed on frame F from buffer
2752 CONTENTS. END is the end of the buffer. Value is non-zero if 2715 CONTENTS. END is the end of the buffer. Value is true if
2753 successful. */ 2716 successful. */
2754 2717
2755static int 2718static bool
2756xbm_load_image (struct frame *f, struct image *img, unsigned char *contents, 2719xbm_load_image (struct frame *f, struct image *img, unsigned char *contents,
2757 unsigned char *end) 2720 unsigned char *end)
2758{ 2721{
2759 int rc; 2722 bool rc;
2760 char *data; 2723 char *data;
2761 int success_p = 0; 2724 bool success_p = 0;
2762 2725
2763 rc = xbm_read_bitmap_data (f, contents, end, &img->width, &img->height, 2726 rc = xbm_read_bitmap_data (f, contents, end, &img->width, &img->height,
2764 &data, 0); 2727 &data, 0);
@@ -2766,7 +2729,7 @@ xbm_load_image (struct frame *f, struct image *img, unsigned char *contents,
2766 { 2729 {
2767 unsigned long foreground = FRAME_FOREGROUND_PIXEL (f); 2730 unsigned long foreground = FRAME_FOREGROUND_PIXEL (f);
2768 unsigned long background = FRAME_BACKGROUND_PIXEL (f); 2731 unsigned long background = FRAME_BACKGROUND_PIXEL (f);
2769 int non_default_colors = 0; 2732 bool non_default_colors = 0;
2770 Lisp_Object value; 2733 Lisp_Object value;
2771 2734
2772 eassert (img->width > 0 && img->height > 0); 2735 eassert (img->width > 0 && img->height > 0);
@@ -2807,9 +2770,9 @@ xbm_load_image (struct frame *f, struct image *img, unsigned char *contents,
2807} 2770}
2808 2771
2809 2772
2810/* Value is non-zero if DATA looks like an in-memory XBM file. */ 2773/* Value is true if DATA looks like an in-memory XBM file. */
2811 2774
2812static int 2775static bool
2813xbm_file_p (Lisp_Object data) 2776xbm_file_p (Lisp_Object data)
2814{ 2777{
2815 int w, h; 2778 int w, h;
@@ -2821,12 +2784,12 @@ xbm_file_p (Lisp_Object data)
2821 2784
2822 2785
2823/* Fill image IMG which is used on frame F with pixmap data. Value is 2786/* Fill image IMG which is used on frame F with pixmap data. Value is
2824 non-zero if successful. */ 2787 true if successful. */
2825 2788
2826static int 2789static bool
2827xbm_load (struct frame *f, struct image *img) 2790xbm_load (struct frame *f, struct image *img)
2828{ 2791{
2829 int success_p = 0; 2792 bool success_p = 0;
2830 Lisp_Object file_name; 2793 Lisp_Object file_name;
2831 2794
2832 eassert (xbm_image_p (img->spec)); 2795 eassert (xbm_image_p (img->spec));
@@ -2862,10 +2825,10 @@ xbm_load (struct frame *f, struct image *img)
2862 Lisp_Object data; 2825 Lisp_Object data;
2863 unsigned long foreground = FRAME_FOREGROUND_PIXEL (f); 2826 unsigned long foreground = FRAME_FOREGROUND_PIXEL (f);
2864 unsigned long background = FRAME_BACKGROUND_PIXEL (f); 2827 unsigned long background = FRAME_BACKGROUND_PIXEL (f);
2865 int non_default_colors = 0; 2828 bool non_default_colors = 0;
2866 char *bits; 2829 char *bits;
2867 int parsed_p; 2830 bool parsed_p;
2868 int in_memory_file_p = 0; 2831 bool in_memory_file_p = 0;
2869 2832
2870 /* See if data looks like an in-memory XBM file. */ 2833 /* See if data looks like an in-memory XBM file. */
2871 data = image_spec_value (img->spec, QCdata, NULL); 2834 data = image_spec_value (img->spec, QCdata, NULL);
@@ -2874,7 +2837,6 @@ xbm_load (struct frame *f, struct image *img)
2874 /* Parse the image specification. */ 2837 /* Parse the image specification. */
2875 memcpy (fmt, xbm_format, sizeof fmt); 2838 memcpy (fmt, xbm_format, sizeof fmt);
2876 parsed_p = parse_image_spec (img->spec, fmt, XBM_LAST, Qxbm); 2839 parsed_p = parse_image_spec (img->spec, fmt, XBM_LAST, Qxbm);
2877 (void) parsed_p;
2878 eassert (parsed_p); 2840 eassert (parsed_p);
2879 2841
2880 /* Get specified width, and height. */ 2842 /* Get specified width, and height. */
@@ -2979,9 +2941,8 @@ xbm_load (struct frame *f, struct image *img)
2979 2941
2980#if defined (HAVE_XPM) || defined (HAVE_NS) 2942#if defined (HAVE_XPM) || defined (HAVE_NS)
2981 2943
2982static int xpm_image_p (Lisp_Object object); 2944static bool xpm_image_p (Lisp_Object object);
2983static int xpm_load (struct frame *f, struct image *img); 2945static bool xpm_load (struct frame *f, struct image *img);
2984static int xpm_valid_color_symbols_p (Lisp_Object);
2985 2946
2986#endif /* HAVE_XPM || HAVE_NS */ 2947#endif /* HAVE_XPM || HAVE_NS */
2987 2948
@@ -3048,7 +3009,7 @@ static const struct image_keyword xpm_format[XPM_LAST] =
3048}; 3009};
3049 3010
3050#ifdef HAVE_NTGUI 3011#ifdef HAVE_NTGUI
3051static int init_xpm_functions (void); 3012static bool init_xpm_functions (void);
3052#else 3013#else
3053#define init_xpm_functions NULL 3014#define init_xpm_functions NULL
3054#endif 3015#endif
@@ -3079,10 +3040,6 @@ static struct image_type xpm_type =
3079 3040
3080#ifdef ALLOC_XPM_COLORS 3041#ifdef ALLOC_XPM_COLORS
3081 3042
3082static void xpm_init_color_cache (struct frame *, XpmAttributes *);
3083static void xpm_free_color_cache (void);
3084static int xpm_lookup_color (struct frame *, char *, XColor *);
3085static int xpm_color_bucket (char *);
3086static struct xpm_cached_color *xpm_cache_color (struct frame *, char *, 3043static struct xpm_cached_color *xpm_cache_color (struct frame *, char *,
3087 XColor *, int); 3044 XColor *, int);
3088 3045
@@ -3189,10 +3146,10 @@ xpm_cache_color (struct frame *f, char *color_name, XColor *color, int bucket)
3189 3146
3190/* Look up color COLOR_NAME for frame F in the color cache. If found, 3147/* Look up color COLOR_NAME for frame F in the color cache. If found,
3191 return the cached definition in *COLOR. Otherwise, make a new 3148 return the cached definition in *COLOR. Otherwise, make a new
3192 entry in the cache and allocate the color. Value is zero if color 3149 entry in the cache and allocate the color. Value is false if color
3193 allocation failed. */ 3150 allocation failed. */
3194 3151
3195static int 3152static bool
3196xpm_lookup_color (struct frame *f, char *color_name, XColor *color) 3153xpm_lookup_color (struct frame *f, char *color_name, XColor *color)
3197{ 3154{
3198 struct xpm_cached_color *p; 3155 struct xpm_cached_color *p;
@@ -3261,7 +3218,7 @@ DEF_IMGLIB_FN (int, XpmReadFileToImage, (Display *, char *, xpm_XImage **,
3261 xpm_XImage **, XpmAttributes *)); 3218 xpm_XImage **, XpmAttributes *));
3262DEF_IMGLIB_FN (void, XImageFree, (xpm_XImage *)); 3219DEF_IMGLIB_FN (void, XImageFree, (xpm_XImage *));
3263 3220
3264static int 3221static bool
3265init_xpm_functions (void) 3222init_xpm_functions (void)
3266{ 3223{
3267 HMODULE library; 3224 HMODULE library;
@@ -3279,11 +3236,11 @@ init_xpm_functions (void)
3279#endif /* HAVE_NTGUI */ 3236#endif /* HAVE_NTGUI */
3280 3237
3281 3238
3282/* Value is non-zero if COLOR_SYMBOLS is a valid color symbols list 3239/* Value is true if COLOR_SYMBOLS is a valid color symbols list
3283 for XPM images. Such a list must consist of conses whose car and 3240 for XPM images. Such a list must consist of conses whose car and
3284 cdr are strings. */ 3241 cdr are strings. */
3285 3242
3286static int 3243static bool
3287xpm_valid_color_symbols_p (Lisp_Object color_symbols) 3244xpm_valid_color_symbols_p (Lisp_Object color_symbols)
3288{ 3245{
3289 while (CONSP (color_symbols)) 3246 while (CONSP (color_symbols))
@@ -3300,9 +3257,9 @@ xpm_valid_color_symbols_p (Lisp_Object color_symbols)
3300} 3257}
3301 3258
3302 3259
3303/* Value is non-zero if OBJECT is a valid XPM image specification. */ 3260/* Value is true if OBJECT is a valid XPM image specification. */
3304 3261
3305static int 3262static bool
3306xpm_image_p (Lisp_Object object) 3263xpm_image_p (Lisp_Object object)
3307{ 3264{
3308 struct image_keyword fmt[XPM_LAST]; 3265 struct image_keyword fmt[XPM_LAST];
@@ -3359,11 +3316,11 @@ x_create_bitmap_from_xpm_data (struct frame *f, const char **bits)
3359#endif /* defined (HAVE_XPM) && defined (HAVE_X_WINDOWS) */ 3316#endif /* defined (HAVE_XPM) && defined (HAVE_X_WINDOWS) */
3360 3317
3361/* Load image IMG which will be displayed on frame F. Value is 3318/* Load image IMG which will be displayed on frame F. Value is
3362 non-zero if successful. */ 3319 true if successful. */
3363 3320
3364#ifdef HAVE_XPM 3321#ifdef HAVE_XPM
3365 3322
3366static int 3323static bool
3367xpm_load (struct frame *f, struct image *img) 3324xpm_load (struct frame *f, struct image *img)
3368{ 3325{
3369 int rc; 3326 int rc;
@@ -3817,7 +3774,7 @@ xpm_str_to_color_key (const char *s)
3817 return -1; 3774 return -1;
3818} 3775}
3819 3776
3820static int 3777static bool
3821xpm_load_image (struct frame *f, 3778xpm_load_image (struct frame *f,
3822 struct image *img, 3779 struct image *img,
3823 const unsigned char *contents, 3780 const unsigned char *contents,
@@ -3832,7 +3789,8 @@ xpm_load_image (struct frame *f,
3832 void (*put_color_table) (Lisp_Object, const unsigned char *, int, Lisp_Object); 3789 void (*put_color_table) (Lisp_Object, const unsigned char *, int, Lisp_Object);
3833 Lisp_Object (*get_color_table) (Lisp_Object, const unsigned char *, int); 3790 Lisp_Object (*get_color_table) (Lisp_Object, const unsigned char *, int);
3834 Lisp_Object frame, color_symbols, color_table; 3791 Lisp_Object frame, color_symbols, color_table;
3835 int best_key, have_mask = 0; 3792 int best_key;
3793 bool have_mask = 0;
3836 XImagePtr ximg = NULL, mask_img = NULL; 3794 XImagePtr ximg = NULL, mask_img = NULL;
3837 3795
3838#define match() \ 3796#define match() \
@@ -4052,11 +4010,11 @@ xpm_load_image (struct frame *f,
4052#undef expect_ident 4010#undef expect_ident
4053} 4011}
4054 4012
4055static int 4013static bool
4056xpm_load (struct frame *f, 4014xpm_load (struct frame *f,
4057 struct image *img) 4015 struct image *img)
4058{ 4016{
4059 int success_p = 0; 4017 bool success_p = 0;
4060 Lisp_Object file_name; 4018 Lisp_Object file_name;
4061 4019
4062 /* If IMG->spec specifies a file name, create a non-file spec from it. */ 4020 /* If IMG->spec specifies a file name, create a non-file spec from it. */
@@ -4227,7 +4185,7 @@ lookup_rgb_color (struct frame *f, int r, int g, int b)
4227#ifdef HAVE_X_WINDOWS 4185#ifdef HAVE_X_WINDOWS
4228 XColor color; 4186 XColor color;
4229 Colormap cmap; 4187 Colormap cmap;
4230 int rc; 4188 bool rc;
4231#else 4189#else
4232 COLORREF color; 4190 COLORREF color;
4233#endif 4191#endif
@@ -4295,7 +4253,7 @@ lookup_pixel_color (struct frame *f, unsigned long pixel)
4295 { 4253 {
4296 XColor color; 4254 XColor color;
4297 Colormap cmap; 4255 Colormap cmap;
4298 int rc; 4256 bool rc;
4299 4257
4300 if (ct_colors_allocated_max <= ct_colors_allocated) 4258 if (ct_colors_allocated_max <= ct_colors_allocated)
4301 return FRAME_FOREGROUND_PIXEL (f); 4259 return FRAME_FOREGROUND_PIXEL (f);
@@ -4389,14 +4347,6 @@ init_color_table (void)
4389 Algorithms 4347 Algorithms
4390 ***********************************************************************/ 4348 ***********************************************************************/
4391 4349
4392static XColor *x_to_xcolors (struct frame *, struct image *, int);
4393static void x_from_xcolors (struct frame *, struct image *, XColor *);
4394static void x_detect_edges (struct frame *, struct image *, int[9], int);
4395
4396#ifdef HAVE_NTGUI
4397static void XPutPixel (XImagePtr , int, int, COLORREF);
4398#endif /* HAVE_NTGUI */
4399
4400/* Edge detection matrices for different edge-detection 4350/* Edge detection matrices for different edge-detection
4401 strategies. */ 4351 strategies. */
4402 4352
@@ -4422,12 +4372,12 @@ static int laplace_matrix[9] = {
4422 4372
4423/* On frame F, return an array of XColor structures describing image 4373/* On frame F, return an array of XColor structures describing image
4424 IMG->pixmap. Each XColor structure has its pixel color set. RGB_P 4374 IMG->pixmap. Each XColor structure has its pixel color set. RGB_P
4425 non-zero means also fill the red/green/blue members of the XColor 4375 means also fill the red/green/blue members of the XColor
4426 structures. Value is a pointer to the array of XColors structures, 4376 structures. Value is a pointer to the array of XColors structures,
4427 allocated with xmalloc; it must be freed by the caller. */ 4377 allocated with xmalloc; it must be freed by the caller. */
4428 4378
4429static XColor * 4379static XColor *
4430x_to_xcolors (struct frame *f, struct image *img, int rgb_p) 4380x_to_xcolors (struct frame *f, struct image *img, bool rgb_p)
4431{ 4381{
4432 int x, y; 4382 int x, y;
4433 XColor *colors, *p; 4383 XColor *colors, *p;
@@ -4803,9 +4753,9 @@ x_disable_image (struct frame *f, struct image *img)
4803 determine the background color of IMG. If it is a list '(R G B)', 4753 determine the background color of IMG. If it is a list '(R G B)',
4804 with R, G, and B being integers >= 0, take that as the color of the 4754 with R, G, and B being integers >= 0, take that as the color of the
4805 background. Otherwise, determine the background color of IMG 4755 background. Otherwise, determine the background color of IMG
4806 heuristically. Value is non-zero if successful. */ 4756 heuristically. */
4807 4757
4808static int 4758static void
4809x_build_heuristic_mask (struct frame *f, struct image *img, Lisp_Object how) 4759x_build_heuristic_mask (struct frame *f, struct image *img, Lisp_Object how)
4810{ 4760{
4811 XImagePtr_or_DC ximg; 4761 XImagePtr_or_DC ximg;
@@ -4817,7 +4767,8 @@ x_build_heuristic_mask (struct frame *f, struct image *img, Lisp_Object how)
4817 char *mask_img; 4767 char *mask_img;
4818 int row_width; 4768 int row_width;
4819#endif /* HAVE_NTGUI */ 4769#endif /* HAVE_NTGUI */
4820 int x, y, rc, use_img_background; 4770 int x, y;
4771 bool rc, use_img_background;
4821 unsigned long bg = 0; 4772 unsigned long bg = 0;
4822 4773
4823 if (img->mask) 4774 if (img->mask)
@@ -4833,7 +4784,7 @@ x_build_heuristic_mask (struct frame *f, struct image *img, Lisp_Object how)
4833 rc = x_create_x_image_and_pixmap (f, img->width, img->height, 1, 4784 rc = x_create_x_image_and_pixmap (f, img->width, img->height, 1,
4834 &mask_img, &img->mask); 4785 &mask_img, &img->mask);
4835 if (!rc) 4786 if (!rc)
4836 return 0; 4787 return;
4837#endif /* !HAVE_NS */ 4788#endif /* !HAVE_NS */
4838 4789
4839 /* Get the X image of IMG->pixmap. */ 4790 /* Get the X image of IMG->pixmap. */
@@ -4923,8 +4874,6 @@ x_build_heuristic_mask (struct frame *f, struct image *img, Lisp_Object how)
4923#endif /* HAVE_NTGUI */ 4874#endif /* HAVE_NTGUI */
4924 4875
4925 Destroy_Image (ximg, prev); 4876 Destroy_Image (ximg, prev);
4926
4927 return 1;
4928} 4877}
4929 4878
4930 4879
@@ -4932,9 +4881,8 @@ x_build_heuristic_mask (struct frame *f, struct image *img, Lisp_Object how)
4932 PBM (mono, gray, color) 4881 PBM (mono, gray, color)
4933 ***********************************************************************/ 4882 ***********************************************************************/
4934 4883
4935static int pbm_image_p (Lisp_Object object); 4884static bool pbm_image_p (Lisp_Object object);
4936static int pbm_load (struct frame *f, struct image *img); 4885static bool pbm_load (struct frame *f, struct image *img);
4937static int pbm_scan_number (unsigned char **, unsigned char *);
4938 4886
4939/* The symbol `pbm' identifying images of this type. */ 4887/* The symbol `pbm' identifying images of this type. */
4940 4888
@@ -4989,9 +4937,9 @@ static struct image_type pbm_type =
4989}; 4937};
4990 4938
4991 4939
4992/* Return non-zero if OBJECT is a valid PBM image specification. */ 4940/* Return true if OBJECT is a valid PBM image specification. */
4993 4941
4994static int 4942static bool
4995pbm_image_p (Lisp_Object object) 4943pbm_image_p (Lisp_Object object)
4996{ 4944{
4997 struct image_keyword fmt[PBM_LAST]; 4945 struct image_keyword fmt[PBM_LAST];
@@ -5084,10 +5032,11 @@ pbm_read_file (Lisp_Object file, int *size)
5084 5032
5085/* Load PBM image IMG for use on frame F. */ 5033/* Load PBM image IMG for use on frame F. */
5086 5034
5087static int 5035static bool
5088pbm_load (struct frame *f, struct image *img) 5036pbm_load (struct frame *f, struct image *img)
5089{ 5037{
5090 int raw_p, x, y; 5038 bool raw_p;
5039 int x, y;
5091 int width, height, max_color_idx = 0; 5040 int width, height, max_color_idx = 0;
5092 XImagePtr ximg; 5041 XImagePtr ximg;
5093 Lisp_Object file, specified_file; 5042 Lisp_Object file, specified_file;
@@ -5350,8 +5299,8 @@ pbm_load (struct frame *f, struct image *img)
5350 5299
5351/* Function prototypes. */ 5300/* Function prototypes. */
5352 5301
5353static int png_image_p (Lisp_Object object); 5302static bool png_image_p (Lisp_Object object);
5354static int png_load (struct frame *f, struct image *img); 5303static bool png_load (struct frame *f, struct image *img);
5355 5304
5356/* The symbol `png' identifying images of this type. */ 5305/* The symbol `png' identifying images of this type. */
5357 5306
@@ -5392,7 +5341,7 @@ static const struct image_keyword png_format[PNG_LAST] =
5392}; 5341};
5393 5342
5394#ifdef HAVE_NTGUI 5343#ifdef HAVE_NTGUI
5395static int init_png_functions (void); 5344static bool init_png_functions (void);
5396#else 5345#else
5397#define init_png_functions NULL 5346#define init_png_functions NULL
5398#endif 5347#endif
@@ -5409,9 +5358,9 @@ static struct image_type png_type =
5409 NULL 5358 NULL
5410}; 5359};
5411 5360
5412/* Return non-zero if OBJECT is a valid PNG image specification. */ 5361/* Return true if OBJECT is a valid PNG image specification. */
5413 5362
5414static int 5363static bool
5415png_image_p (Lisp_Object object) 5364png_image_p (Lisp_Object object)
5416{ 5365{
5417 struct image_keyword fmt[PNG_LAST]; 5366 struct image_keyword fmt[PNG_LAST];
@@ -5463,7 +5412,7 @@ DEF_IMGLIB_FN (void, png_longjmp, (png_structp, int));
5463DEF_IMGLIB_FN (jmp_buf *, png_set_longjmp_fn, (png_structp, png_longjmp_ptr, size_t)); 5412DEF_IMGLIB_FN (jmp_buf *, png_set_longjmp_fn, (png_structp, png_longjmp_ptr, size_t));
5464#endif /* libpng version >= 1.5 */ 5413#endif /* libpng version >= 1.5 */
5465 5414
5466static int 5415static bool
5467init_png_functions (void) 5416init_png_functions (void)
5468{ 5417{
5469 HMODULE library; 5418 HMODULE library;
@@ -5614,7 +5563,7 @@ png_read_from_file (png_structp png_ptr, png_bytep data, png_size_t length)
5614} 5563}
5615 5564
5616 5565
5617/* Load PNG image IMG for use on frame F. Value is non-zero if 5566/* Load PNG image IMG for use on frame F. Value is true if
5618 successful. */ 5567 successful. */
5619 5568
5620struct png_load_context 5569struct png_load_context
@@ -5628,7 +5577,7 @@ struct png_load_context
5628 png_byte **rows; 5577 png_byte **rows;
5629}; 5578};
5630 5579
5631static int 5580static bool
5632png_load_body (struct frame *f, struct image *img, struct png_load_context *c) 5581png_load_body (struct frame *f, struct image *img, struct png_load_context *c)
5633{ 5582{
5634 Lisp_Object file, specified_file; 5583 Lisp_Object file, specified_file;
@@ -5646,7 +5595,7 @@ png_load_body (struct frame *f, struct image *img, struct png_load_context *c)
5646 int bit_depth, color_type, interlace_type; 5595 int bit_depth, color_type, interlace_type;
5647 png_byte channels; 5596 png_byte channels;
5648 png_uint_32 row_bytes; 5597 png_uint_32 row_bytes;
5649 int transparent_p; 5598 bool transparent_p;
5650 struct png_memory_storage tbr; /* Data to be read */ 5599 struct png_memory_storage tbr; /* Data to be read */
5651 5600
5652 /* Find out what file to load. */ 5601 /* Find out what file to load. */
@@ -5979,7 +5928,7 @@ png_load_body (struct frame *f, struct image *img, struct png_load_context *c)
5979 return 1; 5928 return 1;
5980} 5929}
5981 5930
5982static int 5931static bool
5983png_load (struct frame *f, struct image *img) 5932png_load (struct frame *f, struct image *img)
5984{ 5933{
5985 struct png_load_context c; 5934 struct png_load_context c;
@@ -5989,7 +5938,7 @@ png_load (struct frame *f, struct image *img)
5989#else /* HAVE_PNG */ 5938#else /* HAVE_PNG */
5990 5939
5991#ifdef HAVE_NS 5940#ifdef HAVE_NS
5992static int 5941static bool
5993png_load (struct frame *f, struct image *img) 5942png_load (struct frame *f, struct image *img)
5994{ 5943{
5995 return ns_load_image (f, img, 5944 return ns_load_image (f, img,
@@ -6009,8 +5958,8 @@ png_load (struct frame *f, struct image *img)
6009 5958
6010#if defined (HAVE_JPEG) || defined (HAVE_NS) 5959#if defined (HAVE_JPEG) || defined (HAVE_NS)
6011 5960
6012static int jpeg_image_p (Lisp_Object object); 5961static bool jpeg_image_p (Lisp_Object object);
6013static int jpeg_load (struct frame *f, struct image *img); 5962static bool jpeg_load (struct frame *f, struct image *img);
6014 5963
6015/* The symbol `jpeg' identifying images of this type. */ 5964/* The symbol `jpeg' identifying images of this type. */
6016 5965
@@ -6051,7 +6000,7 @@ static const struct image_keyword jpeg_format[JPEG_LAST] =
6051}; 6000};
6052 6001
6053#ifdef HAVE_NTGUI 6002#ifdef HAVE_NTGUI
6054static int init_jpeg_functions (void); 6003static bool init_jpeg_functions (void);
6055#else 6004#else
6056#define init_jpeg_functions NULL 6005#define init_jpeg_functions NULL
6057#endif 6006#endif
@@ -6068,9 +6017,9 @@ static struct image_type jpeg_type =
6068 NULL 6017 NULL
6069}; 6018};
6070 6019
6071/* Return non-zero if OBJECT is a valid JPEG image specification. */ 6020/* Return true if OBJECT is a valid JPEG image specification. */
6072 6021
6073static int 6022static bool
6074jpeg_image_p (Lisp_Object object) 6023jpeg_image_p (Lisp_Object object)
6075{ 6024{
6076 struct image_keyword fmt[JPEG_LAST]; 6025 struct image_keyword fmt[JPEG_LAST];
@@ -6119,7 +6068,7 @@ DEF_IMGLIB_FN (JDIMENSION, jpeg_read_scanlines, (j_decompress_ptr, JSAMPARRAY, J
6119DEF_IMGLIB_FN (struct jpeg_error_mgr *, jpeg_std_error, (struct jpeg_error_mgr *)); 6068DEF_IMGLIB_FN (struct jpeg_error_mgr *, jpeg_std_error, (struct jpeg_error_mgr *));
6120DEF_IMGLIB_FN (boolean, jpeg_resync_to_restart, (j_decompress_ptr, int)); 6069DEF_IMGLIB_FN (boolean, jpeg_resync_to_restart, (j_decompress_ptr, int));
6121 6070
6122static int 6071static bool
6123init_jpeg_functions (void) 6072init_jpeg_functions (void)
6124{ 6073{
6125 HMODULE library; 6074 HMODULE library;
@@ -6389,7 +6338,7 @@ jpeg_file_src (j_decompress_ptr cinfo, FILE *fp)
6389/* Load image IMG for use on frame F. Patterned after example.c 6338/* Load image IMG for use on frame F. Patterned after example.c
6390 from the JPEG lib. */ 6339 from the JPEG lib. */
6391 6340
6392static int 6341static bool
6393jpeg_load_body (struct frame *f, struct image *img, 6342jpeg_load_body (struct frame *f, struct image *img,
6394 struct my_jpeg_error_mgr *mgr) 6343 struct my_jpeg_error_mgr *mgr)
6395{ 6344{
@@ -6570,7 +6519,7 @@ jpeg_load_body (struct frame *f, struct image *img,
6570 return 1; 6519 return 1;
6571} 6520}
6572 6521
6573static int 6522static bool
6574jpeg_load (struct frame *f, struct image *img) 6523jpeg_load (struct frame *f, struct image *img)
6575{ 6524{
6576 struct my_jpeg_error_mgr mgr; 6525 struct my_jpeg_error_mgr mgr;
@@ -6580,7 +6529,7 @@ jpeg_load (struct frame *f, struct image *img)
6580#else /* HAVE_JPEG */ 6529#else /* HAVE_JPEG */
6581 6530
6582#ifdef HAVE_NS 6531#ifdef HAVE_NS
6583static int 6532static bool
6584jpeg_load (struct frame *f, struct image *img) 6533jpeg_load (struct frame *f, struct image *img)
6585{ 6534{
6586 return ns_load_image (f, img, 6535 return ns_load_image (f, img,
@@ -6599,8 +6548,8 @@ jpeg_load (struct frame *f, struct image *img)
6599 6548
6600#if defined (HAVE_TIFF) || defined (HAVE_NS) 6549#if defined (HAVE_TIFF) || defined (HAVE_NS)
6601 6550
6602static int tiff_image_p (Lisp_Object object); 6551static bool tiff_image_p (Lisp_Object object);
6603static int tiff_load (struct frame *f, struct image *img); 6552static bool tiff_load (struct frame *f, struct image *img);
6604 6553
6605/* The symbol `tiff' identifying images of this type. */ 6554/* The symbol `tiff' identifying images of this type. */
6606 6555
@@ -6643,7 +6592,7 @@ static const struct image_keyword tiff_format[TIFF_LAST] =
6643}; 6592};
6644 6593
6645#ifdef HAVE_NTGUI 6594#ifdef HAVE_NTGUI
6646static int init_tiff_functions (void); 6595static bool init_tiff_functions (void);
6647#else 6596#else
6648#define init_tiff_functions NULL 6597#define init_tiff_functions NULL
6649#endif 6598#endif
@@ -6660,9 +6609,9 @@ static struct image_type tiff_type =
6660 NULL 6609 NULL
6661}; 6610};
6662 6611
6663/* Return non-zero if OBJECT is a valid TIFF image specification. */ 6612/* Return true if OBJECT is a valid TIFF image specification. */
6664 6613
6665static int 6614static bool
6666tiff_image_p (Lisp_Object object) 6615tiff_image_p (Lisp_Object object)
6667{ 6616{
6668 struct image_keyword fmt[TIFF_LAST]; 6617 struct image_keyword fmt[TIFF_LAST];
@@ -6696,7 +6645,7 @@ DEF_IMGLIB_FN (int, TIFFReadRGBAImage, (TIFF *, uint32, uint32, uint32 *, int));
6696DEF_IMGLIB_FN (void, TIFFClose, (TIFF *)); 6645DEF_IMGLIB_FN (void, TIFFClose, (TIFF *));
6697DEF_IMGLIB_FN (int, TIFFSetDirectory, (TIFF *, tdir_t)); 6646DEF_IMGLIB_FN (int, TIFFSetDirectory, (TIFF *, tdir_t));
6698 6647
6699static int 6648static bool
6700init_tiff_functions (void) 6649init_tiff_functions (void)
6701{ 6650{
6702 HMODULE library; 6651 HMODULE library;
@@ -6866,10 +6815,10 @@ tiff_warning_handler (const char *title, const char *format, va_list ap)
6866} 6815}
6867 6816
6868 6817
6869/* Load TIFF image IMG for use on frame F. Value is non-zero if 6818/* Load TIFF image IMG for use on frame F. Value is true if
6870 successful. */ 6819 successful. */
6871 6820
6872static int 6821static bool
6873tiff_load (struct frame *f, struct image *img) 6822tiff_load (struct frame *f, struct image *img)
6874{ 6823{
6875 Lisp_Object file, specified_file; 6824 Lisp_Object file, specified_file;
@@ -7034,7 +6983,7 @@ tiff_load (struct frame *f, struct image *img)
7034#else /* HAVE_TIFF */ 6983#else /* HAVE_TIFF */
7035 6984
7036#ifdef HAVE_NS 6985#ifdef HAVE_NS
7037static int 6986static bool
7038tiff_load (struct frame *f, struct image *img) 6987tiff_load (struct frame *f, struct image *img)
7039{ 6988{
7040 return ns_load_image (f, img, 6989 return ns_load_image (f, img,
@@ -7053,8 +7002,8 @@ tiff_load (struct frame *f, struct image *img)
7053 7002
7054#if defined (HAVE_GIF) || defined (HAVE_NS) 7003#if defined (HAVE_GIF) || defined (HAVE_NS)
7055 7004
7056static int gif_image_p (Lisp_Object object); 7005static bool gif_image_p (Lisp_Object object);
7057static int gif_load (struct frame *f, struct image *img); 7006static bool gif_load (struct frame *f, struct image *img);
7058static void gif_clear_image (struct frame *f, struct image *img); 7007static void gif_clear_image (struct frame *f, struct image *img);
7059 7008
7060/* The symbol `gif' identifying images of this type. */ 7009/* The symbol `gif' identifying images of this type. */
@@ -7098,7 +7047,7 @@ static const struct image_keyword gif_format[GIF_LAST] =
7098}; 7047};
7099 7048
7100#ifdef HAVE_NTGUI 7049#ifdef HAVE_NTGUI
7101static int init_gif_functions (void); 7050static bool init_gif_functions (void);
7102#else 7051#else
7103#define init_gif_functions NULL 7052#define init_gif_functions NULL
7104#endif 7053#endif
@@ -7124,9 +7073,9 @@ gif_clear_image (struct frame *f, struct image *img)
7124 x_clear_image (f, img); 7073 x_clear_image (f, img);
7125} 7074}
7126 7075
7127/* Return non-zero if OBJECT is a valid GIF image specification. */ 7076/* Return true if OBJECT is a valid GIF image specification. */
7128 7077
7129static int 7078static bool
7130gif_image_p (Lisp_Object object) 7079gif_image_p (Lisp_Object object)
7131{ 7080{
7132 struct image_keyword fmt[GIF_LAST]; 7081 struct image_keyword fmt[GIF_LAST];
@@ -7169,7 +7118,7 @@ DEF_IMGLIB_FN (int, DGifSlurp, (GifFileType *));
7169DEF_IMGLIB_FN (GifFileType *, DGifOpen, (void *, InputFunc)); 7118DEF_IMGLIB_FN (GifFileType *, DGifOpen, (void *, InputFunc));
7170DEF_IMGLIB_FN (GifFileType *, DGifOpenFileName, (const char *)); 7119DEF_IMGLIB_FN (GifFileType *, DGifOpenFileName, (const char *));
7171 7120
7172static int 7121static bool
7173init_gif_functions (void) 7122init_gif_functions (void)
7174{ 7123{
7175 HMODULE library; 7124 HMODULE library;
@@ -7223,7 +7172,7 @@ gif_read_from_memory (GifFileType *file, GifByteType *buf, int len)
7223} 7172}
7224 7173
7225 7174
7226/* Load GIF image IMG for use on frame F. Value is non-zero if 7175/* Load GIF image IMG for use on frame F. Value is true if
7227 successful. */ 7176 successful. */
7228 7177
7229static const int interlace_start[] = {0, 4, 2, 1}; 7178static const int interlace_start[] = {0, 4, 2, 1};
@@ -7231,7 +7180,7 @@ static const int interlace_increment[] = {8, 8, 4, 2};
7231 7180
7232#define GIF_LOCAL_DESCRIPTOR_EXTENSION 249 7181#define GIF_LOCAL_DESCRIPTOR_EXTENSION 249
7233 7182
7234static int 7183static bool
7235gif_load (struct frame *f, struct image *img) 7184gif_load (struct frame *f, struct image *img)
7236{ 7185{
7237 Lisp_Object file; 7186 Lisp_Object file;
@@ -7529,7 +7478,7 @@ gif_load (struct frame *f, struct image *img)
7529#else /* !HAVE_GIF */ 7478#else /* !HAVE_GIF */
7530 7479
7531#ifdef HAVE_NS 7480#ifdef HAVE_NS
7532static int 7481static bool
7533gif_load (struct frame *f, struct image *img) 7482gif_load (struct frame *f, struct image *img)
7534{ 7483{
7535 return ns_load_image (f, img, 7484 return ns_load_image (f, img,
@@ -7548,8 +7497,8 @@ gif_load (struct frame *f, struct image *img)
7548 7497
7549static Lisp_Object Qimagemagick; 7498static Lisp_Object Qimagemagick;
7550 7499
7551static int imagemagick_image_p (Lisp_Object); 7500static bool imagemagick_image_p (Lisp_Object);
7552static int imagemagick_load (struct frame *, struct image *); 7501static bool imagemagick_load (struct frame *, struct image *);
7553static void imagemagick_clear_image (struct frame *, struct image *); 7502static void imagemagick_clear_image (struct frame *, struct image *);
7554 7503
7555/* Indices of image specification fields in imagemagick_format. */ 7504/* Indices of image specification fields in imagemagick_format. */
@@ -7595,7 +7544,7 @@ static struct image_keyword imagemagick_format[IMAGEMAGICK_LAST] =
7595 }; 7544 };
7596 7545
7597#ifdef HAVE_NTGUI 7546#ifdef HAVE_NTGUI
7598static int init_imagemagick_functions (void); 7547static bool init_imagemagick_functions (void);
7599#else 7548#else
7600#define init_imagemagick_functions NULL 7549#define init_imagemagick_functions NULL
7601#endif 7550#endif
@@ -7622,11 +7571,11 @@ imagemagick_clear_image (struct frame *f,
7622 x_clear_image (f, img); 7571 x_clear_image (f, img);
7623} 7572}
7624 7573
7625/* Return non-zero if OBJECT is a valid IMAGEMAGICK image specification. Do 7574/* Return true if OBJECT is a valid IMAGEMAGICK image specification. Do
7626 this by calling parse_image_spec and supplying the keywords that 7575 this by calling parse_image_spec and supplying the keywords that
7627 identify the IMAGEMAGICK format. */ 7576 identify the IMAGEMAGICK format. */
7628 7577
7629static int 7578static bool
7630imagemagick_image_p (Lisp_Object object) 7579imagemagick_image_p (Lisp_Object object)
7631{ 7580{
7632 struct image_keyword fmt[IMAGEMAGICK_LAST]; 7581 struct image_keyword fmt[IMAGEMAGICK_LAST];
@@ -7678,9 +7627,9 @@ imagemagick_error (MagickWand *wand)
7678 be parsed; SIZE is the number of bytes of data; and FILENAME is 7627 be parsed; SIZE is the number of bytes of data; and FILENAME is
7679 either the file name or the image data. 7628 either the file name or the image data.
7680 7629
7681 Return non-zero if successful. */ 7630 Return true if successful. */
7682 7631
7683static int 7632static bool
7684imagemagick_load_image (struct frame *f, struct image *img, 7633imagemagick_load_image (struct frame *f, struct image *img,
7685 unsigned char *contents, unsigned int size, 7634 unsigned char *contents, unsigned int size,
7686 char *filename) 7635 char *filename)
@@ -8018,14 +7967,14 @@ imagemagick_load_image (struct frame *f, struct image *img,
8018} 7967}
8019 7968
8020 7969
8021/* Load IMAGEMAGICK image IMG for use on frame F. Value is non-zero if 7970/* Load IMAGEMAGICK image IMG for use on frame F. Value is true if
8022 successful. this function will go into the imagemagick_type structure, and 7971 successful. this function will go into the imagemagick_type structure, and
8023 the prototype thus needs to be compatible with that structure. */ 7972 the prototype thus needs to be compatible with that structure. */
8024 7973
8025static int 7974static bool
8026imagemagick_load (struct frame *f, struct image *img) 7975imagemagick_load (struct frame *f, struct image *img)
8027{ 7976{
8028 int success_p = 0; 7977 bool success_p = 0;
8029 Lisp_Object file_name; 7978 Lisp_Object file_name;
8030 7979
8031 /* If IMG->spec specifies a file name, create a non-file spec from it. */ 7980 /* If IMG->spec specifies a file name, create a non-file spec from it. */
@@ -8104,11 +8053,11 @@ and `imagemagick-types-inhibit'. */)
8104 8053
8105/* Function prototypes. */ 8054/* Function prototypes. */
8106 8055
8107static int svg_image_p (Lisp_Object object); 8056static bool svg_image_p (Lisp_Object object);
8108static int svg_load (struct frame *f, struct image *img); 8057static bool svg_load (struct frame *f, struct image *img);
8109 8058
8110static int svg_load_image (struct frame *, struct image *, 8059static bool svg_load_image (struct frame *, struct image *,
8111 unsigned char *, ptrdiff_t); 8060 unsigned char *, ptrdiff_t);
8112 8061
8113/* The symbol `svg' identifying images of this type. */ 8062/* The symbol `svg' identifying images of this type. */
8114 8063
@@ -8149,7 +8098,7 @@ static const struct image_keyword svg_format[SVG_LAST] =
8149}; 8098};
8150 8099
8151#ifdef HAVE_NTGUI 8100#ifdef HAVE_NTGUI
8152static int init_svg_functions (void); 8101static bool init_svg_functions (void);
8153#else 8102#else
8154#define init_svg_functions NULL 8103#define init_svg_functions NULL
8155#endif 8104#endif
@@ -8169,11 +8118,11 @@ static struct image_type svg_type =
8169}; 8118};
8170 8119
8171 8120
8172/* Return non-zero if OBJECT is a valid SVG image specification. Do 8121/* Return true if OBJECT is a valid SVG image specification. Do
8173 this by calling parse_image_spec and supplying the keywords that 8122 this by calling parse_image_spec and supplying the keywords that
8174 identify the SVG format. */ 8123 identify the SVG format. */
8175 8124
8176static int 8125static bool
8177svg_image_p (Lisp_Object object) 8126svg_image_p (Lisp_Object object)
8178{ 8127{
8179 struct image_keyword fmt[SVG_LAST]; 8128 struct image_keyword fmt[SVG_LAST];
@@ -8212,7 +8161,7 @@ DEF_IMGLIB_FN (void, g_error_free);
8212 8161
8213Lisp_Object Qgdk_pixbuf, Qglib, Qgobject; 8162Lisp_Object Qgdk_pixbuf, Qglib, Qgobject;
8214 8163
8215static int 8164static bool
8216init_svg_functions (void) 8165init_svg_functions (void)
8217{ 8166{
8218 HMODULE library, gdklib, glib, gobject; 8167 HMODULE library, gdklib, glib, gobject;
@@ -8268,14 +8217,13 @@ init_svg_functions (void)
8268#define fn_g_error_free g_error_free 8217#define fn_g_error_free g_error_free
8269#endif /* !HAVE_NTGUI */ 8218#endif /* !HAVE_NTGUI */
8270 8219
8271/* Load SVG image IMG for use on frame F. Value is non-zero if 8220/* Load SVG image IMG for use on frame F. Value is true if
8272 successful. this function will go into the svg_type structure, and 8221 successful. */
8273 the prototype thus needs to be compatible with that structure. */
8274 8222
8275static int 8223static bool
8276svg_load (struct frame *f, struct image *img) 8224svg_load (struct frame *f, struct image *img)
8277{ 8225{
8278 int success_p = 0; 8226 bool success_p = 0;
8279 Lisp_Object file_name; 8227 Lisp_Object file_name;
8280 8228
8281 /* If IMG->spec specifies a file name, create a non-file spec from it. */ 8229 /* If IMG->spec specifies a file name, create a non-file spec from it. */
@@ -8328,8 +8276,8 @@ svg_load (struct frame *f, struct image *img)
8328 8276
8329 Uses librsvg to do most of the image processing. 8277 Uses librsvg to do most of the image processing.
8330 8278
8331 Returns non-zero when successful. */ 8279 Returns true when successful. */
8332static int 8280static bool
8333svg_load_image (struct frame *f, /* Pointer to emacs frame structure. */ 8281svg_load_image (struct frame *f, /* Pointer to emacs frame structure. */
8334 struct image *img, /* Pointer to emacs image structure. */ 8282 struct image *img, /* Pointer to emacs image structure. */
8335 unsigned char *contents, /* String containing the SVG XML data to be parsed. */ 8283 unsigned char *contents, /* String containing the SVG XML data to be parsed. */
@@ -8496,8 +8444,8 @@ svg_load_image (struct frame *f, /* Pointer to emacs frame structure. *
8496 8444
8497#ifdef HAVE_GHOSTSCRIPT 8445#ifdef HAVE_GHOSTSCRIPT
8498 8446
8499static int gs_image_p (Lisp_Object object); 8447static bool gs_image_p (Lisp_Object object);
8500static int gs_load (struct frame *f, struct image *img); 8448static bool gs_load (struct frame *f, struct image *img);
8501static void gs_clear_image (struct frame *f, struct image *img); 8449static void gs_clear_image (struct frame *f, struct image *img);
8502 8450
8503/* Keyword symbols. */ 8451/* Keyword symbols. */
@@ -8566,10 +8514,10 @@ gs_clear_image (struct frame *f, struct image *img)
8566} 8514}
8567 8515
8568 8516
8569/* Return non-zero if OBJECT is a valid Ghostscript image 8517/* Return true if OBJECT is a valid Ghostscript image
8570 specification. */ 8518 specification. */
8571 8519
8572static int 8520static bool
8573gs_image_p (Lisp_Object object) 8521gs_image_p (Lisp_Object object)
8574{ 8522{
8575 struct image_keyword fmt[GS_LAST]; 8523 struct image_keyword fmt[GS_LAST];
@@ -8606,10 +8554,10 @@ gs_image_p (Lisp_Object object)
8606} 8554}
8607 8555
8608 8556
8609/* Load Ghostscript image IMG for use on frame F. Value is non-zero 8557/* Load Ghostscript image IMG for use on frame F. Value is true
8610 if successful. */ 8558 if successful. */
8611 8559
8612static int 8560static bool
8613gs_load (struct frame *f, struct image *img) 8561gs_load (struct frame *f, struct image *img)
8614{ 8562{
8615 uprintmax_t printnum1, printnum2; 8563 uprintmax_t printnum1, printnum2;
diff --git a/src/indent.c b/src/indent.c
index 053643e6319..b368a7aeb09 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -115,7 +115,7 @@ character_width (int c, struct Lisp_Char_Table *dp)
115 for characters as WIDTHTAB. We use this to decide when to 115 for characters as WIDTHTAB. We use this to decide when to
116 invalidate the buffer's width_run_cache. */ 116 invalidate the buffer's width_run_cache. */
117 117
118int 118bool
119disptab_matches_widthtab (struct Lisp_Char_Table *disptab, struct Lisp_Vector *widthtab) 119disptab_matches_widthtab (struct Lisp_Char_Table *disptab, struct Lisp_Vector *widthtab)
120{ 120{
121 int i; 121 int i;
@@ -320,14 +320,14 @@ invalidate_current_column (void)
320ptrdiff_t 320ptrdiff_t
321current_column (void) 321current_column (void)
322{ 322{
323 register ptrdiff_t col; 323 ptrdiff_t col;
324 register unsigned char *ptr, *stop; 324 unsigned char *ptr, *stop;
325 register int tab_seen; 325 bool tab_seen;
326 ptrdiff_t post_tab; 326 ptrdiff_t post_tab;
327 register int c; 327 int c;
328 int tab_width = SANE_TAB_WIDTH (current_buffer); 328 int tab_width = SANE_TAB_WIDTH (current_buffer);
329 int ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow)); 329 bool ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow));
330 register struct Lisp_Char_Table *dp = buffer_display_table (); 330 struct Lisp_Char_Table *dp = buffer_display_table ();
331 331
332 if (PT == last_known_column_point 332 if (PT == last_known_column_point
333 && MODIFF == last_known_column_modified) 333 && MODIFF == last_known_column_modified)
@@ -512,9 +512,9 @@ static void
512scan_for_column (ptrdiff_t *endpos, EMACS_INT *goalcol, ptrdiff_t *prevcol) 512scan_for_column (ptrdiff_t *endpos, EMACS_INT *goalcol, ptrdiff_t *prevcol)
513{ 513{
514 int tab_width = SANE_TAB_WIDTH (current_buffer); 514 int tab_width = SANE_TAB_WIDTH (current_buffer);
515 register int ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow)); 515 bool ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow));
516 register struct Lisp_Char_Table *dp = buffer_display_table (); 516 struct Lisp_Char_Table *dp = buffer_display_table ();
517 int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); 517 bool multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
518 struct composition_it cmp_it; 518 struct composition_it cmp_it;
519 Lisp_Object window; 519 Lisp_Object window;
520 struct window *w; 520 struct window *w;
@@ -722,14 +722,14 @@ current_column_1 (void)
722static double 722static double
723string_display_width (Lisp_Object string, Lisp_Object beg, Lisp_Object end) 723string_display_width (Lisp_Object string, Lisp_Object beg, Lisp_Object end)
724{ 724{
725 register int col; 725 int col;
726 register unsigned char *ptr, *stop; 726 unsigned char *ptr, *stop;
727 register int tab_seen; 727 bool tab_seen;
728 int post_tab; 728 int post_tab;
729 register int c; 729 int c;
730 int tab_width = SANE_TAB_WIDTH (current_buffer); 730 int tab_width = SANE_TAB_WIDTH (current_buffer);
731 int ctl_arrow = !NILP (current_buffer->ctl_arrow); 731 bool ctl_arrow = !NILP (current_buffer->ctl_arrow);
732 register struct Lisp_Char_Table *dp = buffer_display_table (); 732 struct Lisp_Char_Table *dp = buffer_display_table ();
733 int b, e; 733 int b, e;
734 734
735 if (NILP (end)) 735 if (NILP (end))
@@ -945,7 +945,7 @@ position_indentation (ptrdiff_t pos_byte)
945 Blank lines are treated as if they had the same indentation as the 945 Blank lines are treated as if they had the same indentation as the
946 preceding line. */ 946 preceding line. */
947 947
948int 948bool
949indented_beyond_p (ptrdiff_t pos, ptrdiff_t pos_byte, EMACS_INT column) 949indented_beyond_p (ptrdiff_t pos, ptrdiff_t pos_byte, EMACS_INT column)
950{ 950{
951 ptrdiff_t val; 951 ptrdiff_t val;
@@ -1047,11 +1047,11 @@ static struct position val_compute_motion;
1047 can't hit the requested column exactly (because of a tab or other 1047 can't hit the requested column exactly (because of a tab or other
1048 multi-column character), overshoot. 1048 multi-column character), overshoot.
1049 1049
1050 DID_MOTION is 1 if FROMHPOS has already accounted for overlay strings 1050 DID_MOTION is true if FROMHPOS has already accounted for overlay strings
1051 at FROM. This is the case if FROMVPOS and FROMVPOS came from an 1051 at FROM. This is the case if FROMVPOS and FROMVPOS came from an
1052 earlier call to compute_motion. The other common case is that FROMHPOS 1052 earlier call to compute_motion. The other common case is that FROMHPOS
1053 is zero and FROM is a position that "belongs" at column zero, but might 1053 is zero and FROM is a position that "belongs" at column zero, but might
1054 be shifted by overlay strings; in this case DID_MOTION should be 0. 1054 be shifted by overlay strings; in this case DID_MOTION should be false.
1055 1055
1056 WIDTH is the number of columns available to display text; 1056 WIDTH is the number of columns available to display text;
1057 compute_motion uses this to handle continuation lines and such. 1057 compute_motion uses this to handle continuation lines and such.
@@ -1104,17 +1104,20 @@ static struct position val_compute_motion;
1104 the scroll bars if they are turned on. */ 1104 the scroll bars if they are turned on. */
1105 1105
1106struct position * 1106struct position *
1107compute_motion (ptrdiff_t from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_motion, ptrdiff_t to, EMACS_INT tovpos, EMACS_INT tohpos, EMACS_INT width, ptrdiff_t hscroll, int tab_offset, struct window *win) 1107compute_motion (ptrdiff_t from, EMACS_INT fromvpos, EMACS_INT fromhpos,
1108 bool did_motion, ptrdiff_t to,
1109 EMACS_INT tovpos, EMACS_INT tohpos, EMACS_INT width,
1110 ptrdiff_t hscroll, int tab_offset, struct window *win)
1108{ 1111{
1109 register EMACS_INT hpos = fromhpos; 1112 EMACS_INT hpos = fromhpos;
1110 register EMACS_INT vpos = fromvpos; 1113 EMACS_INT vpos = fromvpos;
1111 1114
1112 register ptrdiff_t pos; 1115 ptrdiff_t pos;
1113 ptrdiff_t pos_byte; 1116 ptrdiff_t pos_byte;
1114 register int c = 0; 1117 int c = 0;
1115 int tab_width = SANE_TAB_WIDTH (current_buffer); 1118 int tab_width = SANE_TAB_WIDTH (current_buffer);
1116 register int ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow)); 1119 bool ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow));
1117 register struct Lisp_Char_Table *dp = window_display_table (win); 1120 struct Lisp_Char_Table *dp = window_display_table (win);
1118 EMACS_INT selective 1121 EMACS_INT selective
1119 = (INTEGERP (BVAR (current_buffer, selective_display)) 1122 = (INTEGERP (BVAR (current_buffer, selective_display))
1120 ? XINT (BVAR (current_buffer, selective_display)) 1123 ? XINT (BVAR (current_buffer, selective_display))
@@ -1139,7 +1142,7 @@ compute_motion (ptrdiff_t from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_
1139 ptrdiff_t next_width_run = from; 1142 ptrdiff_t next_width_run = from;
1140 Lisp_Object window; 1143 Lisp_Object window;
1141 1144
1142 int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); 1145 bool multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
1143 /* If previous char scanned was a wide character, 1146 /* If previous char scanned was a wide character,
1144 this is the column where it ended. Otherwise, this is 0. */ 1147 this is the column where it ended. Otherwise, this is 0. */
1145 EMACS_INT wide_column_end_hpos = 0; 1148 EMACS_INT wide_column_end_hpos = 0;
@@ -1308,7 +1311,7 @@ compute_motion (ptrdiff_t from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_
1308 if (hpos > width) 1311 if (hpos > width)
1309 { 1312 {
1310 EMACS_INT total_width = width + continuation_glyph_width; 1313 EMACS_INT total_width = width + continuation_glyph_width;
1311 int truncate = 0; 1314 bool truncate = 0;
1312 1315
1313 if (!NILP (Vtruncate_partial_width_windows) 1316 if (!NILP (Vtruncate_partial_width_windows)
1314 && (total_width < FRAME_COLS (XFRAME (WINDOW_FRAME (win))))) 1317 && (total_width < FRAME_COLS (XFRAME (WINDOW_FRAME (win)))))
@@ -1827,7 +1830,7 @@ vmotion (register ptrdiff_t from, register EMACS_INT vtarget, struct window *w)
1827 PTRDIFF_MAX) 1830 PTRDIFF_MAX)
1828 : !NILP (BVAR (current_buffer, selective_display)) ? -1 : 0); 1831 : !NILP (BVAR (current_buffer, selective_display)) ? -1 : 0);
1829 Lisp_Object window; 1832 Lisp_Object window;
1830 int did_motion; 1833 bool did_motion;
1831 /* This is the object we use for fetching character properties. */ 1834 /* This is the object we use for fetching character properties. */
1832 Lisp_Object text_prop_object; 1835 Lisp_Object text_prop_object;
1833 1836
@@ -2017,8 +2020,8 @@ whether or not it is currently displayed in some window. */)
2017 { 2020 {
2018 ptrdiff_t it_start, it_overshoot_count = 0; 2021 ptrdiff_t it_start, it_overshoot_count = 0;
2019 int first_x; 2022 int first_x;
2020 int overshoot_handled = 0; 2023 bool overshoot_handled = 0;
2021 int disp_string_at_start_p = 0; 2024 bool disp_string_at_start_p = 0;
2022 2025
2023 itdata = bidi_shelve_cache (); 2026 itdata = bidi_shelve_cache ();
2024 SET_TEXT_POS (pt, PT, PT_BYTE); 2027 SET_TEXT_POS (pt, PT, PT_BYTE);
diff --git a/src/indent.h b/src/indent.h
index e198137a756..abcd06036d1 100644
--- a/src/indent.h
+++ b/src/indent.h
@@ -27,7 +27,7 @@ struct position
27 }; 27 };
28 28
29struct position *compute_motion (ptrdiff_t from, EMACS_INT fromvpos, 29struct position *compute_motion (ptrdiff_t from, EMACS_INT fromvpos,
30 EMACS_INT fromhpos, int did_motion, 30 EMACS_INT fromhpos, bool did_motion,
31 ptrdiff_t to, EMACS_INT tovpos, 31 ptrdiff_t to, EMACS_INT tovpos,
32 EMACS_INT tohpos, 32 EMACS_INT tohpos,
33 EMACS_INT width, ptrdiff_t hscroll, 33 EMACS_INT width, ptrdiff_t hscroll,
@@ -45,8 +45,8 @@ extern ptrdiff_t last_known_column_point;
45/* Return true if the display table DISPTAB specifies the same widths 45/* Return true if the display table DISPTAB specifies the same widths
46 for characters as WIDTHTAB. We use this to decide when to 46 for characters as WIDTHTAB. We use this to decide when to
47 invalidate the buffer's column_cache. */ 47 invalidate the buffer's column_cache. */
48int disptab_matches_widthtab (struct Lisp_Char_Table *disptab, 48bool disptab_matches_widthtab (struct Lisp_Char_Table *disptab,
49 struct Lisp_Vector *widthtab); 49 struct Lisp_Vector *widthtab);
50 50
51/* Recompute BUF's width table, using the display table DISPTAB. */ 51/* Recompute BUF's width table, using the display table DISPTAB. */
52void recompute_width_table (struct buffer *buf, 52void recompute_width_table (struct buffer *buf,
diff --git a/src/lisp.h b/src/lisp.h
index cce7b52cfe5..665ed17dfd0 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3257,7 +3257,7 @@ extern void keys_of_keyboard (void);
3257/* Defined in indent.c. */ 3257/* Defined in indent.c. */
3258extern ptrdiff_t current_column (void); 3258extern ptrdiff_t current_column (void);
3259extern void invalidate_current_column (void); 3259extern void invalidate_current_column (void);
3260extern int indented_beyond_p (ptrdiff_t, ptrdiff_t, EMACS_INT); 3260extern bool indented_beyond_p (ptrdiff_t, ptrdiff_t, EMACS_INT);
3261extern void syms_of_indent (void); 3261extern void syms_of_indent (void);
3262 3262
3263/* Defined in frame.c. */ 3263/* Defined in frame.c. */
diff --git a/src/nsimage.m b/src/nsimage.m
index 668664c7a20..370cf832c7c 100644
--- a/src/nsimage.m
+++ b/src/nsimage.m
@@ -78,7 +78,7 @@ ns_image_from_file (Lisp_Object file)
78 return [EmacsImage allocInitFromFile: file]; 78 return [EmacsImage allocInitFromFile: file];
79} 79}
80 80
81int 81bool
82ns_load_image (struct frame *f, struct image *img, 82ns_load_image (struct frame *f, struct image *img,
83 Lisp_Object spec_file, Lisp_Object spec_data) 83 Lisp_Object spec_file, Lisp_Object spec_data)
84{ 84{
diff --git a/src/nsterm.h b/src/nsterm.h
index f3adab883a1..97fc6be20e5 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -749,11 +749,11 @@ extern Lisp_Object ns_cursor_type_to_lisp (int arg);
749extern void ns_set_name_as_filename (struct frame *f); 749extern void ns_set_name_as_filename (struct frame *f);
750extern void ns_set_doc_edited (struct frame *f, Lisp_Object arg); 750extern void ns_set_doc_edited (struct frame *f, Lisp_Object arg);
751 751
752extern int 752extern bool
753ns_defined_color (struct frame *f, 753ns_defined_color (struct frame *f,
754 const char *name, 754 const char *name,
755 XColor *color_def, int alloc, 755 XColor *color_def, bool alloc,
756 char makeIndex); 756 bool makeIndex);
757extern void 757extern void
758ns_query_color (void *col, XColor *color_def, int setPixel); 758ns_query_color (void *col, XColor *color_def, int setPixel);
759 759
@@ -799,8 +799,8 @@ struct image;
799extern void *ns_image_from_XBM (unsigned char *bits, int width, int height); 799extern void *ns_image_from_XBM (unsigned char *bits, int width, int height);
800extern void *ns_image_for_XPM (int width, int height, int depth); 800extern void *ns_image_for_XPM (int width, int height, int depth);
801extern void *ns_image_from_file (Lisp_Object file); 801extern void *ns_image_from_file (Lisp_Object file);
802extern int ns_load_image (struct frame *f, struct image *img, 802extern bool ns_load_image (struct frame *f, struct image *img,
803 Lisp_Object spec_file, Lisp_Object spec_data); 803 Lisp_Object spec_file, Lisp_Object spec_data);
804extern int ns_image_width (void *img); 804extern int ns_image_width (void *img);
805extern int ns_image_height (void *img); 805extern int ns_image_height (void *img);
806extern unsigned long ns_get_pixel (void *img, int x, int y); 806extern unsigned long ns_get_pixel (void *img, int x, int y);
diff --git a/src/nsterm.m b/src/nsterm.m
index cd9358f5582..5af3c2e2ae1 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -1575,18 +1575,18 @@ ns_query_color(void *col, XColor *color_def, int setPixel)
1575} 1575}
1576 1576
1577 1577
1578int 1578bool
1579ns_defined_color (struct frame *f, 1579ns_defined_color (struct frame *f,
1580 const char *name, 1580 const char *name,
1581 XColor *color_def, 1581 XColor *color_def,
1582 int alloc, 1582 bool alloc,
1583 char makeIndex) 1583 bool makeIndex)
1584/* -------------------------------------------------------------------------- 1584/* --------------------------------------------------------------------------
1585 Return 1 if named color found, and set color_def rgb accordingly. 1585 Return true if named color found, and set color_def rgb accordingly.
1586 If makeIndex and alloc are nonzero put the color in the color_table, 1586 If makeIndex and alloc are nonzero put the color in the color_table,
1587 and set color_def pixel to the resulting index. 1587 and set color_def pixel to the resulting index.
1588 If makeIndex is zero, set color_def pixel to ARGB. 1588 If makeIndex is zero, set color_def pixel to ARGB.
1589 Return 0 if not found 1589 Return false if not found
1590 -------------------------------------------------------------------------- */ 1590 -------------------------------------------------------------------------- */
1591{ 1591{
1592 NSColor *col; 1592 NSColor *col;
diff --git a/src/xfaces.c b/src/xfaces.c
index a11440d5bd0..28be6aaf082 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -991,7 +991,7 @@ parse_rgb_list (Lisp_Object rgb_list, XColor *color)
991 non-zero, then the `standard' definition of the same color is 991 non-zero, then the `standard' definition of the same color is
992 returned in it. */ 992 returned in it. */
993 993
994static int 994static bool
995tty_lookup_color (struct frame *f, Lisp_Object color, XColor *tty_color, 995tty_lookup_color (struct frame *f, Lisp_Object color, XColor *tty_color,
996 XColor *std_color) 996 XColor *std_color)
997{ 997{
@@ -1052,11 +1052,11 @@ tty_lookup_color (struct frame *f, Lisp_Object color, XColor *tty_color,
1052 1052
1053/* A version of defined_color for non-X frames. */ 1053/* A version of defined_color for non-X frames. */
1054 1054
1055static int 1055static bool
1056tty_defined_color (struct frame *f, const char *color_name, 1056tty_defined_color (struct frame *f, const char *color_name,
1057 XColor *color_def, int alloc) 1057 XColor *color_def, bool alloc)
1058{ 1058{
1059 int status = 1; 1059 bool status = 1;
1060 1060
1061 /* Defaults. */ 1061 /* Defaults. */
1062 color_def->pixel = FACE_TTY_DEFAULT_COLOR; 1062 color_def->pixel = FACE_TTY_DEFAULT_COLOR;
@@ -1084,13 +1084,13 @@ tty_defined_color (struct frame *f, const char *color_name,
1084 1084
1085/* Decide if color named COLOR_NAME is valid for the display 1085/* Decide if color named COLOR_NAME is valid for the display
1086 associated with the frame F; if so, return the rgb values in 1086 associated with the frame F; if so, return the rgb values in
1087 COLOR_DEF. If ALLOC is nonzero, allocate a new colormap cell. 1087 COLOR_DEF. If ALLOC, allocate a new colormap cell.
1088 1088
1089 This does the right thing for any type of frame. */ 1089 This does the right thing for any type of frame. */
1090 1090
1091static int 1091static bool
1092defined_color (struct frame *f, const char *color_name, XColor *color_def, 1092defined_color (struct frame *f, const char *color_name, XColor *color_def,
1093 int alloc) 1093 bool alloc)
1094{ 1094{
1095 if (!FRAME_WINDOW_P (f)) 1095 if (!FRAME_WINDOW_P (f))
1096 return tty_defined_color (f, color_name, color_def, alloc); 1096 return tty_defined_color (f, color_name, color_def, alloc);
diff --git a/src/xfns.c b/src/xfns.c
index 74808e6758f..928e6367743 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -575,15 +575,15 @@ gamma_correct (struct frame *f, XColor *color)
575 575
576 576
577/* Decide if color named COLOR_NAME is valid for use on frame F. If 577/* Decide if color named COLOR_NAME is valid for use on frame F. If
578 so, return the RGB values in COLOR. If ALLOC_P is non-zero, 578 so, return the RGB values in COLOR. If ALLOC_P,
579 allocate the color. Value is zero if COLOR_NAME is invalid, or 579 allocate the color. Value is false if COLOR_NAME is invalid, or
580 no color could be allocated. */ 580 no color could be allocated. */
581 581
582int 582bool
583x_defined_color (struct frame *f, const char *color_name, 583x_defined_color (struct frame *f, const char *color_name,
584 XColor *color, int alloc_p) 584 XColor *color, bool alloc_p)
585{ 585{
586 int success_p = 0; 586 bool success_p = 0;
587 Display *dpy = FRAME_X_DISPLAY (f); 587 Display *dpy = FRAME_X_DISPLAY (f);
588 Colormap cmap = FRAME_X_COLORMAP (f); 588 Colormap cmap = FRAME_X_COLORMAP (f);
589 589
@@ -592,7 +592,7 @@ x_defined_color (struct frame *f, const char *color_name,
592 success_p = xg_check_special_colors (f, color_name, color); 592 success_p = xg_check_special_colors (f, color_name, color);
593#endif 593#endif
594 if (!success_p) 594 if (!success_p)
595 success_p = XParseColor (dpy, cmap, color_name, color); 595 success_p = XParseColor (dpy, cmap, color_name, color) != 0;
596 if (success_p && alloc_p) 596 if (success_p && alloc_p)
597 success_p = x_alloc_nearest_color (f, cmap, color); 597 success_p = x_alloc_nearest_color (f, cmap, color);
598 unblock_input (); 598 unblock_input ();
diff --git a/src/xterm.c b/src/xterm.c
index c33fbf74c77..6cd1d583870 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -287,7 +287,7 @@ enum xembed_message
287 287
288/* Used in x_flush. */ 288/* Used in x_flush. */
289 289
290static int x_alloc_nearest_color_1 (Display *, Colormap, XColor *); 290static bool x_alloc_nearest_color_1 (Display *, Colormap, XColor *);
291static void x_set_window_size_1 (struct frame *, int, int, int); 291static void x_set_window_size_1 (struct frame *, int, int, int);
292static void x_raise_frame (struct frame *); 292static void x_raise_frame (struct frame *);
293static void x_lower_frame (struct frame *); 293static void x_lower_frame (struct frame *);
@@ -899,8 +899,8 @@ static void x_compute_glyph_string_overhangs (struct glyph_string *);
899static void x_set_cursor_gc (struct glyph_string *); 899static void x_set_cursor_gc (struct glyph_string *);
900static void x_set_mode_line_face_gc (struct glyph_string *); 900static void x_set_mode_line_face_gc (struct glyph_string *);
901static void x_set_mouse_face_gc (struct glyph_string *); 901static void x_set_mouse_face_gc (struct glyph_string *);
902static int x_alloc_lighter_color (struct frame *, Display *, Colormap, 902static bool x_alloc_lighter_color (struct frame *, Display *, Colormap,
903 unsigned long *, double, int); 903 unsigned long *, double, int);
904static void x_setup_relief_color (struct frame *, struct relief *, 904static void x_setup_relief_color (struct frame *, struct relief *,
905 double, int, unsigned long); 905 double, int, unsigned long);
906static void x_setup_relief_colors (struct glyph_string *); 906static void x_setup_relief_colors (struct glyph_string *);
@@ -1469,9 +1469,9 @@ x_frame_of_widget (Widget widget)
1469 If this produces the same color as PIXEL, try a color where all RGB 1469 If this produces the same color as PIXEL, try a color where all RGB
1470 values have DELTA added. Return the allocated color in *PIXEL. 1470 values have DELTA added. Return the allocated color in *PIXEL.
1471 DISPLAY is the X display, CMAP is the colormap to operate on. 1471 DISPLAY is the X display, CMAP is the colormap to operate on.
1472 Value is non-zero if successful. */ 1472 Value is true if successful. */
1473 1473
1474int 1474bool
1475x_alloc_lighter_color_for_widget (Widget widget, Display *display, Colormap cmap, 1475x_alloc_lighter_color_for_widget (Widget widget, Display *display, Colormap cmap,
1476 unsigned long *pixel, double factor, int delta) 1476 unsigned long *pixel, double factor, int delta)
1477{ 1477{
@@ -1696,15 +1696,15 @@ x_query_color (struct frame *f, XColor *color)
1696 1696
1697/* Allocate the color COLOR->pixel on DISPLAY, colormap CMAP. If an 1697/* Allocate the color COLOR->pixel on DISPLAY, colormap CMAP. If an
1698 exact match can't be allocated, try the nearest color available. 1698 exact match can't be allocated, try the nearest color available.
1699 Value is non-zero if successful. Set *COLOR to the color 1699 Value is true if successful. Set *COLOR to the color
1700 allocated. */ 1700 allocated. */
1701 1701
1702static int 1702static bool
1703x_alloc_nearest_color_1 (Display *dpy, Colormap cmap, XColor *color) 1703x_alloc_nearest_color_1 (Display *dpy, Colormap cmap, XColor *color)
1704{ 1704{
1705 int rc; 1705 bool rc;
1706 1706
1707 rc = XAllocColor (dpy, cmap, color); 1707 rc = XAllocColor (dpy, cmap, color) != 0;
1708 if (rc == 0) 1708 if (rc == 0)
1709 { 1709 {
1710 /* If we got to this point, the colormap is full, so we're going 1710 /* If we got to this point, the colormap is full, so we're going
@@ -1735,7 +1735,7 @@ x_alloc_nearest_color_1 (Display *dpy, Colormap cmap, XColor *color)
1735 color->red = cells[nearest].red; 1735 color->red = cells[nearest].red;
1736 color->green = cells[nearest].green; 1736 color->green = cells[nearest].green;
1737 color->blue = cells[nearest].blue; 1737 color->blue = cells[nearest].blue;
1738 rc = XAllocColor (dpy, cmap, color); 1738 rc = XAllocColor (dpy, cmap, color) != 0;
1739 } 1739 }
1740 else 1740 else
1741 { 1741 {
@@ -1768,10 +1768,10 @@ x_alloc_nearest_color_1 (Display *dpy, Colormap cmap, XColor *color)
1768 1768
1769/* Allocate the color COLOR->pixel on frame F, colormap CMAP. If an 1769/* Allocate the color COLOR->pixel on frame F, colormap CMAP. If an
1770 exact match can't be allocated, try the nearest color available. 1770 exact match can't be allocated, try the nearest color available.
1771 Value is non-zero if successful. Set *COLOR to the color 1771 Value is true if successful. Set *COLOR to the color
1772 allocated. */ 1772 allocated. */
1773 1773
1774int 1774bool
1775x_alloc_nearest_color (struct frame *f, Colormap cmap, XColor *color) 1775x_alloc_nearest_color (struct frame *f, Colormap cmap, XColor *color)
1776{ 1776{
1777 gamma_correct (f, color); 1777 gamma_correct (f, color);
@@ -1821,12 +1821,12 @@ x_copy_color (struct frame *f, long unsigned int pixel)
1821 DISPLAY is the X display, CMAP is the colormap to operate on. 1821 DISPLAY is the X display, CMAP is the colormap to operate on.
1822 Value is non-zero if successful. */ 1822 Value is non-zero if successful. */
1823 1823
1824static int 1824static bool
1825x_alloc_lighter_color (struct frame *f, Display *display, Colormap cmap, long unsigned int *pixel, double factor, int delta) 1825x_alloc_lighter_color (struct frame *f, Display *display, Colormap cmap, long unsigned int *pixel, double factor, int delta)
1826{ 1826{
1827 XColor color, new; 1827 XColor color, new;
1828 long bright; 1828 long bright;
1829 int success_p; 1829 bool success_p;
1830 1830
1831 /* Get RGB color values. */ 1831 /* Get RGB color values. */
1832 color.pixel = *pixel; 1832 color.pixel = *pixel;
diff --git a/src/xterm.h b/src/xterm.h
index 2d718f49118..4bc8f9813ed 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -962,11 +962,11 @@ extern XtAppContext Xt_app_con;
962extern void x_activate_timeout_atimer (void); 962extern void x_activate_timeout_atimer (void);
963#endif 963#endif
964#ifdef USE_LUCID 964#ifdef USE_LUCID
965extern int x_alloc_lighter_color_for_widget (Widget, Display *, Colormap, 965extern bool x_alloc_lighter_color_for_widget (Widget, Display *, Colormap,
966 unsigned long *, 966 unsigned long *,
967 double, int); 967 double, int);
968#endif 968#endif
969extern int x_alloc_nearest_color (struct frame *, Colormap, XColor *); 969extern bool x_alloc_nearest_color (struct frame *, Colormap, XColor *);
970extern void x_query_color (struct frame *f, XColor *); 970extern void x_query_color (struct frame *f, XColor *);
971extern void x_clear_area (Display *, Window, int, int, int, int, int); 971extern void x_clear_area (Display *, Window, int, int, int, int, int);
972#if defined HAVE_MENUS && !defined USE_X_TOOLKIT && !defined USE_GTK 972#if defined HAVE_MENUS && !defined USE_X_TOOLKIT && !defined USE_GTK
@@ -1034,7 +1034,7 @@ extern void xic_set_statusarea (struct frame *);
1034extern void xic_set_xfontset (struct frame *, const char *); 1034extern void xic_set_xfontset (struct frame *, const char *);
1035extern int x_pixel_width (struct frame *); 1035extern int x_pixel_width (struct frame *);
1036extern int x_pixel_height (struct frame *); 1036extern int x_pixel_height (struct frame *);
1037extern int x_defined_color (struct frame *, const char *, XColor *, int); 1037extern bool x_defined_color (struct frame *, const char *, XColor *, bool);
1038#ifdef HAVE_X_I18N 1038#ifdef HAVE_X_I18N
1039extern void free_frame_xic (struct frame *); 1039extern void free_frame_xic (struct frame *);
1040# if defined HAVE_X_WINDOWS && defined USE_X_TOOLKIT 1040# if defined HAVE_X_WINDOWS && defined USE_X_TOOLKIT