From 8e81d25f5d50df77fb587da3d18abe6a7fa24e73 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Sat, 4 Nov 2023 01:21:57 +0100 Subject: Issue #2342: Use [[nodiscard]] in /hal /image and /intl --- hal/Hal.h | 6 +++--- hal/HalInternal.h | 2 +- image/imgLoader.h | 32 ++++++++++++++++---------------- image/imgRequest.h | 20 ++++++++++---------- intl/uconv/nsIUnicodeDecoder.h | 6 +++--- intl/uconv/nsIUnicodeEncoder.h | 6 +++--- intl/uconv/nsReplacementToUnicode.h | 6 +++--- intl/uconv/nsUTF8ToUnicode.h | 6 +++--- intl/uconv/nsUnicodeToUTF8.h | 6 +++--- intl/uconv/ucvlatin/nsUTF16ToUnicode.h | 6 +++--- intl/uconv/ucvlatin/nsUnicodeToUTF16.h | 6 +++--- intl/uconv/ucvtw/nsUnicodeToBIG5.h | 6 +++--- 12 files changed, 54 insertions(+), 54 deletions(-) diff --git a/hal/Hal.h b/hal/Hal.h index ced295ca4c..b4a0ab8bc3 100644 --- a/hal/Hal.h +++ b/hal/Hal.h @@ -333,7 +333,7 @@ void NotifyScreenConfigurationChange(const hal::ScreenConfiguration& aScreenConf * Lock the screen orientation to the specific orientation. * @return Whether the lock has been accepted. */ -MOZ_MUST_USE bool LockScreenOrientation(const dom::ScreenOrientationInternal& aOrientation); +[[nodiscard]] bool LockScreenOrientation(const dom::ScreenOrientationInternal& aOrientation); /** * Unlock the screen orientation. @@ -346,7 +346,7 @@ void UnlockScreenOrientation(); * * Currently, there can only be 0 or 1 alarm observers. */ -MOZ_MUST_USE bool RegisterTheOneAlarmObserver(hal::AlarmObserver* aObserver); +[[nodiscard]] bool RegisterTheOneAlarmObserver(hal::AlarmObserver* aObserver); /** * Unregister the alarm observer. Doing so will implicitly cancel any @@ -373,7 +373,7 @@ void NotifyAlarmFired(); * This API is currently only allowed to be used from non-sandboxed * contexts. */ -MOZ_MUST_USE bool SetAlarm(int32_t aSeconds, int32_t aNanoseconds); +[[nodiscard]] bool SetAlarm(int32_t aSeconds, int32_t aNanoseconds); /** * Set the priority of the given process. diff --git a/hal/HalInternal.h b/hal/HalInternal.h index b9c7686f71..4544dd1c53 100644 --- a/hal/HalInternal.h +++ b/hal/HalInternal.h @@ -56,7 +56,7 @@ void DisableScreenConfigurationNotifications(); /** * Enable alarm notifications from the backend. */ -MOZ_MUST_USE bool EnableAlarm(); +[[nodiscard]] bool EnableAlarm(); /** * Disable alarm notifications from the backend. diff --git a/image/imgLoader.h b/image/imgLoader.h index 8e818a2907..6ac383cdc6 100644 --- a/image/imgLoader.h +++ b/image/imgLoader.h @@ -287,22 +287,22 @@ public: imgLoader(); nsresult Init(); - MOZ_MUST_USE nsresult LoadImage(nsIURI* aURI, - nsIURI* aInitialDocumentURI, - nsIURI* aReferrerURI, - ReferrerPolicy aReferrerPolicy, - nsIPrincipal* aLoadingPrincipal, - nsILoadGroup* aLoadGroup, - imgINotificationObserver* aObserver, - nsINode* aContext, - nsIDocument* aLoadingDocument, - nsLoadFlags aLoadFlags, - nsISupports* aCacheKey, - nsContentPolicyType aContentPolicyType, - const nsAString& initiatorType, - imgRequestProxy** _retval); - - MOZ_MUST_USE nsresult + [[nodiscard]] nsresult LoadImage(nsIURI* aURI, + nsIURI* aInitialDocumentURI, + nsIURI* aReferrerURI, + ReferrerPolicy aReferrerPolicy, + nsIPrincipal* aLoadingPrincipal, + nsILoadGroup* aLoadGroup, + imgINotificationObserver* aObserver, + nsINode* aContext, + nsIDocument* aLoadingDocument, + nsLoadFlags aLoadFlags, + nsISupports* aCacheKey, + nsContentPolicyType aContentPolicyType, + const nsAString& initiatorType, + imgRequestProxy** _retval); + + [[nodiscard]] nsresult LoadImageWithChannel(nsIChannel* channel, imgINotificationObserver* aObserver, nsISupports* aCX, diff --git a/image/imgRequest.h b/image/imgRequest.h index c05e6a4a94..2ee00af4a9 100644 --- a/image/imgRequest.h +++ b/image/imgRequest.h @@ -65,16 +65,16 @@ public: NS_DECL_NSIINTERFACEREQUESTOR NS_DECL_NSIASYNCVERIFYREDIRECTCALLBACK - MOZ_MUST_USE nsresult Init(nsIURI* aURI, - nsIURI* aCurrentURI, - bool aHadInsecureRedirect, - nsIRequest* aRequest, - nsIChannel* aChannel, - imgCacheEntry* aCacheEntry, - nsISupports* aCX, - nsIPrincipal* aLoadingPrincipal, - int32_t aCORSMode, - ReferrerPolicy aReferrerPolicy); + [[nodiscard]] nsresult Init(nsIURI* aURI, + nsIURI* aCurrentURI, + bool aHadInsecureRedirect, + nsIRequest* aRequest, + nsIChannel* aChannel, + imgCacheEntry* aCacheEntry, + nsISupports* aCX, + nsIPrincipal* aLoadingPrincipal, + int32_t aCORSMode, + ReferrerPolicy aReferrerPolicy); void ClearLoader(); diff --git a/intl/uconv/nsIUnicodeDecoder.h b/intl/uconv/nsIUnicodeDecoder.h index 36a46759b5..539eae6be6 100644 --- a/intl/uconv/nsIUnicodeDecoder.h +++ b/intl/uconv/nsIUnicodeDecoder.h @@ -110,9 +110,9 @@ public: * NS_ERROR_OUT_OF_MEMORY if OOM * NS_OK is all we have is an approximation */ - MOZ_MUST_USE NS_IMETHOD GetMaxLength(const char* aSrc, - int32_t aSrcLength, - int32_t* aDestLength) = 0; + [[nodiscard]] NS_IMETHOD GetMaxLength(const char* aSrc, + int32_t aSrcLength, + int32_t* aDestLength) = 0; /** * Resets the charset converter so it may be recycled for a completely diff --git a/intl/uconv/nsIUnicodeEncoder.h b/intl/uconv/nsIUnicodeEncoder.h index e704a21955..67d0cd7bd0 100644 --- a/intl/uconv/nsIUnicodeEncoder.h +++ b/intl/uconv/nsIUnicodeEncoder.h @@ -135,9 +135,9 @@ public: * NS_ERROR_OUT_OF_MEMORY if OOM * NS_OK if all we have is an approximation */ - MOZ_MUST_USE NS_IMETHOD GetMaxLength(const char16_t* aSrc, - int32_t aSrcLength, - int32_t* aDestLength) = 0; + [[nodiscard]] NS_IMETHOD GetMaxLength(const char16_t* aSrc, + int32_t aSrcLength, + int32_t* aDestLength) = 0; /** * Resets the charset converter so it may be recycled for a completely diff --git a/intl/uconv/nsReplacementToUnicode.h b/intl/uconv/nsReplacementToUnicode.h index fd19e8892f..a2e3058ab8 100644 --- a/intl/uconv/nsReplacementToUnicode.h +++ b/intl/uconv/nsReplacementToUnicode.h @@ -24,9 +24,9 @@ public: char16_t* aDest, int32_t* aDestLength) override; - MOZ_MUST_USE NS_IMETHOD GetMaxLength(const char* aSrc, - int32_t aSrcLength, - int32_t* aDestLength) override; + [[nodiscard]] NS_IMETHOD GetMaxLength(const char* aSrc, + int32_t aSrcLength, + int32_t* aDestLength) override; NS_IMETHOD Reset() override; diff --git a/intl/uconv/nsUTF8ToUnicode.h b/intl/uconv/nsUTF8ToUnicode.h index d80fa18992..ebac158881 100644 --- a/intl/uconv/nsUTF8ToUnicode.h +++ b/intl/uconv/nsUTF8ToUnicode.h @@ -49,9 +49,9 @@ protected: //-------------------------------------------------------------------- // Subclassing of nsDecoderSupport class [declaration] - MOZ_MUST_USE NS_IMETHOD GetMaxLength(const char* aSrc, - int32_t aSrcLength, - int32_t* aDestLength) override; + [[nodiscard]] NS_IMETHOD GetMaxLength(const char* aSrc, + int32_t aSrcLength, + int32_t* aDestLength) override; //-------------------------------------------------------------------- // Subclassing of nsBasicDecoderSupport class [declaration] diff --git a/intl/uconv/nsUnicodeToUTF8.h b/intl/uconv/nsUnicodeToUTF8.h index 410bde2813..e76ad5dbc5 100644 --- a/intl/uconv/nsUnicodeToUTF8.h +++ b/intl/uconv/nsUnicodeToUTF8.h @@ -48,9 +48,9 @@ public: NS_IMETHOD Finish(char* aDest, int32_t* aDestLength) override; - MOZ_MUST_USE NS_IMETHOD GetMaxLength(const char16_t* aSrc, - int32_t aSrcLength, - int32_t* aDestLength) override; + [[nodiscard]] NS_IMETHOD GetMaxLength(const char16_t* aSrc, + int32_t aSrcLength, + int32_t* aDestLength) override; NS_IMETHOD Reset() override {mHighSurrogate = 0; return NS_OK;} diff --git a/intl/uconv/ucvlatin/nsUTF16ToUnicode.h b/intl/uconv/ucvlatin/nsUTF16ToUnicode.h index 227fb412f4..1c39249429 100644 --- a/intl/uconv/ucvlatin/nsUTF16ToUnicode.h +++ b/intl/uconv/ucvlatin/nsUTF16ToUnicode.h @@ -24,9 +24,9 @@ public: //-------------------------------------------------------------------- // Subclassing of nsDecoderSupport class [declaration] - MOZ_MUST_USE NS_IMETHOD GetMaxLength(const char* aSrc, - int32_t aSrcLength, - int32_t* aDestLength) override; + [[nodiscard]] NS_IMETHOD GetMaxLength(const char* aSrc, + int32_t aSrcLength, + int32_t* aDestLength) override; NS_IMETHOD Reset() override; protected: diff --git a/intl/uconv/ucvlatin/nsUnicodeToUTF16.h b/intl/uconv/ucvlatin/nsUnicodeToUTF16.h index b024a1b421..538da8e917 100644 --- a/intl/uconv/ucvlatin/nsUnicodeToUTF16.h +++ b/intl/uconv/ucvlatin/nsUnicodeToUTF16.h @@ -19,9 +19,9 @@ public: NS_IMETHOD Convert(const char16_t* aSrc, int32_t* aSrcLength, char* aDest, int32_t* aDestLength); - MOZ_MUST_USE NS_IMETHOD GetMaxLength(const char16_t* aSrc, - int32_t aSrcLength, - int32_t* aDestLength); + [[nodiscard]] NS_IMETHOD GetMaxLength(const char16_t* aSrc, + int32_t aSrcLength, + int32_t* aDestLength); NS_IMETHOD Finish(char* aDest, int32_t* aDestLength); NS_IMETHOD Reset(); NS_IMETHOD SetOutputErrorBehavior(int32_t aBehavior, diff --git a/intl/uconv/ucvtw/nsUnicodeToBIG5.h b/intl/uconv/ucvtw/nsUnicodeToBIG5.h index 51e2c0928e..42e4297f8c 100644 --- a/intl/uconv/ucvtw/nsUnicodeToBIG5.h +++ b/intl/uconv/ucvtw/nsUnicodeToBIG5.h @@ -29,9 +29,9 @@ public: NS_IMETHOD Finish(char* aDest, int32_t* aDestLength) override; - MOZ_MUST_USE NS_IMETHOD GetMaxLength(const char16_t* aSrc, - int32_t aSrcLength, - int32_t* aDestLength) override; + [[nodiscard]] NS_IMETHOD GetMaxLength(const char16_t* aSrc, + int32_t aSrcLength, + int32_t* aDestLength) override; NS_IMETHOD Reset() override; -- cgit v1.2.3