Bug 883729 - Fix -Wnull-conversion warnings in xpcom. r=bsmedberg

This commit is contained in:
Chris Peterson 2013-06-13 20:57:47 -07:00
Родитель cee1245c6f
Коммит febd752e5f
3 изменённых файлов: 21 добавлений и 21 удалений

Просмотреть файл

@ -73,7 +73,7 @@ FileLocation::GetBaseFile()
nsRefPtr<nsZipHandle> handler = mBaseZip->GetFD();
if (handler)
return handler->mFile.GetBaseFile();
return NULL;
return nullptr;
}
nsCOMPtr<nsIFile> file = mBaseFile;

Просмотреть файл

@ -247,14 +247,14 @@ GetLocationFromDirectoryService(const char* prop)
getter_AddRefs(directoryService));
if (!directoryService)
return NULL;
return nullptr;
nsCOMPtr<nsIFile> file;
nsresult rv = directoryService->Get(prop,
NS_GET_IID(nsIFile),
getter_AddRefs(file));
if (NS_FAILED(rv))
return NULL;
return nullptr;
return file.forget();
}
@ -265,7 +265,7 @@ CloneAndAppend(nsIFile* aBase, const nsACString& append)
nsCOMPtr<nsIFile> f;
aBase->Clone(getter_AddRefs(f));
if (!f)
return NULL;
return nullptr;
f->AppendNative(append);
return f.forget();
@ -386,10 +386,10 @@ nsresult nsComponentManagerImpl::Init()
nsCategoryManager::GetSingleton()->SuppressNotifications(true);
RegisterModule(&kXPCOMModule, NULL);
RegisterModule(&kXPCOMModule, nullptr);
for (uint32_t i = 0; i < sStaticModules->Length(); ++i)
RegisterModule((*sStaticModules)[i], NULL);
RegisterModule((*sStaticModules)[i], nullptr);
nsRefPtr<nsZipArchive> appOmnijar = mozilla::Omnijar::GetReader(mozilla::Omnijar::APP);
if (appOmnijar) {
@ -868,7 +868,7 @@ nsComponentManagerImpl::FindFactory(const nsCID& aClass)
{
nsFactoryEntry* e = GetFactoryEntry(aClass);
if (!e)
return NULL;
return nullptr;
return e->GetFactory();
}
@ -879,7 +879,7 @@ nsComponentManagerImpl::FindFactory(const char *contractID,
{
nsFactoryEntry *entry = GetFactoryEntry(contractID, aContractIDLen);
if (!entry)
return NULL;
return nullptr;
return entry->GetFactory();
}
@ -1113,8 +1113,8 @@ FreeFactoryEntries(const nsID& aCID,
nsFactoryEntry* aEntry,
void* arg)
{
aEntry->mFactory = NULL;
aEntry->mServiceObject = NULL;
aEntry->mFactory = nullptr;
aEntry->mServiceObject = nullptr;
return PL_DHASH_NEXT;
}
@ -1126,7 +1126,7 @@ nsComponentManagerImpl::FreeServices()
if (!gXPCOMShuttingDown)
return NS_ERROR_FAILURE;
mFactories.EnumerateRead(FreeFactoryEntries, NULL);
mFactories.EnumerateRead(FreeFactoryEntries, nullptr);
return NS_OK;
}
@ -1484,7 +1484,7 @@ nsComponentManagerImpl::LoaderForExtension(const nsACString& aExt)
loader = do_GetServiceFromCategory("module-loader",
PromiseFlatCString(aExt).get());
if (!loader)
return NULL;
return nullptr;
mLoaderMap.Put(aExt, loader);
}
@ -1673,7 +1673,7 @@ nsComponentManagerImpl::ContractIDToCID(const char *aContractID,
return NS_OK;
}
}
*_retval = NULL;
*_retval = nullptr;
return NS_ERROR_FACTORY_NOT_REGISTERED;
}
@ -1740,8 +1740,8 @@ nsFactoryEntry::nsFactoryEntry(const mozilla::Module::CIDEntry* entry,
}
nsFactoryEntry::nsFactoryEntry(const nsCID& aCID, nsIFactory* factory)
: mCIDEntry(NULL)
, mModule(NULL)
: mCIDEntry(nullptr)
, mModule(nullptr)
, mFactory(factory)
{
mozilla::Module::CIDEntry* e = new mozilla::Module::CIDEntry();
@ -1749,7 +1749,7 @@ nsFactoryEntry::nsFactoryEntry(const nsCID& aCID, nsIFactory* factory)
*cid = aCID;
e->cid = cid;
mCIDEntry = e;
}
}
nsFactoryEntry::~nsFactoryEntry()
{
@ -1769,10 +1769,10 @@ nsFactoryEntry::GetFactory()
// RegisterFactory then UnregisterFactory can leave an entry in mContractIDs
// pointing to an unusable nsFactoryEntry.
if (!mModule)
return NULL;
return nullptr;
if (!mModule->Load())
return NULL;
return nullptr;
// Don't set mFactory directly, it needs to be locked
nsCOMPtr<nsIFactory> factory;
@ -1789,7 +1789,7 @@ nsFactoryEntry::GetFactory()
factory = new mozilla::GenericFactory(mCIDEntry->constructorProc);
}
if (!factory)
return NULL;
return nullptr;
SafeMutexAutoLock lock(nsComponentManagerImpl::gComponentManager->mLock);
// Threads can race to set mFactory
@ -1859,7 +1859,7 @@ XRE_AddStaticComponent(const mozilla::Module* aComponent)
if (nsComponentManagerImpl::gComponentManager &&
nsComponentManagerImpl::NORMAL == nsComponentManagerImpl::gComponentManager->mStatus)
nsComponentManagerImpl::gComponentManager->RegisterModule(aComponent, NULL);
nsComponentManagerImpl::gComponentManager->RegisterModule(aComponent, nullptr);
return NS_OK;
}

Просмотреть файл

@ -135,7 +135,7 @@ nsInterfaceHashtable<KeyClass,Interface>::Get(KeyType aKey) const
{
typename base_type::EntryType* ent = this->GetEntry(aKey);
if (!ent)
return NULL;
return nullptr;
nsCOMPtr<Interface> copy = ent->mData;
return copy.forget();