summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2023-11-04 23:42:53 +0100
committerMoonchild <moonchild@palemoon.org>2023-11-08 13:49:30 +0100
commitd53992cc127fb85a63a23c01cd92347901bf2371 (patch)
tree9394328528e5bf3f8b04afcc8fdfd6580c51760d
parent6f7a751520896b95c6eef986f841def329cdb20e (diff)
downloaduxp-d53992cc127fb85a63a23c01cd92347901bf2371.tar.gz
Issue #2342: Use [[nodiscard]] in /netwerk
-rw-r--r--netwerk/base/nsNetUtil.h2
-rw-r--r--netwerk/base/nsNetUtilInlines.h2
-rw-r--r--netwerk/base/nsStandardURL.cpp3
-rw-r--r--netwerk/cache2/CacheFileChunk.cpp2
-rw-r--r--netwerk/ipc/NeckoParent.h6
-rw-r--r--netwerk/protocol/about/nsAboutCache.h14
-rw-r--r--netwerk/protocol/about/nsAboutCacheEntry.h18
-rw-r--r--netwerk/protocol/about/nsAboutProtocolUtils.h2
-rw-r--r--netwerk/protocol/data/DataChannelParent.h2
-rw-r--r--netwerk/protocol/data/nsDataChannel.h6
-rw-r--r--netwerk/protocol/data/nsDataHandler.h12
-rw-r--r--netwerk/protocol/device/nsDeviceCaptureProvider.h6
-rw-r--r--netwerk/protocol/device/nsDeviceChannel.h8
-rw-r--r--netwerk/protocol/device/nsDeviceProtocolHandler.h2
-rw-r--r--netwerk/protocol/file/nsFileChannel.h12
-rw-r--r--netwerk/protocol/file/nsFileProtocolHandler.h2
-rw-r--r--netwerk/protocol/http/TunnelUtils.h2
-rw-r--r--netwerk/protocol/http/nsHttpChannel.h2
-rw-r--r--netwerk/sctp/datachannel/DataChannel.h17
19 files changed, 58 insertions, 62 deletions
diff --git a/netwerk/base/nsNetUtil.h b/netwerk/base/nsNetUtil.h
index 53fa679879..bc92301014 100644
--- a/netwerk/base/nsNetUtil.h
+++ b/netwerk/base/nsNetUtil.h
@@ -527,7 +527,7 @@ nsresult NS_BackgroundOutputStream(nsIOutputStream **result,
uint32_t segmentSize = 0,
uint32_t segmentCount = 0);
-MOZ_MUST_USE nsresult
+[[nodiscard]] nsresult
NS_NewBufferedInputStream(nsIInputStream **result,
nsIInputStream *str,
uint32_t bufferSize);
diff --git a/netwerk/base/nsNetUtilInlines.h b/netwerk/base/nsNetUtilInlines.h
index ea05bd1307..7b5ac15330 100644
--- a/netwerk/base/nsNetUtilInlines.h
+++ b/netwerk/base/nsNetUtilInlines.h
@@ -327,7 +327,7 @@ NS_NewLocalFileOutputStream(nsIOutputStream **result,
return rv;
}
-INLINE_IF_EXTERN MOZ_MUST_USE nsresult
+[[nodiscard]] INLINE_IF_EXTERN nsresult
NS_NewBufferedInputStream(nsIInputStream **result,
nsIInputStream *str,
uint32_t bufferSize)
diff --git a/netwerk/base/nsStandardURL.cpp b/netwerk/base/nsStandardURL.cpp
index aa60b52cd5..be40f817ea 100644
--- a/netwerk/base/nsStandardURL.cpp
+++ b/netwerk/base/nsStandardURL.cpp
@@ -3523,8 +3523,7 @@ ToIPCSegment(const nsStandardURL::URLSegment& aSegment)
return ipc::StandardURLSegment(aSegment.mPos, aSegment.mLen);
}
-inline
-MOZ_MUST_USE bool
+[[nodiscard]] inline bool
FromIPCSegment(const nsACString& aSpec, const ipc::StandardURLSegment& aSegment, nsStandardURL::URLSegment& aTarget)
{
// This seems to be just an empty segment.
diff --git a/netwerk/cache2/CacheFileChunk.cpp b/netwerk/cache2/CacheFileChunk.cpp
index 83d79f79fc..2eebd97e93 100644
--- a/netwerk/cache2/CacheFileChunk.cpp
+++ b/netwerk/cache2/CacheFileChunk.cpp
@@ -76,7 +76,7 @@ CacheFileChunkBuffer::FillInvalidRanges(CacheFileChunkBuffer *aOther,
return NS_OK;
}
-MOZ_MUST_USE nsresult
+[[nodiscard]] nsresult
CacheFileChunkBuffer::EnsureBufSize(uint32_t aBufSize)
{
AssertOwnsLock();
diff --git a/netwerk/ipc/NeckoParent.h b/netwerk/ipc/NeckoParent.h
index fe1d77e482..068e96d499 100644
--- a/netwerk/ipc/NeckoParent.h
+++ b/netwerk/ipc/NeckoParent.h
@@ -32,8 +32,7 @@ public:
NeckoParent();
virtual ~NeckoParent();
- MOZ_MUST_USE
- static const char *
+ [[nodiscard]] static const char*
GetValidatedOriginAttributes(const SerializedLoadContext& aSerialized,
PContentParent* aBrowser,
nsIPrincipal* aRequestingPrincipal,
@@ -46,8 +45,7 @@ public:
*
* Returns null if successful, or an error string if failed.
*/
- MOZ_MUST_USE
- static const char*
+ [[nodiscard]] static const char*
CreateChannelLoadContext(const PBrowserOrId& aBrowser,
PContentParent* aContent,
const SerializedLoadContext& aSerialized,
diff --git a/netwerk/protocol/about/nsAboutCache.h b/netwerk/protocol/about/nsAboutCache.h
index 6fb837eacd..a1fe77324f 100644
--- a/netwerk/protocol/about/nsAboutCache.h
+++ b/netwerk/protocol/about/nsAboutCache.h
@@ -49,10 +49,10 @@ public:
nsAboutCache() {}
- static MOZ_MUST_USE nsresult
+ [[nodiscard]] static nsresult
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
- static MOZ_MUST_USE nsresult
+ [[nodiscard]] static nsresult
GetStorage(nsACString const & storageName, nsILoadContextInfo* loadInfo,
nsICacheStorage **storage);
@@ -75,13 +75,13 @@ protected:
virtual ~Channel() {}
public:
- MOZ_MUST_USE nsresult Init(nsIURI* aURI, nsILoadInfo* aLoadInfo);
- MOZ_MUST_USE nsresult ParseURI(nsIURI * uri, nsACString & storage);
+ [[nodiscard]] nsresult Init(nsIURI* aURI, nsILoadInfo* aLoadInfo);
+ [[nodiscard]] nsresult ParseURI(nsIURI * uri, nsACString & storage);
// Finds a next storage we wish to visit (we use this method
// even there is a specified storage name, which is the only
// one in the list then.) Posts FireVisitStorage() when found.
- MOZ_MUST_USE nsresult VisitNextStorage();
+ [[nodiscard]] nsresult VisitNextStorage();
// Helper method that calls VisitStorage() for the current storage.
// When it fails, OnCacheEntryVisitCompleted is simulated to close
// the output stream and thus the about:cache channel.
@@ -89,13 +89,13 @@ protected:
// Kiks the visit cycle for the given storage, names can be:
// "disk", "memory", "appcache"
// Note: any newly added storage type has to be manually handled here.
- MOZ_MUST_USE nsresult VisitStorage(nsACString const & storageName);
+ [[nodiscard]] nsresult VisitStorage(nsACString const & storageName);
// Writes content of mBuffer to mStream and truncates
// the buffer. It may fail when the input stream is closed by canceling
// the input stream channel. It can be used to stop the cache iteration
// process.
- MOZ_MUST_USE nsresult FlushBuffer();
+ [[nodiscard]] nsresult FlushBuffer();
// Whether we are showing overview status of all available
// storages.
diff --git a/netwerk/protocol/about/nsAboutCacheEntry.h b/netwerk/protocol/about/nsAboutCacheEntry.h
index 8bfa0aa723..f770a9fa2e 100644
--- a/netwerk/protocol/about/nsAboutCacheEntry.h
+++ b/netwerk/protocol/about/nsAboutCacheEntry.h
@@ -53,20 +53,20 @@ private:
virtual ~Channel() {}
public:
- MOZ_MUST_USE nsresult Init(nsIURI* uri, nsILoadInfo* aLoadInfo);
-
- MOZ_MUST_USE nsresult GetContentStream(nsIURI *, nsIInputStream **);
- MOZ_MUST_USE nsresult OpenCacheEntry(nsIURI *);
- MOZ_MUST_USE nsresult OpenCacheEntry();
- MOZ_MUST_USE nsresult WriteCacheEntryDescription(nsICacheEntry *);
- MOZ_MUST_USE nsresult WriteCacheEntryUnavailable();
- MOZ_MUST_USE nsresult ParseURI(nsIURI *uri, nsACString &storageName,
+ [[nodiscard]] nsresult Init(nsIURI* uri, nsILoadInfo* aLoadInfo);
+
+ [[nodiscard]] nsresult GetContentStream(nsIURI *, nsIInputStream **);
+ [[nodiscard]] nsresult OpenCacheEntry(nsIURI *);
+ [[nodiscard]] nsresult OpenCacheEntry();
+ [[nodiscard]] nsresult WriteCacheEntryDescription(nsICacheEntry *);
+ [[nodiscard]] nsresult WriteCacheEntryUnavailable();
+ [[nodiscard]] nsresult ParseURI(nsIURI *uri, nsACString &storageName,
nsILoadContextInfo **loadInfo,
nsCString &enahnceID,
nsIURI **cacheUri);
void CloseContent();
- static MOZ_MUST_USE nsresult
+ [[nodiscard]] static nsresult
PrintCacheData(nsIInputStream *aInStream,
void *aClosure,
const char *aFromSegment,
diff --git a/netwerk/protocol/about/nsAboutProtocolUtils.h b/netwerk/protocol/about/nsAboutProtocolUtils.h
index c5946412b0..ec4e51e857 100644
--- a/netwerk/protocol/about/nsAboutProtocolUtils.h
+++ b/netwerk/protocol/about/nsAboutProtocolUtils.h
@@ -12,7 +12,7 @@
#include "nsServiceManagerUtils.h"
#include "prtime.h"
-inline MOZ_MUST_USE nsresult
+[[nodiscard]] inline nsresult
NS_GetAboutModuleName(nsIURI *aAboutURI, nsCString& aModule)
{
#ifdef DEBUG
diff --git a/netwerk/protocol/data/DataChannelParent.h b/netwerk/protocol/data/DataChannelParent.h
index 48c610d6a4..c36a3c8822 100644
--- a/netwerk/protocol/data/DataChannelParent.h
+++ b/netwerk/protocol/data/DataChannelParent.h
@@ -26,7 +26,7 @@ public:
NS_DECL_NSIREQUESTOBSERVER
NS_DECL_NSISTREAMLISTENER
- MOZ_MUST_USE bool Init(const uint32_t& aArgs);
+ [[nodiscard]] bool Init(const uint32_t& aArgs);
private:
~DataChannelParent();
diff --git a/netwerk/protocol/data/nsDataChannel.h b/netwerk/protocol/data/nsDataChannel.h
index c986fba1e9..b5599f0909 100644
--- a/netwerk/protocol/data/nsDataChannel.h
+++ b/netwerk/protocol/data/nsDataChannel.h
@@ -20,9 +20,9 @@ public:
}
protected:
- virtual MOZ_MUST_USE nsresult OpenContentStream(bool async,
- nsIInputStream **result,
- nsIChannel** channel);
+ [[nodiscard]] virtual nsresult OpenContentStream(bool async,
+ nsIInputStream **result,
+ nsIChannel** channel);
};
#endif /* nsDataChannel_h___ */
diff --git a/netwerk/protocol/data/nsDataHandler.h b/netwerk/protocol/data/nsDataHandler.h
index 75f873e174..3c4adbffa3 100644
--- a/netwerk/protocol/data/nsDataHandler.h
+++ b/netwerk/protocol/data/nsDataHandler.h
@@ -24,18 +24,18 @@ public:
nsDataHandler();
// Define a Create method to be used with a factory:
- static MOZ_MUST_USE nsresult
+ [[nodiscard]] static nsresult
Create(nsISupports* aOuter, const nsIID& aIID, void* *aResult);
// Parse a data: URI and return the individual parts
// (the given spec will temporarily be modified but will be returned
// to the original before returning)
// contentCharset and dataBuffer can be nullptr if they are not needed.
- static MOZ_MUST_USE nsresult ParseURI(nsCString& spec,
- nsCString& contentType,
- nsCString* contentCharset,
- bool& isBase64,
- nsCString* dataBuffer);
+ [[nodiscard]] static nsresult ParseURI(nsCString& spec,
+ nsCString& contentType,
+ nsCString* contentCharset,
+ bool& isBase64,
+ nsCString* dataBuffer);
};
#endif /* nsDataHandler_h___ */
diff --git a/netwerk/protocol/device/nsDeviceCaptureProvider.h b/netwerk/protocol/device/nsDeviceCaptureProvider.h
index 024f6689d6..423ef231b8 100644
--- a/netwerk/protocol/device/nsDeviceCaptureProvider.h
+++ b/netwerk/protocol/device/nsDeviceCaptureProvider.h
@@ -23,9 +23,9 @@ struct nsCaptureParams {
class nsDeviceCaptureProvider : public nsISupports
{
public:
- virtual MOZ_MUST_USE nsresult Init(nsACString& aContentType,
- nsCaptureParams* aParams,
- nsIInputStream** aStream) = 0;
+ [[nodiscard]] virtual nsresult Init(nsACString& aContentType,
+ nsCaptureParams* aParams,
+ nsIInputStream** aStream) = 0;
};
#endif
diff --git a/netwerk/protocol/device/nsDeviceChannel.h b/netwerk/protocol/device/nsDeviceChannel.h
index 8c3e447931..f58b2716b5 100644
--- a/netwerk/protocol/device/nsDeviceChannel.h
+++ b/netwerk/protocol/device/nsDeviceChannel.h
@@ -15,10 +15,10 @@ public:
nsDeviceChannel();
- MOZ_MUST_USE nsresult Init(nsIURI* uri);
- MOZ_MUST_USE nsresult OpenContentStream(bool aAsync,
- nsIInputStream **aStream,
- nsIChannel **aChannel) override;
+ [[nodiscard]] nsresult Init(nsIURI* uri);
+ [[nodiscard]] nsresult OpenContentStream(bool aAsync,
+ nsIInputStream **aStream,
+ nsIChannel **aChannel) override;
protected:
~nsDeviceChannel();
diff --git a/netwerk/protocol/device/nsDeviceProtocolHandler.h b/netwerk/protocol/device/nsDeviceProtocolHandler.h
index dee9b4f8f0..8188e3e9e0 100644
--- a/netwerk/protocol/device/nsDeviceProtocolHandler.h
+++ b/netwerk/protocol/device/nsDeviceProtocolHandler.h
@@ -26,7 +26,7 @@ public:
nsDeviceProtocolHandler() {}
- MOZ_MUST_USE nsresult Init();
+ [[nodiscard]] nsresult Init();
};
} // namespace net
diff --git a/netwerk/protocol/file/nsFileChannel.h b/netwerk/protocol/file/nsFileChannel.h
index 4f28b9ed01..090b4bb403 100644
--- a/netwerk/protocol/file/nsFileChannel.h
+++ b/netwerk/protocol/file/nsFileChannel.h
@@ -28,13 +28,13 @@ protected:
// method also returns a best guess at the content-type for the data stream.
// NOTE: If the channel has a type hint set, contentType will be left
// untouched. The caller should not use it in that case.
- MOZ_MUST_USE nsresult MakeFileInputStream(nsIFile *file,
- nsCOMPtr<nsIInputStream> &stream,
- nsCString &contentType, bool async);
+ [[nodiscard]] nsresult MakeFileInputStream(nsIFile *file,
+ nsCOMPtr<nsIInputStream> &stream,
+ nsCString &contentType, bool async);
- virtual MOZ_MUST_USE nsresult OpenContentStream(bool async,
- nsIInputStream **result,
- nsIChannel** channel) override;
+ [[nodiscard]] virtual nsresult OpenContentStream(bool async,
+ nsIInputStream **result,
+ nsIChannel** channel) override;
private:
nsCOMPtr<nsIInputStream> mUploadStream;
diff --git a/netwerk/protocol/file/nsFileProtocolHandler.h b/netwerk/protocol/file/nsFileProtocolHandler.h
index 211eb2873e..1da0713284 100644
--- a/netwerk/protocol/file/nsFileProtocolHandler.h
+++ b/netwerk/protocol/file/nsFileProtocolHandler.h
@@ -21,7 +21,7 @@ public:
nsFileProtocolHandler();
- MOZ_MUST_USE nsresult Init();
+ [[nodiscard]] nsresult Init();
};
#endif // !nsFileProtocolHandler_h__
diff --git a/netwerk/protocol/http/TunnelUtils.h b/netwerk/protocol/http/TunnelUtils.h
index 4a003082ec..2d56fb0932 100644
--- a/netwerk/protocol/http/TunnelUtils.h
+++ b/netwerk/protocol/http/TunnelUtils.h
@@ -122,7 +122,7 @@ public:
nsresult CommitToSegmentSize(uint32_t size, bool forceCommitment) override;
nsresult GetTransactionSecurityInfo(nsISupports **) override;
nsresult NudgeTunnel(NudgeTunnelCallback *callback);
- MOZ_MUST_USE nsresult SetProxiedTransaction(nsAHttpTransaction *aTrans,
+ [[nodiscard]] nsresult SetProxiedTransaction(nsAHttpTransaction *aTrans,
nsAHttpTransaction *aSpdyConnectTransaction = nullptr);
void newIODriver(nsIAsyncInputStream *aSocketIn,
nsIAsyncOutputStream *aSocketOut,
diff --git a/netwerk/protocol/http/nsHttpChannel.h b/netwerk/protocol/http/nsHttpChannel.h
index 2681f34764..8ae7035822 100644
--- a/netwerk/protocol/http/nsHttpChannel.h
+++ b/netwerk/protocol/http/nsHttpChannel.h
@@ -282,7 +282,7 @@ private:
bool RequestIsConditional();
nsresult BeginConnect();
void HandleBeginConnectContinue();
- MOZ_MUST_USE nsresult BeginConnectContinue();
+ [[nodiscard]] nsresult BeginConnectContinue();
nsresult ContinueBeginConnectWithResult();
void ContinueBeginConnect();
nsresult Connect();
diff --git a/netwerk/sctp/datachannel/DataChannel.h b/netwerk/sctp/datachannel/DataChannel.h
index 33458e6c2b..02dca930c5 100644
--- a/netwerk/sctp/datachannel/DataChannel.h
+++ b/netwerk/sctp/datachannel/DataChannel.h
@@ -140,15 +140,14 @@ public:
PARTIAL_RELIABLE_TIMED = 2
} Type;
- MOZ_MUST_USE
- already_AddRefed<DataChannel> Open(const nsACString& label,
- const nsACString& protocol,
- Type type, bool inOrder,
- uint32_t prValue,
- DataChannelListener *aListener,
- nsISupports *aContext,
- bool aExternalNegotiated,
- uint16_t aStream);
+ [[nodiscard]] already_AddRefed<DataChannel> Open(const nsACString& label,
+ const nsACString& protocol,
+ Type type, bool inOrder,
+ uint32_t prValue,
+ DataChannelListener *aListener,
+ nsISupports *aContext,
+ bool aExternalNegotiated,
+ uint16_t aStream);
void Close(DataChannel *aChannel);
// CloseInt() must be called with mLock held