diff options
| author | Steven Tamm | 2004-12-03 17:00:11 +0000 |
|---|---|---|
| committer | Steven Tamm | 2004-12-03 17:00:11 +0000 |
| commit | d8f96db8dacbda24147aeab0af1c74f5ddbec8bb (patch) | |
| tree | 8366e98883775a322f0c52ae59441ef2ccc6569f /src/macmenu.c | |
| parent | 4e4b7d76d13bcf88958964be7ca722130b086cd0 (diff) | |
| download | emacs-d8f96db8dacbda24147aeab0af1c74f5ddbec8bb.tar.gz emacs-d8f96db8dacbda24147aeab0af1c74f5ddbec8bb.zip | |
* macterm.h (cfstring_create_with_utf8_cstring): Added prototype.
* image.c (image_load_quartz2d): Use
cfstring_create_with_utf8_cstring
* macmenu.c (add_menu_item): Use
cfstring_create_with_utf8_cstring
* macfns.c (x_set_name, x_set_title): Use
cfstring_create_with_utf8_cstring
(Fx_file_dialog): Use cfstring_create_with_utf8_cstring and use
constant CFRefs instead of creating them each time for labels.
* mac.c (cfstring_create_with_utf8_cstring): Added to prevent
crashes with invalid characters.
Diffstat (limited to 'src/macmenu.c')
| -rw-r--r-- | src/macmenu.c | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/src/macmenu.c b/src/macmenu.c index af24cfe237c..f0696a49774 100644 --- a/src/macmenu.c +++ b/src/macmenu.c | |||
| @@ -2264,17 +2264,8 @@ add_menu_item (MenuHandle menu, widget_value *wv, int submenu, | |||
| 2264 | item_name[255] = 0; | 2264 | item_name[255] = 0; |
| 2265 | #if TARGET_API_MAC_CARBON | 2265 | #if TARGET_API_MAC_CARBON |
| 2266 | { | 2266 | { |
| 2267 | CFStringRef string = | 2267 | CFStringRef string = cfstring_create_with_utf8_cstring (item_name); |
| 2268 | CFStringCreateWithCString (NULL, item_name, kCFStringEncodingUTF8); | 2268 | |
| 2269 | |||
| 2270 | if (string == NULL) | ||
| 2271 | { | ||
| 2272 | /* Failed to interpret as UTF8. Fall back to Mac Roman. | ||
| 2273 | Maybe wv->name is corrupted? */ | ||
| 2274 | string = CFStringCreateWithCString (NULL, item_name, | ||
| 2275 | kCFStringEncodingMacRoman); | ||
| 2276 | } | ||
| 2277 | |||
| 2278 | SetMenuItemTextWithCFString (menu, pos, string); | 2269 | SetMenuItemTextWithCFString (menu, pos, string); |
| 2279 | CFRelease (string); | 2270 | CFRelease (string); |
| 2280 | } | 2271 | } |