diff options
author | Moonchild <moonchild@palemoon.org> | 2023-11-05 00:59:31 +0100 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2023-11-08 13:49:51 +0100 |
commit | ccc8c3b988375858400e8cbb5cd3ed665ece7aa4 (patch) | |
tree | 0dfab44af42ba7db171eaff6893c6b543835fe5b | |
parent | d53992cc127fb85a63a23c01cd92347901bf2371 (diff) | |
download | uxp-ccc8c3b988375858400e8cbb5cd3ed665ece7aa4.tar.gz |
Issue #2342: Use [[nodiscard]] in /uriloader /widget
Also a few misc low-volume places.
-rw-r--r-- | security/manager/ssl/nsNSSComponent.h | 2 | ||||
-rw-r--r-- | toolkit/components/commandlines/nsCommandLine.cpp | 2 | ||||
-rw-r--r-- | uriloader/base/nsDocLoader.h | 14 | ||||
-rw-r--r-- | uriloader/base/nsURILoader.h | 10 | ||||
-rw-r--r-- | uriloader/exthandler/ContentHandlerService.h | 2 | ||||
-rw-r--r-- | uriloader/exthandler/ExternalHelperAppChild.h | 2 | ||||
-rw-r--r-- | uriloader/exthandler/mac/nsDecodeAppleFile.h | 2 | ||||
-rw-r--r-- | uriloader/exthandler/mac/nsMIMEInfoMac.h | 8 | ||||
-rw-r--r-- | uriloader/exthandler/mac/nsOSHelperAppService.h | 6 | ||||
-rw-r--r-- | uriloader/exthandler/nsExternalHelperAppService.h | 2 | ||||
-rw-r--r-- | widget/PluginWidgetProxy.h | 9 | ||||
-rw-r--r-- | widget/cocoa/nsChildView.h | 9 | ||||
-rw-r--r-- | widget/cocoa/nsCocoaWindow.h | 20 | ||||
-rw-r--r-- | widget/gtk/nsWindow.h | 8 | ||||
-rw-r--r-- | widget/nsBaseWidget.h | 2 | ||||
-rw-r--r-- | widget/nsIWidget.h | 6 | ||||
-rw-r--r-- | widget/uikit/nsWindow.h | 9 | ||||
-rw-r--r-- | widget/windows/nsWindow.h | 11 |
18 files changed, 59 insertions, 65 deletions
diff --git a/security/manager/ssl/nsNSSComponent.h b/security/manager/ssl/nsNSSComponent.h index e510dd10f3..f595aa5c50 100644 --- a/security/manager/ssl/nsNSSComponent.h +++ b/security/manager/ssl/nsNSSComponent.h @@ -30,7 +30,7 @@ class SmartCardThreadList; namespace mozilla { namespace psm { -MOZ_MUST_USE +[[nodiscard]] ::already_AddRefed<mozilla::psm::SharedCertVerifier> GetDefaultCertVerifier(); diff --git a/toolkit/components/commandlines/nsCommandLine.cpp b/toolkit/components/commandlines/nsCommandLine.cpp index 280b1d24a6..d78cdd23a8 100644 --- a/toolkit/components/commandlines/nsCommandLine.cpp +++ b/toolkit/components/commandlines/nsCommandLine.cpp @@ -65,7 +65,7 @@ protected: void *aClosure); void appendArg(const char* arg); - MOZ_MUST_USE nsresult resolveShortcutURL(nsIFile* aFile, nsACString& outURL); + [[nodiscard]] nsresult resolveShortcutURL(nsIFile* aFile, nsACString& outURL); nsresult EnumerateHandlers(EnumerateHandlersCallback aCallback, void *aClosure); nsresult EnumerateValidators(EnumerateValidatorsCallback aCallback, void *aClosure); diff --git a/uriloader/base/nsDocLoader.h b/uriloader/base/nsDocLoader.h index b469b8e079..1c50df24b1 100644 --- a/uriloader/base/nsDocLoader.h +++ b/uriloader/base/nsDocLoader.h @@ -58,7 +58,7 @@ public: nsDocLoader(); - virtual MOZ_MUST_USE nsresult Init(); + [[nodiscard]] virtual nsresult Init(); static already_AddRefed<nsDocLoader> GetAsDocLoader(nsISupports* aSupports); // Needed to deal with ambiguous inheritance from nsISupports... @@ -67,7 +67,7 @@ public: } // Add aDocLoader as a child to the docloader service. - static MOZ_MUST_USE nsresult AddDocLoaderAsChildOfRoot(nsDocLoader* aDocLoader); + [[nodiscard]] static nsresult AddDocLoaderAsChildOfRoot(nsDocLoader* aDocLoader); NS_DECL_ISUPPORTS NS_DECL_NSIDOCUMENTLOADER @@ -89,10 +89,10 @@ public: // Remove aChild from our childlist. This nulls out the child's mParent // pointer. - MOZ_MUST_USE nsresult RemoveChildLoader(nsDocLoader *aChild); + [[nodiscard]] nsresult RemoveChildLoader(nsDocLoader *aChild); // Add aChild to our child list. This will set aChild's mParent pointer to // |this|. - MOZ_MUST_USE nsresult AddChildLoader(nsDocLoader* aChild); + [[nodiscard]] nsresult AddChildLoader(nsDocLoader* aChild); nsDocLoader* GetParent() const { return mParent; } struct nsListenerInfo { @@ -114,7 +114,7 @@ public: protected: virtual ~nsDocLoader(); - virtual MOZ_MUST_USE nsresult SetDocLoaderParent(nsDocLoader * aLoader); + [[nodiscard]] virtual nsresult SetDocLoaderParent(nsDocLoader * aLoader); bool IsBusy(); @@ -166,7 +166,7 @@ protected: nsIURI *aUri, uint32_t aFlags); - MOZ_MUST_USE bool RefreshAttempted(nsIWebProgress* aWebProgress, + [[nodiscard]] bool RefreshAttempted(nsIWebProgress* aWebProgress, nsIURI *aURI, int32_t aDelay, bool aSameURI); @@ -189,7 +189,7 @@ protected: // Inform a parent docloader that aChild is about to call its onload // handler. - MOZ_MUST_USE bool ChildEnteringOnload(nsIDocumentLoader* aChild) { + [[nodiscard]] bool ChildEnteringOnload(nsIDocumentLoader* aChild) { // It's ok if we're already in the list -- we'll just be in there twice // and then the RemoveObject calls from ChildDoneWithOnload will remove // us. diff --git a/uriloader/base/nsURILoader.h b/uriloader/base/nsURILoader.h index 2c5648dbae..3e92eec452 100644 --- a/uriloader/base/nsURILoader.h +++ b/uriloader/base/nsURILoader.h @@ -35,11 +35,11 @@ protected: * Equivalent to nsIURILoader::openChannel, but allows specifying whether the * channel is opened already. */ - MOZ_MUST_USE nsresult OpenChannel(nsIChannel* channel, - uint32_t aFlags, - nsIInterfaceRequestor* aWindowContext, - bool aChannelOpen, - nsIStreamListener** aListener); + [[nodiscard]] nsresult OpenChannel(nsIChannel* channel, + uint32_t aFlags, + nsIInterfaceRequestor* aWindowContext, + bool aChannelOpen, + nsIStreamListener** aListener); /** * we shouldn't need to have an owning ref count on registered diff --git a/uriloader/exthandler/ContentHandlerService.h b/uriloader/exthandler/ContentHandlerService.h index e39e89bc90..1781bbe69c 100644 --- a/uriloader/exthandler/ContentHandlerService.h +++ b/uriloader/exthandler/ContentHandlerService.h @@ -21,7 +21,7 @@ public: NS_DECL_NSIHANDLERSERVICE ContentHandlerService(); - MOZ_MUST_USE nsresult Init(); + [[nodiscard]] nsresult Init(); static void nsIHandlerInfoToHandlerInfo(nsIHandlerInfo* aInfo, HandlerInfo* aHandlerInfo); private: diff --git a/uriloader/exthandler/ExternalHelperAppChild.h b/uriloader/exthandler/ExternalHelperAppChild.h index 0e3b09848c..ee5057857e 100644 --- a/uriloader/exthandler/ExternalHelperAppChild.h +++ b/uriloader/exthandler/ExternalHelperAppChild.h @@ -32,7 +32,7 @@ public: virtual bool RecvCancel(const nsresult& aStatus) override; private: virtual ~ExternalHelperAppChild(); - MOZ_MUST_USE nsresult DivertToParent(nsIDivertableChannel *divertable, nsIRequest *request); + [[nodiscard]] nsresult DivertToParent(nsIDivertableChannel *divertable, nsIRequest *request); RefPtr<nsExternalAppHandler> mHandler; nsresult mStatus; diff --git a/uriloader/exthandler/mac/nsDecodeAppleFile.h b/uriloader/exthandler/mac/nsDecodeAppleFile.h index cea2d701ec..8433b533af 100644 --- a/uriloader/exthandler/mac/nsDecodeAppleFile.h +++ b/uriloader/exthandler/mac/nsDecodeAppleFile.h @@ -83,7 +83,7 @@ public: nsDecodeAppleFile(); virtual ~nsDecodeAppleFile(); - MOZ_MUST_USE nsresult Initialize(nsIOutputStream *output, nsIFile *file); + [[nodiscard]] nsresult Initialize(nsIOutputStream *output, nsIFile *file); private: #define MAX_BUFFERSIZE 1024 diff --git a/uriloader/exthandler/mac/nsMIMEInfoMac.h b/uriloader/exthandler/mac/nsMIMEInfoMac.h index 298357f757..d301234c87 100644 --- a/uriloader/exthandler/mac/nsMIMEInfoMac.h +++ b/uriloader/exthandler/mac/nsMIMEInfoMac.h @@ -16,15 +16,15 @@ class nsMIMEInfoMac : public nsMIMEInfoImpl { NS_IMETHOD LaunchWithFile(nsIFile* aFile); protected: - virtual MOZ_MUST_USE nsresult LoadUriInternal(nsIURI *aURI); + [[nodiscard]] virtual nsresult LoadUriInternal(nsIURI *aURI); #ifdef DEBUG - virtual MOZ_MUST_USE nsresult LaunchDefaultWithFile(nsIFile* aFile) { + [[nodiscard]] virtual nsresult LaunchDefaultWithFile(nsIFile* aFile) { NS_NOTREACHED("do not call this method, use LaunchWithFile"); return NS_ERROR_UNEXPECTED; } #endif - static MOZ_MUST_USE nsresult OpenApplicationWithURI(nsIFile *aApplication, - const nsCString& aURI); + [[nodiscard]] static nsresult OpenApplicationWithURI(nsIFile *aApplication, + const nsCString& aURI); NS_IMETHOD GetDefaultDescription(nsAString& aDefaultDescription); diff --git a/uriloader/exthandler/mac/nsOSHelperAppService.h b/uriloader/exthandler/mac/nsOSHelperAppService.h index 7371e1f42d..05e71d4b1b 100644 --- a/uriloader/exthandler/mac/nsOSHelperAppService.h +++ b/uriloader/exthandler/mac/nsOSHelperAppService.h @@ -36,10 +36,10 @@ public: // platformAppPath --> a platform specific path to an application that we got out of the // rdf data source. This can be a mac file spec, a unix path or a windows path depending on the platform // aFile --> an nsIFile representation of that platform application path. - virtual MOZ_MUST_USE nsresult GetFileTokenForPath(const char16_t * platformAppPath, nsIFile ** aFile); + [[nodiscard]] virtual nsresult GetFileTokenForPath(const char16_t * platformAppPath, nsIFile ** aFile); - MOZ_MUST_USE nsresult OSProtocolHandlerExists(const char * aScheme, - bool * aHandlerExists); + [[nodiscard]] nsresult OSProtocolHandlerExists(const char * aScheme, + bool * aHandlerExists); private: uint32_t mPermissions; diff --git a/uriloader/exthandler/nsExternalHelperAppService.h b/uriloader/exthandler/nsExternalHelperAppService.h index 13dcbb7122..7956b70b2d 100644 --- a/uriloader/exthandler/nsExternalHelperAppService.h +++ b/uriloader/exthandler/nsExternalHelperAppService.h @@ -67,7 +67,7 @@ public: * Initializes internal state. Will be called automatically when * this service is first instantiated. */ - MOZ_MUST_USE nsresult Init(); + [[nodiscard]] nsresult Init(); /** * Given a mimetype and an extension, looks up a mime info from the OS. diff --git a/widget/PluginWidgetProxy.h b/widget/PluginWidgetProxy.h index 3fb86a5162..e16554967f 100644 --- a/widget/PluginWidgetProxy.h +++ b/widget/PluginWidgetProxy.h @@ -35,11 +35,10 @@ public: // nsIWidget using PuppetWidget::Create; // for Create signature not overridden here - virtual MOZ_MUST_USE nsresult Create(nsIWidget* aParent, - nsNativeWidget aNativeParent, - const LayoutDeviceIntRect& aRect, - nsWidgetInitData* aInitData = nullptr) - override; + [[nodiscard]] virtual nsresult Create(nsIWidget* aParent, + nsNativeWidget aNativeParent, + const LayoutDeviceIntRect& aRect, + nsWidgetInitData* aInitData = nullptr) override; virtual void Destroy() override; NS_IMETHOD SetFocus(bool aRaise = false) override; NS_IMETHOD SetParent(nsIWidget* aNewParent) override; diff --git a/widget/cocoa/nsChildView.h b/widget/cocoa/nsChildView.h index 7b998a6c5c..3ec93f1875 100644 --- a/widget/cocoa/nsChildView.h +++ b/widget/cocoa/nsChildView.h @@ -303,11 +303,10 @@ public: nsChildView(); // nsIWidget interface - virtual MOZ_MUST_USE nsresult Create(nsIWidget* aParent, - nsNativeWidget aNativeParent, - const LayoutDeviceIntRect& aRect, - nsWidgetInitData* aInitData = nullptr) - override; + [[nodiscard]] virtual nsresult Create(nsIWidget* aParent, + nsNativeWidget aNativeParent, + const LayoutDeviceIntRect& aRect, + nsWidgetInitData* aInitData = nullptr) override; virtual void Destroy() override; diff --git a/widget/cocoa/nsCocoaWindow.h b/widget/cocoa/nsCocoaWindow.h index 1913696b8c..43f8668e84 100644 --- a/widget/cocoa/nsCocoaWindow.h +++ b/widget/cocoa/nsCocoaWindow.h @@ -223,17 +223,15 @@ public: NS_DECL_ISUPPORTS_INHERITED NS_DECL_NSPIWIDGETCOCOA - virtual MOZ_MUST_USE nsresult Create(nsIWidget* aParent, - nsNativeWidget aNativeParent, - const DesktopIntRect& aRect, - nsWidgetInitData* aInitData = nullptr) - override; - - virtual MOZ_MUST_USE nsresult Create(nsIWidget* aParent, - nsNativeWidget aNativeParent, - const LayoutDeviceIntRect& aRect, - nsWidgetInitData* aInitData = nullptr) - override; + [[nodiscard]] virtual nsresult Create(nsIWidget* aParent, + nsNativeWidget aNativeParent, + const DesktopIntRect& aRect, + nsWidgetInitData* aInitData = nullptr) override; + + [[nodiscard]] virtual nsresult Create(nsIWidget* aParent, + nsNativeWidget aNativeParent, + const LayoutDeviceIntRect& aRect, + nsWidgetInitData* aInitData = nullptr) override; virtual void Destroy() override; diff --git a/widget/gtk/nsWindow.h b/widget/gtk/nsWindow.h index f76f72d71b..1772e11926 100644 --- a/widget/gtk/nsWindow.h +++ b/widget/gtk/nsWindow.h @@ -94,10 +94,10 @@ public: // nsIWidget using nsBaseWidget::Create; // for Create signature not overridden here - virtual MOZ_MUST_USE nsresult Create(nsIWidget* aParent, - nsNativeWidget aNativeParent, - const LayoutDeviceIntRect& aRect, - nsWidgetInitData* aInitData) override; + [[nodiscard]] virtual nsresult Create(nsIWidget* aParent, + nsNativeWidget aNativeParent, + const LayoutDeviceIntRect& aRect, + nsWidgetInitData* aInitData) override; virtual void Destroy() override; virtual nsIWidget *GetParent() override; virtual float GetDPI() override; diff --git a/widget/nsBaseWidget.h b/widget/nsBaseWidget.h index ab29fcd0ff..cc38b14b86 100644 --- a/widget/nsBaseWidget.h +++ b/widget/nsBaseWidget.h @@ -239,7 +239,7 @@ public: virtual LayoutDeviceIntRect GetBounds() override; virtual LayoutDeviceIntRect GetClientBounds() override; virtual LayoutDeviceIntRect GetScreenBounds() override; - virtual MOZ_MUST_USE nsresult GetRestoredBounds(LayoutDeviceIntRect& aRect) override; + [[nodiscard]] virtual nsresult GetRestoredBounds(LayoutDeviceIntRect& aRect) override; NS_IMETHOD SetNonClientMargins(LayoutDeviceIntMargin& aMargins) override; virtual LayoutDeviceIntPoint GetClientOffset() override; virtual void EnableDragDrop(bool aEnable) override {}; diff --git a/widget/nsIWidget.h b/widget/nsIWidget.h index fe21b67275..825db6f0cf 100644 --- a/widget/nsIWidget.h +++ b/widget/nsIWidget.h @@ -417,7 +417,7 @@ class nsIWidget : public nsISupports * @param aInitData data that is used for widget initialization * */ - virtual MOZ_MUST_USE nsresult + [[nodiscard]] virtual nsresult Create(nsIWidget* aParent, nsNativeWidget aNativeParent, const LayoutDeviceIntRect& aRect, @@ -431,7 +431,7 @@ class nsIWidget : public nsISupports * mapping is not straightforward or the native platform needs to use the * desktop pixel values directly. */ - virtual MOZ_MUST_USE nsresult + [[nodiscard]] virtual nsresult Create(nsIWidget* aParent, nsNativeWidget aNativeParent, const DesktopIntRect& aRect, @@ -890,7 +890,7 @@ class nsIWidget : public nsISupports * @param aRect On return it holds the x, y, width and height of * this widget. */ - virtual MOZ_MUST_USE nsresult + [[nodiscard]] virtual nsresult GetRestoredBounds(LayoutDeviceIntRect& aRect) = 0; /** diff --git a/widget/uikit/nsWindow.h b/widget/uikit/nsWindow.h index cb18c09069..9a69113312 100644 --- a/widget/uikit/nsWindow.h +++ b/widget/uikit/nsWindow.h @@ -29,11 +29,10 @@ public: // nsIWidget // - virtual MOZ_MUST_USE nsresult Create(nsIWidget* aParent, - nsNativeWidget aNativeParent, - const LayoutDeviceIntRect& aRect, - nsWidgetInitData* aInitData = nullptr) - override; + [[nodiscard]] virtual nsresult Create(nsIWidget* aParent, + nsNativeWidget aNativeParent, + const LayoutDeviceIntRect& aRect, + nsWidgetInitData* aInitData = nullptr) override; virtual void Destroy() override; NS_IMETHOD Show(bool aState) override; NS_IMETHOD Enable(bool aState) override { diff --git a/widget/windows/nsWindow.h b/widget/windows/nsWindow.h index ec4a1f0192..4c6c7cb80d 100644 --- a/widget/windows/nsWindow.h +++ b/widget/windows/nsWindow.h @@ -98,11 +98,10 @@ public: // nsIWidget interface using nsWindowBase::Create; // for Create signature not overridden here - virtual MOZ_MUST_USE nsresult Create(nsIWidget* aParent, - nsNativeWidget aNativeParent, - const LayoutDeviceIntRect& aRect, - nsWidgetInitData* aInitData = nullptr) - override; + [[nodiscard]] virtual nsresult Create(nsIWidget* aParent, + nsNativeWidget aNativeParent, + const LayoutDeviceIntRect& aRect, + nsWidgetInitData* aInitData = nullptr) override; virtual void Destroy() override; NS_IMETHOD SetParent(nsIWidget *aNewParent) override; virtual nsIWidget* GetParent(void) override; @@ -136,7 +135,7 @@ public: NS_IMETHOD SetFocus(bool aRaise) override; virtual LayoutDeviceIntRect GetBounds() override; virtual LayoutDeviceIntRect GetScreenBounds() override; - virtual MOZ_MUST_USE nsresult GetRestoredBounds(LayoutDeviceIntRect& aRect) override; + [[nodiscard]] virtual nsresult GetRestoredBounds(LayoutDeviceIntRect& aRect) override; virtual LayoutDeviceIntRect GetClientBounds() override; virtual LayoutDeviceIntPoint GetClientOffset() override; void SetBackgroundColor(const nscolor& aColor) override; |