diff --git a/examples/GUI/VideoDemo.h b/examples/GUI/VideoDemo.h index 2336156bc4..7f9ce3c23e 100644 --- a/examples/GUI/VideoDemo.h +++ b/examples/GUI/VideoDemo.h @@ -363,7 +363,7 @@ public: setPortraitOrientationEnabled (true); } - ~VideoDemo() + ~VideoDemo() override { curVideoComp->onPlaybackStarted = nullptr; curVideoComp->onPlaybackStopped = nullptr; diff --git a/modules/juce_audio_devices/native/juce_android_Audio.cpp b/modules/juce_audio_devices/native/juce_android_Audio.cpp index 3fa7399259..ecfa7b94fe 100644 --- a/modules/juce_audio_devices/native/juce_android_Audio.cpp +++ b/modules/juce_audio_devices/native/juce_android_Audio.cpp @@ -73,7 +73,7 @@ public: AndroidAudioIODevice (const String& deviceName) : AudioIODevice (deviceName, javaAudioTypeName), Thread ("audio"), - minBufferSizeOut (0), minBufferSizeIn (0), callback (0), sampleRate (0), + minBufferSizeOut (0), minBufferSizeIn (0), callback (nullptr), sampleRate (0), numClientInputChannels (0), numDeviceInputChannels (0), numDeviceInputChannelsAvailable (2), numClientOutputChannels (0), numDeviceOutputChannels (0), actualBufferSize (0), isRunning (false), @@ -100,7 +100,7 @@ public: << sampleRate << " Hz; input chans: " << numDeviceInputChannelsAvailable); } - ~AndroidAudioIODevice() + ~AndroidAudioIODevice() override { close(); } @@ -196,7 +196,7 @@ public: (jint) (minBufferSizeOut * numDeviceOutputChannels * static_cast (sizeof (int16))), MODE_STREAM))); const bool supportsUnderrunCount = (getAndroidSDKVersion() >= 24); - getUnderrunCount = supportsUnderrunCount ? env->GetMethodID (AudioTrack, "getUnderrunCount", "()I") : 0; + getUnderrunCount = supportsUnderrunCount ? env->GetMethodID (AudioTrack, "getUnderrunCount", "()I") : nullptr; int outputDeviceState = env->CallIntMethod (outputDevice, AudioTrack.getState); if (outputDeviceState > 0) @@ -282,11 +282,11 @@ public: BigInteger getActiveOutputChannels() const override { return activeOutputChans; } BigInteger getActiveInputChannels() const override { return activeInputChans; } String getLastError() override { return lastError; } - bool isPlaying() override { return isRunning && callback != 0; } + bool isPlaying() override { return isRunning && callback != nullptr; } int getXRunCount() const noexcept override { - if (outputDevice != nullptr && getUnderrunCount != 0) + if (outputDevice != nullptr && getUnderrunCount != nullptr) return getEnv()->CallIntMethod (outputDevice, getUnderrunCount); return -1; @@ -337,7 +337,7 @@ public: DBG ("Audio read under-run! " << numRead); } - jshort* const src = env->GetShortArrayElements (audioBuffer, 0); + jshort* const src = env->GetShortArrayElements (audioBuffer, nullptr); for (int chan = 0; chan < inputChannelBuffer.getNumChannels(); ++chan) { @@ -380,7 +380,7 @@ public: if (threadShouldExit()) break; - jshort* const dest = env->GetShortArrayElements (audioBuffer, 0); + jshort* const dest = env->GetShortArrayElements (audioBuffer, nullptr); for (int chan = 0; chan < numDeviceOutputChannels; ++chan) { @@ -417,7 +417,7 @@ private: BigInteger activeOutputChans, activeInputChans; GlobalRef outputDevice, inputDevice; AudioBuffer inputChannelBuffer, outputChannelBuffer; - jmethodID getUnderrunCount = 0; + jmethodID getUnderrunCount = nullptr; void closeDevices() { diff --git a/modules/juce_audio_devices/native/juce_android_OpenSL.cpp b/modules/juce_audio_devices/native/juce_android_OpenSL.cpp index dd3eb514c9..bc60ddcaec 100644 --- a/modules/juce_audio_devices/native/juce_android_OpenSL.cpp +++ b/modules/juce_audio_devices/native/juce_android_OpenSL.cpp @@ -340,7 +340,7 @@ public: auto status = (*config)->AcquireJavaProxy (config, /*SL_ANDROID_JAVA_PROXY_ROUTING*/1, &audioRoutingJni); - if (status == SL_RESULT_SUCCESS && audioRoutingJni != 0) + if (status == SL_RESULT_SUCCESS && audioRoutingJni != nullptr) javaProxy = GlobalRef (LocalRef(getEnv()->NewLocalRef (audioRoutingJni))); } } @@ -662,7 +662,7 @@ public: } const bool supportsUnderrunCount = (getAndroidSDKVersion() >= 24); - getUnderrunCount = supportsUnderrunCount ? getEnv()->GetMethodID (AudioTrack, "getUnderrunCount", "()I") : 0; + getUnderrunCount = supportsUnderrunCount ? getEnv()->GetMethodID (AudioTrack, "getUnderrunCount", "()I") : nullptr; } } } @@ -727,7 +727,7 @@ public: int getXRunCount() const noexcept override { - if (player != nullptr && player->javaProxy != nullptr && getUnderrunCount != 0) + if (player != nullptr && player->javaProxy != nullptr && getUnderrunCount != nullptr) return getEnv()->CallIntMethod (player->javaProxy, getUnderrunCount); return -1; @@ -783,7 +783,7 @@ public: std::unique_ptr> player; std::unique_ptr> recorder; Atomic guard; - jmethodID getUnderrunCount = 0; + jmethodID getUnderrunCount = nullptr; }; //============================================================================== @@ -810,7 +810,7 @@ public: ignoreUnused (success); } - ~OpenSLAudioIODevice() + ~OpenSLAudioIODevice() override { close(); } diff --git a/modules/juce_audio_devices/native/juce_ios_Audio.cpp b/modules/juce_audio_devices/native/juce_ios_Audio.cpp index 8a915cb1af..23da27eaa9 100644 --- a/modules/juce_audio_devices/native/juce_ios_Audio.cpp +++ b/modules/juce_audio_devices/native/juce_ios_Audio.cpp @@ -216,7 +216,7 @@ class iOSAudioIODeviceType : public AudioIODeviceType, { public: iOSAudioIODeviceType(); - ~iOSAudioIODeviceType(); + ~iOSAudioIODeviceType() override; void scanForDevices() override; StringArray getDeviceNames (bool) const override; @@ -262,7 +262,7 @@ struct iOSAudioIODevice::Pimpl : public AudioPlayHead, sessionHolder->activeDevices.add (this); } - ~Pimpl() + ~Pimpl() override { sessionHolder->activeDevices.removeFirstMatchingValue (this); diff --git a/modules/juce_audio_utils/native/juce_android_BluetoothMidiDevicePairingDialogue.cpp b/modules/juce_audio_utils/native/juce_android_BluetoothMidiDevicePairingDialogue.cpp index 664b4837e3..c981ad769d 100644 --- a/modules/juce_audio_utils/native/juce_android_BluetoothMidiDevicePairingDialogue.cpp +++ b/modules/juce_audio_utils/native/juce_android_BluetoothMidiDevicePairingDialogue.cpp @@ -421,7 +421,7 @@ public: enterModalState (true, exitCallback.release(), true); } - ~BluetoothMidiSelectorOverlay() + ~BluetoothMidiSelectorOverlay() override { AndroidBluetoothMidiInterface::startStopScan (false); } diff --git a/modules/juce_audio_utils/native/juce_ios_BluetoothMidiDevicePairingDialogue.mm b/modules/juce_audio_utils/native/juce_ios_BluetoothMidiDevicePairingDialogue.mm index 0b2e003ae9..eccb0b82e2 100644 --- a/modules/juce_audio_utils/native/juce_ios_BluetoothMidiDevicePairingDialogue.mm +++ b/modules/juce_audio_utils/native/juce_ios_BluetoothMidiDevicePairingDialogue.mm @@ -61,7 +61,7 @@ public: enterModalState (true, exitCallback.release(), true); } - ~BluetoothMidiSelectorOverlay() + ~BluetoothMidiSelectorOverlay() override { nativeSelectorComponent.setView (nullptr); [controller release]; @@ -126,7 +126,7 @@ bool BluetoothMidiDevicePairingDialogue::open (ModalComponentManager::Callback* bool BluetoothMidiDevicePairingDialogue::isAvailable() { - return NSClassFromString ([NSString stringWithUTF8String: "CABTMIDICentralViewController"]) != nil; + return NSClassFromString (@"CABTMIDICentralViewController") != nil; } } // namespace juce diff --git a/modules/juce_blocks_basics/littlefoot/juce_LittleFootRunner.h b/modules/juce_blocks_basics/littlefoot/juce_LittleFootRunner.h index f36e46078b..aca029fe8c 100644 --- a/modules/juce_blocks_basics/littlefoot/juce_LittleFootRunner.h +++ b/modules/juce_blocks_basics/littlefoot/juce_LittleFootRunner.h @@ -174,7 +174,7 @@ struct NativeFunction jassert (slash > 0); // The slash can't be the first character in this string! jassert (nameAndArgTypes[slash + 1] != 0); // The slash must be followed by a return type character jassert (String (nameAndArgTypes).substring (0, slash).containsOnly ("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_")); - jassert (! String ("0123456789").containsChar (nameAndArgTypes[0])); + jassert (! String ("0123456789").containsChar (String (nameAndArgTypes)[0])); jassert (String (nameAndArgTypes).substring (slash + 1).containsOnly ("vifb")); jassert (String (nameAndArgTypes).substring (slash + 2).containsOnly ("ifb")); // arguments must only be of these types diff --git a/modules/juce_core/misc/juce_ConsoleApplication.cpp b/modules/juce_core/misc/juce_ConsoleApplication.cpp index 238360ef53..bf3bf5c737 100644 --- a/modules/juce_core/misc/juce_ConsoleApplication.cpp +++ b/modules/juce_core/misc/juce_ConsoleApplication.cpp @@ -111,7 +111,7 @@ bool ArgumentList::Argument::isShortOption (char option) const { jassert (option != '-'); // this is probably not what you intended to pass in - return isShortOption() && text.containsChar (option); + return isShortOption() && text.containsChar (String (option)[0]); } bool ArgumentList::Argument::operator== (StringRef wildcard) const diff --git a/modules/juce_core/native/juce_android_Files.cpp b/modules/juce_core/native/juce_android_Files.cpp index 115dba7d40..4163c59a55 100644 --- a/modules/juce_core/native/juce_android_Files.cpp +++ b/modules/juce_core/native/juce_android_Files.cpp @@ -89,7 +89,7 @@ static File getWellKnownFolder (const char* folderId) auto* env = getEnv(); auto fieldId = env->GetStaticFieldID (AndroidEnvironment, folderId, "Ljava/lang/String;"); - if (fieldId == 0) + if (fieldId == nullptr) { // unknown field in environment jassertfalse; @@ -194,7 +194,7 @@ public: auto* env = getEnv(); LocalRef contentResolver (env->CallObjectMethod (getAppContext().get(), AndroidContext.getContentResolver)); - if (contentResolver == 0) + if (contentResolver == nullptr) return {}; auto filename = getStringUsingDataColumn ("_display_name", env, uri, contentResolver); @@ -298,7 +298,7 @@ private: auto* env = getEnv(); static jmethodID m = (env->GetMethodID (AndroidContext, "getExternalFilesDirs", "(Ljava/lang/String;)[Ljava/io/File;")); - if (m == 0) + if (m == nullptr) return {}; auto paths = convertFileArray (LocalRef (env->CallObjectMethod (getAppContext().get(), m, nullptr))); @@ -406,7 +406,7 @@ private: return {}; } - if (cursor == 0) + if (cursor == nullptr) return {}; String fileName; @@ -439,7 +439,7 @@ struct AndroidContentUriOutputStream : public OutputStream { } - ~AndroidContentUriOutputStream() + ~AndroidContentUriOutputStream() override { stream.callVoidMethod (AndroidOutputStream.close); } @@ -484,7 +484,7 @@ OutputStream* juce_CreateContentURIOutputStream (const URL& url) { auto stream = AndroidContentUriResolver::getStreamForContentUri (url, false); - return (stream.get() != 0 ? new AndroidContentUriOutputStream (std::move (stream)) : nullptr); + return (stream.get() != nullptr ? new AndroidContentUriOutputStream (std::move (stream)) : nullptr); } //============================================================================== @@ -676,7 +676,7 @@ private: void FileOutputStream::flushInternal() { - if (fileHandle != 0) + if (fileHandle != nullptr) { if (fsync (getFD (fileHandle)) == -1) status = getResultForErrno(); diff --git a/modules/juce_core/native/juce_android_JNIHelpers.cpp b/modules/juce_core/native/juce_android_JNIHelpers.cpp index ea41e53e22..89d70ca753 100644 --- a/modules/juce_core/native/juce_android_JNIHelpers.cpp +++ b/modules/juce_core/native/juce_android_JNIHelpers.cpp @@ -116,7 +116,7 @@ struct SystemJavaClassComparator //============================================================================== JNIClassBase::JNIClassBase (const char* cp, int classMinSDK, const void* bc, size_t n) - : classPath (cp), byteCode (bc), byteCodeSize (n), minSDK (classMinSDK), classRef (0) + : classPath (cp), byteCode (bc), byteCodeSize (n), minSDK (classMinSDK), classRef (nullptr) { SystemJavaClassComparator comparator; @@ -162,13 +162,13 @@ void JNIClassBase::initialise (JNIEnv* env) LocalRef defaultClassLoader (env->CallStaticObjectMethod (JavaClassLoader, JavaClassLoader.getSystemClassLoader)); tryLoadingClassWithClassLoader (env, defaultClassLoader.get()); - if (classRef == 0) + if (classRef == nullptr) { for (auto& byteCodeLoader : byteCodeLoaders) { tryLoadingClassWithClassLoader (env, byteCodeLoader.get()); - if (classRef != 0) + if (classRef != nullptr) break; } @@ -234,10 +234,10 @@ void JNIClassBase::initialise (JNIEnv* env) } } - if (classRef == 0) + if (classRef == nullptr) classRef = (jclass) env->NewGlobalRef (LocalRef (env->FindClass (classPath))); - jassert (classRef != 0); + jassert (classRef != nullptr); initialiseFields (env); } } @@ -253,7 +253,7 @@ void JNIClassBase::tryLoadingClassWithClassLoader (JNIEnv* env, jobject classLoa if (jthrowable exception = env->ExceptionOccurred ()) { env->ExceptionClear(); - classObj = 0; + classObj = nullptr; } // later versions of Android don't throw at all, so re-check the object @@ -263,7 +263,7 @@ void JNIClassBase::tryLoadingClassWithClassLoader (JNIEnv* env, jobject classLoa void JNIClassBase::release (JNIEnv* env) { - if (classRef != 0) + if (classRef != nullptr) env->DeleteGlobalRef (classRef); } @@ -284,28 +284,28 @@ void JNIClassBase::releaseAllClasses (JNIEnv* env) jmethodID JNIClassBase::resolveMethod (JNIEnv* env, const char* methodName, const char* params) { jmethodID m = env->GetMethodID (classRef, methodName, params); - jassert (m != 0); + jassert (m != nullptr); return m; } jmethodID JNIClassBase::resolveStaticMethod (JNIEnv* env, const char* methodName, const char* params) { jmethodID m = env->GetStaticMethodID (classRef, methodName, params); - jassert (m != 0); + jassert (m != nullptr); return m; } jfieldID JNIClassBase::resolveField (JNIEnv* env, const char* fieldName, const char* signature) { jfieldID f = env->GetFieldID (classRef, fieldName, signature); - jassert (f != 0); + jassert (f != nullptr); return f; } jfieldID JNIClassBase::resolveStaticField (JNIEnv* env, const char* fieldName, const char* signature) { jfieldID f = env->GetStaticFieldID (classRef, fieldName, signature); - jassert (f != 0); + jassert (f != nullptr); return f; } @@ -440,10 +440,10 @@ int getAndroidSDKVersion() auto* env = getEnv(); auto buildVersion = env->FindClass ("android/os/Build$VERSION"); - jassert (buildVersion != 0); + jassert (buildVersion != nullptr); auto sdkVersionField = env->GetStaticFieldID (buildVersion, "SDK_INT", "I"); - jassert (sdkVersionField != 0); + jassert (sdkVersionField != nullptr); return env->GetStaticIntField (buildVersion, sdkVersionField); }(); @@ -581,7 +581,7 @@ void FragmentOverlay::onRequestPermissionsResultNative (JNIEnv* env, jobject, jl if (n > 0) { - auto* data = env->GetIntArrayElements (jGrantResults, 0); + auto* data = env->GetIntArrayElements (jGrantResults, nullptr); for (int i = 0; i < n; ++i) grantResults.add (data[i]); diff --git a/modules/juce_core/native/juce_android_JNIHelpers.h b/modules/juce_core/native/juce_android_JNIHelpers.h index 4af5b85304..389b48ef84 100644 --- a/modules/juce_core/native/juce_android_JNIHelpers.h +++ b/modules/juce_core/native/juce_android_JNIHelpers.h @@ -31,18 +31,18 @@ template class LocalRef { public: - explicit inline LocalRef() noexcept : obj (0) {} + explicit inline LocalRef() noexcept : obj (nullptr) {} explicit inline LocalRef (JavaType o) noexcept : obj (o) {} inline LocalRef (const LocalRef& other) noexcept : obj (retain (other.obj)) {} - inline LocalRef (LocalRef&& other) noexcept : obj (0) { std::swap (obj, other.obj); } + inline LocalRef (LocalRef&& other) noexcept : obj (nullptr) { std::swap (obj, other.obj); } ~LocalRef() { clear(); } void clear() { - if (obj != 0) + if (obj != nullptr) { getEnv()->DeleteLocalRef (obj); - obj = 0; + obj = nullptr; } } @@ -69,7 +69,7 @@ private: static JavaType retain (JavaType obj) { - return obj == 0 ? 0 : (JavaType) getEnv()->NewLocalRef (obj); + return obj == nullptr ? nullptr : (JavaType) getEnv()->NewLocalRef (obj); } }; @@ -77,21 +77,21 @@ private: class GlobalRef { public: - inline GlobalRef() noexcept : obj (0) {} + inline GlobalRef() noexcept : obj (nullptr) {} inline explicit GlobalRef (const LocalRef& o) : obj (retain (o.get(), getEnv())) {} inline explicit GlobalRef (const LocalRef& o, JNIEnv* env) : obj (retain (o.get(), env)) {} inline GlobalRef (const GlobalRef& other) : obj (retain (other.obj, getEnv())) {} - inline GlobalRef (GlobalRef && other) noexcept : obj (0) { std::swap (other.obj, obj); } + inline GlobalRef (GlobalRef && other) noexcept : obj (nullptr) { std::swap (other.obj, obj); } ~GlobalRef() { clear(); } - inline void clear() { if (obj != 0) clear (getEnv()); } + inline void clear() { if (obj != nullptr) clear (getEnv()); } inline void clear (JNIEnv* env) { - if (obj != 0) + if (obj != nullptr) { env->DeleteGlobalRef (obj); - obj = 0; + obj = nullptr; } } @@ -147,11 +147,11 @@ public: private: //============================================================================== - jobject obj = 0; + jobject obj = nullptr; static inline jobject retain (jobject obj, JNIEnv* env) { - return obj == 0 ? 0 : env->NewGlobalRef (obj); + return obj == nullptr ? nullptr : env->NewGlobalRef (obj); } }; @@ -193,7 +193,7 @@ private: size_t byteCodeSize; int minSDK; - jclass classRef = 0; + jclass classRef = nullptr; static Array& getClasses(); void initialise (JNIEnv*); @@ -755,7 +755,7 @@ namespace { inline String juceString (JNIEnv* env, jstring s) { - if (s == 0) + if (s == nullptr) return {}; const char* const utf8 = env->GetStringUTFChars (s, nullptr); @@ -889,7 +889,7 @@ private: //============================================================================== struct SurfaceHolderCallback : AndroidInterfaceImplementer { - virtual ~SurfaceHolderCallback() {} + virtual ~SurfaceHolderCallback() override = default; virtual void surfaceChanged (LocalRef holder, int format, int width, int height) = 0; virtual void surfaceCreated (LocalRef holder) = 0; diff --git a/modules/juce_core/native/juce_android_Network.cpp b/modules/juce_core/native/juce_android_Network.cpp index 375b5fbc49..83e8522d0a 100644 --- a/modules/juce_core/native/juce_android_Network.cpp +++ b/modules/juce_core/native/juce_android_Network.cpp @@ -297,7 +297,7 @@ public: const ScopedLock lock (createStreamLock); - if (stream != 0) + if (stream != nullptr) { stream.callVoidMethod (HTTPStream.release); stream.clear(); @@ -333,7 +333,7 @@ public: if (isPost) WebInputStream::createHeadersAndPostData (url, headers, postData); - jbyteArray postDataArray = 0; + jbyteArray postDataArray = nullptr; if (postData.getSize() > 0) { @@ -348,7 +348,7 @@ public: jassert (Thread::getCurrentThread() != nullptr); jintArray statusCodeArray = env->NewIntArray (1); - jassert (statusCodeArray != 0); + jassert (statusCodeArray != nullptr); { const ScopedLock lock (createStreamLock); @@ -367,18 +367,18 @@ public: javaString (httpRequest).get()))); } - if (stream != 0 && ! stream.callBooleanMethod (HTTPStream.connect)) + if (stream != nullptr && ! stream.callBooleanMethod (HTTPStream.connect)) stream.clear(); - jint* const statusCodeElements = env->GetIntArrayElements (statusCodeArray, 0); + jint* const statusCodeElements = env->GetIntArrayElements (statusCodeArray, nullptr); statusCode = statusCodeElements[0]; env->ReleaseIntArrayElements (statusCodeArray, statusCodeElements, 0); env->DeleteLocalRef (statusCodeArray); - if (postDataArray != 0) + if (postDataArray != nullptr) env->DeleteLocalRef (postDataArray); - if (stream != 0) + if (stream != nullptr) { StringArray headerLines; @@ -547,12 +547,12 @@ static Array findIPAddresses (int dummySocket) if (item.ifr_addr.sa_family == AF_INET) { InterfaceInfo info; - info.interfaceAddress = makeAddress ((const sockaddr_in*) &item.ifr_addr); + info.interfaceAddress = makeAddress (reinterpret_cast (&item.ifr_addr)); if (! info.interfaceAddress.isNull()) { if (ioctl (dummySocket, SIOCGIFBRDADDR, &item) == 0) - info.broadcastAddress = makeAddress ((const sockaddr_in*) &item.ifr_broadaddr); + info.broadcastAddress = makeAddress (reinterpret_cast (&item.ifr_broadaddr)); result.add (info); } diff --git a/modules/juce_core/native/juce_android_RuntimePermissions.cpp b/modules/juce_core/native/juce_android_RuntimePermissions.cpp index 8d8fa14638..d4b1acf03b 100644 --- a/modules/juce_core/native/juce_android_RuntimePermissions.cpp +++ b/modules/juce_core/native/juce_android_RuntimePermissions.cpp @@ -95,7 +95,7 @@ struct PermissionsRequest struct PermissionsOverlay : FragmentOverlay { PermissionsOverlay (CriticalSection& cs) : overlayGuard (cs) {} - ~PermissionsOverlay() {} + ~PermissionsOverlay() override = default; struct PermissionResult { @@ -175,7 +175,7 @@ struct PermissionsOverlay : FragmentOverlay // this code should only be reached for SDKs >= 23, so this method should be // be available - jassert(requestPermissionsMethodID != 0); + jassert(requestPermissionsMethodID != nullptr); env->CallVoidMethod (getNativeHandle(), requestPermissionsMethodID, jPermissionsArray.get (), 0); } diff --git a/modules/juce_core/native/juce_android_Threads.cpp b/modules/juce_core/native/juce_android_Threads.cpp index ec1135b163..1b72686dda 100644 --- a/modules/juce_core/native/juce_android_Threads.cpp +++ b/modules/juce_core/native/juce_android_Threads.cpp @@ -113,7 +113,7 @@ public: checkActivityIsMain (androidApkContext); } - ~JuceActivityWatcher() + ~JuceActivityWatcher() override { LocalRef appContext (getAppContext()); diff --git a/modules/juce_core/native/juce_mac_Network.mm b/modules/juce_core/native/juce_mac_Network.mm index 7c3104d85f..d86baf45b6 100644 --- a/modules/juce_core/native/juce_mac_Network.mm +++ b/modules/juce_core/native/juce_mac_Network.mm @@ -425,7 +425,8 @@ struct BackgroundDownloadTask : public URL::DownloadTask DelegateClass::setState (delegate, this); activeSessions.set (uniqueIdentifier, this); - NSMutableURLRequest* request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:juceStringToNS (urlToUse.toString (true))]]; + auto nsUrl = [NSURL URLWithString: juceStringToNS (urlToUse.toString (true))]; + NSMutableURLRequest* request = [[NSMutableURLRequest alloc] initWithURL: nsUrl]; if (shouldUsePostRequest) [request setHTTPMethod: @"POST"]; diff --git a/modules/juce_events/native/juce_android_Messaging.cpp b/modules/juce_events/native/juce_android_Messaging.cpp index 7cee9b0730..f563d9904a 100644 --- a/modules/juce_events/native/juce_android_Messaging.cpp +++ b/modules/juce_events/native/juce_android_Messaging.cpp @@ -76,7 +76,7 @@ struct AndroidMessageQueue : private Android::Runnable { } - ~AndroidMessageQueue() + ~AndroidMessageQueue() override { JUCE_ASSERT_MESSAGE_THREAD clearSingletonInstance(); @@ -156,14 +156,14 @@ void MessageManager::stopDispatchLoop() { jmethodID quitMethod = env->GetMethodID (AndroidActivity, "finishAndRemoveTask", "()V"); - if (quitMethod != 0) + if (quitMethod != nullptr) { env->CallVoidMethod (activity.get(), quitMethod); return; } quitMethod = env->GetMethodID (AndroidActivity, "finish", "()V"); - jassert (quitMethod != 0); + jassert (quitMethod != nullptr); env->CallVoidMethod (activity.get(), quitMethod); } else @@ -195,7 +195,7 @@ public: } } - ~JuceAppLifecycle() + ~JuceAppLifecycle() override { LocalRef appContext (getAppContext()); diff --git a/modules/juce_graphics/image_formats/juce_JPEGLoader.cpp b/modules/juce_graphics/image_formats/juce_JPEGLoader.cpp index 5c635717f7..413e519e34 100644 --- a/modules/juce_graphics/image_formats/juce_JPEGLoader.cpp +++ b/modules/juce_graphics/image_formats/juce_JPEGLoader.cpp @@ -43,6 +43,7 @@ namespace jpeglibNamespace #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wconversion" #pragma clang diagnostic ignored "-Wdeprecated-register" + #pragma clang diagnostic ignored "-Wcast-align" #if __has_warning("-Wzero-as-null-pointer-constant") #pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant" #endif diff --git a/modules/juce_graphics/native/juce_android_Fonts.cpp b/modules/juce_graphics/native/juce_android_Fonts.cpp index cf3e36146f..26445be2d7 100644 --- a/modules/juce_graphics/native/juce_android_Fonts.cpp +++ b/modules/juce_graphics/native/juce_android_Fonts.cpp @@ -374,7 +374,7 @@ public: { et = new EdgeTable (bounds); - jint* const maskDataElements = env->GetIntArrayElements ((jintArray) cachedRenderArray.get(), 0); + jint* const maskDataElements = env->GetIntArrayElements ((jintArray) cachedRenderArray.get(), nullptr); const jint* mask = maskDataElements; for (int y = bounds.getY(); y < bounds.getBottom(); ++y) @@ -494,7 +494,7 @@ private: String key; { LocalRef digest (env->CallStaticObjectMethod (JavaMessageDigest, JavaMessageDigest.getInstance, javaString("MD5").get())); - LocalRef bytes(env->NewByteArray(size)); + LocalRef bytes(env->NewByteArray ((int) size)); jboolean ignore; auto* jbytes = env->GetByteArrayElements(bytes.get(), &ignore); diff --git a/modules/juce_gui_basics/filebrowser/juce_ContentSharer.cpp b/modules/juce_gui_basics/filebrowser/juce_ContentSharer.cpp index 6f54fb35ea..ac2c443096 100644 --- a/modules/juce_gui_basics/filebrowser/juce_ContentSharer.cpp +++ b/modules/juce_gui_basics/filebrowser/juce_ContentSharer.cpp @@ -44,7 +44,7 @@ public: startThread(); } - ~PrepareImagesThread() + ~PrepareImagesThread() override { signalThreadShouldExit(); waitForThreadToExit (10000); @@ -98,7 +98,7 @@ public: startThread(); } - ~PrepareDataThread() + ~PrepareDataThread() override { signalThreadShouldExit(); waitForThreadToExit (10000); diff --git a/modules/juce_gui_basics/native/juce_MultiTouchMapper.h b/modules/juce_gui_basics/native/juce_MultiTouchMapper.h index f72711bf54..af64d15ca3 100644 --- a/modules/juce_gui_basics/native/juce_MultiTouchMapper.h +++ b/modules/juce_gui_basics/native/juce_MultiTouchMapper.h @@ -35,7 +35,7 @@ public: int getIndexOfTouch (ComponentPeer* peer, IDType touchID) { - jassert (touchID != 0); // need to rethink this if IDs can be 0! + jassert (touchID != nullptr); // need to rethink this if IDs can be 0! TouchInfo info {touchID, peer}; int touchIndex = currentTouches.indexOf (info); @@ -64,7 +64,7 @@ public: bool areAnyTouchesActive() const noexcept { for (auto& t : currentTouches) - if (t.touchId != 0) + if (t.touchId != nullptr) return true; return false; @@ -74,14 +74,14 @@ public: { for (auto& t : currentTouches) if (t.owner == peer) - t.touchId = 0; + t.touchId = nullptr; } private: //============================================================================== struct TouchInfo { - TouchInfo() noexcept : touchId (0), owner (nullptr) {} + TouchInfo() noexcept : touchId (nullptr), owner (nullptr) {} TouchInfo (IDType idToUse, ComponentPeer* peer) noexcept : touchId (idToUse), owner (peer) {} TouchInfo (const TouchInfo&) = default; diff --git a/modules/juce_gui_basics/native/juce_android_ContentSharer.cpp b/modules/juce_gui_basics/native/juce_android_ContentSharer.cpp index c8b58c7e1e..16ee696b56 100644 --- a/modules/juce_gui_basics/native/juce_android_ContentSharer.cpp +++ b/modules/juce_gui_basics/native/juce_android_ContentSharer.cpp @@ -135,7 +135,7 @@ public: resultColumns.get())))) { // the content provider must be created first - jassert (contentProvider.get() != 0); + jassert (contentProvider.get() != nullptr); } jobject getNativeCursor() { return cursor.get(); } @@ -199,7 +199,7 @@ public: open | access | closeWrite | closeNoWrite)))) { // the content provider must be created first - jassert (contentProvider.get() != 0); + jassert (contentProvider.get() != nullptr); env->CallVoidMethod (fileObserver, JuceContentProviderFileObserver.startWatching); } @@ -284,7 +284,7 @@ public: startThread(); } - ~AndroidContentSharerPrepareFilesThread() + ~AndroidContentSharerPrepareFilesThread() override { signalThreadShouldExit(); waitForThreadToExit (10000); @@ -307,7 +307,7 @@ private: ~StreamCloser() { - if (stream.get() != 0) + if (stream.get() != nullptr) getEnv()->CallVoidMethod (stream, JavaCloseable.close); } @@ -471,7 +471,7 @@ public: { } - ~ContentSharerNativeImpl() + ~ContentSharerNativeImpl() override { masterReference.clear(); } @@ -586,7 +586,7 @@ public: return cursor->getNativeCursor(); auto values = LocalRef (env->NewObjectArray ((jsize) resultColumns.size(), - JavaObject, 0)); + JavaObject, nullptr)); for (int i = 0; i < resultColumns.size(); ++i) { diff --git a/modules/juce_gui_basics/native/juce_android_FileChooser.cpp b/modules/juce_gui_basics/native/juce_android_FileChooser.cpp index d95d4671b4..4ba5f50787 100644 --- a/modules/juce_gui_basics/native/juce_android_FileChooser.cpp +++ b/modules/juce_gui_basics/native/juce_android_FileChooser.cpp @@ -134,7 +134,7 @@ public: jassertfalse; // there can only be a single file chooser } - ~Native() + ~Native() override { masterReference.clear(); currentFileChooser = nullptr; diff --git a/modules/juce_gui_basics/native/juce_android_Windowing.cpp b/modules/juce_gui_basics/native/juce_android_Windowing.cpp index 12c196f542..a881c4944a 100644 --- a/modules/juce_gui_basics/native/juce_android_Windowing.cpp +++ b/modules/juce_gui_basics/native/juce_android_Windowing.cpp @@ -318,7 +318,7 @@ public: handleFocusGain(); } - ~AndroidComponentPeer() + ~AndroidComponentPeer() override { auto* env = getEnv(); @@ -466,7 +466,7 @@ public: LocalRef position (env->NewIntArray (2)); env->CallVoidMethod (view.get(), AndroidView.getLocationOnScreen, position.get()); - jint* const screenPosition = env->GetIntArrayElements (position.get(), 0); + jint* const screenPosition = env->GetIntArrayElements (position.get(), nullptr); Point pos (screenPosition[0], screenPosition[1]); env->ReleaseIntArrayElements (position.get(), screenPosition, 0); @@ -774,7 +774,7 @@ public: return; } - if (jint* dest = env->GetIntArrayElements ((jintArray) buffer.get(), 0)) + if (jint* dest = env->GetIntArrayElements ((jintArray) buffer.get(), nullptr)) { { Image temp (new PreallocatedImage (clip.getWidth(), clip.getHeight(), @@ -936,7 +936,7 @@ private: zeromem (data_, static_cast (width * height) * sizeof (jint)); } - ~PreallocatedImage() + ~PreallocatedImage() override { if (hasAlpha) { @@ -970,7 +970,7 @@ private: ImagePixelData::Ptr clone() override { - auto s = new PreallocatedImage (width, height, 0, hasAlpha); + auto s = new PreallocatedImage (width, height, nullptr, hasAlpha); s->allocatedData.malloc (sizeof (jint) * static_cast (width * height)); s->data = s->allocatedData; memcpy (s->data, data, sizeof (jint) * static_cast (width * height)); @@ -1027,11 +1027,11 @@ Desktop::DisplayOrientation Desktop::getCurrentOrientation() const LocalRef windowManager = LocalRef (env->CallObjectMethod (getAppContext().get(), AndroidContext.getSystemService, windowServiceString.get())); - if (windowManager.get() != 0) + if (windowManager.get() != nullptr) { LocalRef display = LocalRef (env->CallObjectMethod (windowManager, AndroidWindowManager.getDefaultDisplay)); - if (display.get() != 0) + if (display.get() != nullptr) { int rotation = env->CallIntMethod (display, AndroidDisplay.getRotation); @@ -1414,7 +1414,7 @@ void Displays::findDisplays (float masterScale) jmethodID getRealMetricsMethod = env->GetMethodID (AndroidDisplay, "getRealMetrics", "(Landroid/util/DisplayMetrics;)V"); - if (getRealMetricsMethod != 0) + if (getRealMetricsMethod != nullptr) env->CallVoidMethod (display.get(), getRealMetricsMethod, displayMetrics.get()); else env->CallVoidMethod (display.get(), AndroidDisplay.getMetrics, displayMetrics.get()); diff --git a/modules/juce_gui_basics/native/juce_ios_ContentSharer.cpp b/modules/juce_gui_basics/native/juce_ios_ContentSharer.cpp index 1111288356..da10b2ad35 100644 --- a/modules/juce_gui_basics/native/juce_ios_ContentSharer.cpp +++ b/modules/juce_gui_basics/native/juce_ios_ContentSharer.cpp @@ -38,7 +38,7 @@ public: popoverDelegate.reset ([cls.createInstance() init]); } - ~ContentSharerNativeImpl() + ~ContentSharerNativeImpl() override { exitModalState (0); } diff --git a/modules/juce_gui_basics/native/juce_ios_FileChooser.mm b/modules/juce_gui_basics/native/juce_ios_FileChooser.mm index cf5f613e0c..4cea7ea053 100644 --- a/modules/juce_gui_basics/native/juce_ios_FileChooser.mm +++ b/modules/juce_gui_basics/native/juce_ios_FileChooser.mm @@ -115,7 +115,7 @@ public: } } - ~Native() + ~Native() override { exitModalState (0); } diff --git a/modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm b/modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm index 0944ac34e6..34d0d6a10e 100644 --- a/modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm +++ b/modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm @@ -177,7 +177,7 @@ class UIViewComponentPeer : public ComponentPeer, { public: UIViewComponentPeer (Component&, int windowStyleFlags, UIView* viewToAttachTo); - ~UIViewComponentPeer(); + ~UIViewComponentPeer() override; //============================================================================== void* getNativeHandle() const override { return view; } diff --git a/modules/juce_gui_extra/embedding/juce_AndroidViewComponent.h b/modules/juce_gui_extra/embedding/juce_AndroidViewComponent.h index 8234437774..440b5a662f 100644 --- a/modules/juce_gui_extra/embedding/juce_AndroidViewComponent.h +++ b/modules/juce_gui_extra/embedding/juce_AndroidViewComponent.h @@ -50,7 +50,7 @@ public: AndroidViewComponent(); /** Destructor. */ - ~AndroidViewComponent(); + ~AndroidViewComponent() override; /** Assigns a View to this peer. diff --git a/modules/juce_gui_extra/embedding/juce_UIViewComponent.h b/modules/juce_gui_extra/embedding/juce_UIViewComponent.h index ed04812f84..90c4bc6092 100644 --- a/modules/juce_gui_extra/embedding/juce_UIViewComponent.h +++ b/modules/juce_gui_extra/embedding/juce_UIViewComponent.h @@ -50,7 +50,7 @@ public: UIViewComponent(); /** Destructor. */ - ~UIViewComponent(); + ~UIViewComponent() override; /** Assigns an UIView to this peer. diff --git a/modules/juce_gui_extra/native/juce_AndroidViewComponent.cpp b/modules/juce_gui_extra/native/juce_AndroidViewComponent.cpp index 82c283ff54..6f51d2abf7 100644 --- a/modules/juce_gui_extra/native/juce_AndroidViewComponent.cpp +++ b/modules/juce_gui_extra/native/juce_AndroidViewComponent.cpp @@ -39,7 +39,7 @@ public: componentPeerChanged(); } - ~Pimpl() + ~Pimpl() override { removeFromParent(); } @@ -123,7 +123,7 @@ private: auto* env = getEnv(); auto parentView = env->CallObjectMethod (view, AndroidView.getParent); - if (parentView != 0) + if (parentView != nullptr) { // Assuming a parent is always of ViewGroup type env->CallVoidMethod (parentView, AndroidViewGroup.removeView, view.get()); diff --git a/modules/juce_gui_extra/native/juce_android_PushNotifications.cpp b/modules/juce_gui_extra/native/juce_android_PushNotifications.cpp index acbbf2e2ac..41bd3de2e0 100644 --- a/modules/juce_gui_extra/native/juce_android_PushNotifications.cpp +++ b/modules/juce_gui_extra/native/juce_android_PushNotifications.cpp @@ -280,7 +280,7 @@ struct PushNotifications::Pimpl auto notificationManager = getNotificationManager(); - if (notificationManager.get() != 0) + if (notificationManager.get() != nullptr) return env->CallBooleanMethod (notificationManager, NotificationManagerApi24.areNotificationsEnabled); } @@ -297,7 +297,7 @@ struct PushNotifications::Pimpl auto notificationManager = getNotificationManager(); - if (notificationManager.get() != 0) + if (notificationManager.get() != nullptr) { auto notification = juceNotificationToJavaNotification (n); @@ -317,10 +317,9 @@ struct PushNotifications::Pimpl Array notifications; auto notificationManager = getNotificationManager(); + jassert (notificationManager != nullptr); - jassert (notificationManager.get() != 0); - - if (notificationManager.get() != 0) + if (notificationManager.get() != nullptr) { auto statusBarNotifications = LocalRef ((jobjectArray)env->CallObjectMethod (notificationManager, NotificationManagerApi23.getActiveNotifications)); @@ -389,7 +388,7 @@ struct PushNotifications::Pimpl auto remoteInputResult = LocalRef (env->CallStaticObjectMethod (RemoteInput, RemoteInput.getResultsFromIntent, intent.get())); String responseString; - if (remoteInputResult.get() != 0) + if (remoteInputResult.get() == nullptr) { auto charSequence = LocalRef (env->CallObjectMethod (remoteInputResult, AndroidBundle.getCharSequence, resultKeyString.get())); auto responseStringRef = LocalRef ((jstring) env->CallObjectMethod (charSequence, JavaCharSequence.toString)); @@ -416,7 +415,7 @@ struct PushNotifications::Pimpl auto notificationManager = getNotificationManager(); - if (notificationManager.get() != 0) + if (notificationManager.get() != nullptr) env->CallVoidMethod (notificationManager.get(), NotificationManagerBase.cancelAll); } @@ -426,7 +425,7 @@ struct PushNotifications::Pimpl auto notificationManager = getNotificationManager(); - if (notificationManager.get() != 0) + if (notificationManager.get() != nullptr) { auto tag = javaString (identifier); const int id = 0; @@ -635,12 +634,12 @@ struct PushNotifications::Pimpl LocalRef context (getMainActivity()); jclass builderClass = env->FindClass ("android/app/Notification$Builder"); - jassert (builderClass != 0); + jassert (builderClass != nullptr); - if (builderClass == 0) - return LocalRef (0); + if (builderClass == nullptr) + return LocalRef (nullptr); - jmethodID builderConstructor = 0; + jmethodID builderConstructor = nullptr; const bool apiAtLeast26 = (getAndroidSDKVersion() >= 26); @@ -649,10 +648,10 @@ struct PushNotifications::Pimpl else builderConstructor = env->GetMethodID (builderClass, "", "(Landroid/content/Context;)V"); - jassert (builderConstructor != 0); + jassert (builderConstructor != nullptr); - if (builderConstructor == 0) - return LocalRef (0); + if (builderConstructor == nullptr) + return LocalRef (nullptr); if (apiAtLeast26) return LocalRef (env->NewObject (builderClass, builderConstructor, @@ -754,7 +753,7 @@ struct PushNotifications::Pimpl { auto array = LocalRef (env->NewLongArray (size)); - jlong* elements = env->GetLongArrayElements (array, 0); + jlong* elements = env->GetLongArrayElements (array, nullptr); for (int i = 0; i < size; ++i) elements[i] = (jlong) n.vibrationPattern[i]; @@ -808,7 +807,7 @@ struct PushNotifications::Pimpl { auto array = LocalRef (env->NewLongArray (size)); - jlong* elements = env->GetLongArrayElements (array, 0); + jlong* elements = env->GetLongArrayElements (array, nullptr); for (int i = 0; i < size; ++i) elements[i] = (jlong) n.vibrationPattern[i]; @@ -993,7 +992,7 @@ struct PushNotifications::Pimpl const int size = action.allowedResponses.size(); - auto array = LocalRef (env->NewObjectArray (size, env->FindClass ("java/lang/String"), 0)); + auto array = LocalRef (env->NewObjectArray (size, env->FindClass ("java/lang/String"), nullptr)); for (int i = 0; i < size; ++i) { @@ -1123,7 +1122,7 @@ struct PushNotifications::Pimpl PushNotifications::Notification n; - if (bundle.get() != 0) + if (bundle.get() != nullptr) { n.identifier = getStringFromBundle (env, "identifier", bundle); n.title = getStringFromBundle (env, "title", bundle); @@ -1239,7 +1238,7 @@ struct PushNotifications::Pimpl const int size = env->GetArrayLength (array.get()); - jlong* elements = env->GetLongArrayElements (array.get(), 0); + jlong* elements = env->GetLongArrayElements (array.get(), nullptr); Array resultArray; @@ -1280,7 +1279,7 @@ struct PushNotifications::Pimpl static var bundleToVar (const LocalRef& bundle) { - if (bundle.get() != 0) + if (bundle.get() == nullptr) { auto* env = getEnv(); @@ -1400,7 +1399,7 @@ struct PushNotifications::Pimpl propertiesDynamicObject->setProperty ("titleLocalizationKey", juceString (titleLocalizationKey.get())); propertiesDynamicObject->setProperty ("bodyLocalizationArgs", javaStringArrayToJuce (bodyLocalizationArgs)); propertiesDynamicObject->setProperty ("titleLocalizationArgs", javaStringArrayToJuce (titleLocalizationArgs)); - propertiesDynamicObject->setProperty ("link", link.get() != 0 ? juceString ((jstring) env->CallObjectMethod (link, AndroidUri.toString)) : String()); + propertiesDynamicObject->setProperty ("link", link.get() == nullptr ? juceString ((jstring) env->CallObjectMethod (link, AndroidUri.toString)) : String()); } n.properties = var (propertiesDynamicObject.get()); @@ -1418,9 +1417,9 @@ struct PushNotifications::Pimpl auto notificationManager = getNotificationManager(); - jassert (notificationManager.get() != 0); + jassert (notificationManager.get() != nullptr); - if (notificationManager.get() == 0) + if (notificationManager.get() == nullptr) return; for (const auto& g : groups) @@ -1463,7 +1462,7 @@ struct PushNotifications::Pimpl if (size > 0) { auto array = LocalRef (env->NewLongArray (size)); - jlong* elements = env->GetLongArrayElements (array, 0); + jlong* elements = env->GetLongArrayElements (array, nullptr); for (int i = 0; i < size; ++i) elements[i] = (jlong) c.vibrationPattern[i]; @@ -1527,7 +1526,7 @@ struct PushNotifications::Pimpl auto categories = LocalRef (env->CallObjectMethod (intent, AndroidIntent.getCategories)); - int categoriesNum = categories != 0 + int categoriesNum = categories != nullptr ? env->CallIntMethod (categories, JavaSet.size) : 0; @@ -1542,7 +1541,7 @@ struct PushNotifications::Pimpl auto extras = LocalRef (env->CallObjectMethod (intent, AndroidIntent.getExtras)); - if (extras == 0) + if (extras == nullptr) return false; return env->CallBooleanMethod (extras, AndroidBundle.containsKey, javaString ("google.sent_time").get()) diff --git a/modules/juce_gui_extra/native/juce_android_WebBrowserComponent.cpp b/modules/juce_gui_extra/native/juce_android_WebBrowserComponent.cpp index ed1a125ca5..4661ff368e 100644 --- a/modules/juce_gui_extra/native/juce_android_WebBrowserComponent.cpp +++ b/modules/juce_gui_extra/native/juce_android_WebBrowserComponent.cpp @@ -424,7 +424,7 @@ private: startThread(); } - ~ConnectionThread() + ~ConnectionThread() override { webInputStream->cancel(); signalThreadShouldExit(); @@ -559,11 +559,11 @@ private: LocalRef responseClass (env->FindClass ("android/webkit/WebResourceResponse")); - if (responseClass != 0) + if (responseClass != nullptr) { jmethodID method = env->GetMethodID (responseClass, "getReasonPhrase", "()Ljava/lang/String;"); - if (method != 0) + if (method != nullptr) { auto errorString = LocalRef ((jstring) env->CallObjectMethod (errorResponse, method)); @@ -671,7 +671,7 @@ void WebBrowserComponent::checkWindowAssociation() // page to avoid this, (and send it back when it's made visible again). blankPageShown = true; - browser->goToURL ("about:blank", 0, 0); + browser->goToURL ("about:blank", nullptr, nullptr); } } } @@ -711,7 +711,7 @@ void WebBrowserComponent::clearCookies() auto cookieManager = LocalRef (env->CallStaticObjectMethod (AndroidCookieManager, AndroidCookieManager.getInstance)); - jmethodID clearCookiesMethod = 0; + jmethodID clearCookiesMethod = nullptr; if (getAndroidSDKVersion() >= 21) { diff --git a/modules/juce_gui_extra/native/juce_ios_UIViewComponent.mm b/modules/juce_gui_extra/native/juce_ios_UIViewComponent.mm index 2aa4747480..7053ed6a23 100644 --- a/modules/juce_gui_extra/native/juce_ios_UIViewComponent.mm +++ b/modules/juce_gui_extra/native/juce_ios_UIViewComponent.mm @@ -41,7 +41,7 @@ public: componentPeerChanged(); } - ~Pimpl() + ~Pimpl() override { [view removeFromSuperview]; [view release]; diff --git a/modules/juce_opengl/native/juce_OpenGL_android.h b/modules/juce_opengl/native/juce_OpenGL_android.h index d0c4d5f809..9265fa01ff 100644 --- a/modules/juce_opengl/native/juce_OpenGL_android.h +++ b/modules/juce_opengl/native/juce_OpenGL_android.h @@ -118,7 +118,7 @@ public: hasInitialised = true; } - ~NativeContext() + ~NativeContext() override { auto env = getEnv(); @@ -165,7 +165,7 @@ public: } // create the surface - surface = eglCreateWindowSurface (display, config, window, 0); + surface = eglCreateWindowSurface (display, config, window, nullptr); jassert (surface != EGL_NO_SURFACE); ANativeWindow_release (window); @@ -317,7 +317,7 @@ private: return false; } - if (! eglInitialize (display, 0, 0)) + if (! eglInitialize (display, nullptr, nullptr)) { jassertfalse; return false; diff --git a/modules/juce_opengl/opengl/juce_OpenGLContext.cpp b/modules/juce_opengl/opengl/juce_OpenGLContext.cpp index e59b1f9b7b..d3acf0ecc6 100644 --- a/modules/juce_opengl/opengl/juce_OpenGLContext.cpp +++ b/modules/juce_opengl/opengl/juce_OpenGLContext.cpp @@ -40,8 +40,8 @@ extern Array appBecomingInactiveCallbacks; // this prevents them from happening (which some messy locking behaviour) struct iOSBackgroundProcessCheck : public AppInactivityCallback { - iOSBackgroundProcessCheck() { isBackgroundProcess(); appBecomingInactiveCallbacks.add (this); } - ~iOSBackgroundProcessCheck() { appBecomingInactiveCallbacks.removeAllInstancesOf (this); } + iOSBackgroundProcessCheck() { isBackgroundProcess(); appBecomingInactiveCallbacks.add (this); } + ~iOSBackgroundProcessCheck() override { appBecomingInactiveCallbacks.removeAllInstancesOf (this); } bool isBackgroundProcess() { diff --git a/modules/juce_video/native/juce_android_CameraDevice.h b/modules/juce_video/native/juce_android_CameraDevice.h index 783eb178e9..30aa1ab924 100644 --- a/modules/juce_video/native/juce_android_CameraDevice.h +++ b/modules/juce_video/native/juce_android_CameraDevice.h @@ -508,7 +508,7 @@ struct CameraDevice::Pimpl startBackgroundThread(); } - ~Pimpl() + ~Pimpl() override { auto* env = getEnv(); @@ -764,18 +764,18 @@ private: auto* env = getEnv(); - #define PRINT_ELEMENTS(elem_type, array_type, fun_name_middle) \ - { \ - elem_type* elements = env->Get##fun_name_middle##ArrayElements ((array_type) keyValue.get(), 0); \ - int size = env->GetArrayLength ((array_type) keyValue.get()); \ - \ - for (int i = 0; i < size - 1; ++i) \ - result << String (elements[i]) << " "; \ - \ - if (size > 0) \ - result << String (elements[size - 1]); \ - \ - env->Release##fun_name_middle##ArrayElements ((array_type) keyValue.get(), elements, 0); \ + #define PRINT_ELEMENTS(elem_type, array_type, fun_name_middle) \ + { \ + elem_type* elements = env->Get##fun_name_middle##ArrayElements ((array_type) keyValue.get(), nullptr); \ + int size = env->GetArrayLength ((array_type) keyValue.get()); \ + \ + for (int i = 0; i < size - 1; ++i) \ + result << String (elements[i]) << " "; \ + \ + if (size > 0) \ + result << String (elements[size - 1]); \ + \ + env->Release##fun_name_middle##ArrayElements ((array_type) keyValue.get(), elements, 0); \ } if (keyValueString.startsWith ("[I")) @@ -996,7 +996,7 @@ private: "android/view/TextureView$SurfaceTextureListener").get()); } - ~PreviewDisplay() + ~PreviewDisplay() override { getEnv()->CallVoidMethod (textureView, AndroidTextureView.setSurfaceTextureListener, nullptr); } @@ -1144,7 +1144,7 @@ private: handlerToUse.get()); } - ~ImageReader() + ~ImageReader() override { getEnv()->CallVoidMethod (imageReader, AndroidImageReader.close); } @@ -1405,7 +1405,7 @@ private: getEnv()->CallVoidMethod (mediaRecorder, AndroidMediaRecorder.prepare); } - ~MediaRecorder() + ~MediaRecorder() override { getEnv()->CallVoidMethod (mediaRecorder, AndroidMediaRecorder.release); } @@ -2494,7 +2494,7 @@ private: //============================================================================== struct CaptureSessionModeBase { - virtual ~CaptureSessionModeBase() { } + virtual ~CaptureSessionModeBase() = default; virtual bool isVideoRecordSession() const = 0; @@ -2507,7 +2507,7 @@ private: private PreviewDisplay::Listener, private ScopedCameraDevice::CaptureSession::ConfiguredCallback { - ~CaptureSessionMode() + ~CaptureSessionMode() override { captureSession.reset(); @@ -2789,7 +2789,7 @@ private: setEnabled (true); } - ~DeviceOrientationChangeListener() + ~DeviceOrientationChangeListener() override { setEnabled (false); } @@ -2985,7 +2985,7 @@ private: { auto* env = getEnv(); - auto* jArrayElems = env->GetIntArrayElements (jArray, 0); + auto* jArrayElems = env->GetIntArrayElements (jArray, nullptr); auto numElems = env->GetArrayLength (jArray); Array juceArray; diff --git a/modules/juce_video/native/juce_android_Video.h b/modules/juce_video/native/juce_android_Video.h index b416d064e8..7c7beeadcc 100644 --- a/modules/juce_video/native/juce_android_Video.h +++ b/modules/juce_video/native/juce_android_Video.h @@ -375,7 +375,7 @@ struct VideoComponent::Pimpl } } - ~Pimpl() + ~Pimpl() override { auto* env = getEnv(); @@ -502,7 +502,7 @@ private: env->CallVoidMethod (nativeMediaSession, AndroidMediaSession.setCallback, mediaSessionCallback.get()); } - ~MediaSession() + ~MediaSession() override { auto* env = getEnv(); @@ -1405,7 +1405,7 @@ private: auto playPos = player.getPlayPosition(); auto durationMs = player.getVideoDuration(); - int playPosPercent = 100 * playPos / static_cast (durationMs); + auto playPosPercent = (int) (100.0 * playPos / static_cast (durationMs)); // NB: assuming the playback will start roughly when there is 5% of content loaded... return ! bufferedRegions.containsRange (Range (playPosPercent, jmin (101, playPosPercent + 5))); @@ -1456,7 +1456,7 @@ private: auto playPos = player.getPlayPosition(); auto durationMs = player.getVideoDuration(); - int playPosPercent = 100 * playPos / static_cast (durationMs); + auto playPosPercent = (int) (100.0 * playPos / static_cast (durationMs)); bufferedRegions.addRange (Range (playPosPercent, progress + 1)); diff --git a/modules/juce_video/native/juce_ios_CameraDevice.h b/modules/juce_video/native/juce_ios_CameraDevice.h index 9147735117..edefe326c1 100644 --- a/modules/juce_video/native/juce_ios_CameraDevice.h +++ b/modules/juce_video/native/juce_ios_CameraDevice.h @@ -304,7 +304,7 @@ private: static String cmTimeToString (CMTime time) { - CFStringRef timeDesc = CMTimeCopyDescription (NULL, time); + CFStringRef timeDesc = CMTimeCopyDescription (nullptr, time); String result = String::fromCFString (timeDesc); CFRelease (timeDesc); @@ -984,7 +984,7 @@ private: class VideoRecorder { public: - VideoRecorder (CaptureSession& captureSession) + VideoRecorder (CaptureSession& session) : movieFileOutput ([AVCaptureMovieFileOutput new]), delegate (nullptr) { @@ -992,7 +992,7 @@ private: delegate.reset ([cls.createInstance() init]); FileOutputRecordingDelegateClass::setOwner (delegate.get(), this); - captureSession.addOutputIfPossible (movieFileOutput); + session.addOutputIfPossible (movieFileOutput); } ~VideoRecorder()