From eefecb0ae123769a41be06607925ecc7bc511023 Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Thu, 19 Sep 2013 15:29:27 -0400 Subject: [PATCH] Bug 784739 - Switch from NULL to nullptr in netwerk/ (2/2); r=ehsan --- netwerk/mime/nsMIMEHeaderParamImpl.cpp | 32 +++++++++---------- .../device/AndroidCaptureProvider.cpp | 4 +-- netwerk/protocol/device/CameraStreamImpl.cpp | 8 ++--- .../protocol/file/nsFileProtocolHandler.cpp | 2 +- netwerk/protocol/http/SpdySession2.cpp | 4 +-- netwerk/protocol/http/SpdySession3.cpp | 2 +- netwerk/protocol/http/SpdyStream3.cpp | 2 +- netwerk/protocol/http/nsHttpChannel.cpp | 4 +-- netwerk/protocol/http/nsHttpConnectionMgr.cpp | 2 +- netwerk/protocol/websocket/WebSocketChannel.h | 2 +- netwerk/socket/nsSOCKSIOLayer.cpp | 16 +++++----- .../converters/nsDirIndexParser.cpp | 2 +- .../converters/nsHTTPCompressConv.cpp | 14 ++++---- .../converters/nsMultiMixedConv.cpp | 2 +- netwerk/streamconv/test/TestStreamConv.cpp | 8 ++--- netwerk/system/win32/nsNotifyAddrListener.cpp | 12 +++---- netwerk/test/ReadNTLM.cpp | 2 +- netwerk/test/TestPageLoad.cpp | 12 +++---- netwerk/test/TestSTSParser.cpp | 2 +- netwerk/test/TestWriteSpeed.cpp | 4 +-- netwerk/wifi/nsWifiScannerSolaris.cpp | 10 +++--- netwerk/wifi/nsWifiScannerWin.cpp | 18 +++++------ 22 files changed, 82 insertions(+), 82 deletions(-) diff --git a/netwerk/mime/nsMIMEHeaderParamImpl.cpp b/netwerk/mime/nsMIMEHeaderParamImpl.cpp index 86ea1fa9d4d..66480c2c92d 100644 --- a/netwerk/mime/nsMIMEHeaderParamImpl.cpp +++ b/netwerk/mime/nsMIMEHeaderParamImpl.cpp @@ -202,12 +202,12 @@ class Continuation { }; // combine segments into a single string, returning the allocated string -// (or NULL) while emptying the list +// (or nullptr) while emptying the list char *combineContinuations(nsTArray& aArray) { // Sanity check if (aArray.Length() == 0) - return NULL; + return nullptr; // Get an upper bound for the length uint32_t length = 0; @@ -239,7 +239,7 @@ char *combineContinuations(nsTArray& aArray) // return null if empty value if (*result == '\0') { nsMemory::Free(result); - result = NULL; + result = nullptr; } } else { // Handle OOM @@ -435,9 +435,9 @@ nsMIMEHeaderParamImpl::DoParameterInternal(const char *aHeaderValue, // collect results for the different algorithms (plain filename, // RFC5987/2231-encoded filename, + continuations) separately and decide // which to use at the end - char *caseAResult = NULL; - char *caseBResult = NULL; - char *caseCDResult = NULL; + char *caseAResult = nullptr; + char *caseBResult = nullptr; + char *caseCDResult = nullptr; // collect continuation segments nsTArray segments; @@ -455,9 +455,9 @@ nsMIMEHeaderParamImpl::DoParameterInternal(const char *aHeaderValue, // find name/value const char *nameStart = str; - const char *nameEnd = NULL; + const char *nameEnd = nullptr; const char *valueStart = str; - const char *valueEnd = NULL; + const char *valueEnd = nullptr; bool isQuotedString = false; NS_ASSERTION(!nsCRT::IsAsciiSpace(*str), "should be after whitespace."); @@ -568,11 +568,11 @@ nsMIMEHeaderParamImpl::DoParameterInternal(const char *aHeaderValue, NS_WARNING("Mandatory two single quotes are missing in header parameter\n"); } - const char *charsetStart = NULL; + const char *charsetStart = nullptr; int32_t charsetLength = 0; - const char *langStart = NULL; + const char *langStart = nullptr; int32_t langLength = 0; - const char *rawValStart = NULL; + const char *rawValStart = nullptr; int32_t rawValLength = 0; if (sQuote2 && sQuote1) { @@ -677,31 +677,31 @@ increment_str: // check that the 2231/5987 result decodes properly given the // specified character set if (!IsValidOctetSequenceForCharset(charsetB, caseBResult)) - caseBResult = NULL; + caseBResult = nullptr; } if (caseCDResult && !charsetCD.IsEmpty()) { // check that the 2231/5987 result decodes properly given the // specified character set if (!IsValidOctetSequenceForCharset(charsetCD, caseCDResult)) - caseCDResult = NULL; + caseCDResult = nullptr; } if (caseBResult) { // prefer simple 5987 format over 2231 with continuations *aResult = caseBResult; - caseBResult = NULL; + caseBResult = nullptr; charset.Assign(charsetB); } else if (caseCDResult) { // prefer 2231/5987 with or without continuations over plain format *aResult = caseCDResult; - caseCDResult = NULL; + caseCDResult = nullptr; charset.Assign(charsetCD); } else if (caseAResult) { *aResult = caseAResult; - caseAResult = NULL; + caseAResult = nullptr; } // free unused stuff diff --git a/netwerk/protocol/device/AndroidCaptureProvider.cpp b/netwerk/protocol/device/AndroidCaptureProvider.cpp index d43757e6ee5..8503b3f2118 100644 --- a/netwerk/protocol/device/AndroidCaptureProvider.cpp +++ b/netwerk/protocol/device/AndroidCaptureProvider.cpp @@ -257,13 +257,13 @@ NS_IMETHODIMP AndroidCameraInputStream::CloseWithStatus(nsresult status) NS_IMPL_ISUPPORTS0(AndroidCaptureProvider) -AndroidCaptureProvider* AndroidCaptureProvider::sInstance = NULL; +AndroidCaptureProvider* AndroidCaptureProvider::sInstance = nullptr; AndroidCaptureProvider::AndroidCaptureProvider() { } AndroidCaptureProvider::~AndroidCaptureProvider() { - AndroidCaptureProvider::sInstance = NULL; + AndroidCaptureProvider::sInstance = nullptr; } nsresult AndroidCaptureProvider::Init(nsACString& aContentType, diff --git a/netwerk/protocol/device/CameraStreamImpl.cpp b/netwerk/protocol/device/CameraStreamImpl.cpp index 030b83de673..7c38d4a2d1c 100644 --- a/netwerk/protocol/device/CameraStreamImpl.cpp +++ b/netwerk/protocol/device/CameraStreamImpl.cpp @@ -28,8 +28,8 @@ using namespace mozilla; namespace mozilla { namespace net { -static CameraStreamImpl* mCamera0 = NULL; -static CameraStreamImpl* mCamera1 = NULL; +static CameraStreamImpl* mCamera0 = nullptr; +static CameraStreamImpl* mCamera1 = nullptr; /** * CameraStreamImpl @@ -48,7 +48,7 @@ void CameraStreamImpl::transmitFrame(JNIEnv *env, jbyteArray *data) { } CameraStreamImpl* CameraStreamImpl::GetInstance(uint32_t aCamera) { - CameraStreamImpl* res = NULL; + CameraStreamImpl* res = nullptr; switch(aCamera) { case 0: if (mCamera0) @@ -91,7 +91,7 @@ bool CameraStreamImpl::Init(const nsCString& contentType, const uint32_t& camera void CameraStreamImpl::Close() { AndroidBridge::Bridge()->CloseCamera(); - mCallback = NULL; + mCallback = nullptr; } } // namespace net diff --git a/netwerk/protocol/file/nsFileProtocolHandler.cpp b/netwerk/protocol/file/nsFileProtocolHandler.cpp index 2b7666480af..a51db62ebd3 100644 --- a/netwerk/protocol/file/nsFileProtocolHandler.cpp +++ b/netwerk/protocol/file/nsFileProtocolHandler.cpp @@ -78,7 +78,7 @@ nsFileProtocolHandler::ReadURLFile(nsIFile* aFile, nsIURI** aURI) rv = NS_ERROR_NOT_AVAILABLE; IUniformResourceLocatorW* urlLink = nullptr; - result = ::CoCreateInstance(CLSID_InternetShortcut, NULL, CLSCTX_INPROC_SERVER, + result = ::CoCreateInstance(CLSID_InternetShortcut, nullptr, CLSCTX_INPROC_SERVER, IID_IUniformResourceLocatorW, (void**)&urlLink); if (SUCCEEDED(result) && urlLink) { IPersistFile* urlFile = nullptr; diff --git a/netwerk/protocol/http/SpdySession2.cpp b/netwerk/protocol/http/SpdySession2.cpp index b2167a771f5..854af15a828 100644 --- a/netwerk/protocol/http/SpdySession2.cpp +++ b/netwerk/protocol/http/SpdySession2.cpp @@ -724,7 +724,7 @@ SpdySession2::ConvertHeaders(nsDependentCSubstring &status, mFlatHTTPResponseHeaders.Append(nameString); mFlatHTTPResponseHeaders.Append(NS_LITERAL_CSTRING(": ")); - // expand NULL bytes in the value string + // expand nullptr bytes in the value string for (char *cPtr = valueString.BeginWriting(); cPtr && cPtr < valueString.EndWriting(); ++cPtr) { @@ -2218,7 +2218,7 @@ SpdySession2::RequestHead() MOZ_ASSERT(false, "SpdySession2::RequestHead() " "should not be called after SPDY is setup"); - return NULL; + return nullptr; } uint32_t diff --git a/netwerk/protocol/http/SpdySession3.cpp b/netwerk/protocol/http/SpdySession3.cpp index f6b103758e3..5f51e67c8ed 100644 --- a/netwerk/protocol/http/SpdySession3.cpp +++ b/netwerk/protocol/http/SpdySession3.cpp @@ -2606,7 +2606,7 @@ SpdySession3::RequestHead() MOZ_ASSERT(false, "SpdySession3::RequestHead() " "should not be called after SPDY is setup"); - return NULL; + return nullptr; } uint32_t diff --git a/netwerk/protocol/http/SpdyStream3.cpp b/netwerk/protocol/http/SpdyStream3.cpp index bc18c8209bf..f29bfcb04a6 100644 --- a/netwerk/protocol/http/SpdyStream3.cpp +++ b/netwerk/protocol/http/SpdyStream3.cpp @@ -1218,7 +1218,7 @@ SpdyStream3::ConvertHeaders(nsACString &aHeadersOut) aHeadersOut.Append(nameString); aHeadersOut.Append(NS_LITERAL_CSTRING(": ")); - // expand NULL bytes in the value string + // expand nullptr bytes in the value string for (char *cPtr = valueString.BeginWriting(); cPtr && cPtr < valueString.EndWriting(); ++cPtr) { diff --git a/netwerk/protocol/http/nsHttpChannel.cpp b/netwerk/protocol/http/nsHttpChannel.cpp index 854ce82d073..c74a459757b 100644 --- a/netwerk/protocol/http/nsHttpChannel.cpp +++ b/netwerk/protocol/http/nsHttpChannel.cpp @@ -1205,7 +1205,7 @@ nsHttpChannel::ProcessSTSHeader() NS_ENSURE_SUCCESS(rv, rv); rv = sss->ProcessHeader(nsISiteSecurityService::HEADER_HSTS, mURI, - stsHeader.get(), flags, NULL, NULL); + stsHeader.get(), flags, nullptr, nullptr); if (NS_FAILED(rv)) { AddSecurityMessage(NS_LITERAL_STRING("InvalidSTSHeaders"), NS_LITERAL_STRING("Invalid HSTS Headers")); @@ -1635,7 +1635,7 @@ nsHttpChannel::PromptTempRedirect() nsXPIDLString messageString; rv = stringBundle->GetStringFromName(NS_LITERAL_STRING("RepostFormData").get(), getter_Copies(messageString)); - // GetStringFromName can return NS_OK and NULL messageString. + // GetStringFromName can return NS_OK and nullptr messageString. if (NS_SUCCEEDED(rv) && messageString) { bool repost = false; diff --git a/netwerk/protocol/http/nsHttpConnectionMgr.cpp b/netwerk/protocol/http/nsHttpConnectionMgr.cpp index af948a9f928..fce775e1c4f 100644 --- a/netwerk/protocol/http/nsHttpConnectionMgr.cpp +++ b/netwerk/protocol/http/nsHttpConnectionMgr.cpp @@ -211,7 +211,7 @@ nsHttpConnectionMgr::ConditionallyStopPruneDeadConnectionsTimer() mTimeOfNextWakeUp = UINT64_MAX; if (mTimer) { mTimer->Cancel(); - mTimer = NULL; + mTimer = nullptr; } } diff --git a/netwerk/protocol/websocket/WebSocketChannel.h b/netwerk/protocol/websocket/WebSocketChannel.h index 1af942b7944..276219a5bdd 100644 --- a/netwerk/protocol/websocket/WebSocketChannel.h +++ b/netwerk/protocol/websocket/WebSocketChannel.h @@ -118,7 +118,7 @@ private: // Common send code for binary + text msgs nsresult SendMsgCommon(const nsACString *aMsg, bool isBinary, - uint32_t length, nsIInputStream *aStream = NULL); + uint32_t length, nsIInputStream *aStream = nullptr); void EnqueueOutgoingMessage(nsDeque &aQueue, OutboundMessage *aMsg); diff --git a/netwerk/socket/nsSOCKSIOLayer.cpp b/netwerk/socket/nsSOCKSIOLayer.cpp index 46da9246db2..a415ead0ef8 100644 --- a/netwerk/socket/nsSOCKSIOLayer.cpp +++ b/netwerk/socket/nsSOCKSIOLayer.cpp @@ -881,7 +881,7 @@ nsSOCKSSocketInfo::WriteUint32(uint32_t v) void nsSOCKSSocketInfo::WriteNetAddr(const NetAddr *addr) { - const char *ip = NULL; + const char *ip = nullptr; uint32_t len = 0; if (addr->raw.family == AF_INET) { @@ -892,7 +892,7 @@ nsSOCKSSocketInfo::WriteNetAddr(const NetAddr *addr) len = sizeof(addr->inet6.ip.u8); } - NS_ABORT_IF_FALSE(ip != NULL, "Unknown address"); + NS_ABORT_IF_FALSE(ip != nullptr, "Unknown address"); NS_ABORT_IF_FALSE(mDataLength + len <= BUFFER_SIZE, "Can't write that much data!"); @@ -979,7 +979,7 @@ nsSOCKSSocketInfo::ReadNetPort(NetAddr *addr) void nsSOCKSSocketInfo::WantRead(uint32_t sz) { - NS_ABORT_IF_FALSE(mDataIoPtr == NULL, + NS_ABORT_IF_FALSE(mDataIoPtr == nullptr, "WantRead() called while I/O already in progress!"); NS_ABORT_IF_FALSE(mDataLength + sz <= BUFFER_SIZE, "Can't read that much data!"); @@ -1077,7 +1077,7 @@ nsSOCKSIOLayerConnect(PRFileDesc *fd, const PRNetAddr *addr, PRIntervalTime to) NetAddr dst; nsSOCKSSocketInfo * info = (nsSOCKSSocketInfo*) fd->secret; - if (info == NULL) return PR_FAILURE; + if (info == nullptr) return PR_FAILURE; if (addr->raw.family == PR_AF_INET6 && PR_IsNetAddrType(addr, PR_IpAddrV4Mapped)) { @@ -1113,7 +1113,7 @@ nsSOCKSIOLayerConnectContinue(PRFileDesc *fd, int16_t oflags) PRStatus status; nsSOCKSSocketInfo * info = (nsSOCKSSocketInfo*) fd->secret; - if (info == NULL) return PR_FAILURE; + if (info == nullptr) return PR_FAILURE; do { status = info->DoHandshake(fd, oflags); @@ -1126,7 +1126,7 @@ static int16_t nsSOCKSIOLayerPoll(PRFileDesc *fd, int16_t in_flags, int16_t *out_flags) { nsSOCKSSocketInfo * info = (nsSOCKSSocketInfo*) fd->secret; - if (info == NULL) return PR_FAILURE; + if (info == nullptr) return PR_FAILURE; if (!info->IsConnected()) { *out_flags = 0; @@ -1178,7 +1178,7 @@ nsSOCKSIOLayerGetName(PRFileDesc *fd, PRNetAddr *addr) { nsSOCKSSocketInfo * info = (nsSOCKSSocketInfo*) fd->secret; - if (info != NULL && addr != NULL) { + if (info != nullptr && addr != nullptr) { NetAddr temp; NetAddr *tempPtr = &temp; if (info->GetExternalProxyAddr(&tempPtr) == NS_OK) { @@ -1195,7 +1195,7 @@ nsSOCKSIOLayerGetPeerName(PRFileDesc *fd, PRNetAddr *addr) { nsSOCKSSocketInfo * info = (nsSOCKSSocketInfo*) fd->secret; - if (info != NULL && addr != NULL) { + if (info != nullptr && addr != nullptr) { NetAddr temp; NetAddr *tempPtr = &temp; if (info->GetDestinationAddr(&tempPtr) == NS_OK) { diff --git a/netwerk/streamconv/converters/nsDirIndexParser.cpp b/netwerk/streamconv/converters/nsDirIndexParser.cpp index 97745cf6fd6..c3e4f6ea273 100644 --- a/netwerk/streamconv/converters/nsDirIndexParser.cpp +++ b/netwerk/streamconv/converters/nsDirIndexParser.cpp @@ -171,7 +171,7 @@ nsDirIndexParser::ParseFormat(const char* aFormatStr) { delete[] mFormat; mFormat = new int[num+1]; - // Prevent NULL Deref - Bug 443299 + // Prevent nullptr Deref - Bug 443299 if (mFormat == nullptr) return NS_ERROR_OUT_OF_MEMORY; mFormat[num] = -1; diff --git a/netwerk/streamconv/converters/nsHTTPCompressConv.cpp b/netwerk/streamconv/converters/nsHTTPCompressConv.cpp index 71385ca2946..78002799ed5 100644 --- a/netwerk/streamconv/converters/nsHTTPCompressConv.cpp +++ b/netwerk/streamconv/converters/nsHTTPCompressConv.cpp @@ -26,8 +26,8 @@ NS_IMPL_ISUPPORTS3(nsHTTPCompressConv, nsHTTPCompressConv::nsHTTPCompressConv() : mListener(nullptr) , mMode(HTTP_COMPRESS_IDENTITY) - , mOutBuffer(NULL) - , mInpBuffer(NULL) + , mOutBuffer(nullptr) + , mInpBuffer(nullptr) , mOutBufferLen(0) , mInpBufferLen(0) , mCheckHeaderDone(false) @@ -134,24 +134,24 @@ nsHTTPCompressConv::OnDataAvailable(nsIRequest* request, case HTTP_COMPRESS_DEFLATE: - if (mInpBuffer != NULL && streamLen > mInpBufferLen) + if (mInpBuffer != nullptr && streamLen > mInpBufferLen) { mInpBuffer = (unsigned char *) nsMemory::Realloc(mInpBuffer, mInpBufferLen = streamLen); if (mOutBufferLen < streamLen * 2) mOutBuffer = (unsigned char *) nsMemory::Realloc(mOutBuffer, mOutBufferLen = streamLen * 3); - if (mInpBuffer == NULL || mOutBuffer == NULL) + if (mInpBuffer == nullptr || mOutBuffer == nullptr) return NS_ERROR_OUT_OF_MEMORY; } - if (mInpBuffer == NULL) + if (mInpBuffer == nullptr) mInpBuffer = (unsigned char *) nsMemory::Alloc(mInpBufferLen = streamLen); - if (mOutBuffer == NULL) + if (mOutBuffer == nullptr) mOutBuffer = (unsigned char *) nsMemory::Alloc(mOutBufferLen = streamLen * 3); - if (mInpBuffer == NULL || mOutBuffer == NULL) + if (mInpBuffer == nullptr || mOutBuffer == nullptr) return NS_ERROR_OUT_OF_MEMORY; uint32_t unused; diff --git a/netwerk/streamconv/converters/nsMultiMixedConv.cpp b/netwerk/streamconv/converters/nsMultiMixedConv.cpp index 2a44ab0f2b0..c77435b697e 100644 --- a/netwerk/streamconv/converters/nsMultiMixedConv.cpp +++ b/netwerk/streamconv/converters/nsMultiMixedConv.cpp @@ -449,7 +449,7 @@ nsMultiMixedConv::AsyncConvertData(const char *aFromType, const char *aToType, class AutoFree { public: - AutoFree() : mBuffer(NULL) {} + AutoFree() : mBuffer(nullptr) {} AutoFree(char *buffer) : mBuffer(buffer) {} diff --git a/netwerk/streamconv/test/TestStreamConv.cpp b/netwerk/streamconv/test/TestStreamConv.cpp index 0a3c7d26e44..cb1cf2cee8c 100644 --- a/netwerk/streamconv/test/TestStreamConv.cpp +++ b/netwerk/streamconv/test/TestStreamConv.cpp @@ -132,8 +132,8 @@ nsresult SendData(const char * aData, nsIStreamListener* aListener, nsIRequest* #define SEND_DATA(x) SendData(x, converterListener, request) static const mozilla::Module::CIDEntry kTestCIDs[] = { - { &kTestConverterCID, false, NULL, CreateTestConverter }, - { NULL } + { &kTestConverterCID, false, nullptr, CreateTestConverter }, + { nullptr } }; static const mozilla::Module::ContractIDEntry kTestContracts[] = { @@ -144,7 +144,7 @@ static const mozilla::Module::ContractIDEntry kTestContracts[] = { { NS_ISTREAMCONVERTER_KEY "?from=d/foo&to=e/foo", &kTestConverterCID }, { NS_ISTREAMCONVERTER_KEY "?from=d/foo&to=f/foo", &kTestConverterCID }, { NS_ISTREAMCONVERTER_KEY "?from=t/foo&to=k/foo", &kTestConverterCID }, - { NULL } + { nullptr } }; static const mozilla::Module::CategoryEntry kTestCategories[] = { @@ -155,7 +155,7 @@ static const mozilla::Module::CategoryEntry kTestCategories[] = { { NS_ISTREAMCONVERTER_KEY, "?from=d/foo&to=e/foo", "x" }, { NS_ISTREAMCONVERTER_KEY, "?from=d/foo&to=f/foo", "x" }, { NS_ISTREAMCONVERTER_KEY, "?from=t/foo&to=k/foo", "x" }, - { NULL } + { nullptr } }; static const mozilla::Module kTestModule = { diff --git a/netwerk/system/win32/nsNotifyAddrListener.cpp b/netwerk/system/win32/nsNotifyAddrListener.cpp index 4493d5ef982..9642a0bb739 100644 --- a/netwerk/system/win32/nsNotifyAddrListener.cpp +++ b/netwerk/system/win32/nsNotifyAddrListener.cpp @@ -155,7 +155,7 @@ nsNotifyAddrListener::Init(void) false); NS_ENSURE_SUCCESS(rv, rv); - mShutdownEvent = CreateEvent(NULL, FALSE, FALSE, NULL); + mShutdownEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr); NS_ENSURE_TRUE(mShutdownEvent, NS_ERROR_OUT_OF_MEMORY); rv = NS_NewThread(getter_AddRefs(mThread), this); @@ -186,7 +186,7 @@ nsNotifyAddrListener::Shutdown(void) mThread = nullptr; CloseHandle(mShutdownEvent); - mShutdownEvent = NULL; + mShutdownEvent = nullptr; return rv; } @@ -256,7 +256,7 @@ nsNotifyAddrListener::CheckICSStatus(PWCHAR aAdapterName) nsRefPtr netSharingManager; hr = CoCreateInstance( CLSID_NetSharingManager, - NULL, + nullptr, CLSCTX_INPROC_SERVER, IID_INetSharingManager, getter_AddRefs(netSharingManager)); @@ -326,16 +326,16 @@ nsNotifyAddrListener::CheckAdaptersAddresses(void) if (!addresses) return ERROR_OUTOFMEMORY; - DWORD ret = GetAdaptersAddresses(AF_UNSPEC, 0, NULL, addresses, &len); + DWORD ret = GetAdaptersAddresses(AF_UNSPEC, 0, nullptr, addresses, &len); if (ret == ERROR_BUFFER_OVERFLOW) { free(addresses); addresses = (PIP_ADAPTER_ADDRESSES) malloc(len); if (!addresses) return ERROR_BUFFER_OVERFLOW; - ret = GetAdaptersAddresses(AF_UNSPEC, 0, NULL, addresses, &len); + ret = GetAdaptersAddresses(AF_UNSPEC, 0, nullptr, addresses, &len); } - if (FAILED(CoInitializeEx(NULL, COINIT_MULTITHREADED))) { + if (FAILED(CoInitializeEx(nullptr, COINIT_MULTITHREADED))) { free(addresses); return ERROR_NOT_SUPPORTED; } diff --git a/netwerk/test/ReadNTLM.cpp b/netwerk/test/ReadNTLM.cpp index 2cec6889a40..20411e33697 100644 --- a/netwerk/test/ReadNTLM.cpp +++ b/netwerk/test/ReadNTLM.cpp @@ -281,7 +281,7 @@ ReadType3MsgBody(const uint8_t *inBuf, uint32_t start) static void ReadMsg(const char *base64buf, uint32_t bufLen) { - uint8_t *inBuf = (uint8_t *) PL_Base64Decode(base64buf, bufLen, NULL); + uint8_t *inBuf = (uint8_t *) PL_Base64Decode(base64buf, bufLen, nullptr); if (!inBuf) { printf("PL_Base64Decode failed\n"); diff --git a/netwerk/test/TestPageLoad.cpp b/netwerk/test/TestPageLoad.cpp index e5e129e5147..62e4dd744d8 100644 --- a/netwerk/test/TestPageLoad.cpp +++ b/netwerk/test/TestPageLoad.cpp @@ -74,10 +74,10 @@ static NS_METHOD streamParse (nsIInputStream* in, return NS_OK; } parseBuf[0]='\0'; - if((loc_t=PL_strcasestr(lineBuf, "img"))!= NULL - || (loc_t=PL_strcasestr(lineBuf, "script"))!=NULL) { + if((loc_t=PL_strcasestr(lineBuf, "img"))!= nullptr + || (loc_t=PL_strcasestr(lineBuf, "script"))!=nullptr) { loc_t2=PL_strcasestr(loc_t, "src"); - if(loc_t2!=NULL) { + if(loc_t2!=nullptr) { loc_t2+=3; strcpy(loc, loc_t2); sscanf(loc, "=\"%[^\"]", parseBuf); @@ -91,9 +91,9 @@ static NS_METHOD streamParse (nsIInputStream* in, } /***NEED BETTER CHECK FOR STYLESHEETS - if((loc_t=PL_strcasestr(lineBuf, "link"))!= NULL) { + if((loc_t=PL_strcasestr(lineBuf, "link"))!= nullptr) { loc_t2=PL_strcasestr(loc_t, "href"); - if(loc_t2!=NULL) { + if(loc_t2!=nullptr) { loc_t2+=4; strcpy(loc, loc_t2); //printf("%s\n", loc); @@ -106,7 +106,7 @@ static NS_METHOD streamParse (nsIInputStream* in, } } */ - if((loc_t=PL_strcasestr(lineBuf, "background"))!=NULL) { + if((loc_t=PL_strcasestr(lineBuf, "background"))!=nullptr) { loc_t+=10; strcpy(loc, loc_t); sscanf(loc, "=\"%[^\"]", parseBuf); diff --git a/netwerk/test/TestSTSParser.cpp b/netwerk/test/TestSTSParser.cpp index 8e0a7bfeffe..d62f2344ab0 100644 --- a/netwerk/test/TestSTSParser.cpp +++ b/netwerk/test/TestSTSParser.cpp @@ -69,7 +69,7 @@ bool TestFailure(const char* hdr, EXPECT_SUCCESS(rv, "Failed to create URI"); rv = sss->ProcessHeader(nsISiteSecurityService::HEADER_HSTS, dummyUri, hdr, - 0, NULL, NULL); + 0, nullptr, nullptr); EXPECT_FAILURE(rv, "Parsed invalid header: %s", hdr); passed(hdr); return true; diff --git a/netwerk/test/TestWriteSpeed.cpp b/netwerk/test/TestWriteSpeed.cpp index 2512bf5089b..0b0260fdd5d 100644 --- a/netwerk/test/TestWriteSpeed.cpp +++ b/netwerk/test/TestWriteSpeed.cpp @@ -36,7 +36,7 @@ Test(const char* filename, int32_t minSize, int32_t maxSize, for (int32_t size = minSize; size <= maxSize; size += sizeIncrement) { // create a buffer of stuff to write char* buf = (char*)PR_Malloc(size); - if (buf == NULL) + if (buf == nullptr) return -1; // initialize it with a pattern @@ -54,7 +54,7 @@ Test(const char* filename, int32_t minSize, int32_t maxSize, char name[1024]; sprintf(name, "%s_%d", filename, i); PRFileDesc* fd = PR_Open(name, PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE, 0664); - if (fd == NULL) + if (fd == nullptr) return -1; PRIntervalTime writeStart = PR_IntervalNow(); diff --git a/netwerk/wifi/nsWifiScannerSolaris.cpp b/netwerk/wifi/nsWifiScannerSolaris.cpp index 202e913b701..d0e3fd49477 100644 --- a/netwerk/wifi/nsWifiScannerSolaris.cpp +++ b/netwerk/wifi/nsWifiScannerSolaris.cpp @@ -58,15 +58,15 @@ do_parse_str(char *bssid_str, char *essid_str, char *strength) static void do_dladm(nsCOMArray &accessPoints) { - GError *err = NULL; - char *sout = NULL; - char *serr = NULL; + GError *err = nullptr; + char *sout = nullptr; + char *serr = nullptr; int exit_status = 0; char * dladm_args[] = { "/usr/bin/pfexec", "/usr/sbin/dladm", "scan-wifi", "-p", "-o", "BSSID,ESSID,STRENGTH" }; - gboolean rv = g_spawn_sync("/", dladm_args, NULL, (GSpawnFlags)0, NULL, NULL, - &sout, &serr, &exit_status, &err); + gboolean rv = g_spawn_sync("/", dladm_args, nullptr, (GSpawnFlags)0, nullptr, + nullptr, &sout, &serr, &exit_status, &err); if (rv && !exit_status) { char wlan[DLADM_SECTIONS][DLADM_STRSIZE+1]; uint32_t section = 0; diff --git a/netwerk/wifi/nsWifiScannerWin.cpp b/netwerk/wifi/nsWifiScannerWin.cpp index 3bf7826b790..7e042ba9c3f 100644 --- a/netwerk/wifi/nsWifiScannerWin.cpp +++ b/netwerk/wifi/nsWifiScannerWin.cpp @@ -47,13 +47,13 @@ nsWifiMonitor::DoScan() // Get the handle to the WLAN API. DWORD negotiated_version; - HANDLE wlan_handle = NULL; + HANDLE wlan_handle = nullptr; // We could be executing on either Windows XP or Windows Vista, so use the // lower version of the client WLAN API. It seems that the negotiated version // is the Vista version irrespective of what we pass! static const int kXpWlanClientVersion = 1; if ((*WlanOpenHandle)(kXpWlanClientVersion, - NULL, + nullptr, &negotiated_version, &wlan_handle) != ERROR_SUCCESS) { return NS_ERROR_NOT_AVAILABLE; @@ -64,10 +64,10 @@ nsWifiMonitor::DoScan() return NS_ERROR_FAILURE; // Get the list of interfaces. WlanEnumInterfaces allocates interface_list. - WLAN_INTERFACE_INFO_LIST *interface_list = NULL; - if ((*WlanEnumInterfaces)(wlan_handle, NULL, &interface_list) != ERROR_SUCCESS) { + WLAN_INTERFACE_INFO_LIST *interface_list = nullptr; + if ((*WlanEnumInterfaces)(wlan_handle, nullptr, &interface_list) != ERROR_SUCCESS) { // try again later - (*WlanCloseHandle)(wlan_handle, NULL); + (*WlanCloseHandle)(wlan_handle, nullptr); return NS_ERROR_FAILURE; } @@ -77,10 +77,10 @@ nsWifiMonitor::DoScan() WLAN_BSS_LIST *bss_list; HRESULT rv = (*WlanGetNetworkBssList)(wlan_handle, &interface_list->InterfaceInfo[i].InterfaceGuid, - NULL, // Use all SSIDs. + nullptr, // Use all SSIDs. DOT11_BSS_TYPE_UNUSED, - false, // bSecurityEnabled - unused - NULL, // reserved + false, // bSecurityEnabled - unused + nullptr, // reserved &bss_list); if (rv != ERROR_SUCCESS) { continue; @@ -108,7 +108,7 @@ nsWifiMonitor::DoScan() (*WlanFreeMemory)(interface_list); // Close the handle. - (*WlanCloseHandle)(wlan_handle, NULL); + (*WlanCloseHandle)(wlan_handle, nullptr); bool accessPointsChanged = !AccessPointsEqual(accessPoints, lastAccessPoints);