Bug 784739 - Switch from NULL to nullptr in startupcache/; r=ehsan

This commit is contained in:
Birunthan Mohanathas 2013-07-31 11:44:43 -04:00
parent 573d76ec6d
commit 7f55fcbfb9
3 changed files with 22 additions and 22 deletions

View File

@ -126,7 +126,7 @@ bool StartupCache::gIgnoreDiskCache;
enum StartupCache::TelemetrifyAge StartupCache::gPostFlushAgeAction = StartupCache::IGNORE_AGE; enum StartupCache::TelemetrifyAge StartupCache::gPostFlushAgeAction = StartupCache::IGNORE_AGE;
StartupCache::StartupCache() StartupCache::StartupCache()
: mArchive(NULL), mStartupWriteInitiated(false), mWriteThread(NULL), : mArchive(nullptr), mStartupWriteInitiated(false), mWriteThread(nullptr),
mMappingMemoryReporter(nullptr), mDataMemoryReporter(nullptr) { } mMappingMemoryReporter(nullptr), mDataMemoryReporter(nullptr) { }
StartupCache::~StartupCache() StartupCache::~StartupCache()
@ -254,7 +254,7 @@ StartupCache::LoadArchive(enum TelemetrifyAge flag)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
bool exists; bool exists;
mArchive = NULL; mArchive = nullptr;
nsresult rv = mFile->Exists(&exists); nsresult rv = mFile->Exists(&exists);
if (NS_FAILED(rv) || !exists) if (NS_FAILED(rv) || !exists)
return NS_ERROR_FILE_NOT_FOUND; return NS_ERROR_FILE_NOT_FOUND;
@ -481,7 +481,7 @@ StartupCache::WriteToDisk()
mTable.Enumerate(CacheCloseHelper, &holder); mTable.Enumerate(CacheCloseHelper, &holder);
// Close the archive so Windows doesn't choke. // Close the archive so Windows doesn't choke.
mArchive = NULL; mArchive = nullptr;
zipW->Close(); zipW->Close();
// We succesfully wrote the archive to disk; mark the disk file as trusted // We succesfully wrote the archive to disk; mark the disk file as trusted
@ -498,7 +498,7 @@ StartupCache::InvalidateCache()
{ {
WaitOnWriteThread(); WaitOnWriteThread();
mTable.Clear(); mTable.Clear();
mArchive = NULL; mArchive = nullptr;
nsresult rv = mFile->Remove(false); nsresult rv = mFile->Remove(false);
if (NS_FAILED(rv) && rv != NS_ERROR_FILE_TARGET_DOES_NOT_EXIST && if (NS_FAILED(rv) && rv != NS_ERROR_FILE_TARGET_DOES_NOT_EXIST &&
rv != NS_ERROR_FILE_NOT_FOUND) { rv != NS_ERROR_FILE_NOT_FOUND) {
@ -531,7 +531,7 @@ StartupCache::WaitOnWriteThread()
return; return;
PR_JoinThread(mWriteThread); PR_JoinThread(mWriteThread);
mWriteThread = NULL; mWriteThread = nullptr;
} }
void void
@ -551,7 +551,7 @@ StartupCache::WriteTimeout(nsITimer *aTimer, void *aClosure)
{ {
gStartupCache->mWriteThread = PR_CreateThread(PR_USER_THREAD, gStartupCache->mWriteThread = PR_CreateThread(PR_USER_THREAD,
StartupCache::ThreadedWrite, StartupCache::ThreadedWrite,
NULL, nullptr,
PR_PRIORITY_NORMAL, PR_PRIORITY_NORMAL,
PR_LOCAL_THREAD, PR_LOCAL_THREAD,
PR_JOINABLE_THREAD, PR_JOINABLE_THREAD,

View File

@ -23,23 +23,23 @@ NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(StartupCacheWrapper,
NS_DEFINE_NAMED_CID(NS_STARTUPCACHE_CID); NS_DEFINE_NAMED_CID(NS_STARTUPCACHE_CID);
static const mozilla::Module::CIDEntry kStartupCacheCIDs[] = { static const mozilla::Module::CIDEntry kStartupCacheCIDs[] = {
{ &kNS_STARTUPCACHE_CID, false, NULL, StartupCacheWrapperConstructor }, { &kNS_STARTUPCACHE_CID, false, nullptr, StartupCacheWrapperConstructor },
{ NULL } { nullptr }
}; };
static const mozilla::Module::ContractIDEntry kStartupCacheContracts[] = { static const mozilla::Module::ContractIDEntry kStartupCacheContracts[] = {
{ "@mozilla.org/startupcache/cache;1", &kNS_STARTUPCACHE_CID }, { "@mozilla.org/startupcache/cache;1", &kNS_STARTUPCACHE_CID },
{ NULL } { nullptr }
}; };
static const mozilla::Module kStartupCacheModule = { static const mozilla::Module kStartupCacheModule = {
mozilla::Module::kVersion, mozilla::Module::kVersion,
kStartupCacheCIDs, kStartupCacheCIDs,
kStartupCacheContracts, kStartupCacheContracts,
NULL, nullptr,
NULL, nullptr,
NULL, nullptr,
NULL nullptr
}; };
NSMODULE_DEFN(StartupCacheModule) = &kStartupCacheModule; NSMODULE_DEFN(StartupCacheModule) = &kStartupCacheModule;

View File

@ -91,7 +91,7 @@ TestStartupWriteRead() {
const char* buf = "Market opportunities for BeardBook"; const char* buf = "Market opportunities for BeardBook";
const char* id = "id"; const char* id = "id";
char* outbufPtr = NULL; char* outbufPtr = nullptr;
nsAutoArrayPtr<char> outbuf; nsAutoArrayPtr<char> outbuf;
uint32_t len; uint32_t len;
@ -120,7 +120,7 @@ TestWriteInvalidateRead() {
nsresult rv; nsresult rv;
const char* buf = "BeardBook competitive analysis"; const char* buf = "BeardBook competitive analysis";
const char* id = "id"; const char* id = "id";
char* outbuf = NULL; char* outbuf = nullptr;
uint32_t len; uint32_t len;
nsCOMPtr<nsIStartupCache> sc nsCOMPtr<nsIStartupCache> sc
= do_GetService("@mozilla.org/startupcache/cache;1", &rv); = do_GetService("@mozilla.org/startupcache/cache;1", &rv);
@ -196,7 +196,7 @@ TestWriteObject() {
return rv; return rv;
} }
char* bufPtr = NULL; char* bufPtr = nullptr;
nsAutoArrayPtr<char> buf; nsAutoArrayPtr<char> buf;
uint32_t len; uint32_t len;
NewBufferFromStorageStream(storageStream, &bufPtr, &len); NewBufferFromStorageStream(storageStream, &bufPtr, &len);
@ -210,7 +210,7 @@ TestWriteObject() {
return rv; return rv;
} }
char* buf2Ptr = NULL; char* buf2Ptr = nullptr;
nsAutoArrayPtr<char> buf2; nsAutoArrayPtr<char> buf2;
uint32_t len2; uint32_t len2;
nsCOMPtr<nsIObjectInputStream> objectInput; nsCOMPtr<nsIObjectInputStream> objectInput;
@ -315,7 +315,7 @@ TestIgnoreDiskCache(nsIFile* profileDir) {
const char* buf = "Get a Beardbook app for your smartphone"; const char* buf = "Get a Beardbook app for your smartphone";
const char* id = "id"; const char* id = "id";
char* outbuf = NULL; char* outbuf = nullptr;
uint32_t len; uint32_t len;
rv = sc->PutBuffer(id, buf, strlen(buf) + 1); rv = sc->PutBuffer(id, buf, strlen(buf) + 1);
@ -361,7 +361,7 @@ TestEarlyShutdown() {
const char* buf = "Find your soul beardmate on BeardBook"; const char* buf = "Find your soul beardmate on BeardBook";
const char* id = "id"; const char* id = "id";
uint32_t len; uint32_t len;
char* outbuf = NULL; char* outbuf = nullptr;
sc->ResetStartupWriteTimer(); sc->ResetStartupWriteTimer();
rv = sc->PutBuffer(id, buf, strlen(buf) + 1); rv = sc->PutBuffer(id, buf, strlen(buf) + 1);
@ -413,13 +413,13 @@ GetHistogramCounts(const char *testmsg, const nsACString &histogram_id,
passed(testmsg); passed(testmsg);
Rooted<Value> snapshot_val(cx); Rooted<Value> snapshot_val(cx);
JSFunction *snapshot_fn = NULL; JSFunction *snapshot_fn = nullptr;
Rooted<Value> ss(cx); Rooted<Value> ss(cx);
return (JS_GetProperty(cx, JSVAL_TO_OBJECT(h), "snapshot", return (JS_GetProperty(cx, JSVAL_TO_OBJECT(h), "snapshot",
&snapshot_val) &snapshot_val)
&& (snapshot_fn = JS_ValueToFunction(cx, snapshot_val)) && (snapshot_fn = JS_ValueToFunction(cx, snapshot_val))
&& JS::Call(cx, JSVAL_TO_OBJECT(h), && JS::Call(cx, JSVAL_TO_OBJECT(h),
snapshot_fn, 0, NULL, &ss) snapshot_fn, 0, nullptr, &ss)
&& JS_GetProperty(cx, JSVAL_TO_OBJECT(ss), "counts", counts)); && JS_GetProperty(cx, JSVAL_TO_OBJECT(ss), "counts", counts));
} }
@ -522,7 +522,7 @@ int main(int argc, char** argv)
}; };
JSObject *glob = nullptr; JSObject *glob = nullptr;
if (use_js) if (use_js)
glob = JS_NewGlobalObject(cx, &global_class, NULL); glob = JS_NewGlobalObject(cx, &global_class, nullptr);
if (!glob) if (!glob)
use_js = false; use_js = false;
mozilla::Maybe<JSAutoCompartment> ac; mozilla::Maybe<JSAutoCompartment> ac;