зеркало из https://github.com/mozilla/gecko-dev.git
Bug 784739 - Switch from NULL to nullptr in netwerk/ (2/2); r=ehsan
This commit is contained in:
Родитель
8975ae03b9
Коммит
33b5286d45
|
@ -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<Continuation>& 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<Continuation>& 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<Continuation> 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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -211,7 +211,7 @@ nsHttpConnectionMgr::ConditionallyStopPruneDeadConnectionsTimer()
|
|||
mTimeOfNextWakeUp = UINT64_MAX;
|
||||
if (mTimer) {
|
||||
mTimer->Cancel();
|
||||
mTimer = NULL;
|
||||
mTimer = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {}
|
||||
|
||||
|
|
|
@ -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 = {
|
||||
|
|
|
@ -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<INetSharingManager> 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;
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -58,15 +58,15 @@ do_parse_str(char *bssid_str, char *essid_str, char *strength)
|
|||
static void
|
||||
do_dladm(nsCOMArray<nsWifiAccessPoint> &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;
|
||||
|
|
|
@ -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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче