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/mac.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/mac.c')
| -rw-r--r-- | src/mac.c | 16 |
1 files changed, 16 insertions, 0 deletions
| @@ -262,6 +262,22 @@ posix_to_mac_pathname (const char *ufn, char *mfn, int mfnbuflen) | |||
| 262 | return 1; | 262 | return 1; |
| 263 | } | 263 | } |
| 264 | 264 | ||
| 265 | #if TARGET_API_MAC_CARBON | ||
| 266 | CFStringRef | ||
| 267 | cfstring_create_with_utf8_cstring (c_str) | ||
| 268 | const char *c_str; | ||
| 269 | { | ||
| 270 | CFStringRef str; | ||
| 271 | |||
| 272 | str = CFStringCreateWithCString (NULL, c_str, kCFStringEncodingUTF8); | ||
| 273 | if (str == NULL) | ||
| 274 | /* Failed to interpret as UTF 8. Fall back on Mac Roman. */ | ||
| 275 | str = CFStringCreateWithCString (NULL, c_str, kCFStringEncodingMacRoman); | ||
| 276 | |||
| 277 | return str; | ||
| 278 | } | ||
| 279 | #endif | ||
| 280 | |||
| 265 | #ifndef MAC_OSX | 281 | #ifndef MAC_OSX |
| 266 | 282 | ||
| 267 | /* The following functions with "sys_" prefix are stubs to Unix | 283 | /* The following functions with "sys_" prefix are stubs to Unix |