Bug 784739 - Switch from NULL to nullptr in xpcom/ (2/3); r=ehsan

This commit is contained in:
Birunthan Mohanathas
2013-10-10 16:41:39 -04:00
parent 52e24d677b
commit d655a19190
34 changed files with 171 additions and 165 deletions

View File

@@ -380,7 +380,7 @@ public:
* CheckAcquisition This method is called after acquiring |aLast|, * CheckAcquisition This method is called after acquiring |aLast|,
* but before trying to acquire |aProposed| from |aCallContext|. * but before trying to acquire |aProposed| from |aCallContext|.
* It determines whether actually trying to acquire |aProposed| * It determines whether actually trying to acquire |aProposed|
* will create problems. It is OK if |aLast| is NULL; this is * will create problems. It is OK if |aLast| is nullptr; this is
* interpreted as |aProposed| being the thread's first acquisition * interpreted as |aProposed| being the thread's first acquisition
* of its current chain. * of its current chain.
* *

View File

@@ -266,7 +266,7 @@ class ScopedMMap
{ {
public: public:
ScopedMMap(const char *aFilePath) ScopedMMap(const char *aFilePath)
: buf(NULL) : buf(nullptr)
{ {
fd = open(aFilePath, O_RDONLY); fd = open(aFilePath, O_RDONLY);
if (fd < 0) { if (fd < 0) {
@@ -277,7 +277,7 @@ public:
return; return;
} }
size = st.st_size; size = st.st_size;
buf = (char *)mmap(NULL, size, PROT_READ, MAP_PRIVATE, fd, 0); buf = (char *)mmap(nullptr, size, PROT_READ, MAP_PRIVATE, fd, 0);
} }
~ScopedMMap() ~ScopedMMap()
{ {
@@ -480,8 +480,8 @@ mozilla::ReadAheadFile(mozilla::pathstr_t aFilePath, const size_t aOffset,
} }
return; return;
} }
HANDLE fd = CreateFileW(aFilePath, GENERIC_READ, FILE_SHARE_READ, HANDLE fd = CreateFileW(aFilePath, GENERIC_READ, FILE_SHARE_READ, nullptr,
NULL, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL); OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, nullptr);
if (aOutFd) { if (aOutFd) {
*aOutFd = fd; *aOutFd = fd;
} }

View File

@@ -59,9 +59,9 @@ typedef Scoped<ScopedCloseFDTraits> ScopedClose;
struct ScopedClosePRFDTraits struct ScopedClosePRFDTraits
{ {
typedef PRFileDesc* type; typedef PRFileDesc* type;
static type empty() { return NULL; } static type empty() { return nullptr; }
static void release(type fd) { static void release(type fd) {
if (fd != NULL) { if (fd != nullptr) {
PR_Close(fd); PR_Close(fd);
} }
} }

View File

@@ -51,7 +51,7 @@ GenericModule::RegisterSelf(nsIComponentManager* aCompMgr,
{ {
nsCOMPtr<nsIComponentRegistrar> r = do_QueryInterface(aCompMgr); nsCOMPtr<nsIComponentRegistrar> r = do_QueryInterface(aCompMgr);
for (const Module::CIDEntry* e = mData->mCIDs; e->cid; ++e) for (const Module::CIDEntry* e = mData->mCIDs; e->cid; ++e)
r->RegisterFactoryLocation(*e->cid, "", NULL, aLocation, aLoaderStr, aType); r->RegisterFactoryLocation(*e->cid, "", nullptr, aLocation, aLoaderStr, aType);
for (const Module::ContractIDEntry* e = mData->mContractIDs; for (const Module::ContractIDEntry* e = mData->mContractIDs;
e && e->contractid; e && e->contractid;

View File

@@ -265,7 +265,8 @@ public:
return PL_DHashTableSizeOfExcludingThis(&this->mTable, s_SizeOfStub, return PL_DHashTableSizeOfExcludingThis(&this->mTable, s_SizeOfStub,
mallocSizeOf, &args); mallocSizeOf, &args);
} }
return PL_DHashTableSizeOfExcludingThis(&this->mTable, NULL, mallocSizeOf); return PL_DHashTableSizeOfExcludingThis(&this->mTable, nullptr,
mallocSizeOf);
} }
protected: protected:

View File

@@ -165,11 +165,11 @@ public:
(nsISupports* aElement, mozilla::MallocSizeOf aMallocSizeOf, void *aData); (nsISupports* aElement, mozilla::MallocSizeOf aMallocSizeOf, void *aData);
// Measures the size of the array's element storage, and if // Measures the size of the array's element storage, and if
// |aSizeOfElement| is non-NULL, measures the size of things pointed to by // |aSizeOfElement| is non-nullptr, measures the size of things pointed to
// elements. // by elements.
size_t SizeOfExcludingThis( size_t SizeOfExcludingThis(
nsBaseArraySizeOfElementIncludingThisFunc aSizeOfElementIncludingThis, nsBaseArraySizeOfElementIncludingThisFunc aSizeOfElementIncludingThis,
mozilla::MallocSizeOf aMallocSizeOf, void* aData = NULL) const; mozilla::MallocSizeOf aMallocSizeOf, void* aData = nullptr) const;
private: private:
@@ -381,7 +381,7 @@ class nsCOMArray : public nsCOMArray_base
size_t SizeOfExcludingThis( size_t SizeOfExcludingThis(
nsCOMArraySizeOfElementIncludingThisFunc aSizeOfElementIncludingThis, nsCOMArraySizeOfElementIncludingThisFunc aSizeOfElementIncludingThis,
mozilla::MallocSizeOf aMallocSizeOf, void *aData = NULL) const { mozilla::MallocSizeOf aMallocSizeOf, void *aData = nullptr) const {
return nsCOMArray_base::SizeOfExcludingThis( return nsCOMArray_base::SizeOfExcludingThis(
nsBaseArraySizeOfElementIncludingThisFunc(aSizeOfElementIncludingThis), nsBaseArraySizeOfElementIncludingThisFunc(aSizeOfElementIncludingThis),
aMallocSizeOf, aData); aMallocSizeOf, aData);

View File

@@ -184,7 +184,7 @@ struct already_AddRefed
operator already_AddRefed<U>() operator already_AddRefed<U>()
{ {
U* tmp = mRawPtr; U* tmp = mRawPtr;
mRawPtr = NULL; mRawPtr = nullptr;
return already_AddRefed<U>(tmp); return already_AddRefed<U>(tmp);
} }

View File

@@ -41,13 +41,13 @@ char*
NS_strtok(const char *delims, char **str) NS_strtok(const char *delims, char **str)
{ {
if (!*str) if (!*str)
return NULL; return nullptr;
char *ret = (char*) NS_strspnp(delims, *str); char *ret = (char*) NS_strspnp(delims, *str);
if (!*ret) { if (!*ret) {
*str = ret; *str = ret;
return NULL; return nullptr;
} }
char *i = ret; char *i = ret;
@@ -62,7 +62,7 @@ NS_strtok(const char *delims, char **str)
++i; ++i;
} while (*i); } while (*i);
*str = NULL; *str = nullptr;
return ret; return ret;
} }

View File

@@ -32,7 +32,7 @@ NS_strspnp(const char *delims, const char *str);
* reset to the end of the found token + 1, or to the * reset to the end of the found token + 1, or to the
* end-of-string if there are no more tokens. * end-of-string if there are no more tokens.
* @return The token. If no token is found (the string is only * @return The token. If no token is found (the string is only
* delimiter characters), NULL is returned. * delimiter characters), nullptr is returned.
*/ */
NS_COM_GLUE char* NS_COM_GLUE char*
NS_strtok(const char *delims, char **str); NS_strtok(const char *delims, char **str);

View File

@@ -43,13 +43,14 @@ public:
/** /**
* @copydoc nsBaseHashtable::Get * @copydoc nsBaseHashtable::Get
* @returns NULL if the key is not present. * @returns nullptr if the key is not present.
*/ */
UserDataType Get(KeyType aKey) const; UserDataType Get(KeyType aKey) const;
/** /**
* Remove the entry for the given key from the hashtable and return it in * Remove the entry for the given key from the hashtable and return it in
* aOut. If the key is not in the hashtable, aOut's pointer is set to NULL. * aOut. If the key is not in the hashtable, aOut's pointer is set to
* nullptr.
* *
* Normally, an entry is deleted when it's removed from an nsClassHashtable, * Normally, an entry is deleted when it's removed from an nsClassHashtable,
* but this function transfers ownership of the entry back to the caller * but this function transfers ownership of the entry back to the caller
@@ -91,7 +92,7 @@ nsClassHashtable<KeyClass,T>::Get(KeyType aKey) const
typename base_type::EntryType* ent = this->GetEntry(aKey); typename base_type::EntryType* ent = this->GetEntry(aKey);
if (!ent) if (!ent)
return NULL; return nullptr;
return ent->mData; return ent->mData;
} }

View File

@@ -37,14 +37,14 @@ NS_IMETHODIMP
GenericClassInfo::GetContractID(char** contractid) GenericClassInfo::GetContractID(char** contractid)
{ {
NS_ERROR("GetContractID not implemented"); NS_ERROR("GetContractID not implemented");
*contractid = NULL; *contractid = nullptr;
return NS_ERROR_NOT_IMPLEMENTED; return NS_ERROR_NOT_IMPLEMENTED;
} }
NS_IMETHODIMP NS_IMETHODIMP
GenericClassInfo::GetClassDescription(char** description) GenericClassInfo::GetClassDescription(char** description)
{ {
*description = NULL; *description = nullptr;
return NS_ERROR_NOT_IMPLEMENTED; return NS_ERROR_NOT_IMPLEMENTED;
} }
@@ -52,7 +52,7 @@ NS_IMETHODIMP
GenericClassInfo::GetClassID(nsCID** classid) GenericClassInfo::GetClassID(nsCID** classid)
{ {
NS_ERROR("GetClassID not implemented"); NS_ERROR("GetClassID not implemented");
*classid = NULL; *classid = nullptr;
return NS_ERROR_NOT_IMPLEMENTED; return NS_ERROR_NOT_IMPLEMENTED;
} }

View File

@@ -352,7 +352,7 @@ class nsPtrHashKey : public PLDHashEntryHdr
}; };
/** /**
* hashkey wrapper using T* KeyType that sets key to NULL upon * hashkey wrapper using T* KeyType that sets key to nullptr upon
* destruction. Relevant only in cases where a memory pointer-scanner * destruction. Relevant only in cases where a memory pointer-scanner
* like valgrind might get confused about stale references. * like valgrind might get confused about stale references.
* *

View File

@@ -31,16 +31,16 @@
* *
* Change this to * Change this to
* *
* NS_IMPL_CLASSINFO(nsFooBar, NULL, 0, NS_FOOBAR_CID) * NS_IMPL_CLASSINFO(nsFooBar, nullptr, 0, NS_FOOBAR_CID)
* NS_IMPL_ISUPPORTS2_CI(nsFooBar, nsIFoo, nsIBar) * NS_IMPL_ISUPPORTS2_CI(nsFooBar, nsIFoo, nsIBar)
* *
* If nsFooBar is threadsafe, change the 0 above to nsIClassInfo::THREADSAFE. * If nsFooBar is threadsafe, change the 0 above to nsIClassInfo::THREADSAFE.
* If it's a singleton, use nsIClassInfo::SINGLETON. The full list of flags is * If it's a singleton, use nsIClassInfo::SINGLETON. The full list of flags is
* in nsIClassInfo.idl. * in nsIClassInfo.idl.
* *
* The NULL parameter is there so you can pass a function for converting from * The nullptr parameter is there so you can pass a function for converting
* an XPCOM object to a scriptable helper. Unless you're doing specialized JS * from an XPCOM object to a scriptable helper. Unless you're doing
* work, you can probably leave this as NULL. * specialized JS work, you can probably leave this as nullptr.
* *
* This file also defines the NS_IMPL_QUERY_INTERFACE2_CI macro, which you can * This file also defines the NS_IMPL_QUERY_INTERFACE2_CI macro, which you can
* use to replace NS_IMPL_QUERY_INTERFACE2, if you use that instead of * use to replace NS_IMPL_QUERY_INTERFACE2, if you use that instead of
@@ -121,7 +121,7 @@ private:
_cid, \ _cid, \
}; \ }; \
mozilla::AlignedStorage2<GenericClassInfo> k##_class##ClassInfoDataPlace; \ mozilla::AlignedStorage2<GenericClassInfo> k##_class##ClassInfoDataPlace; \
nsIClassInfo* NS_CLASSINFO_NAME(_class) = NULL; nsIClassInfo* NS_CLASSINFO_NAME(_class) = nullptr;
#define NS_IMPL_QUERY_CLASSINFO(_class) \ #define NS_IMPL_QUERY_CLASSINFO(_class) \
if ( aIID.Equals(NS_GET_IID(nsIClassInfo)) ) { \ if ( aIID.Equals(NS_GET_IID(nsIClassInfo)) ) { \

View File

@@ -97,7 +97,7 @@ char *nsID::ToString() const
{ {
char *res = (char*)NS_Alloc(NSID_LENGTH); char *res = (char*)NS_Alloc(NSID_LENGTH);
if (res != NULL) { if (res != nullptr) {
PR_snprintf(res, NSID_LENGTH, gIDFormat, PR_snprintf(res, NSID_LENGTH, gIDFormat,
m0, (uint32_t) m1, (uint32_t) m2, m0, (uint32_t) m1, (uint32_t) m2,
(uint32_t) m3[0], (uint32_t) m3[1], (uint32_t) m3[2], (uint32_t) m3[0], (uint32_t) m3[1], (uint32_t) m3[2],

View File

@@ -148,10 +148,10 @@ nsINIParser::InitFromFILE(FILE *fd)
0, 0,
reinterpret_cast<LPWSTR>(buffer), reinterpret_cast<LPWSTR>(buffer),
-1, -1,
NULL, nullptr,
0, 0,
NULL, nullptr,
NULL); nullptr);
if (0 == flen) { if (0 == flen) {
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
@@ -163,8 +163,8 @@ nsINIParser::InitFromFILE(FILE *fd)
-1, -1,
utf8Buffer, utf8Buffer,
flen, flen,
NULL, nullptr,
NULL)) { nullptr)) {
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
mFileContents = utf8Buffer.forget(); mFileContents = utf8Buffer.forget();

View File

@@ -43,7 +43,7 @@ ToSupports(nsISupports* p)
inline nsISupports* inline nsISupports*
ToCanonicalSupports(nsISupports* p) ToCanonicalSupports(nsISupports* p)
{ {
return NULL; return nullptr;
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@@ -82,7 +82,7 @@ struct nsPurpleBufferEntry {
nsCycleCollectingAutoRefCnt *mRefCnt; nsCycleCollectingAutoRefCnt *mRefCnt;
nsCycleCollectionParticipant *mParticipant; // NULL for nsISupports nsCycleCollectionParticipant *mParticipant; // nullptr for nsISupports
}; };
#define NS_NUMBER_OF_FLAGS_IN_REFCNT 2 #define NS_NUMBER_OF_FLAGS_IN_REFCNT 2

View File

@@ -63,7 +63,7 @@ ns_if_addref( T expr )
} /* extern "C++" */ } /* extern "C++" */
/** /**
* Macro for adding a reference to an interface that checks for NULL. * Macro for adding a reference to an interface that checks for nullptr.
* @param _expr The interface pointer. * @param _expr The interface pointer.
*/ */
#define NS_IF_ADDREF(_expr) ns_if_addref(_expr) #define NS_IF_ADDREF(_expr) ns_if_addref(_expr)
@@ -109,7 +109,7 @@ ns_if_addref( T expr )
} while (0) } while (0)
/** /**
* Macro for releasing a reference to an interface that checks for NULL; * Macro for releasing a reference to an interface that checks for nullptr;
* @param _ptr The interface pointer. * @param _ptr The interface pointer.
*/ */
#define NS_IF_RELEASE(_ptr) \ #define NS_IF_RELEASE(_ptr) \

View File

@@ -111,7 +111,7 @@ public:
// off-main-thread. But some consumers need to use the same pointer for // off-main-thread. But some consumers need to use the same pointer for
// multiple classes, some of which are main-thread-only and some of which // multiple classes, some of which are main-thread-only and some of which
// aren't. So we allow them to explicitly disable this strict checking. // aren't. So we allow them to explicitly disable this strict checking.
nsMainThreadPtrHolder(T* ptr, bool strict = true) : mRawPtr(NULL), mStrict(strict) { nsMainThreadPtrHolder(T* ptr, bool strict = true) : mRawPtr(nullptr), mStrict(strict) {
// We can only AddRef our pointer on the main thread, which means that the // We can only AddRef our pointer on the main thread, which means that the
// holder must be constructed on the main thread. // holder must be constructed on the main thread.
MOZ_ASSERT(!mStrict || NS_IsMainThread()); MOZ_ASSERT(!mStrict || NS_IsMainThread());
@@ -165,7 +165,7 @@ class nsMainThreadPtrHandle
nsRefPtr<nsMainThreadPtrHolder<T> > mPtr; nsRefPtr<nsMainThreadPtrHolder<T> > mPtr;
public: public:
nsMainThreadPtrHandle() : mPtr(NULL) {} nsMainThreadPtrHandle() : mPtr(nullptr) {}
nsMainThreadPtrHandle(nsMainThreadPtrHolder<T> *aHolder) : mPtr(aHolder) {} nsMainThreadPtrHandle(nsMainThreadPtrHolder<T> *aHolder) : mPtr(aHolder) {}
nsMainThreadPtrHandle(const nsMainThreadPtrHandle& aOther) : mPtr(aOther.mPtr) {} nsMainThreadPtrHandle(const nsMainThreadPtrHandle& aOther) : mPtr(aOther.mPtr) {}
nsMainThreadPtrHandle& operator=(const nsMainThreadPtrHandle& aOther) { nsMainThreadPtrHandle& operator=(const nsMainThreadPtrHandle& aOther) {

View File

@@ -254,8 +254,8 @@ public:
/** /**
* Measure the size of the table's entry storage, and if * Measure the size of the table's entry storage, and if
* |sizeOfEntryExcludingThis| is non-NULL, measure the size of things pointed * |sizeOfEntryExcludingThis| is non-nullptr, measure the size of things
* to by entries. * pointed to by entries.
* *
* @param sizeOfEntryExcludingThis the * @param sizeOfEntryExcludingThis the
* <code>SizeOfEntryExcludingThisFun</code> function to call * <code>SizeOfEntryExcludingThisFun</code> function to call
@@ -265,13 +265,14 @@ public:
* @return the summed size of all the entries * @return the summed size of all the entries
*/ */
size_t SizeOfExcludingThis(SizeOfEntryExcludingThisFun sizeOfEntryExcludingThis, size_t SizeOfExcludingThis(SizeOfEntryExcludingThisFun sizeOfEntryExcludingThis,
mozilla::MallocSizeOf mallocSizeOf, void *userArg = NULL) const mozilla::MallocSizeOf mallocSizeOf,
void *userArg = nullptr) const
{ {
if (sizeOfEntryExcludingThis) { if (sizeOfEntryExcludingThis) {
s_SizeOfArgs args = { sizeOfEntryExcludingThis, userArg }; s_SizeOfArgs args = { sizeOfEntryExcludingThis, userArg };
return PL_DHashTableSizeOfExcludingThis(&mTable, s_SizeOfStub, mallocSizeOf, &args); return PL_DHashTableSizeOfExcludingThis(&mTable, s_SizeOfStub, mallocSizeOf, &args);
} }
return PL_DHashTableSizeOfExcludingThis(&mTable, NULL, mallocSizeOf); return PL_DHashTableSizeOfExcludingThis(&mTable, nullptr, mallocSizeOf);
} }
#ifdef DEBUG #ifdef DEBUG

View File

@@ -566,7 +566,7 @@ static struct NumArgState* BuildArgArray(const PRUnichar *fmt,
if (c == '$') { if (c == '$') {
if (i > 0) { if (i > 0) {
*rv = -1; *rv = -1;
return NULL; return nullptr;
} }
number++; number++;
break; break;
@@ -575,7 +575,7 @@ static struct NumArgState* BuildArgArray(const PRUnichar *fmt,
/* non-numbered argument case */ /* non-numbered argument case */
if (number > 0) { if (number > 0) {
*rv = -1; *rv = -1;
return NULL; return nullptr;
} }
i = 1; i = 1;
break; break;
@@ -586,14 +586,14 @@ static struct NumArgState* BuildArgArray(const PRUnichar *fmt,
} }
if (number == 0) { if (number == 0) {
return NULL; return nullptr;
} }
if (number > NAS_DEFAULT_NUM) { if (number > NAS_DEFAULT_NUM) {
nas = (struct NumArgState*)nsMemory::Alloc(number * sizeof(struct NumArgState)); nas = (struct NumArgState*)nsMemory::Alloc(number * sizeof(struct NumArgState));
if (!nas) { if (!nas) {
*rv = -1; *rv = -1;
return NULL; return nullptr;
} }
} else { } else {
nas = nasArray; nas = nasArray;
@@ -750,7 +750,7 @@ static struct NumArgState* BuildArgArray(const PRUnichar *fmt,
if( nas != nasArray ) { if( nas != nasArray ) {
PR_DELETE(nas); PR_DELETE(nas);
} }
return NULL; return nullptr;
} }
cn = 0; cn = 0;
@@ -789,7 +789,7 @@ static struct NumArgState* BuildArgArray(const PRUnichar *fmt,
PR_DELETE( nas ); PR_DELETE( nas );
} }
*rv = -1; *rv = -1;
return NULL; return nullptr;
} }
cn++; cn++;
} }
@@ -823,7 +823,7 @@ static int dosprintf(SprintfState *ss, const PRUnichar *fmt, va_list ap)
const PRUnichar *hexp; const PRUnichar *hexp;
int rv, i; int rv, i;
struct NumArgState* nas = NULL; struct NumArgState* nas = nullptr;
struct NumArgState nasArray[NAS_DEFAULT_NUM]; struct NumArgState nasArray[NAS_DEFAULT_NUM];
@@ -862,7 +862,7 @@ static int dosprintf(SprintfState *ss, const PRUnichar *fmt, va_list ap)
continue; continue;
} }
if (nas != NULL) { if (nas != nullptr) {
/* the fmt contains the Numbered Arguments feature */ /* the fmt contains the Numbered Arguments feature */
i = 0; i = 0;
/* should imporve error check later */ /* should imporve error check later */

View File

@@ -45,15 +45,15 @@ class NS_COM_GLUE nsTextFormatter {
public: public:
/* /*
* sprintf into a fixed size buffer. Guarantees that a NULL is at the end * sprintf into a fixed size buffer. Guarantees that the buffer is null
* of the buffer. Returns the length of the written output, NOT including * terminated. Returns the length of the written output, NOT including the
* the NUL, or (uint32_t)-1 if an error occurs. * null terminator, or (uint32_t)-1 if an error occurs.
*/ */
static uint32_t snprintf(PRUnichar *out, uint32_t outlen, const PRUnichar *fmt, ...); static uint32_t snprintf(PRUnichar *out, uint32_t outlen, const PRUnichar *fmt, ...);
/* /*
* sprintf into a nsMemory::Alloc'd buffer. Return a pointer to * sprintf into a nsMemory::Alloc'd buffer. Return a pointer to
* buffer on success, NULL on failure. * buffer on success, nullptr on failure.
*/ */
static PRUnichar* smprintf(const PRUnichar *fmt, ...); static PRUnichar* smprintf(const PRUnichar *fmt, ...);

View File

@@ -108,11 +108,11 @@ public:
bool EnumerateBackwards(nsVoidArrayEnumFunc aFunc, void* aData); bool EnumerateBackwards(nsVoidArrayEnumFunc aFunc, void* aData);
// Measures the size of the array's element storage, and if // Measures the size of the array's element storage, and if
// |aSizeOfElementIncludingThis| is non-NULL, measures the size of things // |aSizeOfElementIncludingThis| is non-nullptr, measures the size of things
// pointed to by elements. // pointed to by elements.
size_t SizeOfExcludingThis( size_t SizeOfExcludingThis(
nsVoidArraySizeOfElementIncludingThisFunc aSizeOfElementIncludingThis, nsVoidArraySizeOfElementIncludingThisFunc aSizeOfElementIncludingThis,
mozilla::MallocSizeOf aMallocSizeOf, void* aData = NULL) const; mozilla::MallocSizeOf aMallocSizeOf, void* aData = nullptr) const;
protected: protected:
bool GrowArrayBy(int32_t aGrowBy); bool GrowArrayBy(int32_t aGrowBy);

View File

@@ -160,7 +160,7 @@ static const PLDHashTableOps stub_ops = {
PL_DHashMoveEntryStub, PL_DHashMoveEntryStub,
PL_DHashClearEntryStub, PL_DHashClearEntryStub,
PL_DHashFinalizeStub, PL_DHashFinalizeStub,
NULL nullptr
}; };
const PLDHashTableOps * const PLDHashTableOps *
@@ -177,10 +177,10 @@ PL_NewDHashTable(const PLDHashTableOps *ops, void *data, uint32_t entrySize,
table = (PLDHashTable *) malloc(sizeof *table); table = (PLDHashTable *) malloc(sizeof *table);
if (!table) if (!table)
return NULL; return nullptr;
if (!PL_DHashTableInit(table, ops, data, entrySize, capacity)) { if (!PL_DHashTableInit(table, ops, data, entrySize, capacity)) {
free(table); free(table);
return NULL; return nullptr;
} }
return table; return table;
} }
@@ -334,13 +334,13 @@ PL_DHashTableFinish(PLDHashTable *table)
PLDHashEntryHdr *entry; PLDHashEntryHdr *entry;
#ifdef DEBUG_XXXbrendan #ifdef DEBUG_XXXbrendan
static FILE *dumpfp = NULL; static FILE *dumpfp = nullptr;
if (!dumpfp) dumpfp = fopen("/tmp/pldhash.bigdump", "w"); if (!dumpfp) dumpfp = fopen("/tmp/pldhash.bigdump", "w");
if (dumpfp) { if (dumpfp) {
#ifdef MOZILLA_CLIENT #ifdef MOZILLA_CLIENT
NS_TraceStack(1, dumpfp); NS_TraceStack(1, dumpfp);
#endif #endif
PL_DHashTableDumpMeter(table, NULL, dumpfp); PL_DHashTableDumpMeter(table, nullptr, dumpfp);
fputc('\n', dumpfp); fputc('\n', dumpfp);
} }
#endif #endif
@@ -408,7 +408,7 @@ SearchTable(PLDHashTable *table, const void *key, PLDHashNumber keyHash,
sizeMask = (1u << sizeLog2) - 1; sizeMask = (1u << sizeLog2) - 1;
/* Save the first removed entry pointer so PL_DHASH_ADD can recycle it. */ /* Save the first removed entry pointer so PL_DHASH_ADD can recycle it. */
firstRemoved = NULL; firstRemoved = nullptr;
for (;;) { for (;;) {
if (MOZ_UNLIKELY(ENTRY_IS_REMOVED(entry))) { if (MOZ_UNLIKELY(ENTRY_IS_REMOVED(entry))) {
@@ -437,7 +437,7 @@ SearchTable(PLDHashTable *table, const void *key, PLDHashNumber keyHash,
} }
/* NOTREACHED */ /* NOTREACHED */
return NULL; return nullptr;
} }
/* /*
@@ -495,7 +495,7 @@ FindFreeEntry(PLDHashTable *table, PLDHashNumber keyHash)
} }
/* NOTREACHED */ /* NOTREACHED */
return NULL; return nullptr;
} }
static bool static bool
@@ -609,7 +609,7 @@ PL_DHashTableOperate(PLDHashTable *table, const void *key, PLDHashOperator op)
if (!ChangeTable(table, deltaLog2) && if (!ChangeTable(table, deltaLog2) &&
table->entryCount + table->removedCount == size - 1) { table->entryCount + table->removedCount == size - 1) {
METER(table->stats.addFailures++); METER(table->stats.addFailures++);
entry = NULL; entry = nullptr;
break; break;
} }
} }
@@ -631,7 +631,7 @@ PL_DHashTableOperate(PLDHashTable *table, const void *key, PLDHashOperator op)
!table->ops->initEntry(table, entry, key)) { !table->ops->initEntry(table, entry, key)) {
/* We haven't claimed entry yet; fail with null return. */ /* We haven't claimed entry yet; fail with null return. */
memset(entry + 1, 0, table->entrySize - sizeof *entry); memset(entry + 1, 0, table->entrySize - sizeof *entry);
entry = NULL; entry = nullptr;
break; break;
} }
entry->keyHash = keyHash; entry->keyHash = keyHash;
@@ -656,12 +656,12 @@ PL_DHashTableOperate(PLDHashTable *table, const void *key, PLDHashOperator op)
} }
} }
METER(else table->stats.removeMisses++); METER(else table->stats.removeMisses++);
entry = NULL; entry = nullptr;
break; break;
default: default:
NS_NOTREACHED("0"); NS_NOTREACHED("0");
entry = NULL; entry = nullptr;
} }
DECREMENT_RECURSION_LEVEL(table); DECREMENT_RECURSION_LEVEL(table);
@@ -773,7 +773,7 @@ size_t
PL_DHashTableSizeOfExcludingThis(const PLDHashTable *table, PL_DHashTableSizeOfExcludingThis(const PLDHashTable *table,
PLDHashSizeOfEntryExcludingThisFun sizeOfEntryExcludingThis, PLDHashSizeOfEntryExcludingThisFun sizeOfEntryExcludingThis,
MallocSizeOf mallocSizeOf, MallocSizeOf mallocSizeOf,
void *arg /* = NULL */) void *arg /* = nullptr */)
{ {
size_t n = 0; size_t n = 0;
n += mallocSizeOf(table->entryStore); n += mallocSizeOf(table->entryStore);
@@ -790,7 +790,7 @@ size_t
PL_DHashTableSizeOfIncludingThis(const PLDHashTable *table, PL_DHashTableSizeOfIncludingThis(const PLDHashTable *table,
PLDHashSizeOfEntryExcludingThisFun sizeOfEntryExcludingThis, PLDHashSizeOfEntryExcludingThisFun sizeOfEntryExcludingThis,
MallocSizeOf mallocSizeOf, MallocSizeOf mallocSizeOf,
void *arg /* = NULL */) void *arg /* = nullptr */)
{ {
return mallocSizeOf(table) + return mallocSizeOf(table) +
PL_DHashTableSizeOfExcludingThis(table, sizeOfEntryExcludingThis, PL_DHashTableSizeOfExcludingThis(table, sizeOfEntryExcludingThis,

View File

@@ -569,15 +569,15 @@ typedef size_t
/** /**
* Measure the size of the table's entry storage, and if * Measure the size of the table's entry storage, and if
* |sizeOfEntryExcludingThis| is non-NULL, measure the size of things pointed * |sizeOfEntryExcludingThis| is non-nullptr, measure the size of things
* to by entries. Doesn't measure |ops| because it's often shared between * pointed to by entries. Doesn't measure |ops| because it's often shared
* tables, nor |data| because it's opaque. * between tables, nor |data| because it's opaque.
*/ */
NS_COM_GLUE size_t NS_COM_GLUE size_t
PL_DHashTableSizeOfExcludingThis(const PLDHashTable *table, PL_DHashTableSizeOfExcludingThis(const PLDHashTable *table,
PLDHashSizeOfEntryExcludingThisFun sizeOfEntryExcludingThis, PLDHashSizeOfEntryExcludingThisFun sizeOfEntryExcludingThis,
mozilla::MallocSizeOf mallocSizeOf, mozilla::MallocSizeOf mallocSizeOf,
void *arg = NULL); void *arg = nullptr);
/** /**
* Like PL_DHashTableSizeOfExcludingThis, but includes sizeof(*this). * Like PL_DHashTableSizeOfExcludingThis, but includes sizeof(*this).
@@ -586,7 +586,7 @@ NS_COM_GLUE size_t
PL_DHashTableSizeOfIncludingThis(const PLDHashTable *table, PL_DHashTableSizeOfIncludingThis(const PLDHashTable *table,
PLDHashSizeOfEntryExcludingThisFun sizeOfEntryExcludingThis, PLDHashSizeOfEntryExcludingThisFun sizeOfEntryExcludingThis,
mozilla::MallocSizeOf mallocSizeOf, mozilla::MallocSizeOf mallocSizeOf,
void *arg = NULL); void *arg = nullptr);
#ifdef DEBUG #ifdef DEBUG
/** /**

View File

@@ -66,7 +66,7 @@ TEST(ReadSysFile, Nonexistent) {
bool ret; bool ret;
int errno_saved; int errno_saved;
ret = ReadSysFile("/nonexistent", NULL, 0); ret = ReadSysFile("/nonexistent", nullptr, 0);
errno_saved = errno; errno_saved = errno;
ASSERT_FALSE(ret); ASSERT_FALSE(ret);

View File

@@ -67,7 +67,7 @@ typedef HRESULT (WINAPI* nsGetKnownFolderPath)(GUID& rfid,
HANDLE hToken, HANDLE hToken,
PWSTR *ppszPath); PWSTR *ppszPath);
static nsGetKnownFolderPath gGetKnownFolderPath = NULL; static nsGetKnownFolderPath gGetKnownFolderPath = nullptr;
#endif #endif
void StartupSpecialSystemDirectory() void StartupSpecialSystemDirectory()
@@ -91,8 +91,8 @@ static nsresult GetKnownFolder(GUID* guid, nsIFile** aFile)
if (!guid || !gGetKnownFolderPath) if (!guid || !gGetKnownFolderPath)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
PWSTR path = NULL; PWSTR path = nullptr;
gGetKnownFolderPath(*guid, 0, NULL, &path); gGetKnownFolderPath(*guid, 0, nullptr, &path);
if (!path) if (!path)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
@@ -110,7 +110,7 @@ GetWindowsFolder(int folder, nsIFile** aFile)
{ {
WCHAR path_orig[MAX_PATH + 3]; WCHAR path_orig[MAX_PATH + 3];
WCHAR *path = path_orig+1; WCHAR *path = path_orig+1;
HRESULT result = SHGetSpecialFolderPathW(NULL, path, folder, true); HRESULT result = SHGetSpecialFolderPathW(nullptr, path, folder, true);
if (!SUCCEEDED(result)) if (!SUCCEEDED(result))
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
@@ -130,9 +130,9 @@ __inline HRESULT
SHLoadLibraryFromKnownFolder(REFKNOWNFOLDERID aFolderId, DWORD aMode, SHLoadLibraryFromKnownFolder(REFKNOWNFOLDERID aFolderId, DWORD aMode,
REFIID riid, void **ppv) REFIID riid, void **ppv)
{ {
*ppv = NULL; *ppv = nullptr;
IShellLibrary *plib; IShellLibrary *plib;
HRESULT hr = CoCreateInstance(CLSID_ShellLibrary, NULL, HRESULT hr = CoCreateInstance(CLSID_ShellLibrary, nullptr,
CLSCTX_INPROC_SERVER, CLSCTX_INPROC_SERVER,
IID_PPV_ARGS(&plib)); IID_PPV_ARGS(&plib));
if (SUCCEEDED(hr)) { if (SUCCEEDED(hr)) {
@@ -202,8 +202,8 @@ static nsresult GetRegWindowsAppDataFolder(bool aLocal, nsIFile** aFile)
WCHAR path[MAX_PATH + 2]; WCHAR path[MAX_PATH + 2];
DWORD type, size; DWORD type, size;
res = RegQueryValueExW(key, (aLocal ? L"Local AppData" : L"AppData"), NULL, res = RegQueryValueExW(key, (aLocal ? L"Local AppData" : L"AppData"),
&type, (LPBYTE)&path, &size); nullptr, &type, (LPBYTE)&path, &size);
::RegCloseKey(key); ::RegCloseKey(key);
// The call to RegQueryValueExW must succeed, the type must be REG_SZ, the // The call to RegQueryValueExW must succeed, the type must be REG_SZ, the
// buffer size must not equal 0, and the buffer size be a multiple of 2. // buffer size must not equal 0, and the buffer size be a multiple of 2.
@@ -287,14 +287,14 @@ xdg_user_dir_lookup (const char *type)
home_dir = getenv ("HOME"); home_dir = getenv ("HOME");
if (home_dir == NULL) if (home_dir == nullptr)
goto error; goto error;
config_home = getenv ("XDG_CONFIG_HOME"); config_home = getenv ("XDG_CONFIG_HOME");
if (config_home == NULL || config_home[0] == 0) if (config_home == nullptr || config_home[0] == 0)
{ {
config_file = (char*) malloc (strlen (home_dir) + strlen ("/.config/user-dirs.dirs") + 1); config_file = (char*) malloc (strlen (home_dir) + strlen ("/.config/user-dirs.dirs") + 1);
if (config_file == NULL) if (config_file == nullptr)
goto error; goto error;
strcpy (config_file, home_dir); strcpy (config_file, home_dir);
@@ -303,7 +303,7 @@ xdg_user_dir_lookup (const char *type)
else else
{ {
config_file = (char*) malloc (strlen (config_home) + strlen ("/user-dirs.dirs") + 1); config_file = (char*) malloc (strlen (config_home) + strlen ("/user-dirs.dirs") + 1);
if (config_file == NULL) if (config_file == nullptr)
goto error; goto error;
strcpy (config_file, config_home); strcpy (config_file, config_home);
@@ -312,10 +312,10 @@ xdg_user_dir_lookup (const char *type)
file = fopen (config_file, "r"); file = fopen (config_file, "r");
free (config_file); free (config_file);
if (file == NULL) if (file == nullptr)
goto error; goto error;
user_dir = NULL; user_dir = nullptr;
while (fgets (buffer, sizeof (buffer), file)) while (fgets (buffer, sizeof (buffer), file))
{ {
/* Remove newline at end */ /* Remove newline at end */
@@ -363,7 +363,7 @@ xdg_user_dir_lookup (const char *type)
if (relative) if (relative)
{ {
user_dir = (char*) malloc (strlen (home_dir) + 1 + strlen (p) + 1); user_dir = (char*) malloc (strlen (home_dir) + 1 + strlen (p) + 1);
if (user_dir == NULL) if (user_dir == nullptr)
goto error2; goto error2;
strcpy (user_dir, home_dir); strcpy (user_dir, home_dir);
@@ -372,7 +372,7 @@ xdg_user_dir_lookup (const char *type)
else else
{ {
user_dir = (char*) malloc (strlen (p) + 1); user_dir = (char*) malloc (strlen (p) + 1);
if (user_dir == NULL) if (user_dir == nullptr)
goto error2; goto error2;
*user_dir = 0; *user_dir = 0;
@@ -394,7 +394,7 @@ error2:
return user_dir; return user_dir;
error: error:
return NULL; return nullptr;
} }
static const char xdg_user_dirs[] = static const char xdg_user_dirs[] =

View File

@@ -128,8 +128,8 @@ char* nsEscape(const char * str, nsEscapeMask flags)
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
{ {
if(!str) if(!str)
return NULL; return nullptr;
return nsEscapeCount(str, flags, NULL); return nsEscapeCount(str, flags, nullptr);
} }
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------

View File

@@ -109,8 +109,8 @@ _mbschr(const unsigned char* stringToSearch, int charToSearchFor)
p = (const unsigned char*)WinNextChar(0,0,0,(char*)p); p = (const unsigned char*)WinNextChar(0,0,0,(char*)p);
} while (*p); } while (*p);
// Result is p or NULL // Result is p or nullptr
return *p ? (unsigned char*)p : NULL; return *p ? (unsigned char*)p : nullptr;
} }
// Locates the first occurrence of subString in the stringToSearch // Locates the first occurrence of subString in the stringToSearch
@@ -142,7 +142,7 @@ _mbsstr(const unsigned char* stringToSearch, const unsigned char* subString)
} while (*pStr); } while (*pStr);
// if we got to the end of pSub, we've found it // if we got to the end of pSub, we've found it
return *pSub ? NULL : (unsigned char*)pStr; return *pSub ? nullptr : (unsigned char*)pStr;
} }
// Locates last occurence of charToSearchFor in the stringToSearch // Locates last occurence of charToSearchFor in the stringToSearch
@@ -158,8 +158,8 @@ _mbsrchr(const unsigned char* stringToSearch, int charToSearchFor)
p = (const unsigned char*)WinPrevChar(0,0,0,(char*)stringToSearch,(char*)p); p = (const unsigned char*)WinPrevChar(0,0,0,(char*)stringToSearch,(char*)p);
} while (p > stringToSearch); } while (p > stringToSearch);
// Result is p or NULL // Result is p or nullptr
return (*p == charToSearchFor) ? (unsigned char*)p : NULL; return (*p == charToSearchFor) ? (unsigned char*)p : nullptr;
} }
// Implement equivalent of Win32 CreateDirectoryA // Implement equivalent of Win32 CreateDirectoryA
@@ -563,7 +563,7 @@ nsLocalFile::nsLocalFileConstructor(nsISupports* outer, const nsIID& aIID, void*
NS_ENSURE_NO_AGGREGATION(outer); NS_ENSURE_NO_AGGREGATION(outer);
nsLocalFile* inst = new nsLocalFile(); nsLocalFile* inst = new nsLocalFile();
if (inst == NULL) if (inst == nullptr)
return NS_ERROR_OUT_OF_MEMORY; return NS_ERROR_OUT_OF_MEMORY;
nsresult rv = inst->QueryInterface(aIID, aInstancePtr); nsresult rv = inst->QueryInterface(aIID, aInstancePtr);
@@ -765,7 +765,7 @@ nsLocalFile::Create(uint32_t type, uint32_t attributes)
{ {
*slash = '\0'; *slash = '\0';
rv = CreateDirectoryA(const_cast<char*>(mWorkingPath.get()), NULL); rv = CreateDirectoryA(const_cast<char*>(mWorkingPath.get()), nullptr);
if (rv) { if (rv) {
rv = ConvertOS2Error(rv); rv = ConvertOS2Error(rv);
if (rv != NS_ERROR_FILE_ALREADY_EXISTS) if (rv != NS_ERROR_FILE_ALREADY_EXISTS)
@@ -789,7 +789,7 @@ nsLocalFile::Create(uint32_t type, uint32_t attributes)
if (type == DIRECTORY_TYPE) if (type == DIRECTORY_TYPE)
{ {
rv = CreateDirectoryA(const_cast<char*>(mWorkingPath.get()), NULL); rv = CreateDirectoryA(const_cast<char*>(mWorkingPath.get()), nullptr);
if (rv) if (rv)
return ConvertOS2Error(rv); return ConvertOS2Error(rv);
else else
@@ -1391,8 +1391,8 @@ nsLocalFile::CopySingleFile(nsIFile *sourceFile, nsIFile *destParent,
strcat(achProgram, """"); strcat(achProgram, """");
achProgram[strlen(achProgram) + 1] = '\0'; achProgram[strlen(achProgram) + 1] = '\0';
achProgram[7] = '\0'; achProgram[7] = '\0';
DosExecPgm(NULL, 0, DosExecPgm(nullptr, 0,
EXEC_SYNC, achProgram, (PSZ)NULL, EXEC_SYNC, achProgram, (PSZ)nullptr,
&rescResults, achProgram); &rescResults, achProgram);
rc = 0; // Assume it worked rc = 0; // Assume it worked
@@ -1909,7 +1909,7 @@ nsLocalFile::SetFileSize(int64_t aFileSize)
FILE_NORMAL, FILE_NORMAL,
OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS, OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS,
OPEN_SHARE_DENYREADWRITE | OPEN_ACCESS_READWRITE, OPEN_SHARE_DENYREADWRITE | OPEN_ACCESS_READWRITE,
NULL); nullptr);
if (rc != NO_ERROR) if (rc != NO_ERROR)
{ {

View File

@@ -1157,7 +1157,7 @@ GetDeviceName(int deviceMajor, int deviceMinor, nsACString &deviceName)
char *p_dev = strstr(mountinfo_line,device_num); char *p_dev = strstr(mountinfo_line,device_num);
int i; int i;
for(i = 0; i < kMountInfoDevPosition && p_dev != NULL; i++) { for(i = 0; i < kMountInfoDevPosition && p_dev != nullptr; i++) {
p_dev = strchr(p_dev,' '); p_dev = strchr(p_dev,' ');
if(p_dev) if(p_dev)
p_dev++; p_dev++;
@@ -2030,7 +2030,7 @@ static nsresult CFStringReftoUTF8(CFStringRef aInStrRef, nsACString& aOutStr)
CFIndex usedBufLen, inStrLen = ::CFStringGetLength(aInStrRef); CFIndex usedBufLen, inStrLen = ::CFStringGetLength(aInStrRef);
CFIndex charsConverted = ::CFStringGetBytes(aInStrRef, CFRangeMake(0, inStrLen), CFIndex charsConverted = ::CFStringGetBytes(aInStrRef, CFRangeMake(0, inStrLen),
kCFStringEncodingUTF8, 0, false, kCFStringEncodingUTF8, 0, false,
NULL, 0, &usedBufLen); nullptr, 0, &usedBufLen);
if (charsConverted == inStrLen) { if (charsConverted == inStrLen) {
// all characters converted, do the actual conversion // all characters converted, do the actual conversion
aOutStr.SetLength(usedBufLen); aOutStr.SetLength(usedBufLen);
@@ -2094,7 +2094,7 @@ nsLocalFile::GetFSRef(FSRef *_retval)
nsresult rv = NS_ERROR_FAILURE; nsresult rv = NS_ERROR_FAILURE;
CFURLRef url = NULL; CFURLRef url = nullptr;
if (NS_SUCCEEDED(GetCFURL(&url))) { if (NS_SUCCEEDED(GetCFURL(&url))) {
if (::CFURLGetFSRef(url, _retval)) { if (::CFURLGetFSRef(url, _retval)) {
rv = NS_OK; rv = NS_OK;
@@ -2224,7 +2224,7 @@ nsLocalFile::LaunchWithDoc(nsIFile *aDocToLoad, bool aLaunchInBackground)
} }
thelaunchSpec.launchFlags = theLaunchFlags; thelaunchSpec.launchFlags = theLaunchFlags;
OSErr err = ::LSOpenFromRefSpec(&thelaunchSpec, NULL); OSErr err = ::LSOpenFromRefSpec(&thelaunchSpec, nullptr);
if (err != noErr) if (err != noErr)
return MacErrorMapper(err); return MacErrorMapper(err);
@@ -2240,7 +2240,7 @@ nsLocalFile::OpenDocWithApp(nsIFile *aAppToOpenWith, bool aLaunchInBackground)
return rv; return rv;
if (!aAppToOpenWith) { if (!aAppToOpenWith) {
OSErr err = ::LSOpenFSRef(&docFSRef, NULL); OSErr err = ::LSOpenFSRef(&docFSRef, nullptr);
return MacErrorMapper(err); return MacErrorMapper(err);
} }
@@ -2272,7 +2272,7 @@ nsLocalFile::OpenDocWithApp(nsIFile *aAppToOpenWith, bool aLaunchInBackground)
thelaunchSpec.itemRefs = &docFSRef; thelaunchSpec.itemRefs = &docFSRef;
thelaunchSpec.launchFlags = theLaunchFlags; thelaunchSpec.launchFlags = theLaunchFlags;
OSErr err = ::LSOpenFromRefSpec(&thelaunchSpec, NULL); OSErr err = ::LSOpenFromRefSpec(&thelaunchSpec, nullptr);
if (err != noErr) if (err != noErr)
return MacErrorMapper(err); return MacErrorMapper(err);
@@ -2336,7 +2336,7 @@ nsLocalFile::GetBundleIdentifier(nsACString& outBundleIdentifier)
CFURLRef urlRef; CFURLRef urlRef;
if (NS_SUCCEEDED(GetCFURL(&urlRef))) { if (NS_SUCCEEDED(GetCFURL(&urlRef))) {
CFBundleRef bundle = ::CFBundleCreate(NULL, urlRef); CFBundleRef bundle = ::CFBundleCreate(nullptr, urlRef);
if (bundle) { if (bundle) {
CFStringRef bundleIdentifier = ::CFBundleGetIdentifier(bundle); CFStringRef bundleIdentifier = ::CFBundleGetIdentifier(bundle);
if (bundleIdentifier) if (bundleIdentifier)

View File

@@ -118,7 +118,7 @@ public:
MOZ_ASSERT(!NS_IsMainThread(), MOZ_ASSERT(!NS_IsMainThread(),
"AsyncLocalFileWinOperation should not be run on the main thread!"); "AsyncLocalFileWinOperation should not be run on the main thread!");
CoInitialize(NULL); CoInitialize(nullptr);
switch(mOperation) { switch(mOperation) {
case RevealOp: { case RevealOp: {
Reveal(); Reveal();
@@ -205,11 +205,11 @@ private:
memset(&seinfo, 0, sizeof(seinfo)); memset(&seinfo, 0, sizeof(seinfo));
seinfo.cbSize = sizeof(SHELLEXECUTEINFOW); seinfo.cbSize = sizeof(SHELLEXECUTEINFOW);
seinfo.fMask = 0; seinfo.fMask = 0;
seinfo.hwnd = NULL; seinfo.hwnd = nullptr;
seinfo.lpVerb = NULL; seinfo.lpVerb = nullptr;
seinfo.lpFile = mResolvedPath.get(); seinfo.lpFile = mResolvedPath.get();
seinfo.lpParameters = NULL; seinfo.lpParameters = nullptr;
seinfo.lpDirectory = NULL; seinfo.lpDirectory = nullptr;
seinfo.nShow = SW_SHOWNORMAL; seinfo.nShow = SW_SHOWNORMAL;
// Use the directory of the file we're launching as the working // Use the directory of the file we're launching as the working
@@ -326,7 +326,7 @@ private:
ShortcutResolver::ShortcutResolver() : ShortcutResolver::ShortcutResolver() :
mLock("ShortcutResolver.mLock") mLock("ShortcutResolver.mLock")
{ {
CoInitialize(NULL); CoInitialize(nullptr);
} }
ShortcutResolver::~ShortcutResolver() ShortcutResolver::~ShortcutResolver()
@@ -339,7 +339,7 @@ ShortcutResolver::Init()
{ {
// Get a pointer to the IPersistFile interface. // Get a pointer to the IPersistFile interface.
if (FAILED(CoCreateInstance(CLSID_ShellLink, if (FAILED(CoCreateInstance(CLSID_ShellLink,
NULL, nullptr,
CLSCTX_INPROC_SERVER, CLSCTX_INPROC_SERVER,
IID_IShellLinkW, IID_IShellLinkW,
getter_AddRefs(mShellLink))) || getter_AddRefs(mShellLink))) ||
@@ -362,7 +362,7 @@ ShortcutResolver::Resolve(const WCHAR* in, WCHAR* out)
if (FAILED(mPersistFile->Load(in, STGM_READ)) || if (FAILED(mPersistFile->Load(in, STGM_READ)) ||
FAILED(mShellLink->Resolve(nullptr, SLR_NO_UI)) || FAILED(mShellLink->Resolve(nullptr, SLR_NO_UI)) ||
FAILED(mShellLink->GetPath(out, MAX_PATH, NULL, SLGP_UNCPRIORITY))) FAILED(mShellLink->GetPath(out, MAX_PATH, nullptr, SLGP_UNCPRIORITY)))
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
return NS_OK; return NS_OK;
} }
@@ -636,7 +636,7 @@ OpenFile(const nsAFlatString &name, int osflags, int mode,
HANDLE file = ::CreateFileW(name.get(), access, HANDLE file = ::CreateFileW(name.get(), access,
FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE,
NULL, disposition, attributes, NULL); nullptr, disposition, attributes, nullptr);
if (file == INVALID_HANDLE_VALUE) { if (file == INVALID_HANDLE_VALUE) {
*fd = nullptr; *fd = nullptr;
@@ -963,7 +963,7 @@ nsLocalFile::nsLocalFileConstructor(nsISupports* outer, const nsIID& aIID, void*
NS_ENSURE_NO_AGGREGATION(outer); NS_ENSURE_NO_AGGREGATION(outer);
nsLocalFile* inst = new nsLocalFile(); nsLocalFile* inst = new nsLocalFile();
if (inst == NULL) if (inst == nullptr)
return NS_ERROR_OUT_OF_MEMORY; return NS_ERROR_OUT_OF_MEMORY;
nsresult rv = inst->QueryInterface(aIID, aInstancePtr); nsresult rv = inst->QueryInterface(aIID, aInstancePtr);
@@ -1271,7 +1271,7 @@ nsLocalFile::Create(uint32_t type, uint32_t attributes)
{ {
*slash = L'\0'; *slash = L'\0';
if (!::CreateDirectoryW(mResolvedPath.get(), NULL)) { if (!::CreateDirectoryW(mResolvedPath.get(), nullptr)) {
rv = ConvertWinError(GetLastError()); rv = ConvertWinError(GetLastError());
if (NS_ERROR_FILE_NOT_FOUND == rv && if (NS_ERROR_FILE_NOT_FOUND == rv &&
NS_ERROR_FILE_ACCESS_DENIED == directoryCreateError) { NS_ERROR_FILE_ACCESS_DENIED == directoryCreateError) {
@@ -1319,7 +1319,7 @@ nsLocalFile::Create(uint32_t type, uint32_t attributes)
if (type == DIRECTORY_TYPE) if (type == DIRECTORY_TYPE)
{ {
if (!::CreateDirectoryW(mResolvedPath.get(), NULL)) { if (!::CreateDirectoryW(mResolvedPath.get(), nullptr)) {
rv = ConvertWinError(GetLastError()); rv = ConvertWinError(GetLastError());
if (NS_ERROR_FILE_NOT_FOUND == rv && if (NS_ERROR_FILE_NOT_FOUND == rv &&
NS_ERROR_FILE_ACCESS_DENIED == directoryCreateError) { NS_ERROR_FILE_ACCESS_DENIED == directoryCreateError) {
@@ -1692,9 +1692,9 @@ nsLocalFile::SetShortcut(nsIFile* targetFile,
return rv; return rv;
} }
const WCHAR* targetFilePath = NULL; const WCHAR* targetFilePath = nullptr;
const WCHAR* workingDirPath = NULL; const WCHAR* workingDirPath = nullptr;
const WCHAR* iconFilePath = NULL; const WCHAR* iconFilePath = nullptr;
nsAutoString targetFilePathAuto; nsAutoString targetFilePathAuto;
if (targetFile) { if (targetFile) {
@@ -1839,7 +1839,8 @@ nsLocalFile::CopySingleFile(nsIFile *sourceFile, nsIFile *destParent,
if (!move) if (!move)
{ {
copyOK = ::CopyFileExW(filePath.get(), destPath.get(), NULL, NULL, NULL, dwCopyFlags); copyOK = ::CopyFileExW(filePath.get(), destPath.get(), nullptr,
nullptr, nullptr, dwCopyFlags);
} }
else else
{ {
@@ -1849,7 +1850,8 @@ nsLocalFile::CopySingleFile(nsIFile *sourceFile, nsIFile *destParent,
// as this could be an SMBV2 mapped drive. // as this could be an SMBV2 mapped drive.
if (!copyOK && GetLastError() == ERROR_NOT_SAME_DEVICE) if (!copyOK && GetLastError() == ERROR_NOT_SAME_DEVICE)
{ {
copyOK = CopyFileExW(filePath.get(), destPath.get(), NULL, NULL, NULL, dwCopyFlags); copyOK = CopyFileExW(filePath.get(), destPath.get(), nullptr,
nullptr, nullptr, dwCopyFlags);
if (copyOK) if (copyOK)
DeleteFileW(filePath.get()); DeleteFileW(filePath.get());
@@ -1862,16 +1864,16 @@ nsLocalFile::CopySingleFile(nsIFile *sourceFile, nsIFile *destParent,
{ {
// Set security permissions to inherit from parent. // Set security permissions to inherit from parent.
// Note: propagates to all children: slow for big file trees // Note: propagates to all children: slow for big file trees
PACL pOldDACL = NULL; PACL pOldDACL = nullptr;
PSECURITY_DESCRIPTOR pSD = NULL; PSECURITY_DESCRIPTOR pSD = nullptr;
::GetNamedSecurityInfoW((LPWSTR)destPath.get(), SE_FILE_OBJECT, ::GetNamedSecurityInfoW((LPWSTR)destPath.get(), SE_FILE_OBJECT,
DACL_SECURITY_INFORMATION, DACL_SECURITY_INFORMATION,
NULL, NULL, &pOldDACL, NULL, &pSD); nullptr, nullptr, &pOldDACL, nullptr, &pSD);
if (pOldDACL) if (pOldDACL)
::SetNamedSecurityInfoW((LPWSTR)destPath.get(), SE_FILE_OBJECT, ::SetNamedSecurityInfoW((LPWSTR)destPath.get(), SE_FILE_OBJECT,
DACL_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION |
UNPROTECTED_DACL_SECURITY_INFORMATION, UNPROTECTED_DACL_SECURITY_INFORMATION,
NULL, NULL, pOldDACL, NULL); nullptr, nullptr, pOldDACL, nullptr);
if (pSD) if (pSD)
LocalFree((HLOCAL)pSD); LocalFree((HLOCAL)pSD);
} }
@@ -2336,10 +2338,10 @@ nsLocalFile::SetModDate(PRTime aLastModifiedTime, const PRUnichar *filePath)
HANDLE file = ::CreateFileW(filePath, // pointer to name of the file HANDLE file = ::CreateFileW(filePath, // pointer to name of the file
GENERIC_WRITE, // access (write) mode GENERIC_WRITE, // access (write) mode
0, // share mode 0, // share mode
NULL, // pointer to security attributes nullptr, // pointer to security attributes
OPEN_EXISTING, // how to create OPEN_EXISTING, // how to create
FILE_FLAG_BACKUP_SEMANTICS, // file attributes FILE_FLAG_BACKUP_SEMANTICS, // file attributes
NULL); nullptr);
if (file == INVALID_HANDLE_VALUE) if (file == INVALID_HANDLE_VALUE)
{ {
@@ -2364,7 +2366,7 @@ nsLocalFile::SetModDate(PRTime aLastModifiedTime, const PRUnichar *filePath)
nsresult rv = NS_OK; nsresult rv = NS_OK;
// if at least one of these fails... // if at least one of these fails...
if (!(SystemTimeToFileTime(&st, &ft) != 0 && if (!(SystemTimeToFileTime(&st, &ft) != 0 &&
SetFileTime(file, NULL, &ft, &ft) != 0)) SetFileTime(file, nullptr, &ft, &ft) != 0))
{ {
rv = ConvertWinError(GetLastError()); rv = ConvertWinError(GetLastError());
} }
@@ -2517,10 +2519,10 @@ nsLocalFile::SetFileSize(int64_t aFileSize)
HANDLE hFile = ::CreateFileW(mResolvedPath.get(),// pointer to name of the file HANDLE hFile = ::CreateFileW(mResolvedPath.get(),// pointer to name of the file
GENERIC_WRITE, // access (write) mode GENERIC_WRITE, // access (write) mode
FILE_SHARE_READ, // share mode FILE_SHARE_READ, // share mode
NULL, // pointer to security attributes nullptr, // pointer to security attributes
OPEN_EXISTING, // how to create OPEN_EXISTING, // how to create
FILE_ATTRIBUTE_NORMAL, // file attributes FILE_ATTRIBUTE_NORMAL, // file attributes
NULL); nullptr);
if (hFile == INVALID_HANDLE_VALUE) if (hFile == INVALID_HANDLE_VALUE)
{ {
return ConvertWinError(GetLastError()); return ConvertWinError(GetLastError());
@@ -2560,7 +2562,7 @@ nsLocalFile::GetDiskSpaceAvailable(int64_t *aDiskSpaceAvailable)
ULARGE_INTEGER liFreeBytesAvailableToCaller, liTotalNumberOfBytes; ULARGE_INTEGER liFreeBytesAvailableToCaller, liTotalNumberOfBytes;
if (::GetDiskFreeSpaceExW(mResolvedPath.get(), &liFreeBytesAvailableToCaller, if (::GetDiskFreeSpaceExW(mResolvedPath.get(), &liFreeBytesAvailableToCaller,
&liTotalNumberOfBytes, NULL)) &liTotalNumberOfBytes, nullptr))
{ {
*aDiskSpaceAvailable = liFreeBytesAvailableToCaller.QuadPart; *aDiskSpaceAvailable = liFreeBytesAvailableToCaller.QuadPart;
return NS_OK; return NS_OK;
@@ -3350,8 +3352,8 @@ nsLocalFile::EnsureShortPath()
DWORD lengthNeeded = ::GetShortPathNameW(mWorkingPath.get(), shortPath, DWORD lengthNeeded = ::GetShortPathNameW(mWorkingPath.get(), shortPath,
ArrayLength(shortPath)); ArrayLength(shortPath));
// If an error occurred then lengthNeeded is set to 0 or the length of the // If an error occurred then lengthNeeded is set to 0 or the length of the
// needed buffer including NULL termination. If it succeeds the number of // needed buffer including null termination. If it succeeds the number of
// wide characters not including NULL termination is returned. // wide characters not including null termination is returned.
if (lengthNeeded != 0 && lengthNeeded < ArrayLength(shortPath)) if (lengthNeeded != 0 && lengthNeeded < ArrayLength(shortPath))
mShortWorkingPath.Assign(shortPath); mShortWorkingPath.Assign(shortPath);
else else

View File

@@ -63,7 +63,7 @@ private:
NS_IMPL_ADDREF(nsMultiplexInputStream) NS_IMPL_ADDREF(nsMultiplexInputStream)
NS_IMPL_RELEASE(nsMultiplexInputStream) NS_IMPL_RELEASE(nsMultiplexInputStream)
NS_IMPL_CLASSINFO(nsMultiplexInputStream, NULL, nsIClassInfo::THREADSAFE, NS_IMPL_CLASSINFO(nsMultiplexInputStream, nullptr, nsIClassInfo::THREADSAFE,
NS_MULTIPLEXINPUTSTREAM_CID) NS_MULTIPLEXINPUTSTREAM_CID)
NS_IMPL_QUERY_INTERFACE4_CI(nsMultiplexInputStream, NS_IMPL_QUERY_INTERFACE4_CI(nsMultiplexInputStream,

View File

@@ -139,12 +139,12 @@ xp_iconv(iconv_t converter,
static inline void static inline void
xp_iconv_reset(iconv_t converter) xp_iconv_reset(iconv_t converter)
{ {
// NOTE: the man pages on Solaris claim that you can pass NULL // NOTE: the man pages on Solaris claim that you can pass nullptr
// for all parameter to reset the converter, but beware the // for all parameter to reset the converter, but beware the
// evil Solaris crash if you go down this route >:-) // evil Solaris crash if you go down this route >:-)
const char *zero_char_in_ptr = NULL; const char *zero_char_in_ptr = nullptr;
char *zero_char_out_ptr = NULL; char *zero_char_out_ptr = nullptr;
size_t zero_size_in = 0, size_t zero_size_in = 0,
zero_size_out = 0; zero_size_out = 0;
@@ -216,7 +216,7 @@ static const char *UTF_16_NAMES[] = {
"ucs-2", "ucs-2",
"ucs2", "ucs2",
"ucs_2", "ucs_2",
NULL nullptr
}; };
#if defined(ENABLE_UTF8_FALLBACK_SUPPORT) #if defined(ENABLE_UTF8_FALLBACK_SUPPORT)
@@ -227,7 +227,7 @@ static const char *UTF_8_NAMES[] = {
"utf-8", "utf-8",
"utf8", "utf8",
"utf_8", "utf_8",
NULL nullptr
}; };
#endif #endif
@@ -244,7 +244,7 @@ static const char *ISO_8859_1_NAMES[] = {
"iso_8859_1", "iso_8859_1",
"iso8859_1", "iso8859_1",
#endif #endif
NULL nullptr
}; };
class nsNativeCharsetConverter class nsNativeCharsetConverter
@@ -302,7 +302,7 @@ nsNativeCharsetConverter::LazyInit()
// we are the first to care about the locale's charset. // we are the first to care about the locale's charset.
if (!gLock) if (!gLock)
setlocale(LC_CTYPE, ""); setlocale(LC_CTYPE, "");
const char *blank_list[] = { "", NULL }; const char *blank_list[] = { "", nullptr };
const char **native_charset_list = blank_list; const char **native_charset_list = blank_list;
const char *native_charset = nl_langinfo(CODESET); const char *native_charset = nl_langinfo(CODESET);
if (native_charset == nullptr) { if (native_charset == nullptr) {
@@ -888,7 +888,7 @@ NS_CopyNativeToUnicode(const nsACString &input, nsAString &output)
// determine length of result // determine length of result
uint32_t resultLen = 0; uint32_t resultLen = 0;
int n = ::MultiByteToWideChar(CP_ACP, 0, buf, inputLen, NULL, 0); int n = ::MultiByteToWideChar(CP_ACP, 0, buf, inputLen, nullptr, 0);
if (n > 0) if (n > 0)
resultLen += n; resultLen += n;
@@ -919,7 +919,8 @@ NS_CopyUnicodeToNative(const nsAString &input, nsACString &output)
// determine length of result // determine length of result
uint32_t resultLen = 0; uint32_t resultLen = 0;
int n = ::WideCharToMultiByte(CP_ACP, 0, buf, inputLen, NULL, 0, NULL, NULL); int n = ::WideCharToMultiByte(CP_ACP, 0, buf, inputLen, nullptr, 0,
nullptr, nullptr);
if (n > 0) if (n > 0)
resultLen += n; resultLen += n;
@@ -937,7 +938,7 @@ NS_CopyUnicodeToNative(const nsAString &input, nsACString &output)
char *result = out_iter.get(); char *result = out_iter.get();
::WideCharToMultiByte(CP_ACP, 0, buf, inputLen, result, resultLen, ::WideCharToMultiByte(CP_ACP, 0, buf, inputLen, result, resultLen,
&defaultChar, NULL); &defaultChar, nullptr);
} }
return NS_OK; return NS_OK;
} }
@@ -958,7 +959,7 @@ NS_ConvertWtoA(const PRUnichar *aStrInW, int aBufferSizeOut,
int numCharsConverted = WideCharToMultiByte(CP_ACP, 0, aStrInW, -1, int numCharsConverted = WideCharToMultiByte(CP_ACP, 0, aStrInW, -1,
aStrOutA, aBufferSizeOut, aStrOutA, aBufferSizeOut,
aDefault, NULL); aDefault, nullptr);
if (!numCharsConverted) { if (!numCharsConverted) {
if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) { if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
@@ -993,7 +994,7 @@ NS_ConvertWtoA(const PRUnichar *aStrInW, int aBufferSizeOut,
using namespace mozilla; using namespace mozilla;
static UconvObject UnicodeConverter = NULL; static UconvObject UnicodeConverter = nullptr;
nsresult nsresult
NS_CopyNativeToUnicode(const nsACString &input, nsAString &output) NS_CopyNativeToUnicode(const nsACString &input, nsAString &output)
@@ -1090,7 +1091,7 @@ NS_StartupNativeCharsetUtils()
if (unirc == ULS_SUCCESS) { if (unirc == ULS_SUCCESS) {
uconv_attribute_t attr; uconv_attribute_t attr;
::UniQueryUconvObject(UnicodeConverter, &attr, sizeof(uconv_attribute_t), ::UniQueryUconvObject(UnicodeConverter, &attr, sizeof(uconv_attribute_t),
NULL, NULL, NULL); nullptr, nullptr, nullptr);
attr.options = UCONV_OPTION_SUBSTITUTE_BOTH; attr.options = UCONV_OPTION_SUBSTITUTE_BOTH;
attr.subchar_len=1; attr.subchar_len=1;
attr.subchar[0]='_'; attr.subchar[0]='_';

View File

@@ -81,7 +81,7 @@ private:
NS_IMPL_ADDREF(nsStringInputStream) NS_IMPL_ADDREF(nsStringInputStream)
NS_IMPL_RELEASE(nsStringInputStream) NS_IMPL_RELEASE(nsStringInputStream)
NS_IMPL_CLASSINFO(nsStringInputStream, NULL, nsIClassInfo::THREADSAFE, NS_IMPL_CLASSINFO(nsStringInputStream, nullptr, nsIClassInfo::THREADSAFE,
NS_STRINGINPUTSTREAM_CID) NS_STRINGINPUTSTREAM_CID)
NS_IMPL_QUERY_INTERFACE5_CI(nsStringInputStream, NS_IMPL_QUERY_INTERFACE5_CI(nsStringInputStream,
nsIStringInputStream, nsIStringInputStream,

View File

@@ -168,7 +168,7 @@ _shexp_match(const T *str, const T *expr, bool case_insensitive, unsigned int le
* or stop2 inside it. Return ABORTED if bracketed expression is unterminated. * or stop2 inside it. Return ABORTED if bracketed expression is unterminated.
* Handle all escaping. * Handle all escaping.
* Return index in input string of first stop found, or ABORTED if not found. * Return index in input string of first stop found, or ABORTED if not found.
* If "dest" is non-NULL, copy counted characters to it and NUL terminate. * If "dest" is non-nullptr, copy counted characters to it and null terminate.
*/ */
template<class T> template<class T>
static int static int
@@ -219,7 +219,7 @@ _handle_union(const T *str, const T *expr, bool case_insensitive,
T *e2; T *e2;
/* Find the closing parenthesis that ends this union in the expression */ /* Find the closing parenthesis that ends this union in the expression */
cp = ::_scan_and_copy(expr, T(')'), T('\0'), static_cast<T*>(NULL)); cp = ::_scan_and_copy(expr, T(')'), T('\0'), static_cast<T*>(nullptr));
if (cp == ABORTED || cp < 4) /* must be at least "(a|b" before ')' */ if (cp == ABORTED || cp < 4) /* must be at least "(a|b" before ')' */
return ABORTED; return ABORTED;
++cp; /* now index of char after closing parenthesis */ ++cp; /* now index of char after closing parenthesis */
@@ -383,7 +383,7 @@ template<class T>
static int static int
ns_WildCardMatch(const T *str, const T *xp, bool case_insensitive) ns_WildCardMatch(const T *str, const T *xp, bool case_insensitive)
{ {
T *expr = NULL; T *expr = nullptr;
int x, ret = MATCH; int x, ret = MATCH;
if (!nsCharTraits<T>::find(xp, nsCharTraits<T>::length(xp), T('~'))) if (!nsCharTraits<T>::find(xp, nsCharTraits<T>::length(xp), T('~')))
@@ -394,7 +394,7 @@ ns_WildCardMatch(const T *str, const T *xp, bool case_insensitive)
return NOMATCH; return NOMATCH;
memcpy(expr, xp, (nsCharTraits<T>::length(xp) + 1) * sizeof(T)); memcpy(expr, xp, (nsCharTraits<T>::length(xp) + 1) * sizeof(T));
x = ::_scan_and_copy(expr, T('~'), T('\0'), static_cast<T*>(NULL)); x = ::_scan_and_copy(expr, T('~'), T('\0'), static_cast<T*>(nullptr));
if (x != ABORTED && expr[x] == '~') { if (x != ABORTED && expr[x] == '~') {
expr[x++] = '\0'; expr[x++] = '\0';
ret = ::_shexp_match(str, &expr[x], case_insensitive, 0); ret = ::_shexp_match(str, &expr[x], case_insensitive, 0);