From: Eli Zaretskii Date: Thu, 29 Jan 2015 17:16:56 +0000 (+0200) Subject: Use bool for boolean in w32menu.c, w32font.c, w32uniscribe.c. X-Git-Tag: emacs-25.0.90~2572^2~25 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=0761ec1669d6125d555ec39d2b938ce3562874af;p=emacs.git Use bool for boolean in w32menu.c, w32font.c, w32uniscribe.c. src/w32uniscribe.c (uniscribe_list, uniscribe_match): Use bool where appropriate. src/w32font.c (struct font_callback_data, w32font_list_internal) (w32font_driver, w32font_match_internal): Use bool where appropriate. src/w32menu.c (x_activate_menubar, set_frame_menubar) (w32_dialog_show, initialize_frame_menubar, w32_menu_show) (is_simple_dialog): Use bool where appropriate. --- diff --git a/src/w32font.c b/src/w32font.c index ab772679908..360ad3f1c48 100644 --- a/src/w32font.c +++ b/src/w32font.c @@ -95,7 +95,7 @@ struct font_callback_data /* The list to add matches to. */ Lisp_Object list; /* Whether to match only opentype fonts. */ - int opentype_only; + bool opentype_only; }; /* Handles the problem that EnumFontFamiliesEx will not return all @@ -746,7 +746,8 @@ w32font_otf_drive (struct font *font, Lisp_Object features, Additional parameter opentype_only restricts the returned fonts to opentype fonts, which can be used with the Uniscribe backend. */ Lisp_Object -w32font_list_internal (struct frame *f, Lisp_Object font_spec, int opentype_only) +w32font_list_internal (struct frame *f, Lisp_Object font_spec, + bool opentype_only) { struct font_callback_data match_data; HDC dc; @@ -798,7 +799,8 @@ w32font_list_internal (struct frame *f, Lisp_Object font_spec, int opentype_only Additional parameter opentype_only restricts the returned fonts to opentype fonts, which can be used with the Uniscribe backend. */ Lisp_Object -w32font_match_internal (struct frame *f, Lisp_Object font_spec, int opentype_only) +w32font_match_internal (struct frame *f, Lisp_Object font_spec, + bool opentype_only) { struct font_callback_data match_data; HDC dc; @@ -2459,7 +2461,7 @@ w32font_filter_properties (Lisp_Object font, Lisp_Object alist) struct font_driver w32font_driver = { LISP_INITIALLY_ZERO, /* Qgdi */ - 0, /* case insensitive */ + false, /* case insensitive */ w32font_get_cache, w32font_list, w32font_match, diff --git a/src/w32font.h b/src/w32font.h index 82c5e09b9fc..0ad01254be9 100644 --- a/src/w32font.h +++ b/src/w32font.h @@ -66,10 +66,10 @@ struct w32font_info Lisp_Object w32font_get_cache (struct frame *fe); Lisp_Object w32font_list_internal (struct frame *f, Lisp_Object font_spec, - int opentype_only); + bool opentype_only); Lisp_Object w32font_match_internal (struct frame *f, Lisp_Object font_spec, - int opentype_only); + bool opentype_only); int w32font_open_internal (struct frame *f, Lisp_Object font_entity, int pixel_size, Lisp_Object font_object); void w32font_close (struct font *font); diff --git a/src/w32menu.c b/src/w32menu.c index 2a1dafbd6d7..40b8f5f82a0 100644 --- a/src/w32menu.c +++ b/src/w32menu.c @@ -103,7 +103,7 @@ void set_frame_menubar (struct frame *, bool, bool); #ifdef HAVE_DIALOGS static Lisp_Object w32_dialog_show (struct frame *, Lisp_Object, Lisp_Object, char **); #else -static int is_simple_dialog (Lisp_Object); +static bool is_simple_dialog (Lisp_Object); static Lisp_Object simple_dialog_show (struct frame *, Lisp_Object, Lisp_Object); #endif @@ -166,7 +166,7 @@ w32_popup_dialog (struct frame *f, Lisp_Object header, Lisp_Object contents) void x_activate_menubar (struct frame *f) { - set_frame_menubar (f, 0, 1); + set_frame_menubar (f, false, true); /* Lock out further menubar changes while active. */ f->output_data.w32->menubar_active = 1; @@ -289,7 +289,7 @@ set_frame_menubar (struct frame *f, bool first_time, bool deep_p) XSETFRAME (Vmenu_updating_frame, f); if (! menubar_widget) - deep_p = 1; + deep_p = true; if (deep_p) { @@ -388,7 +388,7 @@ set_frame_menubar (struct frame *f, bool first_time, bool deep_p) else first_wv->contents = wv; /* Don't set wv->name here; GC during the loop might relocate it. */ - wv->enabled = 1; + wv->enabled = true; wv->button_type = BUTTON_TYPE_NONE; prev_wv = wv; } @@ -501,7 +501,7 @@ set_frame_menubar (struct frame *f, bool first_time, bool deep_p) /* Force the window size to be recomputed so that the frame's text area remains the same, if menubar has just been created. */ if (old_widget == NULL) - adjust_frame_size (f, -1, -1, 2, 0, Qmenu_bar_lines); + adjust_frame_size (f, -1, -1, 2, false, Qmenu_bar_lines); } unblock_input (); @@ -518,7 +518,7 @@ initialize_frame_menubar (struct frame *f) /* This function is called before the first chance to redisplay the frame. It has to be, so the frame will have the right size. */ fset_menu_bar_items (f, menu_bar_items (FRAME_MENU_BAR_ITEMS (f))); - set_frame_menubar (f, 1, 1); + set_frame_menubar (f, true, true); } /* Get rid of the menu bar of frame F, and free its storage. @@ -570,7 +570,7 @@ w32_menu_show (struct frame *f, int x, int y, int menuflags, Lisp_Object *subprefix_stack = (Lisp_Object *) alloca (menu_items_used * word_size); int submenu_depth = 0; - int first_pane; + bool first_pane; *error = NULL; @@ -590,7 +590,7 @@ w32_menu_show (struct frame *f, int x, int y, int menuflags, wv = make_widget_value ("menu", NULL, true, Qnil); wv->button_type = BUTTON_TYPE_NONE; first_wv = wv; - first_pane = 1; + first_pane = true; /* Loop over all panes and items, filling in the tree. */ i = 0; @@ -601,14 +601,14 @@ w32_menu_show (struct frame *f, int x, int y, int menuflags, submenu_stack[submenu_depth++] = save_wv; save_wv = prev_wv; prev_wv = 0; - first_pane = 1; + first_pane = false; i++; } else if (EQ (AREF (menu_items, i), Qlambda)) { prev_wv = save_wv; save_wv = submenu_stack[--submenu_depth]; - first_pane = 0; + first_pane = false; i++; } else if (EQ (AREF (menu_items, i), Qt) @@ -664,7 +664,7 @@ w32_menu_show (struct frame *f, int x, int y, int menuflags, save_wv = wv; prev_wv = 0; } - first_pane = 0; + first_pane = false; i += MENU_ITEMS_PANE_LENGTH; } else @@ -883,8 +883,9 @@ w32_dialog_show (struct frame *f, Lisp_Object title, /* Number of elements seen so far, before boundary. */ int left_count = 0; - /* 1 means we've seen the boundary between left-hand elts and right-hand. */ - int boundary_seen = 0; + /* true means we've seen the boundary between left-hand elts and + right-hand. */ + bool boundary_seen = false; *error = NULL; @@ -928,7 +929,7 @@ w32_dialog_show (struct frame *f, Lisp_Object title, { /* This is the boundary between left-side elts and right-side elts. Stop incrementing right_count. */ - boundary_seen = 1; + boundary_seen = true; i++; continue; } @@ -986,7 +987,7 @@ w32_dialog_show (struct frame *f, Lisp_Object title, /* Actually create the dialog. */ dialog_id = widget_id_tick++; menu = lw_create_widget (first_wv->name, "dialog", dialog_id, first_wv, - f->output_data.w32->widget, 1, 0, + f->output_data.w32->widget, true, 0, dialog_selection_callback, 0); lw_modify_all_widgets (dialog_id, first_wv->contents, TRUE); @@ -1037,25 +1038,25 @@ w32_dialog_show (struct frame *f, Lisp_Object title, anywhere in Emacs that uses the other specific dialog choices that MessageBox provides. */ -static int +static bool is_simple_dialog (Lisp_Object contents) { Lisp_Object options; Lisp_Object name, yes, no, other; if (!CONSP (contents)) - return 0; + return false; options = XCDR (contents); yes = build_string ("Yes"); no = build_string ("No"); if (!CONSP (options)) - return 0; + return false; name = XCAR (options); if (!CONSP (name)) - return 0; + return false; name = XCAR (name); if (!NILP (Fstring_equal (name, yes))) @@ -1063,18 +1064,18 @@ is_simple_dialog (Lisp_Object contents) else if (!NILP (Fstring_equal (name, no))) other = yes; else - return 0; + return false; options = XCDR (options); if (!CONSP (options)) - return 0; + return false; name = XCAR (options); if (!CONSP (name)) - return 0; + return false; name = XCAR (name); if (NILP (Fstring_equal (name, other))) - return 0; + return false; /* Check there are no more options. */ options = XCDR (options); diff --git a/src/w32uniscribe.c b/src/w32uniscribe.c index 9cd97e28616..73c0410c7b7 100644 --- a/src/w32uniscribe.c +++ b/src/w32uniscribe.c @@ -67,7 +67,7 @@ memq_no_quit (Lisp_Object elt, Lisp_Object list) static Lisp_Object uniscribe_list (struct frame *f, Lisp_Object font_spec) { - Lisp_Object fonts = w32font_list_internal (f, font_spec, 1); + Lisp_Object fonts = w32font_list_internal (f, font_spec, true); FONT_ADD_LOG ("uniscribe-list", font_spec, fonts); return fonts; } @@ -75,7 +75,7 @@ uniscribe_list (struct frame *f, Lisp_Object font_spec) static Lisp_Object uniscribe_match (struct frame *f, Lisp_Object font_spec) { - Lisp_Object entity = w32font_match_internal (f, font_spec, 1); + Lisp_Object entity = w32font_match_internal (f, font_spec, true); FONT_ADD_LOG ("uniscribe-match", font_spec, entity); return entity; }