diff options
author | Michael Lutz <michi@icosahedron.de> | 2020-04-10 23:53:07 +0200 |
---|---|---|
committer | Michael Lutz <michi@icosahedron.de> | 2020-04-12 18:44:43 +0200 |
commit | e9294ce4e30409fa84755fb7a77fb2770d433e62 (patch) | |
tree | 9fefa8ba7cc8b85183d47e0887cbc10acddc9cde /src/os/macosx/macos.mm | |
parent | c21a298a8ae13caa975367229855dc29622ddcf5 (diff) | |
download | openttd-e9294ce4e30409fa84755fb7a77fb2770d433e62.tar.xz |
Cleanup: [OSX] Mop up some remaining stuff catering to compiling with very old SDK versions.
Diffstat (limited to 'src/os/macosx/macos.mm')
-rw-r--r-- | src/os/macosx/macos.mm | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/src/os/macosx/macos.mm b/src/os/macosx/macos.mm index 33d2ad219..19e1d4b76 100644 --- a/src/os/macosx/macos.mm +++ b/src/os/macosx/macos.mm @@ -161,19 +161,8 @@ const char *GetCurrentLocale(const char *) NSString *preferredLang = [ languages objectAtIndex:0 ]; /* preferredLang is either 2 or 5 characters long ("xx" or "xx_YY"). */ - /* 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) - if (MacOSVersionIsAtLeast(10, 4, 0)) { - [ preferredLang getCString:retbuf maxLength:32 encoding:NSASCIIStringEncoding ]; - } else -#endif - { -#if (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_4) - /* maxLength does not include the \0 char in contrast to the call above. */ - [ preferredLang getCString:retbuf maxLength:31 ]; -#endif - } + [ preferredLang getCString:retbuf maxLength:32 encoding:NSASCIIStringEncoding ]; + return retbuf; } @@ -213,7 +202,7 @@ bool IsMonospaceFont(CFStringRef name) { NSFont *font = [ NSFont fontWithName:(__bridge NSString *)name size:0.0f ]; - return font != NULL ? [ font isFixedPitch ] : false; + return font != nil ? [ font isFixedPitch ] : false; } /** @@ -222,14 +211,12 @@ bool IsMonospaceFont(CFStringRef name) */ void MacOSSetThreadName(const char *name) { -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6) if (MacOSVersionIsAtLeast(10, 6, 0)) { pthread_setname_np(name); } -#endif NSThread *cur = [ NSThread currentThread ]; - if (cur != NULL && [ cur respondsToSelector:@selector(setName:) ]) { + if (cur != nil && [ cur respondsToSelector:@selector(setName:) ]) { [ cur performSelector:@selector(setName:) withObject:[ NSString stringWithUTF8String:name ] ]; } } |