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 4f2da6a7bd
commit 4dce3f3fa6
34 changed files with 171 additions and 165 deletions

View File

@ -380,7 +380,7 @@ public:
* CheckAcquisition This method is called after acquiring |aLast|,
* but before trying to acquire |aProposed| from |aCallContext|.
* 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
* of its current chain.
*

View File

@ -266,7 +266,7 @@ class ScopedMMap
{
public:
ScopedMMap(const char *aFilePath)
: buf(NULL)
: buf(nullptr)
{
fd = open(aFilePath, O_RDONLY);
if (fd < 0) {
@ -277,7 +277,7 @@ public:
return;
}
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()
{
@ -480,8 +480,8 @@ mozilla::ReadAheadFile(mozilla::pathstr_t aFilePath, const size_t aOffset,
}
return;
}
HANDLE fd = CreateFileW(aFilePath, GENERIC_READ, FILE_SHARE_READ,
NULL, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL);
HANDLE fd = CreateFileW(aFilePath, GENERIC_READ, FILE_SHARE_READ, nullptr,
OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, nullptr);
if (aOutFd) {
*aOutFd = fd;
}

View File

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

View File

@ -51,7 +51,7 @@ GenericModule::RegisterSelf(nsIComponentManager* aCompMgr,
{
nsCOMPtr<nsIComponentRegistrar> r = do_QueryInterface(aCompMgr);
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;
e && e->contractid;

View File

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

View File

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

View File

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

View File

@ -41,13 +41,13 @@ char*
NS_strtok(const char *delims, char **str)
{
if (!*str)
return NULL;
return nullptr;
char *ret = (char*) NS_strspnp(delims, *str);
if (!*ret) {
*str = ret;
return NULL;
return nullptr;
}
char *i = ret;
@ -62,7 +62,7 @@ NS_strtok(const char *delims, char **str)
++i;
} while (*i);
*str = NULL;
*str = nullptr;
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
* end-of-string if there are no more tokens.
* @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_strtok(const char *delims, char **str);

View File

@ -43,13 +43,14 @@ public:
/**
* @copydoc nsBaseHashtable::Get
* @returns NULL if the key is not present.
* @returns nullptr if the key is not present.
*/
UserDataType Get(KeyType aKey) const;
/**
* 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,
* 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);
if (!ent)
return NULL;
return nullptr;
return ent->mData;
}

View File

@ -37,14 +37,14 @@ NS_IMETHODIMP
GenericClassInfo::GetContractID(char** contractid)
{
NS_ERROR("GetContractID not implemented");
*contractid = NULL;
*contractid = nullptr;
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
GenericClassInfo::GetClassDescription(char** description)
{
*description = NULL;
*description = nullptr;
return NS_ERROR_NOT_IMPLEMENTED;
}
@ -52,7 +52,7 @@ NS_IMETHODIMP
GenericClassInfo::GetClassID(nsCID** classid)
{
NS_ERROR("GetClassID not implemented");
*classid = NULL;
*classid = nullptr;
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
* like valgrind might get confused about stale references.
*

View File

@ -31,16 +31,16 @@
*
* 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)
*
* 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
* in nsIClassInfo.idl.
*
* The NULL parameter is there so you can pass a function for converting from
* an XPCOM object to a scriptable helper. Unless you're doing specialized JS
* work, you can probably leave this as NULL.
* The nullptr parameter is there so you can pass a function for converting
* from an XPCOM object to a scriptable helper. Unless you're doing
* specialized JS work, you can probably leave this as nullptr.
*
* 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
@ -121,7 +121,7 @@ private:
_cid, \
}; \
mozilla::AlignedStorage2<GenericClassInfo> k##_class##ClassInfoDataPlace; \
nsIClassInfo* NS_CLASSINFO_NAME(_class) = NULL;
nsIClassInfo* NS_CLASSINFO_NAME(_class) = nullptr;
#define NS_IMPL_QUERY_CLASSINFO(_class) \
if ( aIID.Equals(NS_GET_IID(nsIClassInfo)) ) { \

View File

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

View File

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

View File

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

View File

@ -63,7 +63,7 @@ ns_if_addref( T expr )
} /* 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.
*/
#define NS_IF_ADDREF(_expr) ns_if_addref(_expr)
@ -109,7 +109,7 @@ ns_if_addref( T expr )
} 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.
*/
#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
// 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.
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
// holder must be constructed on the main thread.
MOZ_ASSERT(!mStrict || NS_IsMainThread());
@ -165,7 +165,7 @@ class nsMainThreadPtrHandle
nsRefPtr<nsMainThreadPtrHolder<T> > mPtr;
public:
nsMainThreadPtrHandle() : mPtr(NULL) {}
nsMainThreadPtrHandle() : mPtr(nullptr) {}
nsMainThreadPtrHandle(nsMainThreadPtrHolder<T> *aHolder) : mPtr(aHolder) {}
nsMainThreadPtrHandle(const nsMainThreadPtrHandle& aOther) : mPtr(aOther.mPtr) {}
nsMainThreadPtrHandle& operator=(const nsMainThreadPtrHandle& aOther) {

View File

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

View File

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

View File

@ -45,15 +45,15 @@ class NS_COM_GLUE nsTextFormatter {
public:
/*
* sprintf into a fixed size buffer. Guarantees that a NULL is at the end
* of the buffer. Returns the length of the written output, NOT including
* the NUL, or (uint32_t)-1 if an error occurs.
* sprintf into a fixed size buffer. Guarantees that the buffer is null
* terminated. Returns the length of the written output, NOT including the
* null terminator, or (uint32_t)-1 if an error occurs.
*/
static uint32_t snprintf(PRUnichar *out, uint32_t outlen, const PRUnichar *fmt, ...);
/*
* 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, ...);

View File

@ -108,11 +108,11 @@ public:
bool EnumerateBackwards(nsVoidArrayEnumFunc aFunc, void* aData);
// 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.
size_t SizeOfExcludingThis(
nsVoidArraySizeOfElementIncludingThisFunc aSizeOfElementIncludingThis,
mozilla::MallocSizeOf aMallocSizeOf, void* aData = NULL) const;
mozilla::MallocSizeOf aMallocSizeOf, void* aData = nullptr) const;
protected:
bool GrowArrayBy(int32_t aGrowBy);

View File

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

View File

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

View File

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

View File

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

View File

@ -128,8 +128,8 @@ char* nsEscape(const char * str, nsEscapeMask flags)
//----------------------------------------------------------------------------------------
{
if(!str)
return NULL;
return nsEscapeCount(str, flags, NULL);
return nullptr;
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);
} while (*p);
// Result is p or NULL
return *p ? (unsigned char*)p : NULL;
// Result is p or nullptr
return *p ? (unsigned char*)p : nullptr;
}
// Locates the first occurrence of subString in the stringToSearch
@ -142,7 +142,7 @@ _mbsstr(const unsigned char* stringToSearch, const unsigned char* subString)
} while (*pStr);
// 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
@ -158,8 +158,8 @@ _mbsrchr(const unsigned char* stringToSearch, int charToSearchFor)
p = (const unsigned char*)WinPrevChar(0,0,0,(char*)stringToSearch,(char*)p);
} while (p > stringToSearch);
// Result is p or NULL
return (*p == charToSearchFor) ? (unsigned char*)p : NULL;
// Result is p or nullptr
return (*p == charToSearchFor) ? (unsigned char*)p : nullptr;
}
// Implement equivalent of Win32 CreateDirectoryA
@ -563,7 +563,7 @@ nsLocalFile::nsLocalFileConstructor(nsISupports* outer, const nsIID& aIID, void*
NS_ENSURE_NO_AGGREGATION(outer);
nsLocalFile* inst = new nsLocalFile();
if (inst == NULL)
if (inst == nullptr)
return NS_ERROR_OUT_OF_MEMORY;
nsresult rv = inst->QueryInterface(aIID, aInstancePtr);
@ -765,7 +765,7 @@ nsLocalFile::Create(uint32_t type, uint32_t attributes)
{
*slash = '\0';
rv = CreateDirectoryA(const_cast<char*>(mWorkingPath.get()), NULL);
rv = CreateDirectoryA(const_cast<char*>(mWorkingPath.get()), nullptr);
if (rv) {
rv = ConvertOS2Error(rv);
if (rv != NS_ERROR_FILE_ALREADY_EXISTS)
@ -789,7 +789,7 @@ nsLocalFile::Create(uint32_t type, uint32_t attributes)
if (type == DIRECTORY_TYPE)
{
rv = CreateDirectoryA(const_cast<char*>(mWorkingPath.get()), NULL);
rv = CreateDirectoryA(const_cast<char*>(mWorkingPath.get()), nullptr);
if (rv)
return ConvertOS2Error(rv);
else
@ -1391,8 +1391,8 @@ nsLocalFile::CopySingleFile(nsIFile *sourceFile, nsIFile *destParent,
strcat(achProgram, """");
achProgram[strlen(achProgram) + 1] = '\0';
achProgram[7] = '\0';
DosExecPgm(NULL, 0,
EXEC_SYNC, achProgram, (PSZ)NULL,
DosExecPgm(nullptr, 0,
EXEC_SYNC, achProgram, (PSZ)nullptr,
&rescResults, achProgram);
rc = 0; // Assume it worked
@ -1909,7 +1909,7 @@ nsLocalFile::SetFileSize(int64_t aFileSize)
FILE_NORMAL,
OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS,
OPEN_SHARE_DENYREADWRITE | OPEN_ACCESS_READWRITE,
NULL);
nullptr);
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);
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,' ');
if(p_dev)
p_dev++;
@ -2030,7 +2030,7 @@ static nsresult CFStringReftoUTF8(CFStringRef aInStrRef, nsACString& aOutStr)
CFIndex usedBufLen, inStrLen = ::CFStringGetLength(aInStrRef);
CFIndex charsConverted = ::CFStringGetBytes(aInStrRef, CFRangeMake(0, inStrLen),
kCFStringEncodingUTF8, 0, false,
NULL, 0, &usedBufLen);
nullptr, 0, &usedBufLen);
if (charsConverted == inStrLen) {
// all characters converted, do the actual conversion
aOutStr.SetLength(usedBufLen);
@ -2094,7 +2094,7 @@ nsLocalFile::GetFSRef(FSRef *_retval)
nsresult rv = NS_ERROR_FAILURE;
CFURLRef url = NULL;
CFURLRef url = nullptr;
if (NS_SUCCEEDED(GetCFURL(&url))) {
if (::CFURLGetFSRef(url, _retval)) {
rv = NS_OK;
@ -2224,7 +2224,7 @@ nsLocalFile::LaunchWithDoc(nsIFile *aDocToLoad, bool aLaunchInBackground)
}
thelaunchSpec.launchFlags = theLaunchFlags;
OSErr err = ::LSOpenFromRefSpec(&thelaunchSpec, NULL);
OSErr err = ::LSOpenFromRefSpec(&thelaunchSpec, nullptr);
if (err != noErr)
return MacErrorMapper(err);
@ -2240,7 +2240,7 @@ nsLocalFile::OpenDocWithApp(nsIFile *aAppToOpenWith, bool aLaunchInBackground)
return rv;
if (!aAppToOpenWith) {
OSErr err = ::LSOpenFSRef(&docFSRef, NULL);
OSErr err = ::LSOpenFSRef(&docFSRef, nullptr);
return MacErrorMapper(err);
}
@ -2272,7 +2272,7 @@ nsLocalFile::OpenDocWithApp(nsIFile *aAppToOpenWith, bool aLaunchInBackground)
thelaunchSpec.itemRefs = &docFSRef;
thelaunchSpec.launchFlags = theLaunchFlags;
OSErr err = ::LSOpenFromRefSpec(&thelaunchSpec, NULL);
OSErr err = ::LSOpenFromRefSpec(&thelaunchSpec, nullptr);
if (err != noErr)
return MacErrorMapper(err);
@ -2336,7 +2336,7 @@ nsLocalFile::GetBundleIdentifier(nsACString& outBundleIdentifier)
CFURLRef urlRef;
if (NS_SUCCEEDED(GetCFURL(&urlRef))) {
CFBundleRef bundle = ::CFBundleCreate(NULL, urlRef);
CFBundleRef bundle = ::CFBundleCreate(nullptr, urlRef);
if (bundle) {
CFStringRef bundleIdentifier = ::CFBundleGetIdentifier(bundle);
if (bundleIdentifier)

View File

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

View File

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

View File

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

View File

@ -81,7 +81,7 @@ private:
NS_IMPL_ADDREF(nsStringInputStream)
NS_IMPL_RELEASE(nsStringInputStream)
NS_IMPL_CLASSINFO(nsStringInputStream, NULL, nsIClassInfo::THREADSAFE,
NS_IMPL_CLASSINFO(nsStringInputStream, nullptr, nsIClassInfo::THREADSAFE,
NS_STRINGINPUTSTREAM_CID)
NS_IMPL_QUERY_INTERFACE5_CI(nsStringInputStream,
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.
* Handle all escaping.
* 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>
static int
@ -219,7 +219,7 @@ _handle_union(const T *str, const T *expr, bool case_insensitive,
T *e2;
/* 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 ')' */
return ABORTED;
++cp; /* now index of char after closing parenthesis */
@ -383,7 +383,7 @@ template<class T>
static int
ns_WildCardMatch(const T *str, const T *xp, bool case_insensitive)
{
T *expr = NULL;
T *expr = nullptr;
int x, ret = MATCH;
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;
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] == '~') {
expr[x++] = '\0';
ret = ::_shexp_match(str, &expr[x], case_insensitive, 0);