aboutsummaryrefslogtreecommitdiffstats
path: root/src/macfns.c
diff options
context:
space:
mode:
authorSteven Tamm2004-12-03 17:00:11 +0000
committerSteven Tamm2004-12-03 17:00:11 +0000
commitd8f96db8dacbda24147aeab0af1c74f5ddbec8bb (patch)
tree8366e98883775a322f0c52ae59441ef2ccc6569f /src/macfns.c
parent4e4b7d76d13bcf88958964be7ca722130b086cd0 (diff)
downloademacs-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/macfns.c')
-rw-r--r--src/macfns.c31
1 files changed, 9 insertions, 22 deletions
diff --git a/src/macfns.c b/src/macfns.c
index 9220bdd2798..fdfe7a52416 100644
--- a/src/macfns.c
+++ b/src/macfns.c
@@ -1932,8 +1932,7 @@ x_set_name (f, name, explicit)
1932 { 1932 {
1933#if TARGET_API_MAC_CARBON 1933#if TARGET_API_MAC_CARBON
1934 CFStringRef windowTitle = 1934 CFStringRef windowTitle =
1935 CFStringCreateWithCString (NULL, SDATA (name), 1935 cfstring_create_with_utf8_cstring (SDATA (name));
1936 kCFStringEncodingUTF8);
1937 1936
1938 SetWindowTitleWithCFString (FRAME_MAC_WINDOW (f), windowTitle); 1937 SetWindowTitleWithCFString (FRAME_MAC_WINDOW (f), windowTitle);
1939 CFRelease (windowTitle); 1938 CFRelease (windowTitle);
@@ -2015,8 +2014,7 @@ x_set_title (f, name, old_name)
2015 { 2014 {
2016#if TARGET_API_MAC_CARBON 2015#if TARGET_API_MAC_CARBON
2017 CFStringRef windowTitle = 2016 CFStringRef windowTitle =
2018 CFStringCreateWithCString (NULL, SDATA (name), 2017 cfstring_create_with_utf8_cstring (SDATA (name));
2019 kCFStringEncodingUTF8);
2020 2018
2021 SetWindowTitleWithCFString (FRAME_MAC_WINDOW (f), windowTitle); 2019 SetWindowTitleWithCFString (FRAME_MAC_WINDOW (f), windowTitle);
2022 CFRelease (windowTitle); 2020 CFRelease (windowTitle);
@@ -4246,8 +4244,7 @@ If ONLY-DIR-P is non-nil, the user can only select directories. */)
4246 NavDialogRef dialogRef; 4244 NavDialogRef dialogRef;
4247 NavTypeListHandle fileTypes = NULL; 4245 NavTypeListHandle fileTypes = NULL;
4248 NavUserAction userAction; 4246 NavUserAction userAction;
4249 CFStringRef message=NULL, client=NULL, saveName = NULL, ok = NULL; 4247 CFStringRef message=NULL, saveName = NULL;
4250 CFStringRef title = NULL;
4251 4248
4252 BLOCK_INPUT; 4249 BLOCK_INPUT;
4253 /* No need for a callback function because we are modal */ 4250 /* No need for a callback function because we are modal */
@@ -4259,15 +4256,11 @@ If ONLY-DIR-P is non-nil, the user can only select directories. */)
4259 options.optionFlags |= kNavSelectAllReadableItem; 4256 options.optionFlags |= kNavSelectAllReadableItem;
4260 if (!NILP(prompt)) 4257 if (!NILP(prompt))
4261 { 4258 {
4262 message = CFStringCreateWithCStringNoCopy(NULL, SDATA(prompt), 4259 message = cfstring_create_with_utf8_cstring (SDATA (prompt));
4263 kCFStringEncodingUTF8,
4264 kCFAllocatorNull);
4265 options.message = message; 4260 options.message = message;
4266 } 4261 }
4267 /* Don't set the application, let it use default. 4262 /* Don't set the application, let it use default.
4268 client = CFStringCreateWithCStringNoCopy(NULL, "Emacs", 4263 options.clientName = CFSTR ("Emacs");
4269 kCFStringEncodingMacRoman, NULL);
4270 options.clientName = client;
4271 */ 4264 */
4272 4265
4273 if (!NILP (only_dir_p)) 4266 if (!NILP (only_dir_p))
@@ -4276,17 +4269,14 @@ If ONLY-DIR-P is non-nil, the user can only select directories. */)
4276 else if (NILP (mustmatch)) 4269 else if (NILP (mustmatch))
4277 { 4270 {
4278 /* This is a save dialog */ 4271 /* This is a save dialog */
4279 ok = CFStringCreateWithCString (NULL, "Ok", kCFStringEncodingUTF8);
4280 title = CFStringCreateWithCString (NULL, "Enter name",
4281 kCFStringEncodingUTF8);
4282 options.optionFlags |= kNavDontConfirmReplacement; 4272 options.optionFlags |= kNavDontConfirmReplacement;
4283 options.actionButtonLabel = ok; 4273 options.actionButtonLabel = CFSTR ("Ok");
4284 options.windowTitle = title; 4274 options.windowTitle = CFSTR ("Enter name");
4285 4275
4286 if (!NILP(default_filename)) 4276 if (!NILP(default_filename))
4287 { 4277 {
4288 saveName = CFStringCreateWithCString(NULL, SDATA(default_filename), 4278 saveName =
4289 kCFStringEncodingUTF8); 4279 cfstring_create_with_utf8_cstring (SDATA (default_filename));
4290 options.saveFileName = saveName; 4280 options.saveFileName = saveName;
4291 options.optionFlags |= kNavSelectDefaultLocation; 4281 options.optionFlags |= kNavSelectDefaultLocation;
4292 } 4282 }
@@ -4320,10 +4310,7 @@ If ONLY-DIR-P is non-nil, the user can only select directories. */)
4320 } 4310 }
4321 4311
4322 if (saveName) CFRelease(saveName); 4312 if (saveName) CFRelease(saveName);
4323 if (client) CFRelease(client);
4324 if (message) CFRelease(message); 4313 if (message) CFRelease(message);
4325 if (ok) CFRelease(ok);
4326 if (title) CFRelease(title);
4327 4314
4328 if (status == noErr) { 4315 if (status == noErr) {
4329 userAction = NavDialogGetUserAction(dialogRef); 4316 userAction = NavDialogGetUserAction(dialogRef);