mirror of https://github.com/OpenTTD/OpenTTD
Cleanup: [OSX] Mop up some remaining stuff catering to compiling with very old SDK versions.
parent
c21a298a8a
commit
e9294ce4e3
|
@ -63,10 +63,12 @@ class CrashLogOSX : public CrashLog {
|
||||||
" Name: Mac OS X\n"
|
" Name: Mac OS X\n"
|
||||||
" Release: %d.%d.%d\n"
|
" Release: %d.%d.%d\n"
|
||||||
" Machine: %s\n"
|
" Machine: %s\n"
|
||||||
" Min Ver: %d\n",
|
" Min Ver: %d\n"
|
||||||
|
" Max Ver: %d\n",
|
||||||
ver_maj, ver_min, ver_bug,
|
ver_maj, ver_min, ver_bug,
|
||||||
arch != nullptr ? arch->description : "unknown",
|
arch != nullptr ? arch->description : "unknown",
|
||||||
MAC_OS_X_VERSION_MIN_REQUIRED
|
MAC_OS_X_VERSION_MIN_REQUIRED,
|
||||||
|
MAC_OS_X_VERSION_MAX_ALLOWED
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -161,19 +161,8 @@ const char *GetCurrentLocale(const char *)
|
||||||
NSString *preferredLang = [ languages objectAtIndex:0 ];
|
NSString *preferredLang = [ languages objectAtIndex:0 ];
|
||||||
/* preferredLang is either 2 or 5 characters long ("xx" or "xx_YY"). */
|
/* 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
|
[ preferredLang getCString:retbuf maxLength:32 encoding:NSASCIIStringEncoding ];
|
||||||
* 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
|
|
||||||
}
|
|
||||||
return retbuf;
|
return retbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -213,7 +202,7 @@ bool IsMonospaceFont(CFStringRef name)
|
||||||
{
|
{
|
||||||
NSFont *font = [ NSFont fontWithName:(__bridge NSString *)name size:0.0f ];
|
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)
|
void MacOSSetThreadName(const char *name)
|
||||||
{
|
{
|
||||||
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6)
|
|
||||||
if (MacOSVersionIsAtLeast(10, 6, 0)) {
|
if (MacOSVersionIsAtLeast(10, 6, 0)) {
|
||||||
pthread_setname_np(name);
|
pthread_setname_np(name);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
NSThread *cur = [ NSThread currentThread ];
|
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 ] ];
|
[ cur performSelector:@selector(setName:) withObject:[ NSString stringWithUTF8String:name ] ];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
#include <CoreFoundation/CoreFoundation.h>
|
#include <CoreFoundation/CoreFoundation.h>
|
||||||
|
|
||||||
|
|
||||||
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
|
|
||||||
|
|
||||||
/* CTRunDelegateCreate is supported since MacOS X 10.5, but was only included in the SDKs starting with the 10.9 SDK. */
|
/* CTRunDelegateCreate is supported since MacOS X 10.5, but was only included in the SDKs starting with the 10.9 SDK. */
|
||||||
#ifndef HAVE_OSX_109_SDK
|
#ifndef HAVE_OSX_109_SDK
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -435,23 +433,3 @@ int MacOSStringCompare(const char *s1, const char *s2)
|
||||||
|
|
||||||
return new OSXStringIterator();
|
return new OSXStringIterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
|
||||||
void MacOSResetScriptCache(FontSize size) {}
|
|
||||||
void MacOSSetCurrentLocaleName(const char *iso_code) {}
|
|
||||||
|
|
||||||
int MacOSStringCompare(const char *s1, const char *s2)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* static */ StringIterator *OSXStringIterator::Create()
|
|
||||||
{
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* static */ ParagraphLayouter *CoreTextParagraphLayoutFactory::GetParagraphLayout(CharType *buff, CharType *buff_end, FontMap &fontMapping)
|
|
||||||
{
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
#endif /* (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) */
|
|
||||||
|
|
Loading…
Reference in New Issue