From 6ad5489d015fd95af470ebbf4af09ae7512fe9a1 Mon Sep 17 00:00:00 2001 From: Michael Lutz Date: Sat, 2 Jan 2021 17:40:54 +0100 Subject: Codechange: [OSX] Silence some annoying warnings. --- src/fontdetection.cpp | 6 +++--- src/os/macosx/macos.mm | 7 +++++++ src/video/cocoa/cocoa_v.mm | 2 +- 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 name_desc(CTFontDescriptorCreateWithNameAndSize(name.get(), 0.0)); - CFAutoRelease mandatory_attribs(CFSetCreate(kCFAllocatorDefault, (const void **)&kCTFontNameAttribute, 1, &kCFTypeSetCallBacks)); + CFAutoRelease mandatory_attribs(CFSetCreate(kCFAllocatorDefault, const_cast(reinterpret_cast(&kCTFontNameAttribute)), 1, &kCFTypeSetCallBacks)); CFAutoRelease 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 lang_attribs(CFDictionaryCreate(kCFAllocatorDefault, (const void**)&kCTFontLanguagesAttribute, (const void **)&lang_arr, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); + CFAutoRelease lang_attribs(CFDictionaryCreate(kCFAllocatorDefault, const_cast(reinterpret_cast(&kCTFontLanguagesAttribute)), (const void **)&lang_arr, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); CFAutoRelease lang_desc(CTFontDescriptorCreateWithAttributes(lang_attribs.get())); CFRelease(lang_arr); CFRelease(lang_codes[0]); /* Get array of all font descriptors for the wanted language. */ - CFAutoRelease mandatory_attribs(CFSetCreate(kCFAllocatorDefault, (const void **)&kCTFontLanguagesAttribute, 1, &kCFTypeSetCallBacks)); + CFAutoRelease mandatory_attribs(CFSetCreate(kCFAllocatorDefault, const_cast(reinterpret_cast(&kCTFontLanguagesAttribute)), 1, &kCFTypeSetCallBacks)); CFAutoRelease 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(const_cast(CFArrayGetValueAtIndex(modes, i))); width = (uint16)CGDisplayModeGetWidth(mode); height = (uint16)CGDisplayModeGetHeight(mode); -- cgit v1.2.3-70-g09d2