summaryrefslogtreecommitdiff
path: root/src/os
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2008-07-31 14:00:01 +0000
committerbjarni <bjarni@openttd.org>2008-07-31 14:00:01 +0000
commit05040910b85528e598a6b3573223b9ad1ab1ace6 (patch)
treeab9c43669ceb2ccbcedae0d9600e5e3db8a12745 /src/os
parentb52ce85021d1d935203e9d0173603783dca04cf5 (diff)
downloadopenttd-05040910b85528e598a6b3573223b9ad1ab1ace6.tar.xz
(svn r13893) -Fix: [OSX] solved a deprecated warning specific to 10.5
Diffstat (limited to 'src/os')
-rw-r--r--src/os/macosx/macos.mm21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/os/macosx/macos.mm b/src/os/macosx/macos.mm
index ca8954f49..c1e872a57 100644
--- a/src/os/macosx/macos.mm
+++ b/src/os/macosx/macos.mm
@@ -171,18 +171,23 @@ const char *GetCurrentLocale(const char *)
NSString* preferredLang = [languages objectAtIndex:0];
/* preferredLang is either 2 or 5 characters long ("xx" or "xx_YY"). */
- /* MacOS 10.3.9 can't handle encoding:NSASCIIStringEncoding
- * we will completely disable compiling it for such old targets to avoid a warning */
-#if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_3)
- /* Note: MAC_OS_X_VERSION_MAX_ALLOWED is the current OSX version/SDK by default */
+ /* Since Apple introduced encoding to CString in OSX 10.4 we have to make a few conditions
+ * to get the right code for the used version of OSX. */
+#if (MAC_OS_X_VERSION_MAX_ALLOWED == MAC_OS_X_VERSION_10_4)
+ /* 10.4 can compile both versions just fine and will select the correct version at runtime based
+ * on the version of OSX at execution time. */
if (MacOSVersionIsAtLeast(10, 4, 0)) {
[ preferredLang getCString:retbuf maxLength:32 encoding:NSASCIIStringEncoding ];
- } else {
-#else
- /* 10.3.9 needs to start the { too */
+ } else
+#endif
{
+ [ preferredLang getCString:retbuf maxLength:32
+#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
+ /* If 10.5+ is used to compile then encoding is needed here.
+ * If 10.3 or 10.4 is used for compiling then this line is used by 10.3 and encoding should not be present here. */
+ encoding:NSASCIIStringEncoding
#endif
- [ preferredLang getCString:retbuf maxLength:32 ];
+ ];
}
return retbuf;
}