mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-09 13:10:57 -08:00
(single_submenu, xmenu_show) [!HAVE_MULTILINGUAL_MENU]:
Protect unibyte strings created by replacing their multibyte equivalents in menu_items.
This commit is contained in:
parent
e15e282807
commit
4c329aa8be
2 changed files with 54 additions and 27 deletions
|
|
@ -1,5 +1,9 @@
|
|||
2001-05-29 Gerd Moellmann <gerd@gnu.org>
|
||||
|
||||
* xmenu.c (single_submenu, xmenu_show) [!HAVE_MULTILINGUAL_MENU]:
|
||||
Protect unibyte strings created by replacing their multibyte
|
||||
equivalents in menu_items.
|
||||
|
||||
* keymap.c (Fsingle_key_description): NUL-terminate the string
|
||||
buffer before calling build_string.
|
||||
|
||||
|
|
|
|||
77
src/xmenu.c
77
src/xmenu.c
|
|
@ -1441,11 +1441,16 @@ single_submenu (item_key, item_name, maps)
|
|||
/* Create a new pane. */
|
||||
Lisp_Object pane_name, prefix;
|
||||
char *pane_string;
|
||||
|
||||
pane_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_NAME];
|
||||
prefix = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_PREFIX];
|
||||
|
||||
#ifndef HAVE_MULTILINGUAL_MENU
|
||||
if (STRINGP (pane_name) && STRING_MULTIBYTE (pane_name))
|
||||
pane_name = string_make_unibyte (pane_name);
|
||||
{
|
||||
pane_name = string_make_unibyte (pane_name);
|
||||
AREF (menu_items, i + MENU_ITEMS_PANE_NAME) = pane_name;
|
||||
}
|
||||
#endif
|
||||
pane_string = (NILP (pane_name)
|
||||
? "" : (char *) XSTRING (pane_name)->data);
|
||||
|
|
@ -1483,21 +1488,27 @@ single_submenu (item_key, item_name, maps)
|
|||
Lisp_Object item_name, enable, descrip, def, type, selected;
|
||||
Lisp_Object help;
|
||||
|
||||
item_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_NAME];
|
||||
enable = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_ENABLE];
|
||||
descrip
|
||||
= XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY];
|
||||
def = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_DEFINITION];
|
||||
type = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_TYPE];
|
||||
selected = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_SELECTED];
|
||||
help = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_HELP];
|
||||
item_name = AREF (menu_items, i + MENU_ITEMS_ITEM_NAME);
|
||||
enable = AREF (menu_items, i + MENU_ITEMS_ITEM_ENABLE);
|
||||
descrip = AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY);
|
||||
def = AREF (menu_items, i + MENU_ITEMS_ITEM_DEFINITION);
|
||||
type = AREF (menu_items, i + MENU_ITEMS_ITEM_TYPE);
|
||||
selected = AREF (menu_items, i + MENU_ITEMS_ITEM_SELECTED);
|
||||
help = AREF (menu_items, i + MENU_ITEMS_ITEM_HELP);
|
||||
|
||||
#ifndef HAVE_MULTILINGUAL_MENU
|
||||
if (STRING_MULTIBYTE (item_name))
|
||||
item_name = string_make_unibyte (item_name);
|
||||
{
|
||||
item_name = string_make_unibyte (item_name);
|
||||
AREF (menu_items, i + MENU_ITEMS_ITEM_NAME) = item_name;
|
||||
}
|
||||
|
||||
if (STRINGP (descrip) && STRING_MULTIBYTE (descrip))
|
||||
descrip = string_make_unibyte (descrip);
|
||||
#endif
|
||||
{
|
||||
descrip = string_make_unibyte (descrip);
|
||||
AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY) = descrip;
|
||||
}
|
||||
#endif /* not HAVE_MULTILINGUAL_MENU */
|
||||
|
||||
wv = xmalloc_widget_value ();
|
||||
if (prev_wv)
|
||||
|
|
@ -2020,11 +2031,16 @@ xmenu_show (f, x, y, for_click, keymaps, title, error)
|
|||
/* Create a new pane. */
|
||||
Lisp_Object pane_name, prefix;
|
||||
char *pane_string;
|
||||
pane_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_NAME];
|
||||
prefix = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_PREFIX];
|
||||
|
||||
pane_name = AREF (menu_items, i + MENU_ITEMS_PANE_NAME);
|
||||
prefix = AREF (menu_items, i + MENU_ITEMS_PANE_PREFIX);
|
||||
|
||||
#ifndef HAVE_MULTILINGUAL_MENU
|
||||
if (!NILP (pane_name) && STRING_MULTIBYTE (pane_name))
|
||||
pane_name = string_make_unibyte (pane_name);
|
||||
if (STRINGP (pane_name) && STRING_MULTIBYTE (pane_name))
|
||||
{
|
||||
pane_name = string_make_unibyte (pane_name);
|
||||
AREF (menu_items, i + MENU_ITEMS_PANE_NAME) = pane_name;
|
||||
}
|
||||
#endif
|
||||
pane_string = (NILP (pane_name)
|
||||
? "" : (char *) XSTRING (pane_name)->data);
|
||||
|
|
@ -2064,21 +2080,27 @@ xmenu_show (f, x, y, for_click, keymaps, title, error)
|
|||
{
|
||||
/* Create a new item within current pane. */
|
||||
Lisp_Object item_name, enable, descrip, def, type, selected, help;
|
||||
item_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_NAME];
|
||||
enable = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_ENABLE];
|
||||
descrip
|
||||
= XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY];
|
||||
def = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_DEFINITION];
|
||||
type = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_TYPE];
|
||||
selected = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_SELECTED];
|
||||
help = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_HELP];
|
||||
item_name = AREF (menu_items, i + MENU_ITEMS_ITEM_NAME);
|
||||
enable = AREF (menu_items, i + MENU_ITEMS_ITEM_ENABLE);
|
||||
descrip = AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY);
|
||||
def = AREF (menu_items, i + MENU_ITEMS_ITEM_DEFINITION);
|
||||
type = AREF (menu_items, i + MENU_ITEMS_ITEM_TYPE);
|
||||
selected = AREF (menu_items, i + MENU_ITEMS_ITEM_SELECTED);
|
||||
help = AREF (menu_items, i + MENU_ITEMS_ITEM_HELP);
|
||||
|
||||
#ifndef HAVE_MULTILINGUAL_MENU
|
||||
if (STRINGP (item_name) && STRING_MULTIBYTE (item_name))
|
||||
item_name = string_make_unibyte (item_name);
|
||||
{
|
||||
item_name = string_make_unibyte (item_name);
|
||||
AREF (menu_items, i + MENU_ITEMS_ITEM_NAME) = item_name;
|
||||
}
|
||||
|
||||
if (STRINGP (descrip) && STRING_MULTIBYTE (descrip))
|
||||
descrip = string_make_unibyte (descrip);
|
||||
#endif
|
||||
{
|
||||
descrip = string_make_unibyte (descrip);
|
||||
AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY) = descrip;
|
||||
}
|
||||
#endif /* not HAVE_MULTILINGUAL_MENU */
|
||||
|
||||
wv = xmalloc_widget_value ();
|
||||
if (prev_wv)
|
||||
|
|
@ -2132,6 +2154,7 @@ xmenu_show (f, x, y, for_click, keymaps, title, error)
|
|||
if (STRING_MULTIBYTE (title))
|
||||
title = string_make_unibyte (title);
|
||||
#endif
|
||||
|
||||
wv_title->name = (char *) XSTRING (title)->data;
|
||||
wv_title->enabled = True;
|
||||
wv_title->button_type = BUTTON_TYPE_NONE;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue