summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Lutz <michi@icosahedron.de>2021-01-02 17:40:54 +0100
committerMichael Lutz <michi@icosahedron.de>2021-01-03 13:25:32 +0100
commit6ad5489d015fd95af470ebbf4af09ae7512fe9a1 (patch)
tree95c728339017bc77bb9c9d23310153cf2d0786c5
parent7bdaabf5f126edd58f3ddb14c71bb4ed2230bf27 (diff)
downloadopenttd-6ad5489d015fd95af470ebbf4af09ae7512fe9a1.tar.xz
Codechange: [OSX] Silence some annoying warnings.
-rw-r--r--src/fontdetection.cpp6
-rw-r--r--src/os/macosx/macos.mm7
-rw-r--r--src/video/cocoa/cocoa_v.mm2
3 files changed, 11 insertions, 4 deletions
diff --git a/src/fontdetection.cpp b/src/fontdetection.cpp
index 9cfc9f554..1b1f9d689 100644
--- a/src/fontdetection.cpp
+++ b/src/fontdetection.cpp
@@ -399,7 +399,7 @@ FT_Error GetFontByFaceName(const char *font_name, FT_Face *face)
* We instead query the list of all font descriptors that match the given name which
* does not do this stupid name fallback. */
CFAutoRelease<CTFontDescriptorRef> name_desc(CTFontDescriptorCreateWithNameAndSize(name.get(), 0.0));
- CFAutoRelease<CFSetRef> mandatory_attribs(CFSetCreate(kCFAllocatorDefault, (const void **)&kCTFontNameAttribute, 1, &kCFTypeSetCallBacks));
+ CFAutoRelease<CFSetRef> mandatory_attribs(CFSetCreate(kCFAllocatorDefault, const_cast<const void **>(reinterpret_cast<const void * const *>(&kCTFontNameAttribute)), 1, &kCFTypeSetCallBacks));
CFAutoRelease<CFArrayRef> descs(CTFontDescriptorCreateMatchingFontDescriptors(name_desc.get(), mandatory_attribs.get()));
/* Loop over all matches until we can get a path for one of them. */
@@ -441,13 +441,13 @@ bool SetFallbackFont(FreeTypeSettings *settings, const char *language_isocode, i
lang_codes[0] = CFStringCreateWithCString(kCFAllocatorDefault, lang, kCFStringEncodingUTF8);
lang_codes[1] = CFSTR("en");
CFArrayRef lang_arr = CFArrayCreate(kCFAllocatorDefault, (const void **)lang_codes, lengthof(lang_codes), &kCFTypeArrayCallBacks);
- CFAutoRelease<CFDictionaryRef> lang_attribs(CFDictionaryCreate(kCFAllocatorDefault, (const void**)&kCTFontLanguagesAttribute, (const void **)&lang_arr, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+ CFAutoRelease<CFDictionaryRef> lang_attribs(CFDictionaryCreate(kCFAllocatorDefault, const_cast<const void **>(reinterpret_cast<const void * const *>(&kCTFontLanguagesAttribute)), (const void **)&lang_arr, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
CFAutoRelease<CTFontDescriptorRef> lang_desc(CTFontDescriptorCreateWithAttributes(lang_attribs.get()));
CFRelease(lang_arr);
CFRelease(lang_codes[0]);
/* Get array of all font descriptors for the wanted language. */
- CFAutoRelease<CFSetRef> mandatory_attribs(CFSetCreate(kCFAllocatorDefault, (const void **)&kCTFontLanguagesAttribute, 1, &kCFTypeSetCallBacks));
+ CFAutoRelease<CFSetRef> mandatory_attribs(CFSetCreate(kCFAllocatorDefault, const_cast<const void **>(reinterpret_cast<const void * const *>(&kCTFontLanguagesAttribute)), 1, &kCFTypeSetCallBacks));
CFAutoRelease<CFArrayRef> descs(CTFontDescriptorCreateMatchingFontDescriptors(lang_desc.get(), mandatory_attribs.get()));
bool result = false;
diff --git a/src/os/macosx/macos.mm b/src/os/macosx/macos.mm
index 8ecd3a88e..6f0ab8d63 100644
--- a/src/os/macosx/macos.mm
+++ b/src/os/macosx/macos.mm
@@ -72,6 +72,10 @@ void GetMacOSVersion(int *return_major, int *return_minor, int *return_bugfix)
}
#if (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_10)
+#ifdef __clang__
+# pragma clang diagnostic push
+# pragma clang diagnostic ignored "-Wdeprecated-declarations"
+#endif
SInt32 systemVersion, version_major, version_minor, version_bugfix;
if (Gestalt(gestaltSystemVersion, &systemVersion) == noErr) {
if (systemVersion >= 0x1040) {
@@ -84,6 +88,9 @@ void GetMacOSVersion(int *return_major, int *return_minor, int *return_bugfix)
*return_bugfix = (int)GB(systemVersion, 0, 4);
}
}
+#ifdef __clang__
+# pragma clang diagnostic pop
+#endif
#endif
}
diff --git a/src/video/cocoa/cocoa_v.mm b/src/video/cocoa/cocoa_v.mm
index d8178699e..6031fa34c 100644
--- a/src/video/cocoa/cocoa_v.mm
+++ b/src/video/cocoa/cocoa_v.mm
@@ -70,7 +70,7 @@ static bool ModeSorter(const OTTD_Point &p1, const OTTD_Point &p2)
static void QZ_GetDisplayModeInfo(CFArrayRef modes, CFIndex i, int &bpp, uint16 &width, uint16 &height)
{
- CGDisplayModeRef mode = (CGDisplayModeRef)CFArrayGetValueAtIndex(modes, i);
+ CGDisplayModeRef mode = static_cast<CGDisplayModeRef>(const_cast<void *>(CFArrayGetValueAtIndex(modes, i)));
width = (uint16)CGDisplayModeGetWidth(mode);
height = (uint16)CGDisplayModeGetHeight(mode);