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

Convert ignoreUnused to [[maybe_unused]]

This commit is contained in:
reuk 2022-09-16 19:08:31 +01:00
parent 4351e87bdd
commit 28f2157912
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C
141 changed files with 1057 additions and 1209 deletions

View file

@ -191,10 +191,10 @@ StringArray CameraDevice::getAvailableDevices()
}
}
CameraDevice* CameraDevice::openDevice (int index,
int minWidth, int minHeight,
int maxWidth, int maxHeight,
bool useHighQuality)
CameraDevice* CameraDevice::openDevice ([[maybe_unused]] int index,
[[maybe_unused]] int minWidth, [[maybe_unused]] int minHeight,
[[maybe_unused]] int maxWidth, [[maybe_unused]] int maxHeight,
[[maybe_unused]] bool useHighQuality)
{
jassert (juce::MessageManager::getInstance()->currentThreadHasLockedMessageManager());
@ -204,9 +204,6 @@ CameraDevice* CameraDevice::openDevice (int index,
if (d != nullptr && d->pimpl->openedOk())
return d.release();
#else
ignoreUnused (index, minWidth, minHeight);
ignoreUnused (maxWidth, maxHeight, useHighQuality);
// Use openDeviceAsync to open a camera device on iOS or Android.
jassertfalse;
#endif

View file

@ -715,7 +715,7 @@ private:
{
auto key = LocalRef<jobject> (env->CallObjectMethod (keysList, JavaList.get, i));
auto jKeyName = LocalRef<jstring> ((jstring) env->CallObjectMethod (key, CameraCharacteristicsKey.getName));
auto keyName = juceString (jKeyName);
[[maybe_unused]] auto keyName = juceString (jKeyName);
auto keyValue = LocalRef<jobject> (env->CallObjectMethod (characteristics, CameraCharacteristics.get, key.get()));
auto jKeyValueString = LocalRef<jstring> ((jstring) env->CallObjectMethod (keyValue, JavaObject.toString));
@ -747,16 +747,12 @@ private:
JUCE_CAMERA_LOG ("Key: " + keyName + ", value: " + keyValueString);
}
}
ignoreUnused (keyName);
}
}
static void printPrimitiveArrayElements (const LocalRef<jobject>& keyValue, const String& keyName,
static void printPrimitiveArrayElements (const LocalRef<jobject>& keyValue, [[maybe_unused]] const String& keyName,
const String& keyValueString)
{
ignoreUnused (keyName);
String result = "[";
auto* env = getEnv();
@ -790,7 +786,7 @@ private:
JUCE_CAMERA_LOG ("Key: " + keyName + ", value: " + result);
}
static void printRangeArrayElements (const LocalRef<jobject>& rangeArray, const String& keyName)
static void printRangeArrayElements (const LocalRef<jobject>& rangeArray, [[maybe_unused]] const String& keyName)
{
auto* env = getEnv();
@ -809,7 +805,6 @@ private:
result << juceString (jRangeString) << " ";
}
ignoreUnused (keyName);
JUCE_CAMERA_LOG ("Key: " + keyName + ", value: " + result);
}
@ -921,10 +916,8 @@ private:
javaString (name).get()));
}
static void printSizesLog (const Array<Rectangle<int>>& sizes, const String& className)
static void printSizesLog ([[maybe_unused]] const Array<Rectangle<int>>& sizes, [[maybe_unused]] const String& className)
{
ignoreUnused (sizes, className);
JUCE_CAMERA_LOG ("Sizes for class " + className);
#if JUCE_CAMERA_LOG_ENABLED
@ -1489,18 +1482,14 @@ private:
Desktop::getInstance().setOrientationsEnabled (orientationsEnabled);
}
void onInfo (LocalRef<jobject>& recorder, int what, int extra) override
void onInfo ([[maybe_unused]] LocalRef<jobject>& recorder, [[maybe_unused]] int what, [[maybe_unused]] int extra) override
{
ignoreUnused (recorder, what, extra);
JUCE_CAMERA_LOG ("MediaRecorder::OnInfo: " + getInfoStringFromCode (what)
+ ", extra code = " + String (extra));
}
void onError (LocalRef<jobject>& recorder, int what, int extra) override
void onError ([[maybe_unused]] LocalRef<jobject>& recorder, [[maybe_unused]] int what, [[maybe_unused]] int extra) override
{
ignoreUnused (recorder, what, extra);
JUCE_CAMERA_LOG ("MediaRecorder::onError: " + getErrorStringFromCode (what)
+ ", extra code = " + String (extra));
}
@ -1976,54 +1965,60 @@ private:
}
//==============================================================================
void cameraCaptureSessionCaptureCompleted (bool isPreview, jobject session, jobject request, jobject result)
void cameraCaptureSessionCaptureCompleted (bool isPreview,
[[maybe_unused]] jobject session,
[[maybe_unused]] jobject request,
jobject result)
{
JUCE_CAMERA_LOG ("cameraCaptureSessionCaptureCompleted()");
ignoreUnused (session, request);
if (isPreview)
updateState (result);
else if (currentState != State::idle)
unlockFocus();
}
void cameraCaptureSessionCaptureFailed (bool isPreview, jobject session, jobject request, jobject failure)
void cameraCaptureSessionCaptureFailed ([[maybe_unused]] bool isPreview,
[[maybe_unused]] jobject session,
[[maybe_unused]] jobject request,
[[maybe_unused]] jobject failure)
{
JUCE_CAMERA_LOG ("cameraCaptureSessionCaptureFailed()");
ignoreUnused (isPreview, session, request, failure);
}
void cameraCaptureSessionCaptureProgressed (bool isPreview, jobject session, jobject request, jobject partialResult)
void cameraCaptureSessionCaptureProgressed (bool isPreview,
[[maybe_unused]] jobject session,
[[maybe_unused]] jobject request,
jobject partialResult)
{
JUCE_CAMERA_LOG ("cameraCaptureSessionCaptureProgressed()");
ignoreUnused (session, request);
if (isPreview)
updateState (partialResult);
}
void cameraCaptureSessionCaptureSequenceAborted (bool isPreview, jobject session, int sequenceId)
void cameraCaptureSessionCaptureSequenceAborted ([[maybe_unused]] bool isPreview,
[[maybe_unused]] jobject session,
[[maybe_unused]] int sequenceId)
{
JUCE_CAMERA_LOG ("cameraCaptureSessionCaptureSequenceAborted()");
ignoreUnused (isPreview, isPreview, session, sequenceId);
}
void cameraCaptureSessionCaptureSequenceCompleted (bool isPreview, jobject session, int sequenceId, int64 frameNumber)
void cameraCaptureSessionCaptureSequenceCompleted ([[maybe_unused]] bool isPreview,
[[maybe_unused]] jobject session,
[[maybe_unused]] int sequenceId,
[[maybe_unused]] int64 frameNumber)
{
JUCE_CAMERA_LOG ("cameraCaptureSessionCaptureSequenceCompleted()");
ignoreUnused (isPreview, session, sequenceId, frameNumber);
}
void cameraCaptureSessionCaptureStarted (bool isPreview, jobject session, jobject request, int64 timestamp, int64 frameNumber)
void cameraCaptureSessionCaptureStarted ([[maybe_unused]] bool isPreview,
[[maybe_unused]] jobject session,
[[maybe_unused]] jobject request,
[[maybe_unused]] int64 timestamp,
[[maybe_unused]] int64 frameNumber)
{
JUCE_CAMERA_LOG ("cameraCaptureSessionCaptureStarted()");
ignoreUnused (isPreview, session, request, timestamp, frameNumber);
}
//==============================================================================
@ -2166,24 +2161,21 @@ private:
env->CallVoidMethod (captureRequestBuilder, CaptureRequestBuilder.set, jKey.get(), jValue.get());
}
void cameraCaptureSessionActive (jobject session)
void cameraCaptureSessionActive ([[maybe_unused]] jobject session)
{
JUCE_CAMERA_LOG ("cameraCaptureSessionActive()");
ignoreUnused (session);
}
void cameraCaptureSessionClosed (jobject session)
void cameraCaptureSessionClosed ([[maybe_unused]] jobject session)
{
JUCE_CAMERA_LOG ("cameraCaptureSessionClosed()");
ignoreUnused (session);
closedEvent.signal();
}
void cameraCaptureSessionConfigureFailed (jobject session)
void cameraCaptureSessionConfigureFailed ([[maybe_unused]] jobject session)
{
JUCE_CAMERA_LOG ("cameraCaptureSessionConfigureFailed()");
ignoreUnused (session);
MessageManager::callAsync ([weakRef = WeakReference<CaptureSession> { this }]
{
@ -2231,10 +2223,9 @@ private:
});
}
void cameraCaptureSessionReady (const LocalRef<jobject>& session)
void cameraCaptureSessionReady ([[maybe_unused]] const LocalRef<jobject>& session)
{
JUCE_CAMERA_LOG ("cameraCaptureSessionReady()");
ignoreUnused (session);
}
//==============================================================================

View file

@ -774,20 +774,18 @@ private:
//==============================================================================
// MediaSessionController callbacks
static void audioInfoChanged (JNIEnv*, jobject, jlong host, jobject playbackInfo)
static void audioInfoChanged (JNIEnv*, jobject, jlong host, [[maybe_unused]] jobject playbackInfo)
{
if (auto* myself = reinterpret_cast<VideoComponent::Pimpl::MediaSession::Controller*> (host))
{
ignoreUnused (playbackInfo);
JUCE_VIDEO_LOG ("MediaSessionController::audioInfoChanged()");
}
}
static void metadataChanged (JNIEnv*, jobject, jlong host, jobject metadata)
static void metadataChanged (JNIEnv*, jobject, jlong host, [[maybe_unused]] jobject metadata)
{
if (auto* myself = reinterpret_cast<VideoComponent::Pimpl::MediaSession::Controller*> (host))
{
ignoreUnused (metadata);
JUCE_VIDEO_LOG ("MediaSessionController::metadataChanged()");
}
}
@ -835,10 +833,8 @@ private:
getEnv()->CallVoidMethod (nativeMediaPlayer, AndroidMediaPlayer.setDisplay, videoSurfaceHolder.get());
}
void load (const LocalRef<jstring>& mediaId, const LocalRef<jobject>& extras)
void load (const LocalRef<jstring>& mediaId, [[maybe_unused]] const LocalRef<jobject>& extras)
{
ignoreUnused (extras);
closeVideo();
auto* env = getEnv();
@ -1114,39 +1110,31 @@ private:
State currentState = State::idle;
//==============================================================================
void onPrepared (LocalRef<jobject>& mediaPlayer) override
void onPrepared ([[maybe_unused]] LocalRef<jobject>& mediaPlayer) override
{
JUCE_VIDEO_LOG ("MediaPlayer::onPrepared()");
ignoreUnused (mediaPlayer);
currentState = State::prepared;
owner.playerPrepared();
}
void onBufferingUpdate (LocalRef<jobject>& mediaPlayer, int progress) override
void onBufferingUpdate ([[maybe_unused]] LocalRef<jobject>& mediaPlayer, int progress) override
{
ignoreUnused (mediaPlayer);
owner.playerBufferingUpdated (progress);
}
void onSeekComplete (LocalRef<jobject>& mediaPlayer) override
void onSeekComplete ([[maybe_unused]] LocalRef<jobject>& mediaPlayer) override
{
JUCE_VIDEO_LOG ("MediaPlayer::onSeekComplete()");
ignoreUnused (mediaPlayer);
owner.playerSeekCompleted();
}
void onCompletion (LocalRef<jobject>& mediaPlayer) override
void onCompletion ([[maybe_unused]] LocalRef<jobject>& mediaPlayer) override
{
JUCE_VIDEO_LOG ("MediaPlayer::onCompletion()");
ignoreUnused (mediaPlayer);
currentState = State::complete;
owner.playerPlaybackCompleted();
@ -1169,13 +1157,11 @@ private:
MEDIA_INFO_SUBTITLE_TIMED_OUT = 902
};
bool onInfo (LocalRef<jobject>& mediaPlayer, int what, int extra) override
bool onInfo ([[maybe_unused]] LocalRef<jobject>& mediaPlayer, int what, [[maybe_unused]] int extra) override
{
JUCE_VIDEO_LOG ("MediaPlayer::onInfo(), infoCode: " + String (what) + " (" + infoCodeToString (what) + ")"
+ ", extraCode: " + String (extra));
ignoreUnused (mediaPlayer, extra);
if (what == MEDIA_INFO_BUFFERING_START)
owner.playerBufferingStarted();
else if (what == MEDIA_INFO_BUFFERING_END)
@ -1205,7 +1191,7 @@ private:
}
}
bool onError (LocalRef<jobject>& mediaPlayer, int what, int extra) override
bool onError ([[maybe_unused]] LocalRef<jobject>& mediaPlayer, int what, int extra) override
{
auto errorMessage = errorCodeToString (what);
auto extraMessage = errorCodeToString (extra);
@ -1216,8 +1202,6 @@ private:
JUCE_VIDEO_LOG ("MediaPlayer::onError(), errorCode: " + String (what) + " (" + errorMessage + ")"
+ ", extraCode: " + String (extra) + " (" + extraMessage + ")");
ignoreUnused (mediaPlayer);
currentState = State::error;
owner.errorOccurred (errorMessage);

View file

@ -524,23 +524,19 @@ private:
private:
//==============================================================================
static void started (id self, SEL, NSNotification* notification)
static void started (id self, SEL, [[maybe_unused]] NSNotification* notification)
{
JUCE_CAMERA_LOG (nsStringToJuce ([notification description]));
ignoreUnused (notification);
dispatch_async (dispatch_get_main_queue(),
^{
getOwner (self).cameraSessionStarted();
});
}
static void stopped (id, SEL, NSNotification* notification)
static void stopped (id, SEL, [[maybe_unused]] NSNotification* notification)
{
JUCE_CAMERA_LOG (nsStringToJuce ([notification description]));
ignoreUnused (notification);
}
static void runtimeError (id self, SEL, NSNotification* notification)
@ -555,18 +551,14 @@ private:
});
}
static void interrupted (id, SEL, NSNotification* notification)
static void interrupted (id, SEL, [[maybe_unused]] NSNotification* notification)
{
JUCE_CAMERA_LOG (nsStringToJuce ([notification description]));
ignoreUnused (notification);
}
static void interruptionEnded (id, SEL, NSNotification* notification)
static void interruptionEnded (id, SEL, [[maybe_unused]] NSNotification* notification)
{
JUCE_CAMERA_LOG (nsStringToJuce ([notification description]));
ignoreUnused (notification);
}
};
@ -788,8 +780,7 @@ private:
static void didFinishCaptureForSettings (id, SEL, AVCapturePhotoOutput*, AVCaptureResolvedPhotoSettings*, NSError* error)
{
String errorString = error != nil ? nsStringToJuce (error.localizedDescription) : String();
ignoreUnused (errorString);
[[maybe_unused]] String errorString = error != nil ? nsStringToJuce (error.localizedDescription) : String();
JUCE_CAMERA_LOG ("didFinishCaptureForSettings(), error = " + errorString);
}
@ -799,8 +790,7 @@ private:
{
getOwner (self).takingPicture = false;
String errorString = error != nil ? nsStringToJuce (error.localizedDescription) : String();
ignoreUnused (errorString);
[[maybe_unused]] String errorString = error != nil ? nsStringToJuce (error.localizedDescription) : String();
JUCE_CAMERA_LOG ("didFinishProcessingPhoto(), error = " + errorString);
@ -904,8 +894,7 @@ private:
{
getOwner (self).takingPicture = false;
String errorString = error != nil ? nsStringToJuce (error.localizedDescription) : String();
ignoreUnused (errorString);
[[maybe_unused]] String errorString = error != nil ? nsStringToJuce (error.localizedDescription) : String();
JUCE_CAMERA_LOG ("didFinishProcessingPhotoSampleBuffer(), error = " + errorString);
@ -1019,10 +1008,8 @@ private:
}
private:
static void printVideoOutputDebugInfo (AVCaptureMovieFileOutput* output)
static void printVideoOutputDebugInfo ([[maybe_unused]] AVCaptureMovieFileOutput* output)
{
ignoreUnused (output);
JUCE_CAMERA_LOG ("Available video codec types:");
#if JUCE_CAMERA_LOG_ENABLED

View file

@ -306,8 +306,7 @@ private:
{
if (error != nil)
{
String errorString = error != nil ? nsStringToJuce (error.localizedDescription) : String();
ignoreUnused (errorString);
[[maybe_unused]] String errorString = error != nil ? nsStringToJuce (error.localizedDescription) : String();
JUCE_CAMERA_LOG ("Still picture capture failed, error: " + errorString);
jassertfalse;

View file

@ -479,7 +479,7 @@ struct CameraDevice::Pimpl : public ChangeBroadcaster
auto context = []
{
IBindCtx* ptr = nullptr;
ignoreUnused (CreateBindCtx (0, &ptr));
[[maybe_unused]] const auto result = CreateBindCtx (0, &ptr);
return ContextPtr (ptr);
}();

View file

@ -395,7 +395,7 @@ private:
{
DirectShowContext (Pimpl& c) : component (c)
{
ignoreUnused (CoInitialize (nullptr));
[[maybe_unused]] const auto result = CoInitialize (nullptr);
}
~DirectShowContext() override

View file

@ -145,7 +145,6 @@ Result VideoComponent::loadInternal (const FileOrURL& fileOrUrl, bool loadAsync)
{
#if JUCE_ANDROID || JUCE_IOS
ignoreUnused (fileOrUrl, loadAsync);
// You need to use loadAsync on Android & iOS.
jassertfalse;
return Result::fail ("load() is not supported on this platform. Use loadAsync() instead.");
@ -155,7 +154,7 @@ Result VideoComponent::loadInternal (const FileOrURL& fileOrUrl, bool loadAsync)
if (loadAsync)
startTimer (50);
else
resized();
resized();
return result;
#endif