From effab49a6f8132a2e99f925993dfcfa229d66e49 Mon Sep 17 00:00:00 2001 From: James Crook Date: Thu, 12 Apr 2018 19:51:38 +0100 Subject: [PATCH] Improve Mac wx3.1.1 compatibility 1. Qualify hash as std::hash. 2. Ensure we have a header for the function 'free' --- lib-src/FileDialog/mac/FileDialogPrivate.mm | 2 ++ src/MemoryX.h | 1 + src/commands/CommandManager.h | 12 ++++++++++-- src/import/ImportQT.cpp | 4 ++++ 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/lib-src/FileDialog/mac/FileDialogPrivate.mm b/lib-src/FileDialog/mac/FileDialogPrivate.mm index d893f74d5..7d0a25b4a 100644 --- a/lib-src/FileDialog/mac/FileDialogPrivate.mm +++ b/lib-src/FileDialog/mac/FileDialogPrivate.mm @@ -49,6 +49,8 @@ // implementation // ============================================================================ +#define NSObject wxOSX_10_6_AND_LATER( x ) x + @interface OSPanelDelegate : NSObject wxOSX_10_6_AND_LATER() { FileDialog* _dialog; diff --git a/src/MemoryX.h b/src/MemoryX.h index 72c2e8185..ca821ae3d 100644 --- a/src/MemoryX.h +++ b/src/MemoryX.h @@ -3,6 +3,7 @@ // C++ standard header with a few extensions #include +#include // Needed for free. #ifndef safenew #define safenew new #endif diff --git a/src/commands/CommandManager.h b/src/commands/CommandManager.h index 4fa466c5f..7d75f4f10 100644 --- a/src/commands/CommandManager.h +++ b/src/commands/CommandManager.h @@ -103,7 +103,6 @@ namespace std #ifdef __AUDACITY_OLD_STD__ namespace tr1 { -#endif template struct hash; template<> struct hash< NormalizedKeyString > { size_t operator () (const NormalizedKeyString &str) const // noexcept @@ -113,8 +112,17 @@ namespace std return Hasher{}( stdstr ); } }; -#ifdef __AUDACITY_OLD_STD__ } +#else + // in std, not in tr1. + template<> struct hash< NormalizedKeyString > { + size_t operator () (const NormalizedKeyString &str) const // noexcept + { + auto &stdstr = str.Raw(); // no allocations, a cheap fetch + using Hasher = std::hash< wxString >; + return Hasher{}( stdstr ); + } + }; #endif } diff --git a/src/import/ImportQT.cpp b/src/import/ImportQT.cpp index e12e2148e..a0781966b 100644 --- a/src/import/ImportQT.cpp +++ b/src/import/ImportQT.cpp @@ -31,6 +31,10 @@ static const wxChar *exts[] = wxT("mp4") }; +#if defined(__WXMAC__) +#undef USE_QUICKTIME +#endif + #ifndef USE_QUICKTIME void GetQTImportPlugin(ImportPluginList &importPluginList,