Mercurial > emacs
comparison src/macmenu.c @ 58752:4ad0594e1ac4
* 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.
author | Steven Tamm <steventamm@mac.com> |
---|---|
date | Fri, 03 Dec 2004 17:00:11 +0000 |
parents | 60340bd28043 |
children | c4138f578114 f2ebccfa87d4 |
comparison
equal
deleted
inserted
replaced
58751:0cb8dbb527b9 | 58752:4ad0594e1ac4 |
---|---|
2262 strncat (item_name, wv->key, 255); | 2262 strncat (item_name, wv->key, 255); |
2263 } | 2263 } |
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 } |
2281 #else | 2272 #else |
2282 c2pstr (item_name); | 2273 c2pstr (item_name); |