Bug 1316206 - Fix RefPtr assignments from 0 - r=froydnj
Giving '0' (literal zero) to RefPtr is now ambiguous, as both
RefPtr(decltype(nullptr)) and RefPtr(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: A458A4e9for
--- a/dom/media/webspeech/recognition/SpeechRecognition.h
+++ b/dom/media/webspeech/recognition/SpeechRecognition.h
@@ -250,18 +250,18 @@ private:
const char* GetName(SpeechEvent* aId);
};
class SpeechEvent : public Runnable
{
public:
SpeechEvent(SpeechRecognition* aRecognition, SpeechRecognition::EventType aType)
: mAudioSegment(0)
- , mRecognitionResultList(0)
- , mError(0)
+ , mRecognitionResultList(nullptr)
+ , mError(nullptr)
, mRecognition(aRecognition)
, mType(aType)
, mTrackRate(0)
{
}
~SpeechEvent();
--- a/editor/libeditor/WSRunObject.h
+++ b/editor/libeditor/WSRunObject.h
@@ -291,17 +291,17 @@ protected:
// stored in the struct.
struct MOZ_STACK_CLASS WSPoint final
{
RefPtr<dom::Text> mTextNode;
uint32_t mOffset;
char16_t mChar;
WSPoint()
- : mTextNode(0)
+ : mTextNode(nullptr)
, mOffset(0)
, mChar(0)
{}
WSPoint(dom::Text* aTextNode, int32_t aOffset, char16_t aChar)
: mTextNode(aTextNode)
, mOffset(aOffset)
, mChar(aChar)
--- a/editor/txmgr/nsTransactionList.cpp
+++ b/editor/txmgr/nsTransactionList.cpp
@@ -14,34 +14,34 @@
#include "nsTransactionList.h"
#include "nsTransactionStack.h"
#include "nscore.h"
NS_IMPL_ISUPPORTS(nsTransactionList, nsITransactionList)
nsTransactionList::nsTransactionList(nsITransactionManager *aTxnMgr, nsTransactionStack *aTxnStack)
: mTxnStack(aTxnStack)
- , mTxnItem(0)
+ , mTxnItem(nullptr)
{
if (aTxnMgr)
mTxnMgr = do_GetWeakReference(aTxnMgr);
}
nsTransactionList::nsTransactionList(nsITransactionManager *aTxnMgr, nsTransactionItem *aTxnItem)
: mTxnStack(0)
, mTxnItem(aTxnItem)
{
if (aTxnMgr)
mTxnMgr = do_GetWeakReference(aTxnMgr);
}
nsTransactionList::~nsTransactionList()
{
mTxnStack = 0;
- mTxnItem = 0;
+ mTxnItem = nullptr;
}
NS_IMETHODIMP nsTransactionList::GetNumItems(int32_t *aNumItems)
{
NS_ENSURE_TRUE(aNumItems, NS_ERROR_NULL_POINTER);
*aNumItems = 0;
--- a/ipc/chromium/src/base/object_watcher.cc
+++ b/ipc/chromium/src/base/object_watcher.cc
@@ -33,17 +33,17 @@ public:
delegate->OnObjectSignaled(object);
return NS_OK;
}
};
//-----------------------------------------------------------------------------
-ObjectWatcher::ObjectWatcher() : watch_(NULL) {
+ObjectWatcher::ObjectWatcher() : watch_(nullptr) {
}
ObjectWatcher::~ObjectWatcher() {
StopWatching();
}
bool ObjectWatcher::StartWatching(HANDLE object, Delegate* delegate) {
if (watch_) {
@@ -94,17 +94,17 @@ bool ObjectWatcher::StopWatching() {
// since we expect that UnregisterWaitEx resulted in a memory barrier, but
// just to be sure, we're going to be explicit.
MemoryBarrier();
// If the watch has been posted, then we need to make sure it knows not to do
// anything once it is run.
watch_->watcher = NULL;
- watch_ = NULL;
+ watch_ = nullptr;
MessageLoop::current()->RemoveDestructionObserver(this);
return true;
}
HANDLE ObjectWatcher::GetWatchedObject() {
if (!watch_)
return NULL;
--- a/ipc/chromium/src/base/timer.cc
+++ b/ipc/chromium/src/base/timer.cc
@@ -7,18 +7,18 @@
#include "base/timer.h"
#include "base/message_loop.h"
namespace base {
void BaseTimer_Helper::OrphanDelayedTask() {
if (delayed_task_) {
- delayed_task_->timer_ = NULL;
- delayed_task_ = NULL;
+ delayed_task_->timer_ = nullptr;
+ delayed_task_ = nullptr;
}
}
void BaseTimer_Helper::InitiateDelayedTask(TimerTask* timer_task) {
OrphanDelayedTask();
delayed_task_ = timer_task;
delayed_task_->timer_ = this;
--- a/ipc/chromium/src/base/timer.h
+++ b/ipc/chromium/src/base/timer.h
@@ -171,17 +171,17 @@ class BaseTimer : public BaseTimer_Helpe
// Inform the Base that the timer is no longer active.
void ClearBaseTimer() {
if (timer_) {
SelfType* self = static_cast<SelfType*>(timer_);
// It is possible that the Timer has already been reset, and that this
// Task is old. So, if the Timer points to a different task, assume
// that the Timer has already taken care of properly setting the task.
if (self->delayed_task_ == this)
- self->delayed_task_ = NULL;
+ self->delayed_task_ = nullptr;
// By now the delayed_task_ in the Timer does not point to us anymore.
// We should reset our own timer_ because the Timer can not do this
// for us in its destructor.
timer_ = NULL;
}
}
// Inform the Base that we're resetting the timer.
--- a/netwerk/cache/nsDiskCacheDeviceSQL.cpp
+++ b/netwerk/cache/nsDiskCacheDeviceSQL.cpp
@@ -1408,17 +1408,17 @@ nsOfflineCacheDevice::Shutdown()
" (SELECT moz_cache_namespaces.rowid FROM"
" moz_cache_namespaces LEFT OUTER JOIN moz_cache_groups ON"
" (moz_cache_namespaces.ClientID = moz_cache_groups.ActiveClientID)"
" WHERE moz_cache_groups.GroupID ISNULL)"));
if (NS_FAILED(rv))
NS_WARNING("Failed to clean up namespaces.");
- mEvictionFunction = 0;
+ mEvictionFunction = nullptr;
mStatement_CacheSize = nullptr;
mStatement_ApplicationCacheSize = nullptr;
mStatement_EntryCount = nullptr;
mStatement_UpdateEntry = nullptr;
mStatement_UpdateEntrySize = nullptr;
mStatement_DeleteEntry = nullptr;
mStatement_FindEntry = nullptr;
--- a/netwerk/protocol/http/HttpChannelParent.cpp
+++ b/netwerk/protocol/http/HttpChannelParent.cpp
@@ -782,17 +782,17 @@ HttpChannelParent::RecvRedirect2Verify(c
return true;
}
bool
HttpChannelParent::RecvDocumentChannelCleanup()
{
// From now on only using mAssociatedContentSecurity. Free everything else.
- mChannel = 0; // Reclaim some memory sooner.
+ mChannel = nullptr; // Reclaim some memory sooner.
mCacheEntry = 0; // Else we'll block other channels reading same URI
return true;
}
bool
HttpChannelParent::RecvMarkOfflineCacheEntryAsForeign()
{
if (mOfflineForeignMarker) {
--- a/netwerk/streamconv/converters/nsMultiMixedConv.cpp
+++ b/netwerk/streamconv/converters/nsMultiMixedConv.cpp
@@ -908,17 +908,17 @@ nsMultiMixedConv::SendStop(nsresult aSta
// Remove the channel from its load group (if any)
nsCOMPtr<nsILoadGroup> loadGroup;
(void) mPartChannel->GetLoadGroup(getter_AddRefs(loadGroup));
if (loadGroup)
(void) loadGroup->RemoveRequest(mPartChannel, mContext, aStatus);
}
- mPartChannel = 0;
+ mPartChannel = nullptr;
return rv;
}
nsresult
nsMultiMixedConv::SendData(char *aBuffer, uint32_t aLen) {
nsresult rv = NS_OK;
--- a/toolkit/components/places/tests/cpp/mock_Link.h
+++ b/toolkit/components/places/tests/cpp/mock_Link.h
@@ -35,17 +35,17 @@ public:
}
virtual void SetLinkState(nsLinkState aState) override
{
// Notify our callback function.
mHandler(aState);
// Break the cycle so the object can be destroyed.
- mDeathGrip = 0;
+ mDeathGrip = nullptr;
}
virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override
{
return 0; // the value shouldn't matter
}
protected: