1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Fixed some Android compiler warnings

This commit is contained in:
Tom Poole 2019-06-06 16:50:12 +01:00
parent 645a538001
commit 670f77f80c
37 changed files with 170 additions and 169 deletions

View file

@ -363,7 +363,7 @@ public:
setPortraitOrientationEnabled (true);
}
~VideoDemo()
~VideoDemo() override
{
curVideoComp->onPlaybackStarted = nullptr;
curVideoComp->onPlaybackStopped = nullptr;

View file

@ -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<int> (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<float> inputChannelBuffer, outputChannelBuffer;
jmethodID getUnderrunCount = 0;
jmethodID getUnderrunCount = nullptr;
void closeDevices()
{

View file

@ -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<jobject>(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<OpenSLQueueRunnerPlayer<T>> player;
std::unique_ptr<OpenSLQueueRunnerRecorder<T>> recorder;
Atomic<int> guard;
jmethodID getUnderrunCount = 0;
jmethodID getUnderrunCount = nullptr;
};
//==============================================================================
@ -810,7 +810,7 @@ public:
ignoreUnused (success);
}
~OpenSLAudioIODevice()
~OpenSLAudioIODevice() override
{
close();
}

View file

@ -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);

View file

@ -421,7 +421,7 @@ public:
enterModalState (true, exitCallback.release(), true);
}
~BluetoothMidiSelectorOverlay()
~BluetoothMidiSelectorOverlay() override
{
AndroidBluetoothMidiInterface::startStopScan (false);
}

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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<jobject> 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<jobject> (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();

View file

@ -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<jobject> 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<jobject> (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]);

View file

@ -31,18 +31,18 @@ template <typename JavaType>
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<jobject>& o) : obj (retain (o.get(), getEnv())) {}
inline explicit GlobalRef (const LocalRef<jobject>& 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<JNIClassBase*>& 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<jobject> holder, int format, int width, int height) = 0;
virtual void surfaceCreated (LocalRef<jobject> holder) = 0;

View file

@ -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<InterfaceInfo> 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<const sockaddr_in*> (&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<const sockaddr_in*> (&item.ifr_broadaddr));
result.add (info);
}

View file

@ -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);
}

View file

@ -113,7 +113,7 @@ public:
checkActivityIsMain (androidApkContext);
}
~JuceActivityWatcher()
~JuceActivityWatcher() override
{
LocalRef<jobject> appContext (getAppContext());

View file

@ -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"];

View file

@ -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<jobject> appContext (getAppContext());

View file

@ -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

View file

@ -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<jobject> digest (env->CallStaticObjectMethod (JavaMessageDigest, JavaMessageDigest.getInstance, javaString("MD5").get()));
LocalRef<jbyteArray> bytes(env->NewByteArray(size));
LocalRef<jbyteArray> bytes(env->NewByteArray ((int) size));
jboolean ignore;
auto* jbytes = env->GetByteArrayElements(bytes.get(), &ignore);

View file

@ -44,7 +44,7 @@ public:
startThread();
}
~PrepareImagesThread()
~PrepareImagesThread() override
{
signalThreadShouldExit();
waitForThreadToExit (10000);
@ -98,7 +98,7 @@ public:
startThread();
}
~PrepareDataThread()
~PrepareDataThread() override
{
signalThreadShouldExit();
waitForThreadToExit (10000);

View file

@ -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;

View file

@ -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<jobjectArray> (env->NewObjectArray ((jsize) resultColumns.size(),
JavaObject, 0));
JavaObject, nullptr));
for (int i = 0; i < resultColumns.size(); ++i)
{

View file

@ -134,7 +134,7 @@ public:
jassertfalse; // there can only be a single file chooser
}
~Native()
~Native() override
{
masterReference.clear();
currentFileChooser = nullptr;

View file

@ -318,7 +318,7 @@ public:
handleFocusGain();
}
~AndroidComponentPeer()
~AndroidComponentPeer() override
{
auto* env = getEnv();
@ -466,7 +466,7 @@ public:
LocalRef<jintArray> 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<int> 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<size_t> (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<size_t> (width * height));
s->data = s->allocatedData;
memcpy (s->data, data, sizeof (jint) * static_cast<size_t> (width * height));
@ -1027,11 +1027,11 @@ Desktop::DisplayOrientation Desktop::getCurrentOrientation() const
LocalRef<jobject> windowManager = LocalRef<jobject> (env->CallObjectMethod (getAppContext().get(), AndroidContext.getSystemService, windowServiceString.get()));
if (windowManager.get() != 0)
if (windowManager.get() != nullptr)
{
LocalRef<jobject> display = LocalRef<jobject> (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());

View file

@ -38,7 +38,7 @@ public:
popoverDelegate.reset ([cls.createInstance() init]);
}
~ContentSharerNativeImpl()
~ContentSharerNativeImpl() override
{
exitModalState (0);
}

View file

@ -115,7 +115,7 @@ public:
}
}
~Native()
~Native() override
{
exitModalState (0);
}

View file

@ -177,7 +177,7 @@ class UIViewComponentPeer : public ComponentPeer,
{
public:
UIViewComponentPeer (Component&, int windowStyleFlags, UIView* viewToAttachTo);
~UIViewComponentPeer();
~UIViewComponentPeer() override;
//==============================================================================
void* getNativeHandle() const override { return view; }

View file

@ -50,7 +50,7 @@ public:
AndroidViewComponent();
/** Destructor. */
~AndroidViewComponent();
~AndroidViewComponent() override;
/** Assigns a View to this peer.

View file

@ -50,7 +50,7 @@ public:
UIViewComponent();
/** Destructor. */
~UIViewComponent();
~UIViewComponent() override;
/** Assigns an UIView to this peer.

View file

@ -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());

View file

@ -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<PushNotifications::Notification> notifications;
auto notificationManager = getNotificationManager();
jassert (notificationManager != nullptr);
jassert (notificationManager.get() != 0);
if (notificationManager.get() != 0)
if (notificationManager.get() != nullptr)
{
auto statusBarNotifications = LocalRef<jobjectArray> ((jobjectArray)env->CallObjectMethod (notificationManager,
NotificationManagerApi23.getActiveNotifications));
@ -389,7 +388,7 @@ struct PushNotifications::Pimpl
auto remoteInputResult = LocalRef<jobject> (env->CallStaticObjectMethod (RemoteInput, RemoteInput.getResultsFromIntent, intent.get()));
String responseString;
if (remoteInputResult.get() != 0)
if (remoteInputResult.get() == nullptr)
{
auto charSequence = LocalRef<jobject> (env->CallObjectMethod (remoteInputResult, AndroidBundle.getCharSequence, resultKeyString.get()));
auto responseStringRef = LocalRef<jstring> ((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<jobject> context (getMainActivity());
jclass builderClass = env->FindClass ("android/app/Notification$Builder");
jassert (builderClass != 0);
jassert (builderClass != nullptr);
if (builderClass == 0)
return LocalRef<jobject> (0);
if (builderClass == nullptr)
return LocalRef<jobject> (nullptr);
jmethodID builderConstructor = 0;
jmethodID builderConstructor = nullptr;
const bool apiAtLeast26 = (getAndroidSDKVersion() >= 26);
@ -649,10 +648,10 @@ struct PushNotifications::Pimpl
else
builderConstructor = env->GetMethodID (builderClass, "<init>", "(Landroid/content/Context;)V");
jassert (builderConstructor != 0);
jassert (builderConstructor != nullptr);
if (builderConstructor == 0)
return LocalRef<jobject> (0);
if (builderConstructor == nullptr)
return LocalRef<jobject> (nullptr);
if (apiAtLeast26)
return LocalRef<jobject> (env->NewObject (builderClass, builderConstructor,
@ -754,7 +753,7 @@ struct PushNotifications::Pimpl
{
auto array = LocalRef<jlongArray> (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<jlongArray> (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<jobjectArray> (env->NewObjectArray (size, env->FindClass ("java/lang/String"), 0));
auto array = LocalRef<jobjectArray> (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<int> resultArray;
@ -1280,7 +1279,7 @@ struct PushNotifications::Pimpl
static var bundleToVar (const LocalRef<jobject>& 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<jlongArray> (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<jobject> (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<jobject> (env->CallObjectMethod (intent, AndroidIntent.getExtras));
if (extras == 0)
if (extras == nullptr)
return false;
return env->CallBooleanMethod (extras, AndroidBundle.containsKey, javaString ("google.sent_time").get())

View file

@ -424,7 +424,7 @@ private:
startThread();
}
~ConnectionThread()
~ConnectionThread() override
{
webInputStream->cancel();
signalThreadShouldExit();
@ -559,11 +559,11 @@ private:
LocalRef<jclass> 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> ((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<jobject> (env->CallStaticObjectMethod (AndroidCookieManager,
AndroidCookieManager.getInstance));
jmethodID clearCookiesMethod = 0;
jmethodID clearCookiesMethod = nullptr;
if (getAndroidSDKVersion() >= 21)
{

View file

@ -41,7 +41,7 @@ public:
componentPeerChanged();
}
~Pimpl()
~Pimpl() override
{
[view removeFromSuperview];
[view release];

View file

@ -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;

View file

@ -41,7 +41,7 @@ extern Array<AppInactivityCallback*> appBecomingInactiveCallbacks;
struct iOSBackgroundProcessCheck : public AppInactivityCallback
{
iOSBackgroundProcessCheck() { isBackgroundProcess(); appBecomingInactiveCallbacks.add (this); }
~iOSBackgroundProcessCheck() { appBecomingInactiveCallbacks.removeAllInstancesOf (this); }
~iOSBackgroundProcessCheck() override { appBecomingInactiveCallbacks.removeAllInstancesOf (this); }
bool isBackgroundProcess()
{

View file

@ -508,7 +508,7 @@ struct CameraDevice::Pimpl
startBackgroundThread();
}
~Pimpl()
~Pimpl() override
{
auto* env = getEnv();
@ -766,7 +766,7 @@ private:
#define PRINT_ELEMENTS(elem_type, array_type, fun_name_middle) \
{ \
elem_type* elements = env->Get##fun_name_middle##ArrayElements ((array_type) keyValue.get(), 0); \
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) \
@ -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<int> juceArray;

View file

@ -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<double> (durationMs);
auto playPosPercent = (int) (100.0 * playPos / static_cast<double> (durationMs));
// NB: assuming the playback will start roughly when there is 5% of content loaded...
return ! bufferedRegions.containsRange (Range<int> (playPosPercent, jmin (101, playPosPercent + 5)));
@ -1456,7 +1456,7 @@ private:
auto playPos = player.getPlayPosition();
auto durationMs = player.getVideoDuration();
int playPosPercent = 100 * playPos / static_cast<double> (durationMs);
auto playPosPercent = (int) (100.0 * playPos / static_cast<double> (durationMs));
bufferedRegions.addRange (Range<int> (playPosPercent, progress + 1));

View file

@ -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()