diff options
| author | Gerd Moellmann | 2001-05-29 14:31:01 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2001-05-29 14:31:01 +0000 |
| commit | 4c329aa8be20b6cf7692e2e996fb281353c4fa02 (patch) | |
| tree | 048f3df2af4b42e4d97d6a87fc3e081eac09924f /src/xmenu.c | |
| parent | e15e282807fd5d0e96f6d49099d2b6a20e6ab30d (diff) | |
| download | emacs-4c329aa8be20b6cf7692e2e996fb281353c4fa02.tar.gz emacs-4c329aa8be20b6cf7692e2e996fb281353c4fa02.zip | |
(single_submenu, xmenu_show) [!HAVE_MULTILINGUAL_MENU]:
Protect unibyte strings created by replacing their multibyte
equivalents in menu_items.
Diffstat (limited to 'src/xmenu.c')
| -rw-r--r-- | src/xmenu.c | 77 |
1 files changed, 50 insertions, 27 deletions
diff --git a/src/xmenu.c b/src/xmenu.c index e87743b0057..d6ee9056a55 100644 --- a/src/xmenu.c +++ b/src/xmenu.c | |||
| @@ -1441,11 +1441,16 @@ single_submenu (item_key, item_name, maps) | |||
| 1441 | /* Create a new pane. */ | 1441 | /* Create a new pane. */ |
| 1442 | Lisp_Object pane_name, prefix; | 1442 | Lisp_Object pane_name, prefix; |
| 1443 | char *pane_string; | 1443 | char *pane_string; |
| 1444 | |||
| 1444 | pane_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_NAME]; | 1445 | pane_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_NAME]; |
| 1445 | prefix = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_PREFIX]; | 1446 | prefix = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_PREFIX]; |
| 1447 | |||
| 1446 | #ifndef HAVE_MULTILINGUAL_MENU | 1448 | #ifndef HAVE_MULTILINGUAL_MENU |
| 1447 | if (STRINGP (pane_name) && STRING_MULTIBYTE (pane_name)) | 1449 | if (STRINGP (pane_name) && STRING_MULTIBYTE (pane_name)) |
| 1448 | pane_name = string_make_unibyte (pane_name); | 1450 | { |
| 1451 | pane_name = string_make_unibyte (pane_name); | ||
| 1452 | AREF (menu_items, i + MENU_ITEMS_PANE_NAME) = pane_name; | ||
| 1453 | } | ||
| 1449 | #endif | 1454 | #endif |
| 1450 | pane_string = (NILP (pane_name) | 1455 | pane_string = (NILP (pane_name) |
| 1451 | ? "" : (char *) XSTRING (pane_name)->data); | 1456 | ? "" : (char *) XSTRING (pane_name)->data); |
| @@ -1483,21 +1488,27 @@ single_submenu (item_key, item_name, maps) | |||
| 1483 | Lisp_Object item_name, enable, descrip, def, type, selected; | 1488 | Lisp_Object item_name, enable, descrip, def, type, selected; |
| 1484 | Lisp_Object help; | 1489 | Lisp_Object help; |
| 1485 | 1490 | ||
| 1486 | item_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_NAME]; | 1491 | item_name = AREF (menu_items, i + MENU_ITEMS_ITEM_NAME); |
| 1487 | enable = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_ENABLE]; | 1492 | enable = AREF (menu_items, i + MENU_ITEMS_ITEM_ENABLE); |
| 1488 | descrip | 1493 | descrip = AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY); |
| 1489 | = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY]; | 1494 | def = AREF (menu_items, i + MENU_ITEMS_ITEM_DEFINITION); |
| 1490 | def = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_DEFINITION]; | 1495 | type = AREF (menu_items, i + MENU_ITEMS_ITEM_TYPE); |
| 1491 | type = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_TYPE]; | 1496 | selected = AREF (menu_items, i + MENU_ITEMS_ITEM_SELECTED); |
| 1492 | selected = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_SELECTED]; | 1497 | help = AREF (menu_items, i + MENU_ITEMS_ITEM_HELP); |
| 1493 | help = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_HELP]; | ||
| 1494 | 1498 | ||
| 1495 | #ifndef HAVE_MULTILINGUAL_MENU | 1499 | #ifndef HAVE_MULTILINGUAL_MENU |
| 1496 | if (STRING_MULTIBYTE (item_name)) | 1500 | if (STRING_MULTIBYTE (item_name)) |
| 1497 | item_name = string_make_unibyte (item_name); | 1501 | { |
| 1502 | item_name = string_make_unibyte (item_name); | ||
| 1503 | AREF (menu_items, i + MENU_ITEMS_ITEM_NAME) = item_name; | ||
| 1504 | } | ||
| 1505 | |||
| 1498 | if (STRINGP (descrip) && STRING_MULTIBYTE (descrip)) | 1506 | if (STRINGP (descrip) && STRING_MULTIBYTE (descrip)) |
| 1499 | descrip = string_make_unibyte (descrip); | 1507 | { |
| 1500 | #endif | 1508 | descrip = string_make_unibyte (descrip); |
| 1509 | AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY) = descrip; | ||
| 1510 | } | ||
| 1511 | #endif /* not HAVE_MULTILINGUAL_MENU */ | ||
| 1501 | 1512 | ||
| 1502 | wv = xmalloc_widget_value (); | 1513 | wv = xmalloc_widget_value (); |
| 1503 | if (prev_wv) | 1514 | if (prev_wv) |
| @@ -2020,11 +2031,16 @@ xmenu_show (f, x, y, for_click, keymaps, title, error) | |||
| 2020 | /* Create a new pane. */ | 2031 | /* Create a new pane. */ |
| 2021 | Lisp_Object pane_name, prefix; | 2032 | Lisp_Object pane_name, prefix; |
| 2022 | char *pane_string; | 2033 | char *pane_string; |
| 2023 | pane_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_NAME]; | 2034 | |
| 2024 | prefix = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_PREFIX]; | 2035 | pane_name = AREF (menu_items, i + MENU_ITEMS_PANE_NAME); |
| 2036 | prefix = AREF (menu_items, i + MENU_ITEMS_PANE_PREFIX); | ||
| 2037 | |||
| 2025 | #ifndef HAVE_MULTILINGUAL_MENU | 2038 | #ifndef HAVE_MULTILINGUAL_MENU |
| 2026 | if (!NILP (pane_name) && STRING_MULTIBYTE (pane_name)) | 2039 | if (STRINGP (pane_name) && STRING_MULTIBYTE (pane_name)) |
| 2027 | pane_name = string_make_unibyte (pane_name); | 2040 | { |
| 2041 | pane_name = string_make_unibyte (pane_name); | ||
| 2042 | AREF (menu_items, i + MENU_ITEMS_PANE_NAME) = pane_name; | ||
| 2043 | } | ||
| 2028 | #endif | 2044 | #endif |
| 2029 | pane_string = (NILP (pane_name) | 2045 | pane_string = (NILP (pane_name) |
| 2030 | ? "" : (char *) XSTRING (pane_name)->data); | 2046 | ? "" : (char *) XSTRING (pane_name)->data); |
| @@ -2064,21 +2080,27 @@ xmenu_show (f, x, y, for_click, keymaps, title, error) | |||
| 2064 | { | 2080 | { |
| 2065 | /* Create a new item within current pane. */ | 2081 | /* Create a new item within current pane. */ |
| 2066 | Lisp_Object item_name, enable, descrip, def, type, selected, help; | 2082 | Lisp_Object item_name, enable, descrip, def, type, selected, help; |
| 2067 | item_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_NAME]; | 2083 | item_name = AREF (menu_items, i + MENU_ITEMS_ITEM_NAME); |
| 2068 | enable = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_ENABLE]; | 2084 | enable = AREF (menu_items, i + MENU_ITEMS_ITEM_ENABLE); |
| 2069 | descrip | 2085 | descrip = AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY); |
| 2070 | = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY]; | 2086 | def = AREF (menu_items, i + MENU_ITEMS_ITEM_DEFINITION); |
| 2071 | def = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_DEFINITION]; | 2087 | type = AREF (menu_items, i + MENU_ITEMS_ITEM_TYPE); |
| 2072 | type = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_TYPE]; | 2088 | selected = AREF (menu_items, i + MENU_ITEMS_ITEM_SELECTED); |
| 2073 | selected = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_SELECTED]; | 2089 | help = AREF (menu_items, i + MENU_ITEMS_ITEM_HELP); |
| 2074 | help = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_HELP]; | ||
| 2075 | 2090 | ||
| 2076 | #ifndef HAVE_MULTILINGUAL_MENU | 2091 | #ifndef HAVE_MULTILINGUAL_MENU |
| 2077 | if (STRINGP (item_name) && STRING_MULTIBYTE (item_name)) | 2092 | if (STRINGP (item_name) && STRING_MULTIBYTE (item_name)) |
| 2078 | item_name = string_make_unibyte (item_name); | 2093 | { |
| 2094 | item_name = string_make_unibyte (item_name); | ||
| 2095 | AREF (menu_items, i + MENU_ITEMS_ITEM_NAME) = item_name; | ||
| 2096 | } | ||
| 2097 | |||
| 2079 | if (STRINGP (descrip) && STRING_MULTIBYTE (descrip)) | 2098 | if (STRINGP (descrip) && STRING_MULTIBYTE (descrip)) |
| 2080 | descrip = string_make_unibyte (descrip); | 2099 | { |
| 2081 | #endif | 2100 | descrip = string_make_unibyte (descrip); |
| 2101 | AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY) = descrip; | ||
| 2102 | } | ||
| 2103 | #endif /* not HAVE_MULTILINGUAL_MENU */ | ||
| 2082 | 2104 | ||
| 2083 | wv = xmalloc_widget_value (); | 2105 | wv = xmalloc_widget_value (); |
| 2084 | if (prev_wv) | 2106 | if (prev_wv) |
| @@ -2132,6 +2154,7 @@ xmenu_show (f, x, y, for_click, keymaps, title, error) | |||
| 2132 | if (STRING_MULTIBYTE (title)) | 2154 | if (STRING_MULTIBYTE (title)) |
| 2133 | title = string_make_unibyte (title); | 2155 | title = string_make_unibyte (title); |
| 2134 | #endif | 2156 | #endif |
| 2157 | |||
| 2135 | wv_title->name = (char *) XSTRING (title)->data; | 2158 | wv_title->name = (char *) XSTRING (title)->data; |
| 2136 | wv_title->enabled = True; | 2159 | wv_title->enabled = True; |
| 2137 | wv_title->button_type = BUTTON_TYPE_NONE; | 2160 | wv_title->button_type = BUTTON_TYPE_NONE; |