From 87042769b657e3b99796f67d6063b1abb37b73d6 Mon Sep 17 00:00:00 2001 From: jules Date: Fri, 11 May 2018 14:44:51 +0100 Subject: [PATCH] Tidied up some more old typedefs --- .../VST3/juce_VST3_Wrapper.cpp | 2 +- .../format_types/juce_VST3PluginFormat.cpp | 2 +- .../format_types/juce_VSTPluginFormat.cpp | 2 +- modules/juce_core/containers/juce_HashMap.h | 2 +- modules/juce_core/maths/juce_MathsFunctions.h | 2 +- modules/juce_core/memory/juce_Atomic.h | 2 +- .../juce_core/threads/juce_CriticalSection.h | 6 +++--- .../containers/juce_SIMDRegister_Impl.h | 4 ++-- .../messages/juce_MessageManager.h | 2 +- .../native/juce_mac_MessageManager.mm | 6 +++--- .../native/juce_win32_Messaging.cpp | 19 +++++++++---------- modules/juce_graphics/fonts/juce_Font.cpp | 2 +- .../lookandfeel/juce_LookAndFeel.cpp | 2 +- .../native/juce_mac_MainMenu.mm | 2 +- .../misc/juce_LiveConstantEditor.h | 10 +++------- modules/juce_osc/osc/juce_OSCTypes.h | 4 ++-- 16 files changed, 32 insertions(+), 37 deletions(-) diff --git a/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp b/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp index a58c7e0a9c..5f8f1058d4 100644 --- a/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp +++ b/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp @@ -2531,7 +2531,7 @@ bool shutdownModule() //============================================================================== /** This typedef represents VST3's createInstance() function signature */ -typedef FUnknown* (*CreateFunction) (Vst::IHostApplication*); +using CreateFunction = FUnknown* (*)(Vst::IHostApplication*); static FUnknown* createComponentInstance (Vst::IHostApplication* host) { diff --git a/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp index 6111de9495..35db7ab353 100644 --- a/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp +++ b/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp @@ -1142,7 +1142,7 @@ private: if (CFBundleLoadExecutableAndReturnError (bundleRef, &error)) { - typedef bool (*BundleEntryProc)(CFBundleRef); + using BundleEntryProc = bool (*)(CFBundleRef); if (auto proc = (BundleEntryProc) getFunction ("bundleEntry")) { diff --git a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp index 3647c0907c..06dfcb0261 100644 --- a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp +++ b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp @@ -226,7 +226,7 @@ static pointer_sized_int VSTINTERFACECALL audioMaster (VstEffectInterface*, int3 namespace { - typedef void (*EventProcPtr) (XEvent* ev); + using EventProcPtr = void (*)(XEvent*); Window getChildWindow (Window windowToCheck) { diff --git a/modules/juce_core/containers/juce_HashMap.h b/modules/juce_core/containers/juce_HashMap.h index d10ae0444f..6fc60eacd4 100644 --- a/modules/juce_core/containers/juce_HashMap.h +++ b/modules/juce_core/containers/juce_HashMap.h @@ -354,7 +354,7 @@ public: inline const TypeOfCriticalSectionToUse& getLock() const noexcept { return lock; } /** Returns the type of scoped lock to use for locking this array */ - typedef typename TypeOfCriticalSectionToUse::ScopedLockType ScopedLockType; + using ScopedLockType = typename TypeOfCriticalSectionToUse::ScopedLockType; private: //============================================================================== diff --git a/modules/juce_core/maths/juce_MathsFunctions.h b/modules/juce_core/maths/juce_MathsFunctions.h index d8e1bf364e..c0a73018b3 100644 --- a/modules/juce_core/maths/juce_MathsFunctions.h +++ b/modules/juce_core/maths/juce_MathsFunctions.h @@ -42,7 +42,7 @@ using uint16 = unsigned short; /** A platform-independent 32-bit signed integer type. */ using int32 = signed int; /** A platform-independent 32-bit unsigned integer type. */ -typedef unsigned int uint32; +using uint32 = unsigned int; #if JUCE_MSVC /** A platform-independent 64-bit integer type. */ diff --git a/modules/juce_core/memory/juce_Atomic.h b/modules/juce_core/memory/juce_Atomic.h index 2a3d1feb91..41a981981c 100644 --- a/modules/juce_core/memory/juce_Atomic.h +++ b/modules/juce_core/memory/juce_Atomic.h @@ -40,7 +40,7 @@ namespace juce template struct Atomic final { - typedef typename AtomicHelpers::DiffTypeHelper::Type DiffType; + using DiffType = typename AtomicHelpers::DiffTypeHelper::Type; /** Creates a new value, initialised to zero. */ Atomic() noexcept : value (0) {} diff --git a/modules/juce_core/threads/juce_CriticalSection.h b/modules/juce_core/threads/juce_CriticalSection.h index b7e3de561a..e1d2463b92 100644 --- a/modules/juce_core/threads/juce_CriticalSection.h +++ b/modules/juce_core/threads/juce_CriticalSection.h @@ -183,7 +183,7 @@ private: @see CriticalSection, ScopedUnlock */ -typedef CriticalSection::ScopedLockType ScopedLock; +using ScopedLock = CriticalSection::ScopedLockType; //============================================================================== /** @@ -223,7 +223,7 @@ typedef CriticalSection::ScopedLockType ScopedLock; @see CriticalSection, ScopedLock */ -typedef CriticalSection::ScopedUnlockType ScopedUnlock; +using ScopedUnlock = CriticalSection::ScopedUnlockType; //============================================================================== /** @@ -257,6 +257,6 @@ typedef CriticalSection::ScopedUnlockType ScopedUnlock; @see CriticalSection::tryEnter, ScopedLock, ScopedUnlock, ScopedReadLock */ -typedef CriticalSection::ScopedTryLockType ScopedTryLock; +using ScopedTryLock = CriticalSection::ScopedTryLockType; } // namespace juce diff --git a/modules/juce_dsp/containers/juce_SIMDRegister_Impl.h b/modules/juce_dsp/containers/juce_SIMDRegister_Impl.h index 0774b1a950..d348c6e1a0 100644 --- a/modules/juce_dsp/containers/juce_SIMDRegister_Impl.h +++ b/modules/juce_dsp/containers/juce_SIMDRegister_Impl.h @@ -54,7 +54,7 @@ private: template struct CmplxSIMDOps { - typedef typename SIMDNativeOps::vSIMDType vSIMDType; + using vSIMDType = typename SIMDNativeOps::vSIMDType; static inline vSIMDType JUCE_VECTOR_CALLTYPE load (const Scalar* a) noexcept { @@ -101,7 +101,7 @@ struct CmplxSIMDOps template struct CmplxSIMDOps> { - typedef typename SIMDNativeOps::vSIMDType vSIMDType; + using vSIMDType = typename SIMDNativeOps::vSIMDType; static inline vSIMDType JUCE_VECTOR_CALLTYPE load (const std::complex* a) noexcept { diff --git a/modules/juce_events/messages/juce_MessageManager.h b/modules/juce_events/messages/juce_MessageManager.h index 669c441d4b..51d8090d62 100644 --- a/modules/juce_events/messages/juce_MessageManager.h +++ b/modules/juce_events/messages/juce_MessageManager.h @@ -35,7 +35,7 @@ class OpenGLContext; //============================================================================== /** See MessageManager::callFunctionOnMessageThread() for use of this function type. */ -typedef void* (MessageCallbackFunction) (void* userData); +using MessageCallbackFunction = void* (void* userData); //============================================================================== diff --git a/modules/juce_events/native/juce_mac_MessageManager.mm b/modules/juce_events/native/juce_mac_MessageManager.mm index ef6749cb81..01463e8da1 100644 --- a/modules/juce_events/native/juce_mac_MessageManager.mm +++ b/modules/juce_events/native/juce_mac_MessageManager.mm @@ -23,13 +23,13 @@ namespace juce { -typedef void (*AppFocusChangeCallback)(); +using AppFocusChangeCallback = void (*)(); AppFocusChangeCallback appFocusChangeCallback = nullptr; -typedef bool (*CheckEventBlockedByModalComps) (NSEvent*); +using CheckEventBlockedByModalComps = bool (*)(NSEvent*); CheckEventBlockedByModalComps isEventBlockedByModalComps = nullptr; -typedef void (*MenuTrackingChangedCallback)(bool); +using MenuTrackingChangedCallback = void (*)(bool); MenuTrackingChangedCallback menuTrackingChangedCallback = nullptr; //============================================================================== diff --git a/modules/juce_events/native/juce_win32_Messaging.cpp b/modules/juce_events/native/juce_win32_Messaging.cpp index 7c5d8d3cad..ace74804f1 100644 --- a/modules/juce_events/native/juce_win32_Messaging.cpp +++ b/modules/juce_events/native/juce_win32_Messaging.cpp @@ -25,10 +25,10 @@ namespace juce extern HWND juce_messageWindowHandle; -typedef bool (*CheckEventBlockedByModalComps) (const MSG&); +using CheckEventBlockedByModalComps = bool (*)(const MSG&); CheckEventBlockedByModalComps isEventBlockedByModalComps = nullptr; -typedef void (*SettingChangeCallbackFunc) (void); +using SettingChangeCallbackFunc = void (*)(void); SettingChangeCallbackFunc settingChangeCallback = nullptr; #if JUCE_MODULE_AVAILABLE_juce_audio_plugin_client && JucePlugin_Build_Unity @@ -72,7 +72,7 @@ namespace WindowsMessageHelpers return TRUE; } - void handleBroadcastMessage (const COPYDATASTRUCT* const data) + void handleBroadcastMessage (const COPYDATASTRUCT* data) { if (data != nullptr && data->dwData == broadcastMessageMagicNumber) { @@ -91,7 +91,7 @@ namespace WindowsMessageHelpers } //============================================================================== - LRESULT CALLBACK messageWndProc (HWND h, const UINT message, const WPARAM wParam, const LPARAM lParam) noexcept + LRESULT CALLBACK messageWndProc (HWND h, UINT message, WPARAM wParam, LPARAM lParam) noexcept { if (h == juce_messageWindowHandle) { @@ -108,11 +108,10 @@ namespace WindowsMessageHelpers handleBroadcastMessage (reinterpret_cast (lParam)); return 0; } - else if (message == WM_SETTINGCHANGE) - { + + if (message == WM_SETTINGCHANGE) if (settingChangeCallback != nullptr) settingChangeCallback(); - } } return DefWindowProc (h, message, wParam, lParam); @@ -124,7 +123,7 @@ LRESULT juce_offerEventToActiveXControl (::MSG&); #endif //============================================================================== -bool MessageManager::dispatchNextMessageOnSystemQueue (const bool returnIfNoPendingMessages) +bool MessageManager::dispatchNextMessageOnSystemQueue (bool returnIfNoPendingMessages) { using namespace WindowsMessageHelpers; MSG m; @@ -134,10 +133,10 @@ bool MessageManager::dispatchNextMessageOnSystemQueue (const bool returnIfNoPend if (GetMessage (&m, (HWND) 0, 0, 0) >= 0) { - #if JUCE_MODULE_AVAILABLE_juce_gui_extra + #if JUCE_MODULE_AVAILABLE_juce_gui_extra if (juce_offerEventToActiveXControl (m) != S_FALSE) return true; - #endif + #endif if (m.message == customMessageID && m.hwnd == juce_messageWindowHandle) { diff --git a/modules/juce_graphics/fonts/juce_Font.cpp b/modules/juce_graphics/fonts/juce_Font.cpp index 1dec474709..2a5ab8bf7b 100644 --- a/modules/juce_graphics/fonts/juce_Font.cpp +++ b/modules/juce_graphics/fonts/juce_Font.cpp @@ -40,7 +40,7 @@ namespace FontValues String fallbackFontStyle; } -typedef Typeface::Ptr (*GetTypefaceForFont) (const Font&); +using GetTypefaceForFont = Typeface::Ptr (*)(const Font&); GetTypefaceForFont juce_getTypefaceForFont = nullptr; float Font::getDefaultMinimumHorizontalScaleFactor() noexcept { return FontValues::minimumHorizontalScale; } diff --git a/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel.cpp b/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel.cpp index 0159d6f747..3ef5f993d8 100644 --- a/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel.cpp +++ b/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel.cpp @@ -32,7 +32,7 @@ static Typeface::Ptr getTypefaceForFontFromLookAndFeel (const Font& font) return LookAndFeel::getDefaultLookAndFeel().getTypefaceForFont (font); } -typedef Typeface::Ptr (*GetTypefaceForFont) (const Font&); +using GetTypefaceForFont = Typeface::Ptr (*)(const Font&); extern GetTypefaceForFont juce_getTypefaceForFont; //============================================================================== diff --git a/modules/juce_gui_basics/native/juce_mac_MainMenu.mm b/modules/juce_gui_basics/native/juce_mac_MainMenu.mm index c41fe5b30a..ec70020df8 100644 --- a/modules/juce_gui_basics/native/juce_mac_MainMenu.mm +++ b/modules/juce_gui_basics/native/juce_mac_MainMenu.mm @@ -765,7 +765,7 @@ const PopupMenu* MenuBarModel::getMacExtraAppleItemsMenu() return nullptr; } -typedef void (*MenuTrackingChangedCallback) (bool); +using MenuTrackingChangedCallback = void (*)(bool); extern MenuTrackingChangedCallback menuTrackingChangedCallback; static void mainMenuTrackingChanged (bool isTracking) diff --git a/modules/juce_gui_extra/misc/juce_LiveConstantEditor.h b/modules/juce_gui_extra/misc/juce_LiveConstantEditor.h index a0a483946b..a5b8148825 100644 --- a/modules/juce_gui_extra/misc/juce_LiveConstantEditor.h +++ b/modules/juce_gui_extra/misc/juce_LiveConstantEditor.h @@ -204,17 +204,13 @@ namespace LiveConstantEditor LiveValue& getValue (const char* file, int line, const Type& initialValue) { const ScopedLock sl (lock); - typedef LiveValue ValueType; - - for (int i = 0; i < values.size(); ++i) - { - LiveValueBase* v = values.getUnchecked(i); + using ValueType = LiveValue; + for (auto* v : values) if (v->sourceLine == line && v->sourceFile == file) return *static_cast (v); - } - ValueType* v = new ValueType (file, line, initialValue); + auto v = new ValueType (file, line, initialValue); addValue (v); return *v; } diff --git a/modules/juce_osc/osc/juce_OSCTypes.h b/modules/juce_osc/osc/juce_OSCTypes.h index 3f657a8deb..990879baac 100644 --- a/modules/juce_osc/osc/juce_OSCTypes.h +++ b/modules/juce_osc/osc/juce_OSCTypes.h @@ -30,11 +30,11 @@ namespace juce //============================================================================== /** The type used for OSC type tags. */ -typedef char OSCType; +using OSCType = char; /** The type used for OSC type tag strings. */ -typedef Array OSCTypeList; +using OSCTypeList = Array; //==============================================================================