Bug 2041298 - Comply with clang-tidy's modernize-use-nullptr check for xpcom/ r=xpcom-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D301767
This commit is contained in:
committed by
sguelton@mozilla.com
parent
205ac921e2
commit
fac0f5e1a8
@@ -314,7 +314,7 @@ already_AddRefed<nsAvailableMemoryWatcherBase> CreateAvailableMemoryWatcher() {
|
||||
// level crash report annotations.
|
||||
void nsAvailableMemoryWatcher::UpdateParentAnnotations() {
|
||||
// Generate a string representation of the current Unix time.
|
||||
time_t timeChanged = time(NULL);
|
||||
time_t timeChanged = time(nullptr);
|
||||
nsAutoCString timeChangedString;
|
||||
timeChangedString =
|
||||
nsPrintfCString("%" PRIu64, static_cast<uint64_t>(timeChanged));
|
||||
@@ -365,8 +365,8 @@ void nsAvailableMemoryWatcher::ReadSysctls() {
|
||||
// Pressure level
|
||||
uint32_t level;
|
||||
size_t size = sizeof(level);
|
||||
if (sysctlbyname("kern.memorystatus_vm_pressure_level", &level, &size, NULL,
|
||||
0) == -1) {
|
||||
if (sysctlbyname("kern.memorystatus_vm_pressure_level", &level, &size,
|
||||
nullptr, 0) == -1) {
|
||||
MP_LOG("Failure reading memory pressure sysctl");
|
||||
NS_WARNING("Failure reading memory pressure sysctl");
|
||||
level = kSysctlLevelNormal;
|
||||
@@ -376,8 +376,8 @@ void nsAvailableMemoryWatcher::ReadSysctls() {
|
||||
// Available memory percent
|
||||
int availPercent;
|
||||
size = sizeof(availPercent);
|
||||
if (sysctlbyname("kern.memorystatus_level", &availPercent, &size, NULL, 0) ==
|
||||
-1) {
|
||||
if (sysctlbyname("kern.memorystatus_level", &availPercent, &size, nullptr,
|
||||
0) == -1) {
|
||||
MP_LOG("Failure reading available memory level");
|
||||
NS_WARNING("Failure reading available memory level");
|
||||
availPercent = 50;
|
||||
|
||||
@@ -21,7 +21,7 @@ nsresult nsGetInterface::operator()(const nsIID& aIID,
|
||||
}
|
||||
|
||||
if (NS_FAILED(status)) {
|
||||
*aInstancePtr = 0;
|
||||
*aInstancePtr = nullptr;
|
||||
}
|
||||
if (mErrorPtr) {
|
||||
*mErrorPtr = status;
|
||||
|
||||
@@ -31,7 +31,7 @@ class MOZ_STACK_CLASS nsGetInterface final : public nsCOMPtr_helper {
|
||||
};
|
||||
|
||||
inline const nsGetInterface do_GetInterface(nsISupports* aSource,
|
||||
nsresult* aError = 0) {
|
||||
nsresult* aError = nullptr) {
|
||||
return nsGetInterface(aSource, aError);
|
||||
}
|
||||
|
||||
|
||||
@@ -194,7 +194,8 @@ bool nsMacUtilsImpl::IsTCSMAvailable() {
|
||||
if (sTCSMStatus == TCSM_Unknown) {
|
||||
uint32_t oldVal = 0;
|
||||
size_t oldValSize = sizeof(oldVal);
|
||||
int rv = sysctlbyname("kern.tcsm_available", &oldVal, &oldValSize, NULL, 0);
|
||||
int rv =
|
||||
sysctlbyname("kern.tcsm_available", &oldVal, &oldValSize, nullptr, 0);
|
||||
TCSMStatus newStatus;
|
||||
if (rv < 0 || oldVal == 0) {
|
||||
newStatus = TCSM_Unavailable;
|
||||
@@ -213,7 +214,8 @@ bool nsMacUtilsImpl::IsTCSMAvailable() {
|
||||
|
||||
static nsresult EnableTCSM() {
|
||||
uint32_t newVal = 1;
|
||||
int rv = sysctlbyname("kern.tcsm_enable", NULL, 0, &newVal, sizeof(newVal));
|
||||
int rv = sysctlbyname("kern.tcsm_enable", nullptr, nullptr, &newVal,
|
||||
sizeof(newVal));
|
||||
if (rv < 0) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
@@ -224,7 +226,7 @@ static nsresult EnableTCSM() {
|
||||
static bool IsTCSMEnabled() {
|
||||
uint32_t oldVal = 0;
|
||||
size_t oldValSize = sizeof(oldVal);
|
||||
int rv = sysctlbyname("kern.tcsm_enable", &oldVal, &oldValSize, NULL, 0);
|
||||
int rv = sysctlbyname("kern.tcsm_enable", &oldVal, &oldValSize, nullptr, 0);
|
||||
return (rv == 0) && (oldVal != 0);
|
||||
}
|
||||
#endif
|
||||
@@ -249,7 +251,7 @@ void nsMacUtilsImpl::EnableTCSMIfAvailable() {
|
||||
uint32_t nsMacUtilsImpl::GetPhysicalCPUCount() {
|
||||
uint32_t oldVal = 0;
|
||||
size_t oldValSize = sizeof(oldVal);
|
||||
int rv = sysctlbyname("hw.physicalcpu_max", &oldVal, &oldValSize, NULL, 0);
|
||||
int rv = sysctlbyname("hw.physicalcpu_max", &oldVal, &oldValSize, nullptr, 0);
|
||||
if (rv == -1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -470,7 +470,7 @@ static bool InSharedRegion(mach_vm_address_t aAddr, cpu_type_t aType) {
|
||||
|
||||
cpu_type_t cpu_type;
|
||||
size_t len = sizeof(cpu_type);
|
||||
if (sysctlbyname("sysctl.proc_cputype", &cpu_type, &len, NULL, 0) != 0) {
|
||||
if (sysctlbyname("sysctl.proc_cputype", &cpu_type, &len, nullptr, 0) != 0) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
+14
-13
@@ -558,7 +558,7 @@ static nsresult ProcessIsRosettaTranslated(bool& isRosetta) {
|
||||
# else
|
||||
int ret = 0;
|
||||
size_t size = sizeof(ret);
|
||||
if (sysctlbyname("sysctl.proc_translated", &ret, &size, NULL, 0) == -1) {
|
||||
if (sysctlbyname("sysctl.proc_translated", &ret, &size, nullptr, 0) == -1) {
|
||||
if (errno != ENOENT) {
|
||||
fprintf(stderr, "Failed to check for translation environment\n");
|
||||
}
|
||||
@@ -776,65 +776,66 @@ nsresult CollectProcessInfo(ProcessInfo& info) {
|
||||
uint32_t sysctlValue32 = 0;
|
||||
size_t len = 0;
|
||||
len = sizeof(sysctlValue64);
|
||||
if (!sysctlbyname("hw.cpufrequency_max", &sysctlValue64, &len, NULL, 0)) {
|
||||
if (!sysctlbyname("hw.cpufrequency_max", &sysctlValue64, &len, nullptr, 0)) {
|
||||
cpuSpeed = static_cast<int>(sysctlValue64 / 1000000);
|
||||
}
|
||||
MOZ_ASSERT(sizeof(sysctlValue64) == len);
|
||||
|
||||
len = sizeof(sysctlValue32);
|
||||
if (!sysctlbyname("hw.physicalcpu_max", &sysctlValue32, &len, NULL, 0)) {
|
||||
if (!sysctlbyname("hw.physicalcpu_max", &sysctlValue32, &len, nullptr, 0)) {
|
||||
physicalCPUs = static_cast<int>(sysctlValue32);
|
||||
}
|
||||
MOZ_ASSERT(sizeof(sysctlValue32) == len);
|
||||
|
||||
len = sizeof(sysctlValue32);
|
||||
if (!sysctlbyname("hw.logicalcpu_max", &sysctlValue32, &len, NULL, 0)) {
|
||||
if (!sysctlbyname("hw.logicalcpu_max", &sysctlValue32, &len, nullptr, 0)) {
|
||||
logicalCPUs = static_cast<int>(sysctlValue32);
|
||||
}
|
||||
MOZ_ASSERT(sizeof(sysctlValue32) == len);
|
||||
|
||||
len = sizeof(sysctlValue64);
|
||||
if (!sysctlbyname("hw.l2cachesize", &sysctlValue64, &len, NULL, 0)) {
|
||||
if (!sysctlbyname("hw.l2cachesize", &sysctlValue64, &len, nullptr, 0)) {
|
||||
cacheSizeL2 = static_cast<int>(sysctlValue64 / 1024);
|
||||
}
|
||||
MOZ_ASSERT(sizeof(sysctlValue64) == len);
|
||||
|
||||
len = sizeof(sysctlValue64);
|
||||
if (!sysctlbyname("hw.l3cachesize", &sysctlValue64, &len, NULL, 0)) {
|
||||
if (!sysctlbyname("hw.l3cachesize", &sysctlValue64, &len, nullptr, 0)) {
|
||||
cacheSizeL3 = static_cast<int>(sysctlValue64 / 1024);
|
||||
}
|
||||
MOZ_ASSERT(sizeof(sysctlValue64) == len);
|
||||
|
||||
if (!sysctlbyname("machdep.cpu.vendor", NULL, &len, NULL, 0)) {
|
||||
if (!sysctlbyname("machdep.cpu.vendor", nullptr, &len, nullptr, 0)) {
|
||||
char* cpuVendorStr = new char[len];
|
||||
if (!sysctlbyname("machdep.cpu.vendor", cpuVendorStr, &len, NULL, 0)) {
|
||||
if (!sysctlbyname("machdep.cpu.vendor", cpuVendorStr, &len, nullptr, 0)) {
|
||||
cpuVendor = cpuVendorStr;
|
||||
}
|
||||
delete[] cpuVendorStr;
|
||||
}
|
||||
|
||||
if (!sysctlbyname("machdep.cpu.brand_string", NULL, &len, NULL, 0)) {
|
||||
if (!sysctlbyname("machdep.cpu.brand_string", nullptr, &len, nullptr, 0)) {
|
||||
char* cpuNameStr = new char[len];
|
||||
if (!sysctlbyname("machdep.cpu.brand_string", cpuNameStr, &len, NULL, 0)) {
|
||||
if (!sysctlbyname("machdep.cpu.brand_string", cpuNameStr, &len, nullptr,
|
||||
0)) {
|
||||
cpuName = cpuNameStr;
|
||||
}
|
||||
delete[] cpuNameStr;
|
||||
}
|
||||
|
||||
len = sizeof(sysctlValue32);
|
||||
if (!sysctlbyname("machdep.cpu.family", &sysctlValue32, &len, NULL, 0)) {
|
||||
if (!sysctlbyname("machdep.cpu.family", &sysctlValue32, &len, nullptr, 0)) {
|
||||
cpuFamily = static_cast<int>(sysctlValue32);
|
||||
}
|
||||
MOZ_ASSERT(sizeof(sysctlValue32) == len);
|
||||
|
||||
len = sizeof(sysctlValue32);
|
||||
if (!sysctlbyname("machdep.cpu.model", &sysctlValue32, &len, NULL, 0)) {
|
||||
if (!sysctlbyname("machdep.cpu.model", &sysctlValue32, &len, nullptr, 0)) {
|
||||
cpuModel = static_cast<int>(sysctlValue32);
|
||||
}
|
||||
MOZ_ASSERT(sizeof(sysctlValue32) == len);
|
||||
|
||||
len = sizeof(sysctlValue32);
|
||||
if (!sysctlbyname("machdep.cpu.stepping", &sysctlValue32, &len, NULL, 0)) {
|
||||
if (!sysctlbyname("machdep.cpu.stepping", &sysctlValue32, &len, nullptr, 0)) {
|
||||
cpuStepping = static_cast<int>(sysctlValue32);
|
||||
}
|
||||
MOZ_ASSERT(sizeof(sysctlValue32) == len);
|
||||
|
||||
@@ -224,7 +224,7 @@ static wchar_t* ParseVP(wchar_t* aPart, VersionPartW& aResult) {
|
||||
static int32_t ns_strcmp(const char* aStr1, const char* aStr2) {
|
||||
// any string is *before* no string
|
||||
if (!aStr1) {
|
||||
return aStr2 != 0;
|
||||
return aStr2 != nullptr;
|
||||
}
|
||||
|
||||
if (!aStr2) {
|
||||
@@ -239,7 +239,7 @@ static int32_t ns_strnncmp(const char* aStr1, uint32_t aLen1, const char* aStr2,
|
||||
uint32_t aLen2) {
|
||||
// any string is *before* no string
|
||||
if (!aStr1) {
|
||||
return aStr2 != 0;
|
||||
return aStr2 != nullptr;
|
||||
}
|
||||
|
||||
if (!aStr2) {
|
||||
@@ -315,7 +315,7 @@ static int32_t CompareVP(VersionPartW& aVer1, VersionPartW& aVer2) {
|
||||
}
|
||||
|
||||
if (!aVer1.extraD) {
|
||||
return aVer2.extraD != 0;
|
||||
return aVer2.extraD != nullptr;
|
||||
}
|
||||
|
||||
if (!aVer2.extraD) {
|
||||
|
||||
@@ -45,7 +45,7 @@ nsresult nsQueryReferent::operator()(const nsIID& aIID, void** aAnswer) const {
|
||||
nsresult status;
|
||||
if (mWeakPtr) {
|
||||
if (NS_FAILED(status = mWeakPtr->QueryReferent(aIID, aAnswer))) {
|
||||
*aAnswer = 0;
|
||||
*aAnswer = nullptr;
|
||||
}
|
||||
} else {
|
||||
status = NS_ERROR_NULL_POINTER;
|
||||
|
||||
@@ -15,7 +15,7 @@ class nsWeakReference;
|
||||
|
||||
class nsSupportsWeakReference : public nsISupportsWeakReference {
|
||||
public:
|
||||
nsSupportsWeakReference() : mProxy(0) {}
|
||||
nsSupportsWeakReference() : mProxy(nullptr) {}
|
||||
|
||||
NS_DECL_NSISUPPORTSWEAKREFERENCE
|
||||
|
||||
|
||||
@@ -196,7 +196,7 @@ struct FuncData {
|
||||
// Wrap aio_write. We have not seen it before, so just assert/report it.
|
||||
typedef ssize_t (*aio_write_t)(struct aiocb* aAioCbp);
|
||||
ssize_t wrap_aio_write(struct aiocb* aAioCbp);
|
||||
FuncData aio_write_data = {0, (void*)wrap_aio_write, (void*)aio_write};
|
||||
FuncData aio_write_data = {nullptr, (void*)wrap_aio_write, (void*)aio_write};
|
||||
ssize_t wrap_aio_write(struct aiocb* aAioCbp) {
|
||||
MacIOAutoObservation timer(mozilla::IOInterposeObserver::OpWrite,
|
||||
aAioCbp->aio_fildes);
|
||||
|
||||
@@ -154,7 +154,7 @@ nsresult nsCreateInstanceByCID::operator()(const nsIID& aIID,
|
||||
void** aInstancePtr) const {
|
||||
nsresult status = CallCreateInstance(mCID, aIID, aInstancePtr);
|
||||
if (NS_FAILED(status)) {
|
||||
*aInstancePtr = 0;
|
||||
*aInstancePtr = nullptr;
|
||||
}
|
||||
if (mErrorPtr) {
|
||||
*mErrorPtr = status;
|
||||
@@ -166,7 +166,7 @@ nsresult nsCreateInstanceByContractID::operator()(const nsIID& aIID,
|
||||
void** aInstancePtr) const {
|
||||
nsresult status = CallCreateInstance(mContractID, aIID, aInstancePtr);
|
||||
if (NS_FAILED(status)) {
|
||||
*aInstancePtr = 0;
|
||||
*aInstancePtr = nullptr;
|
||||
}
|
||||
if (mErrorPtr) {
|
||||
*mErrorPtr = status;
|
||||
@@ -178,7 +178,7 @@ nsresult nsCreateInstanceFromFactory::operator()(const nsIID& aIID,
|
||||
void** aInstancePtr) const {
|
||||
nsresult status = mFactory->CreateInstance(aIID, aInstancePtr);
|
||||
if (NS_FAILED(status)) {
|
||||
*aInstancePtr = 0;
|
||||
*aInstancePtr = nullptr;
|
||||
}
|
||||
if (mErrorPtr) {
|
||||
*mErrorPtr = status;
|
||||
@@ -190,7 +190,7 @@ nsresult nsGetClassObjectByCID::operator()(const nsIID& aIID,
|
||||
void** aInstancePtr) const {
|
||||
nsresult status = CallGetClassObject(mCID, aIID, aInstancePtr);
|
||||
if (NS_FAILED(status)) {
|
||||
*aInstancePtr = 0;
|
||||
*aInstancePtr = nullptr;
|
||||
}
|
||||
if (mErrorPtr) {
|
||||
*mErrorPtr = status;
|
||||
@@ -202,7 +202,7 @@ nsresult nsGetClassObjectByContractID::operator()(const nsIID& aIID,
|
||||
void** aInstancePtr) const {
|
||||
nsresult status = CallGetClassObject(mContractID, aIID, aInstancePtr);
|
||||
if (NS_FAILED(status)) {
|
||||
*aInstancePtr = 0;
|
||||
*aInstancePtr = nullptr;
|
||||
}
|
||||
if (mErrorPtr) {
|
||||
*mErrorPtr = status;
|
||||
@@ -214,7 +214,7 @@ nsresult nsGetServiceByCID::operator()(const nsIID& aIID,
|
||||
void** aInstancePtr) const {
|
||||
nsresult status = CallGetService(mCID, aIID, aInstancePtr);
|
||||
if (NS_FAILED(status)) {
|
||||
*aInstancePtr = 0;
|
||||
*aInstancePtr = nullptr;
|
||||
}
|
||||
|
||||
return status;
|
||||
@@ -224,7 +224,7 @@ nsresult nsGetServiceByCIDWithError::operator()(const nsIID& aIID,
|
||||
void** aInstancePtr) const {
|
||||
nsresult status = CallGetService(mCID, aIID, aInstancePtr);
|
||||
if (NS_FAILED(status)) {
|
||||
*aInstancePtr = 0;
|
||||
*aInstancePtr = nullptr;
|
||||
}
|
||||
|
||||
if (mErrorPtr) {
|
||||
@@ -237,7 +237,7 @@ nsresult nsGetServiceByContractID::operator()(const nsIID& aIID,
|
||||
void** aInstancePtr) const {
|
||||
nsresult status = CallGetService(mContractID, aIID, aInstancePtr);
|
||||
if (NS_FAILED(status)) {
|
||||
*aInstancePtr = 0;
|
||||
*aInstancePtr = nullptr;
|
||||
}
|
||||
|
||||
return status;
|
||||
@@ -247,7 +247,7 @@ nsresult nsGetServiceByContractIDWithError::operator()(
|
||||
const nsIID& aIID, void** aInstancePtr) const {
|
||||
nsresult status = CallGetService(mContractID, aIID, aInstancePtr);
|
||||
if (NS_FAILED(status)) {
|
||||
*aInstancePtr = 0;
|
||||
*aInstancePtr = nullptr;
|
||||
}
|
||||
|
||||
if (mErrorPtr) {
|
||||
|
||||
@@ -34,7 +34,7 @@ class nsSimpleArrayEnumerator final : public nsSimpleEnumerator {
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSimpleArrayEnumerator::HasMoreElements(bool* aResult) {
|
||||
MOZ_ASSERT(aResult != 0, "null ptr");
|
||||
MOZ_ASSERT(aResult != nullptr, "null ptr");
|
||||
if (!aResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
@@ -55,7 +55,7 @@ nsSimpleArrayEnumerator::HasMoreElements(bool* aResult) {
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSimpleArrayEnumerator::GetNext(nsISupports** aResult) {
|
||||
MOZ_ASSERT(aResult != 0, "null ptr");
|
||||
MOZ_ASSERT(aResult != nullptr, "null ptr");
|
||||
if (!aResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
@@ -134,7 +134,7 @@ nsCOMArrayEnumerator::~nsCOMArrayEnumerator() {
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCOMArrayEnumerator::HasMoreElements(bool* aResult) {
|
||||
MOZ_ASSERT(aResult != 0, "null ptr");
|
||||
MOZ_ASSERT(aResult != nullptr, "null ptr");
|
||||
if (!aResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
@@ -145,7 +145,7 @@ nsCOMArrayEnumerator::HasMoreElements(bool* aResult) {
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCOMArrayEnumerator::GetNext(nsISupports** aResult) {
|
||||
MOZ_ASSERT(aResult != 0, "null ptr");
|
||||
MOZ_ASSERT(aResult != nullptr, "null ptr");
|
||||
if (!aResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
@@ -23,9 +23,8 @@ class MOZ_STACK_CLASS nsQueryArrayElementAt final : public nsCOMPtr_helper {
|
||||
nsresult* mErrorPtr;
|
||||
};
|
||||
|
||||
inline const nsQueryArrayElementAt do_QueryElementAt(nsIArray* aArray,
|
||||
uint32_t aIndex,
|
||||
nsresult* aErrorPtr = 0) {
|
||||
inline const nsQueryArrayElementAt do_QueryElementAt(
|
||||
nsIArray* aArray, uint32_t aIndex, nsresult* aErrorPtr = nullptr) {
|
||||
return nsQueryArrayElementAt(aArray, aIndex, aErrorPtr);
|
||||
}
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ nsSingletonEnumerator::~nsSingletonEnumerator() = default;
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSingletonEnumerator::HasMoreElements(bool* aResult) {
|
||||
MOZ_ASSERT(aResult != 0, "null ptr");
|
||||
MOZ_ASSERT(aResult != nullptr, "null ptr");
|
||||
if (!aResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
@@ -116,7 +116,7 @@ nsSingletonEnumerator::HasMoreElements(bool* aResult) {
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSingletonEnumerator::GetNext(nsISupports** aResult) {
|
||||
MOZ_ASSERT(aResult != 0, "null ptr");
|
||||
MOZ_ASSERT(aResult != nullptr, "null ptr");
|
||||
if (!aResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
@@ -170,7 +170,7 @@ nsUnionEnumerator::~nsUnionEnumerator() = default;
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsUnionEnumerator::HasMoreElements(bool* aResult) {
|
||||
MOZ_ASSERT(aResult != 0, "null ptr");
|
||||
MOZ_ASSERT(aResult != nullptr, "null ptr");
|
||||
if (!aResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
@@ -211,7 +211,7 @@ nsUnionEnumerator::HasMoreElements(bool* aResult) {
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsUnionEnumerator::GetNext(nsISupports** aResult) {
|
||||
MOZ_ASSERT(aResult != 0, "null ptr");
|
||||
MOZ_ASSERT(aResult != nullptr, "null ptr");
|
||||
if (!aResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
@@ -267,7 +267,7 @@ nsresult nsGetProperty::operator()(const nsIID& aIID,
|
||||
rv = mPropBag->GetPropertyAsInterface(mPropName, aIID, aInstancePtr);
|
||||
} else {
|
||||
rv = NS_ERROR_NULL_POINTER;
|
||||
*aInstancePtr = 0;
|
||||
*aInstancePtr = nullptr;
|
||||
}
|
||||
|
||||
if (mErrorPtr) {
|
||||
|
||||
@@ -161,7 +161,7 @@ void AddOriginMetadataToFile(const CFStringRef filePath,
|
||||
|
||||
typedef OSStatus (*MDItemSetAttribute_type)(MDItemRef, CFStringRef,
|
||||
CFTypeRef);
|
||||
static MDItemSetAttribute_type mdItemSetAttributeFunc = NULL;
|
||||
static MDItemSetAttribute_type mdItemSetAttributeFunc = nullptr;
|
||||
|
||||
static bool did_symbol_lookup = false;
|
||||
if (!did_symbol_lookup) {
|
||||
@@ -181,12 +181,13 @@ void AddOriginMetadataToFile(const CFStringRef filePath,
|
||||
return;
|
||||
}
|
||||
|
||||
MDItemRef mdItem = ::MDItemCreate(NULL, filePath);
|
||||
MDItemRef mdItem = ::MDItemCreate(nullptr, filePath);
|
||||
if (!mdItem) {
|
||||
return;
|
||||
}
|
||||
|
||||
CFMutableArrayRef list = ::CFArrayCreateMutable(kCFAllocatorDefault, 2, NULL);
|
||||
CFMutableArrayRef list =
|
||||
::CFArrayCreateMutable(kCFAllocatorDefault, 2, nullptr);
|
||||
if (!list) {
|
||||
::CFRelease(mdItem);
|
||||
return;
|
||||
@@ -213,25 +214,25 @@ static CFMutableDictionaryRef CreateQuarantineDictionary(
|
||||
const CFURLRef aFileURL, const bool aCreateProps) {
|
||||
nsAutoreleasePool localPool;
|
||||
|
||||
CFDictionaryRef quarantineProps = NULL;
|
||||
CFDictionaryRef quarantineProps = nullptr;
|
||||
if (aCreateProps) {
|
||||
quarantineProps = ::CFDictionaryCreate(NULL, NULL, NULL, 0,
|
||||
quarantineProps = ::CFDictionaryCreate(nullptr, nullptr, nullptr, 0,
|
||||
&kCFTypeDictionaryKeyCallBacks,
|
||||
&kCFTypeDictionaryValueCallBacks);
|
||||
} else {
|
||||
Boolean success = ::CFURLCopyResourcePropertyForKey(
|
||||
aFileURL, kCFURLQuarantinePropertiesKey, &quarantineProps, NULL);
|
||||
aFileURL, kCFURLQuarantinePropertiesKey, &quarantineProps, nullptr);
|
||||
// If there aren't any quarantine properties then the user probably
|
||||
// set up an exclusion and we don't need to add metadata.
|
||||
if (!success || !quarantineProps) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
// We don't know what to do if the props aren't a dictionary.
|
||||
if (::CFGetTypeID(quarantineProps) != ::CFDictionaryGetTypeID()) {
|
||||
::CFRelease(quarantineProps);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Make a mutable copy of the properties.
|
||||
@@ -282,7 +283,7 @@ void AddQuarantineMetadataToFile(const CFStringRef filePath,
|
||||
|
||||
// Set quarantine properties on file.
|
||||
::CFURLSetResourcePropertyForKey(fileURL, kCFURLQuarantinePropertiesKey,
|
||||
mutQuarantineProps, NULL);
|
||||
mutQuarantineProps, nullptr);
|
||||
|
||||
::CFRelease(fileURL);
|
||||
::CFRelease(mutQuarantineProps);
|
||||
|
||||
@@ -1996,9 +1996,9 @@ nsLocalFile::IsExecutable(bool* aResult) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
CFBooleanRef isApp = NULL;
|
||||
CFBooleanRef isApp = nullptr;
|
||||
*aResult = ::CFURLCopyResourcePropertyForKey(url, kCFURLIsApplicationKey,
|
||||
&isApp, NULL) &&
|
||||
&isApp, nullptr) &&
|
||||
(isApp == kCFBooleanTrue);
|
||||
::CFRelease(url);
|
||||
if (isApp) {
|
||||
|
||||
@@ -779,7 +779,7 @@ static nsresult ReadDir(nsDir* aDir, PRDirFlags aFlags, nsString& aName) {
|
||||
rv = ::FindNextFileW(aDir->handle, &(aDir->data));
|
||||
}
|
||||
|
||||
if (rv == 0) {
|
||||
if (!rv) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -130,8 +130,8 @@ nsStorageStream::Close() {
|
||||
mSegmentedBuffer->ReallocLastSegment(segmentOffset);
|
||||
}
|
||||
|
||||
mWriteCursor = 0;
|
||||
mSegmentEnd = 0;
|
||||
mWriteCursor = nullptr;
|
||||
mSegmentEnd = nullptr;
|
||||
|
||||
LOG(("nsStorageStream [%p] Close mWriteCursor=%p mSegmentEnd=%p\n", this,
|
||||
mWriteCursor, mSegmentEnd));
|
||||
@@ -199,7 +199,7 @@ nsStorageStream::Write(const char* aBuffer, uint32_t aCount,
|
||||
if (!availableInSegment) {
|
||||
mWriteCursor = mSegmentedBuffer->AppendNewSegment();
|
||||
if (!mWriteCursor) {
|
||||
mSegmentEnd = 0;
|
||||
mSegmentEnd = nullptr;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
mLastSegmentNum++;
|
||||
@@ -326,8 +326,8 @@ nsresult nsStorageStream::Seek(int32_t aPosition) {
|
||||
|
||||
// Special handling for seek to start-of-buffer
|
||||
if (aPosition == 0) {
|
||||
mWriteCursor = 0;
|
||||
mSegmentEnd = 0;
|
||||
mWriteCursor = nullptr;
|
||||
mSegmentEnd = nullptr;
|
||||
LOG(("nsStorageStream [%p] Seek mWriteCursor=%p mSegmentEnd=%p\n", this,
|
||||
mWriteCursor, mSegmentEnd));
|
||||
return NS_OK;
|
||||
|
||||
@@ -350,7 +350,7 @@ class nsTSubstring : public mozilla::detail::nsTStringRepr<T> {
|
||||
}
|
||||
|
||||
iterator BeginWriting(const fallible_t&) {
|
||||
return EnsureMutable() ? base_string_type::mData : iterator(0);
|
||||
return EnsureMutable() ? base_string_type::mData : iterator(nullptr);
|
||||
}
|
||||
|
||||
iterator EndWriting() {
|
||||
@@ -364,7 +364,7 @@ class nsTSubstring : public mozilla::detail::nsTStringRepr<T> {
|
||||
iterator EndWriting(const fallible_t&) {
|
||||
return EnsureMutable()
|
||||
? (base_string_type::mData + base_string_type::mLength)
|
||||
: iterator(0);
|
||||
: iterator(nullptr);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -829,8 +829,8 @@ void nsTextFormatter::vssprintf(nsAString& aOut, const char16_t* aFmt,
|
||||
mozilla::Span<BoxedValue> aValues) {
|
||||
SprintfStateStr ss;
|
||||
ss.stuff = StringStuff;
|
||||
ss.base = 0;
|
||||
ss.cur = 0;
|
||||
ss.base = nullptr;
|
||||
ss.cur = nullptr;
|
||||
ss.maxlen = 0;
|
||||
ss.stuffclosure = &aOut;
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ MozExternalRefCountType IFoo::Release() {
|
||||
nsresult IFoo::QueryInterface(const nsIID& aIID, void** aResult) {
|
||||
total_queries_++;
|
||||
|
||||
nsISupports* rawPtr = 0;
|
||||
nsISupports* rawPtr = nullptr;
|
||||
nsresult status = NS_OK;
|
||||
|
||||
if (aIID.Equals(NS_GET_IID(IFoo)))
|
||||
@@ -127,7 +127,7 @@ IBar::~IBar() { total_destructions_++; }
|
||||
nsresult IBar::QueryInterface(const nsID& aIID, void** aResult) {
|
||||
total_queries_++;
|
||||
|
||||
nsISupports* rawPtr = 0;
|
||||
nsISupports* rawPtr = nullptr;
|
||||
nsresult status = NS_OK;
|
||||
|
||||
if (aIID.Equals(NS_GET_IID(IBar)))
|
||||
@@ -172,12 +172,12 @@ using namespace TestCOMPtr;
|
||||
TEST(COMPtr, Bloat_Raw_Unsafe)
|
||||
{
|
||||
// ER: I'm not sure what this is testing...
|
||||
IBar* barP = 0;
|
||||
IBar* barP = nullptr;
|
||||
nsresult rv = CreateIBar(reinterpret_cast<void**>(&barP));
|
||||
ASSERT_NS_SUCCEEDED(rv);
|
||||
ASSERT_TRUE(barP);
|
||||
|
||||
IFoo* fooP = 0;
|
||||
IFoo* fooP = nullptr;
|
||||
rv = barP->QueryInterface(NS_GET_IID(IFoo), reinterpret_cast<void**>(&fooP));
|
||||
ASSERT_NS_SUCCEEDED(rv);
|
||||
ASSERT_TRUE(fooP);
|
||||
|
||||
@@ -236,7 +236,7 @@ MozExternalRefCountType IFoo::Release() {
|
||||
}
|
||||
|
||||
nsresult IFoo::QueryInterface(const nsIID& aIID, void** aResult) {
|
||||
nsISupports* rawPtr = 0;
|
||||
nsISupports* rawPtr = nullptr;
|
||||
nsresult status = NS_OK;
|
||||
|
||||
if (aIID.Equals(NS_GET_IID(IFoo)))
|
||||
|
||||
@@ -68,7 +68,7 @@ MozExternalRefCountType Foo::Release() {
|
||||
nsresult Foo::QueryInterface(const nsIID& aIID, void** aResult) {
|
||||
++total_queries_;
|
||||
|
||||
nsISupports* rawPtr = 0;
|
||||
nsISupports* rawPtr = nullptr;
|
||||
nsresult status = NS_OK;
|
||||
|
||||
if (aIID.Equals(NS_GET_IID(Foo)))
|
||||
@@ -149,7 +149,7 @@ Bar::~Bar() { ++total_destructions_; }
|
||||
nsresult Bar::QueryInterface(const nsID& aIID, void** aResult) {
|
||||
++total_queries_;
|
||||
|
||||
nsISupports* rawPtr = 0;
|
||||
nsISupports* rawPtr = nullptr;
|
||||
nsresult status = NS_OK;
|
||||
|
||||
if (aIID.Equals(NS_GET_IID(Bar)))
|
||||
|
||||
@@ -171,7 +171,7 @@ BlockingResourceBase::BlockingResourceBase(
|
||||
MOZ_CRASH("can't initialize blocking resource static members");
|
||||
}
|
||||
|
||||
mChainPrev = 0;
|
||||
mChainPrev = nullptr;
|
||||
sDeadlockDetector->Add(this);
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ BlockingResourceBase::~BlockingResourceBase() {
|
||||
// Mutexes while they're still locked. it is assumed that the
|
||||
// base class, or its underlying primitive, will check for such
|
||||
// stupid mistakes.
|
||||
mChainPrev = 0; // racy only for stupidly buggy client code
|
||||
mChainPrev = nullptr; // racy only for stupidly buggy client code
|
||||
if (sDeadlockDetector) {
|
||||
sDeadlockDetector->Remove(this);
|
||||
}
|
||||
@@ -238,7 +238,7 @@ PRStatus BlockingResourceBase::InitStatics() {
|
||||
|
||||
void BlockingResourceBase::Shutdown() {
|
||||
delete sDeadlockDetector;
|
||||
sDeadlockDetector = 0;
|
||||
sDeadlockDetector = nullptr;
|
||||
}
|
||||
|
||||
MOZ_NEVER_INLINE void BlockingResourceBase::CheckAcquire() {
|
||||
@@ -250,7 +250,8 @@ MOZ_NEVER_INLINE void BlockingResourceBase::CheckAcquire() {
|
||||
|
||||
BlockingResourceBase* chainFront = ResourceChainFront();
|
||||
mozilla::UniquePtr<DDT::ResourceAcquisitionArray> cycle(
|
||||
sDeadlockDetector->CheckAcquisition(chainFront ? chainFront : 0, this));
|
||||
sDeadlockDetector->CheckAcquisition(chainFront ? chainFront : nullptr,
|
||||
this));
|
||||
if (!cycle) {
|
||||
return;
|
||||
}
|
||||
@@ -465,7 +466,7 @@ nsresult ReentrantMonitor::Wait(PRIntervalTime aInterval) {
|
||||
AcquisitionState savedAcquisitionState = TakeAcquisitionState();
|
||||
BlockingResourceBase* savedChainPrev = mChainPrev;
|
||||
mEntryCount = 0;
|
||||
mChainPrev = 0;
|
||||
mChainPrev = nullptr;
|
||||
|
||||
nsresult rv;
|
||||
{
|
||||
@@ -554,7 +555,7 @@ CVStatus OffTheBooksCondVar::Wait(TimeDuration aDuration) {
|
||||
AcquisitionState savedAcquisitionState = mLock->TakeAcquisitionState();
|
||||
BlockingResourceBase* savedChainPrev = mLock->mChainPrev;
|
||||
PRThread* savedOwningThread = mLock->mOwningThread;
|
||||
mLock->mChainPrev = 0;
|
||||
mLock->mChainPrev = nullptr;
|
||||
mLock->mOwningThread = nullptr;
|
||||
|
||||
// give up mutex until we're back from Wait()
|
||||
|
||||
Reference in New Issue
Block a user