Skip to content

Commit

Permalink
Bug 1316432 - Fix nsCOMPtr constructions&assignments from 0 - r=froydnj
Browse files Browse the repository at this point in the history
Giving '0' (literal zero) to nsCOMPtr is now ambiguous, as both
nsCOMPtr(decltype(nullptr)) and nsCOMPtr(T*) could be used.
In any case, our coding standards mandate the use of 'nullptr' for pointers.
So I'm changing all zeroes into nullptr's where necessary.

MozReview-Commit-ID: LXiZTu87Ck6

--HG--
extra : rebase_source : f9dcc6b06e9ebf9c30a576f9319f76a51b6dc26f
  • Loading branch information
squelart committed Nov 10, 2016
1 parent 10f1b86 commit 0affeb4
Show file tree
Hide file tree
Showing 41 changed files with 88 additions and 88 deletions.
2 changes: 1 addition & 1 deletion dom/base/nsContentSink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1506,7 +1506,7 @@ nsContentSink::DidBuildModelImpl(bool aTerminated)
("nsContentSink::DidBuildModel: canceling notification "
"timeout"));
mNotificationTimer->Cancel();
mNotificationTimer = 0;
mNotificationTimer = nullptr;
}
}

Expand Down
6 changes: 3 additions & 3 deletions dom/plugins/base/nsPluginStreamListenerPeer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ nsPluginByteRangeStreamListener::nsPluginByteRangeStreamListener(nsIWeakReferenc

nsPluginByteRangeStreamListener::~nsPluginByteRangeStreamListener()
{
mStreamConverter = 0;
mWeakPtrPluginStreamListenerPeer = 0;
mStreamConverter = nullptr;
mWeakPtrPluginStreamListenerPeer = nullptr;
}

/**
Expand Down Expand Up @@ -123,7 +123,7 @@ nsPluginByteRangeStreamListener::OnStartRequest(nsIRequest *request, nsISupports
return rv;
}
}
mStreamConverter = 0;
mStreamConverter = nullptr;

nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(request));
if (!httpChannel) {
Expand Down
2 changes: 1 addition & 1 deletion dom/xslt/xpath/txNameTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ txNameTest::txNameTest(nsIAtom* aPrefix, nsIAtom* aLocalName, int32_t aNSID,
mNodeType(aNodeType)
{
if (aPrefix == nsGkAtoms::_empty)
mPrefix = 0;
mPrefix = nullptr;
NS_ASSERTION(aLocalName, "txNameTest without a local name?");
NS_ASSERTION(aNodeType == txXPathNodeType::DOCUMENT_NODE ||
aNodeType == txXPathNodeType::ELEMENT_NODE ||
Expand Down
2 changes: 1 addition & 1 deletion dom/xslt/xpath/txVariableRefExpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ VariableRefExpr::VariableRefExpr(nsIAtom* aPrefix, nsIAtom* aLocalName,
{
NS_ASSERTION(mLocalName, "VariableRefExpr without local name?");
if (mPrefix == nsGkAtoms::_empty)
mPrefix = 0;
mPrefix = nullptr;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions dom/xul/templates/nsRDFPropertyTestNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ nsRDFPropertyTestNode::nsRDFPropertyTestNode(TestNode* aParent,
nsIAtom* aTargetVariable)
: nsRDFTestNode(aParent),
mProcessor(aProcessor),
mSourceVariable(0),
mSourceVariable(nullptr),
mSource(aSource),
mProperty(aProperty),
mTargetVariable(aTargetVariable),
Expand Down Expand Up @@ -90,7 +90,7 @@ nsRDFPropertyTestNode::nsRDFPropertyTestNode(TestNode* aParent,
mSourceVariable(aSourceVariable),
mSource(nullptr),
mProperty(aProperty),
mTargetVariable(0),
mTargetVariable(nullptr),
mTarget(aTarget)
{
if (MOZ_LOG_TEST(gXULTemplateLog, LogLevel::Debug)) {
Expand Down
2 changes: 1 addition & 1 deletion editor/composer/nsEditorSpellCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ nsEditorSpellCheck::UninitSpellChecker()
DeleteSuggestedWordList();
mDictionaryList.Clear();
mDictionaryIndex = 0;
mSpellChecker = 0;
mSpellChecker = nullptr;
return NS_OK;
}

Expand Down
8 changes: 4 additions & 4 deletions editor/libeditor/HTMLEditRules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ HTMLEditRules::AfterEditInner(EditAction action,
// if we created a new block, make sure selection lands in it
if (mNewBlock) {
rv = PinSelectionToNewBlock(selection);
mNewBlock = 0;
mNewBlock = nullptr;
}

// adjust selection for insert text, html paste, and delete actions
Expand Down Expand Up @@ -3079,7 +3079,7 @@ HTMLEditRules::WillMakeList(Selection* aSelection,
NS_ENSURE_STATE(mHTMLEditor);
rv = mHTMLEditor->DeleteNode(curNode);
NS_ENSURE_SUCCESS(rv, rv);
prevListItem = 0;
prevListItem = nullptr;
continue;
} else if (IsEmptyInline(curNode)) {
// if curNode is an empty inline container, delete it
Expand Down Expand Up @@ -3112,7 +3112,7 @@ HTMLEditRules::WillMakeList(Selection* aSelection,
NS_ENSURE_SUCCESS(rv, rv);
curList = newBlock;
}
prevListItem = 0;
prevListItem = nullptr;
continue;
}

Expand Down Expand Up @@ -3206,7 +3206,7 @@ HTMLEditRules::WillMakeList(Selection* aSelection,
// remember our new block for postprocessing
mNewBlock = curList;
// curList is now the correct thing to put curNode in
prevListItem = 0;
prevListItem = nullptr;
}

// if curNode isn't a list item, we must wrap it in one
Expand Down
2 changes: 1 addition & 1 deletion editor/libeditor/HTMLURIRefObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ HTMLURIRefObject::SetNode(nsIDOMNode* aNode)

// If there weren't any URIs in the attributes,
// then don't accept this node.
mNode = 0;
mNode = nullptr;
return NS_ERROR_INVALID_ARG;
}

Expand Down
2 changes: 1 addition & 1 deletion embedding/browser/nsEmbedStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ nsEmbedStream::CloseStream(void)
// satisfied; this is exactly what we want to return.
NS_ENSURE_STATE(mOutputStream);
mOutputStream->Close();
mOutputStream = 0;
mOutputStream = nullptr;

return rv;
}
2 changes: 1 addition & 1 deletion embedding/components/find/nsFind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1044,7 +1044,7 @@ nsFind::Find(const char16_t* aPatText, nsIDOMRange* aSearchRange,
tc = do_QueryInterface(mIterNode);
if (!tc || !(frag = tc->GetText())) { // Out of nodes
mIterator = nullptr;
mLastBlockParent = 0;
mLastBlockParent = nullptr;
ResetAll();
return NS_OK;
}
Expand Down
4 changes: 2 additions & 2 deletions embedding/components/windowwatcher/nsWindowWatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ struct nsWatcherWindowEntry
supportsweak->GetWeakReference(getter_AddRefs(mChromeWeak));
} else {
mChrome = aChrome;
mChromeWeak = 0;
mChromeWeak = nullptr;
}
ReferenceSelf();
}
Expand Down Expand Up @@ -1491,7 +1491,7 @@ nsWindowWatcher::AddWindow(mozIDOMWindowProxy* aWindow, nsIWebBrowserChrome* aCh
supportsweak->GetWeakReference(getter_AddRefs(info->mChromeWeak));
} else {
info->mChrome = aChrome;
info->mChromeWeak = 0;
info->mChromeWeak = nullptr;
}
return NS_OK;
}
Expand Down
2 changes: 1 addition & 1 deletion layout/generic/nsSelection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ class nsAutoScrollTimer final : public nsITimerCallback
if (mTimer)
{
mTimer->Cancel();
mTimer = 0;
mTimer = nullptr;
}

mContent = nullptr;
Expand Down
10 changes: 5 additions & 5 deletions modules/libjar/nsJARChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1017,19 +1017,19 @@ nsJARChannel::OnStopRequest(nsIRequest *req, nsISupports *ctx, nsresult status)

if (mListener) {
mListener->OnStopRequest(this, mListenerContext, status);
mListener = 0;
mListenerContext = 0;
mListener = nullptr;
mListenerContext = nullptr;
}

if (mLoadGroup)
mLoadGroup->RemoveRequest(this, nullptr, status);

mPump = 0;
mPump = nullptr;
mIsPending = false;

// Drop notification callbacks to prevent cycles.
mCallbacks = 0;
mProgressSink = 0;
mCallbacks = nullptr;
mProgressSink = nullptr;

#if defined(XP_WIN) || defined(MOZ_WIDGET_COCOA)
#else
Expand Down
8 changes: 4 additions & 4 deletions netwerk/base/nsIncrementalStreamLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ nsIncrementalStreamLoader::OnStopRequest(nsIRequest* request, nsISupports *ctxt,
}
// done.. cleanup
ReleaseData();
mRequest = 0;
mObserver = 0;
mContext = 0;
mRequest = nullptr;
mObserver = nullptr;
mContext = nullptr;
}
return NS_OK;
}
Expand Down Expand Up @@ -197,7 +197,7 @@ nsIncrementalStreamLoader::OnDataAvailable(nsIRequest* request, nsISupports *ctx
}
uint32_t countRead;
nsresult rv = inStr->ReadSegments(WriteSegmentFun, this, count, &countRead);
mRequest = 0;
mRequest = nullptr;
return rv;
}

Expand Down
10 changes: 5 additions & 5 deletions netwerk/base/nsInputStreamPump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ nsInputStreamPump::AsyncRead(nsIStreamListener *listener, nsISupports *ctxt)

// release our reference to the original stream. from this point forward,
// we only reference the "stream" via mAsyncStream.
mStream = 0;
mStream = nullptr;

// mStreamOffset now holds the number of bytes currently read. we use this
// to enforce the mStreamLength restriction.
Expand Down Expand Up @@ -703,8 +703,8 @@ nsInputStreamPump::OnStateStop()
else if (mCloseWhenDone)
mAsyncStream->Close();

mAsyncStream = 0;
mTargetThread = 0;
mAsyncStream = nullptr;
mTargetThread = nullptr;
mIsPending = false;
{
// Note: Must exit monitor for call to OnStartRequest to avoid
Expand All @@ -714,8 +714,8 @@ nsInputStreamPump::OnStateStop()
mListener->OnStopRequest(this, mListenerContext, mStatus);
mMonitor.Enter();
}
mListener = 0;
mListenerContext = 0;
mListener = nullptr;
mListenerContext = nullptr;

if (mLoadGroup)
mLoadGroup->RemoveRequest(this, nullptr, mStatus);
Expand Down
2 changes: 1 addition & 1 deletion netwerk/base/nsLoadGroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ nsLoadGroup::~nsLoadGroup()
DebugOnly<nsresult> rv = Cancel(NS_BINDING_ABORTED);
NS_ASSERTION(NS_SUCCEEDED(rv), "Cancel failed");

mDefaultLoadRequest = 0;
mDefaultLoadRequest = nullptr;

if (mRequestContext) {
nsID rcid;
Expand Down
4 changes: 2 additions & 2 deletions netwerk/base/nsSocketTransport2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1874,7 +1874,7 @@ nsSocketTransport::OnSocketEvent(uint32_t type, nsresult status, nsISupports *pa
SendStatus(NS_NET_STATUS_RESOLVED_HOST);

SOCKET_LOG((" MSG_DNS_LOOKUP_COMPLETE\n"));
mDNSRequest = 0;
mDNSRequest = nullptr;
if (param) {
mDNSRecord = static_cast<nsIDNSRecord *>(param);
mDNSRecord->GetNextAddr(SocketPort(), &mNetAddr);
Expand Down Expand Up @@ -2092,7 +2092,7 @@ nsSocketTransport::OnSocketDetached(PRFileDesc *fd)
// make sure there isn't any pending DNS request
if (mDNSRequest) {
mDNSRequest->Cancel(NS_ERROR_ABORT);
mDNSRequest = 0;
mDNSRequest = nullptr;
}

//
Expand Down
4 changes: 2 additions & 2 deletions netwerk/base/nsStandardURL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ void
nsStandardURL::InvalidateCache(bool invalidateCachedFile)
{
if (invalidateCachedFile)
mFile = 0;
mFile = nullptr;
if (mHostA) {
free(mHostA);
mHostA = nullptr;
Expand Down Expand Up @@ -3107,7 +3107,7 @@ nsStandardURL::SetFile(nsIFile *file)
if (NS_FAILED(file->Clone(getter_AddRefs(mFile)))) {
NS_WARNING("nsIFile::Clone failed");
// failure to clone is not fatal (GetFile will generate mFile)
mFile = 0;
mFile = nullptr;
}
}
return rv;
Expand Down
6 changes: 3 additions & 3 deletions netwerk/base/nsStreamListenerTee.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,21 @@ nsStreamListenerTee::OnStopRequest(nsIRequest *request,
// it is critical that we close out the input stream tee
if (mInputTee) {
mInputTee->SetSink(nullptr);
mInputTee = 0;
mInputTee = nullptr;
}

// release sink on the same thread where the data was written (bug 716293)
if (mEventTarget) {
NS_ProxyRelease(mEventTarget, mSink.forget());
}
else {
mSink = 0;
mSink = nullptr;
}

nsresult rv = mListener->OnStopRequest(request, context, status);
if (mObserver)
mObserver->OnStopRequest(request, context, status);
mObserver = 0;
mObserver = nullptr;
return rv;
}

Expand Down
6 changes: 3 additions & 3 deletions netwerk/base/nsStreamLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ nsStreamLoader::OnStopRequest(nsIRequest* request, nsISupports *ctxt,
}
// done.. cleanup
ReleaseData();
mRequest = 0;
mObserver = 0;
mContext = 0;
mRequest = nullptr;
mObserver = nullptr;
mContext = nullptr;
}

if (mRequestObserver) {
Expand Down
2 changes: 1 addition & 1 deletion netwerk/protocol/about/nsAboutCacheEntry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ nsAboutCacheEntry::Channel::WriteCacheEntryDescription(nsICacheEntry *entry)
buffer.AppendLiteral("\">");
buffer.Append(escapedStr);
buffer.AppendLiteral("</a>");
uri = 0;
uri = nullptr;
} else {
buffer.Append(escapedStr);
}
Expand Down
2 changes: 1 addition & 1 deletion netwerk/protocol/ftp/nsFtpControlConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ nsFtpControlConnection::Disconnect(nsresult status)
if (NS_FAILED(status)) {
// break cyclic reference!
mSocket->Close(status);
mSocket = 0;
mSocket = nullptr;
mSocketInput->AsyncWait(nullptr, 0, 0, nullptr); // clear any observer
mSocketInput = nullptr;
mSocketOutput = nullptr;
Expand Down
4 changes: 2 additions & 2 deletions netwerk/protocol/http/HttpChannelChild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -977,8 +977,8 @@ HttpChannelChild::DoOnStopRequest(nsIRequest* aRequest, nsresult aChannelStatus,
}
mOnStopRequestCalled = true;

mListener = 0;
mListenerContext = 0;
mListener = nullptr;
mListenerContext = nullptr;
mCacheEntryAvailable = false;
if (mLoadGroup)
mLoadGroup->RemoveRequest(this, nullptr, mStatus);
Expand Down
2 changes: 1 addition & 1 deletion netwerk/protocol/http/HttpChannelParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ HttpChannelParent::RecvDocumentChannelCleanup()
{
// From now on only using mAssociatedContentSecurity. Free everything else.
mChannel = nullptr; // Reclaim some memory sooner.
mCacheEntry = 0; // Else we'll block other channels reading same URI
mCacheEntry = nullptr; // Else we'll block other channels reading same URI
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion netwerk/protocol/http/nsHttpConnectionMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ nsHttpConnectionMgr::Shutdown()
// from being posted. this is how we indicate that we are
// shutting down.
mIsShuttingDown = true;
mSocketThreadTarget = 0;
mSocketThreadTarget = nullptr;

if (NS_FAILED(rv)) {
NS_WARNING("unable to post SHUTDOWN message");
Expand Down
2 changes: 1 addition & 1 deletion netwerk/protocol/http/nsHttpTransaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1298,7 +1298,7 @@ nsHttpTransaction::Restart()
seekable->Seek(nsISeekableStream::NS_SEEK_SET, 0);

// clear old connection state...
mSecurityInfo = 0;
mSecurityInfo = nullptr;
if (mConnection) {
if (!mReuseOnRestart) {
mConnection->DontReuse();
Expand Down
8 changes: 4 additions & 4 deletions netwerk/protocol/wyciwyg/WyciwygChannelChild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,14 +291,14 @@ WyciwygChannelChild::OnStopRequest(const nsresult& statusCode)

mListener->OnStopRequest(this, mListenerContext, statusCode);

mListener = 0;
mListenerContext = 0;
mListener = nullptr;
mListenerContext = nullptr;

if (mLoadGroup)
mLoadGroup->RemoveRequest(this, nullptr, mStatus);

mCallbacks = 0;
mProgressSink = 0;
mCallbacks = nullptr;
mProgressSink = nullptr;
}

if (mIPCOpen)
Expand Down
Loading

0 comments on commit 0affeb4

Please sign in to comment.