| @@ -268,7 +268,7 @@ struct AsyncQuitRetrier : private Timer | |||
| stopTimer(); | |||
| delete this; | |||
| if (JUCEApplicationBase* app = JUCEApplicationBase::getInstance()) | |||
| if (auto* app = JUCEApplicationBase::getInstance()) | |||
| app->systemRequestedQuit(); | |||
| } | |||
| @@ -254,7 +254,7 @@ namespace CoreMidiHelpers | |||
| static String getGlobalMidiClientName() | |||
| { | |||
| if (JUCEApplicationBase* const app = JUCEApplicationBase::getInstance()) | |||
| if (auto* app = JUCEApplicationBase::getInstance()) | |||
| return app->getApplicationName(); | |||
| return "JUCE"; | |||
| @@ -31,8 +31,6 @@ void* JUCEApplicationBase::iOSCustomDelegate = nullptr; | |||
| #endif | |||
| JUCEApplicationBase::JUCEApplicationBase() | |||
| : appReturnValue (0), | |||
| stillInitialising (true) | |||
| { | |||
| jassert (isStandaloneApp() && appInstance == nullptr); | |||
| appInstance = this; | |||
| @@ -75,7 +73,7 @@ void JUCEApplicationBase::sendUnhandledException (const std::exception* const e, | |||
| const char* const sourceFile, | |||
| const int lineNumber) | |||
| { | |||
| if (JUCEApplicationBase* const app = JUCEApplicationBase::getInstance()) | |||
| if (auto* app = JUCEApplicationBase::getInstance()) | |||
| { | |||
| // If you hit this assertion then the __FILE__ macro is providing a | |||
| // relative path instead of an absolute path. On Windows this will be | |||
| @@ -95,7 +93,6 @@ void JUCEApplicationBase::sendUnhandledException (const std::exception* const e, | |||
| #if JUCE_HANDLE_MULTIPLE_INSTANCES | |||
| struct JUCEApplicationBase::MultipleInstanceHandler : public ActionListener | |||
| { | |||
| public: | |||
| MultipleInstanceHandler (const String& appName) | |||
| : appLock ("juceAppLock_" + appName) | |||
| { | |||
| @@ -106,19 +103,21 @@ public: | |||
| if (appLock.enter (0)) | |||
| return false; | |||
| JUCEApplicationBase* const app = JUCEApplicationBase::getInstance(); | |||
| jassert (app != nullptr); | |||
| if (auto* app = JUCEApplicationBase::getInstance()) | |||
| { | |||
| MessageManager::broadcastMessage (app->getApplicationName() + "/" + app->getCommandLineParameters()); | |||
| return true; | |||
| } | |||
| MessageManager::broadcastMessage (app->getApplicationName() | |||
| + "/" + app->getCommandLineParameters()); | |||
| return true; | |||
| jassertfalse; | |||
| return false; | |||
| } | |||
| void actionListenerCallback (const String& message) override | |||
| { | |||
| if (JUCEApplicationBase* const app = JUCEApplicationBase::getInstance()) | |||
| if (auto* app = JUCEApplicationBase::getInstance()) | |||
| { | |||
| const String appName (app->getApplicationName()); | |||
| auto appName = app->getApplicationName(); | |||
| if (message.startsWith (appName + "/")) | |||
| app->anotherInstanceStarted (message.substring (appName.length() + 1)); | |||
| @@ -163,9 +162,9 @@ String JUCE_CALLTYPE JUCEApplicationBase::getCommandLineParameters() | |||
| StringArray JUCE_CALLTYPE JUCEApplicationBase::getCommandLineParameterArray() | |||
| { | |||
| StringArray s; | |||
| int argc = 0; | |||
| if (LPWSTR* const argv = CommandLineToArgvW (GetCommandLineW(), &argc)) | |||
| if (auto argv = CommandLineToArgvW (GetCommandLineW(), &argc)) | |||
| { | |||
| s = StringArray (argv + 1, argc - 1); | |||
| LocalFree (argv); | |||
| @@ -303,8 +302,8 @@ bool JUCEApplicationBase::initialiseApp() | |||
| return false; | |||
| #if JUCE_HANDLE_MULTIPLE_INSTANCES | |||
| if (multipleInstanceHandler != nullptr) | |||
| MessageManager::getInstance()->registerBroadcastListener (multipleInstanceHandler.get()); | |||
| if (auto* mih = multipleInstanceHandler.get()) | |||
| MessageManager::getInstance()->registerBroadcastListener (mih); | |||
| #endif | |||
| return true; | |||
| @@ -315,8 +314,8 @@ int JUCEApplicationBase::shutdownApp() | |||
| jassert (JUCEApplicationBase::getInstance() == this); | |||
| #if JUCE_HANDLE_MULTIPLE_INSTANCES | |||
| if (multipleInstanceHandler != nullptr) | |||
| MessageManager::getInstance()->deregisterBroadcastListener (multipleInstanceHandler.get()); | |||
| if (auto* mih = multipleInstanceHandler.get()) | |||
| MessageManager::getInstance()->deregisterBroadcastListener (mih); | |||
| #endif | |||
| JUCE_TRY | |||
| @@ -190,10 +190,9 @@ public: | |||
| //============================================================================== | |||
| /** Override this method to be informed when the back button is pressed on a device. | |||
| This is currently only implemented on Android devices. | |||
| */ | |||
| virtual void backButtonPressed() { } | |||
| virtual void backButtonPressed() {} | |||
| //============================================================================== | |||
| /** Signals that the main message loop should stop and the application should terminate. | |||
| @@ -275,8 +274,8 @@ public: | |||
| private: | |||
| //============================================================================== | |||
| static JUCEApplicationBase* appInstance; | |||
| int appReturnValue; | |||
| bool stillInitialising; | |||
| int appReturnValue = 0; | |||
| bool stillInitialising = true; | |||
| struct MultipleInstanceHandler; | |||
| friend struct MultipleInstanceHandler; | |||
| @@ -28,7 +28,7 @@ Message::~Message() {} | |||
| void Message::messageCallback() | |||
| { | |||
| if (MessageListener* const r = recipient) | |||
| if (auto* r = recipient.get()) | |||
| r->handleMessage (*this); | |||
| } | |||
| @@ -83,7 +83,7 @@ bool MessageManager::runDispatchLoopUntil (int millisecondsToRunFor) | |||
| { | |||
| jassert (isThisTheMessageThread()); // must only be called by the message thread | |||
| const int64 endTime = Time::currentTimeMillis() + millisecondsToRunFor; | |||
| auto endTime = Time::currentTimeMillis() + millisecondsToRunFor; | |||
| while (! quitMessageReceived) | |||
| { | |||
| @@ -213,7 +213,7 @@ bool MessageManager::isThisTheMessageThread() const noexcept | |||
| void MessageManager::setCurrentThreadAsMessageThread() | |||
| { | |||
| const Thread::ThreadID thisThread = Thread::getCurrentThreadId(); | |||
| auto thisThread = Thread::getCurrentThreadId(); | |||
| if (messageThreadId != thisThread) | |||
| { | |||
| @@ -227,7 +227,7 @@ void MessageManager::setCurrentThreadAsMessageThread() | |||
| bool MessageManager::currentThreadHasLockedMessageManager() const noexcept | |||
| { | |||
| const Thread::ThreadID thisThread = Thread::getCurrentThreadId(); | |||
| auto thisThread = Thread::getCurrentThreadId(); | |||
| return thisThread == messageThreadId || thisThread == threadWithLock.get(); | |||
| } | |||
| @@ -133,7 +133,7 @@ bool MessageManager::dispatchNextMessageOnSystemQueue (const bool returnIfNoPend | |||
| } | |||
| else if (m.message == WM_QUIT) | |||
| { | |||
| if (JUCEApplicationBase* const app = JUCEApplicationBase::getInstance()) | |||
| if (auto* app = JUCEApplicationBase::getInstance()) | |||
| app->systemRequestedQuit(); | |||
| } | |||
| else if (isEventBlockedByModalComps == nullptr || ! isEventBlockedByModalComps (m)) | |||
| @@ -79,7 +79,7 @@ JUCE_JNI_CALLBACK (JUCE_ANDROID_ACTIVITY_CLASSNAME, suspendApp, void, (JNIEnv* e | |||
| { | |||
| setEnv (env); | |||
| if (JUCEApplicationBase* const app = JUCEApplicationBase::getInstance()) | |||
| if (auto* app = JUCEApplicationBase::getInstance()) | |||
| app->suspended(); | |||
| } | |||
| @@ -87,7 +87,7 @@ JUCE_JNI_CALLBACK (JUCE_ANDROID_ACTIVITY_CLASSNAME, resumeApp, void, (JNIEnv* en | |||
| { | |||
| setEnv (env); | |||
| if (JUCEApplicationBase* const app = JUCEApplicationBase::getInstance()) | |||
| if (auto* app = JUCEApplicationBase::getInstance()) | |||
| app->resumed(); | |||
| } | |||
| @@ -537,7 +537,7 @@ public: | |||
| void handleBackButtonCallback() | |||
| { | |||
| if (JUCEApplicationBase* const app = JUCEApplicationBase::getInstance()) | |||
| if (auto* app = JUCEApplicationBase::getInstance()) | |||
| app->backButtonPressed(); | |||
| } | |||
| @@ -123,7 +123,7 @@ namespace juce | |||
| - (void) applicationDidEnterBackground: (UIApplication*) application | |||
| { | |||
| if (JUCEApplicationBase* const app = JUCEApplicationBase::getInstance()) | |||
| if (auto* app = JUCEApplicationBase::getInstance()) | |||
| { | |||
| #if JUCE_EXECUTE_APP_SUSPEND_ON_BACKGROUND_TASK | |||
| appSuspendTask = [application beginBackgroundTaskWithName:@"JUCE Suspend Task" expirationHandler:^{ | |||
| @@ -146,7 +146,7 @@ namespace juce | |||
| { | |||
| ignoreUnused (application); | |||
| if (JUCEApplicationBase* const app = JUCEApplicationBase::getInstance()) | |||
| if (auto* app = JUCEApplicationBase::getInstance()) | |||
| app->resumed(); | |||
| } | |||