Mercurial > emacs
comparison src/xmenu.c @ 109748:e2f8226efb99
Fix -Wwrite_strings in general and for Gtk+ specific code.
* callproc.c (synch_process_death): Make const.
(Fcall_process): Make signame const.
* emacs.c (main): Pass char[] to putenv instead of literal.
* floatfns.c (matherr): Use a const char* variable for x->name.
* font.c (font_open_by_name): Make name const.
* font.h (font_open_by_name): Make name const.
* gtkutil.c (get_utf8_string): Always return an allocated string.
Parameter is const.
(create_dialog, xg_create_one_menuitem, create_menus)
(xg_item_label_same_p, xg_update_menu_item): Free result from
get_utf8_string.
(xg_separator_p, xg_item_label_same_p): label is const.
* gtkutil.h: Replace widget_value with struct _widget_value.
(enum button_type, struct _widget_value): Remove and use the one from
keyboard.h.
* keyboard.h (_widget_value): Add defined USE_GTK. Replace Boolean
with unsigned char and XtPointer with void *.
* menu.c (Fx_popup_menu): error_name is const.
* menu.h (w32_menu_show, ns_menu_show, xmenu_show): error parameter
is const char **.
* w32menu.c (w32_menu_show):
* nsmenu.m (ns_menu_show): error parameter is const char **.
* process.h (synch_process_death): Is const char*.
* xmenu.c (Fx_popup_dialog): error_name is const char*.
(xmenu_show): error parameter is const char **. pane_string is const
char *.
(button_names): Is const char *.
(xdialog_show): error_name and pane_string is const.
* xrdb.c (get_system_app): Make path const and use char *p for non-const
char.
* xselect.c (Fx_get_atom_name): Use char empty[] instead of literal "".
* xsmfns.c (NOSPLASH_OPT): Change to char[].
(smc_save_yourself_CB): Do xstrdup on all ->type and ->name for
props. Free them at the end.
* xterm.c (emacs_class): New char[] for EMACS_CLASS.
(xim_open_dpy, xim_initialize, xim_close_dpy): Use emacs_class.
(x_term_init): Use char[] display_opt and name_opt instead of
string literal. file is const char*.
author | Jan D <jan.h.d@swipnet.se> |
---|---|
date | Wed, 11 Aug 2010 14:34:46 +0200 |
parents | 8ee3605b9d8a |
children | 0217a9452703 |
comparison
equal
deleted
inserted
replaced
109747:1f617baf8ae5 | 109748:e2f8226efb99 |
---|---|
109 | 109 |
110 Lisp_Object Qdebug_on_next_call; | 110 Lisp_Object Qdebug_on_next_call; |
111 | 111 |
112 #if defined (USE_X_TOOLKIT) || defined (USE_GTK) | 112 #if defined (USE_X_TOOLKIT) || defined (USE_GTK) |
113 static Lisp_Object xdialog_show (FRAME_PTR, int, Lisp_Object, Lisp_Object, | 113 static Lisp_Object xdialog_show (FRAME_PTR, int, Lisp_Object, Lisp_Object, |
114 char **); | 114 const char **); |
115 #endif | 115 #endif |
116 | 116 |
117 static int update_frame_menubar (struct frame *); | 117 static int update_frame_menubar (struct frame *); |
118 | 118 |
119 /* Flag which when set indicates a dialog or menu has been posted by | 119 /* Flag which when set indicates a dialog or menu has been posted by |
310 Fcons (Fcar (contents), Fcons (contents, Qnil))); | 310 Fcons (Fcar (contents), Fcons (contents, Qnil))); |
311 } | 311 } |
312 #else | 312 #else |
313 { | 313 { |
314 Lisp_Object title; | 314 Lisp_Object title; |
315 char *error_name; | 315 const char *error_name; |
316 Lisp_Object selection; | 316 Lisp_Object selection; |
317 int specpdl_count = SPECPDL_INDEX (); | 317 int specpdl_count = SPECPDL_INDEX (); |
318 | 318 |
319 /* Decode the dialog items from what was specified. */ | 319 /* Decode the dialog items from what was specified. */ |
320 title = Fcar (contents); | 320 title = Fcar (contents); |
1598 | 1598 |
1599 #endif /* not USE_GTK */ | 1599 #endif /* not USE_GTK */ |
1600 | 1600 |
1601 Lisp_Object | 1601 Lisp_Object |
1602 xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, | 1602 xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, |
1603 Lisp_Object title, char **error, EMACS_UINT timestamp) | 1603 Lisp_Object title, const char **error, EMACS_UINT timestamp) |
1604 { | 1604 { |
1605 int i; | 1605 int i; |
1606 widget_value *wv, *save_wv = 0, *first_wv = 0, *prev_wv = 0; | 1606 widget_value *wv, *save_wv = 0, *first_wv = 0, *prev_wv = 0; |
1607 widget_value **submenu_stack | 1607 widget_value **submenu_stack |
1608 = (widget_value **) alloca (menu_items_used * sizeof (widget_value *)); | 1608 = (widget_value **) alloca (menu_items_used * sizeof (widget_value *)); |
1662 i += 1; | 1662 i += 1; |
1663 else if (EQ (XVECTOR (menu_items)->contents[i], Qt)) | 1663 else if (EQ (XVECTOR (menu_items)->contents[i], Qt)) |
1664 { | 1664 { |
1665 /* Create a new pane. */ | 1665 /* Create a new pane. */ |
1666 Lisp_Object pane_name, prefix; | 1666 Lisp_Object pane_name, prefix; |
1667 char *pane_string; | 1667 const char *pane_string; |
1668 | 1668 |
1669 pane_name = AREF (menu_items, i + MENU_ITEMS_PANE_NAME); | 1669 pane_name = AREF (menu_items, i + MENU_ITEMS_PANE_NAME); |
1670 prefix = AREF (menu_items, i + MENU_ITEMS_PANE_PREFIX); | 1670 prefix = AREF (menu_items, i + MENU_ITEMS_PANE_PREFIX); |
1671 | 1671 |
1672 #ifndef HAVE_MULTILINGUAL_MENU | 1672 #ifndef HAVE_MULTILINGUAL_MENU |
1974 } | 1974 } |
1975 } | 1975 } |
1976 | 1976 |
1977 #endif /* not USE_GTK */ | 1977 #endif /* not USE_GTK */ |
1978 | 1978 |
1979 static char * button_names [] = { | 1979 static const char * button_names [] = { |
1980 "button1", "button2", "button3", "button4", "button5", | 1980 "button1", "button2", "button3", "button4", "button5", |
1981 "button6", "button7", "button8", "button9", "button10" }; | 1981 "button6", "button7", "button8", "button9", "button10" }; |
1982 | 1982 |
1983 static Lisp_Object | 1983 static Lisp_Object |
1984 xdialog_show (FRAME_PTR f, int keymaps, Lisp_Object title, Lisp_Object header, char **error_name) | 1984 xdialog_show (FRAME_PTR f, |
1985 int keymaps, | |
1986 Lisp_Object title, | |
1987 Lisp_Object header, | |
1988 const char **error_name) | |
1985 { | 1989 { |
1986 int i, nb_buttons=0; | 1990 int i, nb_buttons=0; |
1987 char dialog_name[6]; | 1991 char dialog_name[6]; |
1988 | 1992 |
1989 widget_value *wv, *first_wv = 0, *prev_wv = 0; | 1993 widget_value *wv, *first_wv = 0, *prev_wv = 0; |
2006 | 2010 |
2007 /* Create a tree of widget_value objects | 2011 /* Create a tree of widget_value objects |
2008 representing the text label and buttons. */ | 2012 representing the text label and buttons. */ |
2009 { | 2013 { |
2010 Lisp_Object pane_name, prefix; | 2014 Lisp_Object pane_name, prefix; |
2011 char *pane_string; | 2015 const char *pane_string; |
2012 pane_name = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_NAME]; | 2016 pane_name = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_NAME]; |
2013 prefix = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_PREFIX]; | 2017 prefix = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_PREFIX]; |
2014 pane_string = (NILP (pane_name) | 2018 pane_string = (NILP (pane_name) |
2015 ? "" : (char *) SDATA (pane_name)); | 2019 ? "" : (char *) SDATA (pane_name)); |
2016 prev_wv = xmalloc_widget_value (); | 2020 prev_wv = xmalloc_widget_value (); |