changeset 13204:09d2a8dd8714 draft

(svn r17711) -Codechange: [OSX] Don't use deprecated methods to construct a Cocoa string.
author michi_cc <michi_cc@openttd.org>
date Sun, 04 Oct 2009 21:33:31 +0000
parents 3e4abcf964bc
children af865b6b074e
files src/os/macosx/macos.mm src/video/cocoa/cocoa_v.mm src/video/cocoa/wnd_quartz.mm src/video/cocoa/wnd_quickdraw.mm
diffstat 4 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/os/macosx/macos.mm
+++ b/src/os/macosx/macos.mm
@@ -59,7 +59,7 @@
 
 void ShowMacDialog(const char *title, const char *message, const char *buttonLabel)
 {
-	NSRunAlertPanel([NSString stringWithCString: title], [NSString stringWithCString: message], [NSString stringWithCString: buttonLabel], nil, nil);
+	NSRunAlertPanel([ NSString stringWithUTF8String:title ], [ NSString stringWithUTF8String:message ], [ NSString stringWithUTF8String:buttonLabel ], nil, nil);
 }
 
 #elif defined WITH_COCOA
--- a/src/video/cocoa/cocoa_v.mm
+++ b/src/video/cocoa/cocoa_v.mm
@@ -405,7 +405,7 @@
 	}
 
 	QZ_ShowMouse();
-	NSRunAlertPanel([NSString stringWithCString: title], [NSString stringWithCString: message], [NSString stringWithCString: buttonLabel], nil, nil);
+	NSRunAlertPanel([ NSString stringWithUTF8String:title ], [ NSString stringWithUTF8String:message ], [ NSString stringWithUTF8String:buttonLabel ], nil, nil);
 
 	if (!wasstarted && _video_driver != NULL) _video_driver->Stop();
 
--- a/src/video/cocoa/wnd_quartz.mm
+++ b/src/video/cocoa/wnd_quartz.mm
@@ -428,7 +428,6 @@
 bool WindowQuartzSubdriver::SetVideoMode(int width, int height)
 {
 	char caption[50];
-	NSString *nsscaption;
 	unsigned int style;
 	NSRect contentRect;
 	BOOL isCustom = NO;
@@ -470,7 +469,7 @@
 		[ window setDriver:this ];
 
 		snprintf(caption, sizeof(caption), "OpenTTD %s", _openttd_revision);
-		nsscaption = [ [ NSString alloc ] initWithCString:caption ];
+		NSString *nsscaption = [ [ NSString alloc ] initWithUTF8String:caption ];
 		[ window setTitle: nsscaption ];
 		[ window setMiniwindowTitle: nsscaption ];
 		[ nsscaption release ];
--- a/src/video/cocoa/wnd_quickdraw.mm
+++ b/src/video/cocoa/wnd_quickdraw.mm
@@ -402,7 +402,7 @@
 		[ window setDriver:this ];
 
 		snprintf(caption, sizeof(caption), "OpenTTD %s", _openttd_revision);
-		nsscaption = [ [ NSString alloc ] initWithCString:caption ];
+		nsscaption = [ [ NSString alloc ] initWithUTF8String:caption ];
 		[ window setTitle:nsscaption ];
 		[ window setMiniwindowTitle:nsscaption ];
 		[ nsscaption release ];