mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
Bug 1390428
(part 4) - Remove still more nsXPIDLCString local variables. r=erahm.
These are all easy cases where an nsXPIDLCString local variable is set via getter_Copies() and then is null checked. The patch uses IsVoid() to replace the null checks (and get() and EqualsLiteral() calls to replace any implicit conversions). --HG-- extra : rebase_source : 484ad42a7816b34b86afbe072e04ba131c1619c6
This commit is contained in:
parent
bc3ca2ebdd
commit
780a2e4aec
@ -1353,11 +1353,11 @@ nsIOService::PrefsChanged(nsIPrefBranch *prefs, const char *pref)
|
||||
void
|
||||
nsIOService::ParsePortList(nsIPrefBranch *prefBranch, const char *pref, bool remove)
|
||||
{
|
||||
nsXPIDLCString portList;
|
||||
nsCString portList;
|
||||
|
||||
// Get a pref string and chop it up into a list of ports.
|
||||
prefBranch->GetCharPref(pref, getter_Copies(portList));
|
||||
if (portList) {
|
||||
if (!portList.IsVoid()) {
|
||||
nsTArray<nsCString> portListArray;
|
||||
ParseString(portList, ',', portListArray);
|
||||
uint32_t index;
|
||||
|
@ -1333,14 +1333,14 @@ NS_IMETHODIMP CacheEntry::GetSecurityInfo(nsISupports * *aSecurityInfo)
|
||||
|
||||
NS_ENSURE_SUCCESS(mFileStatus, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
nsXPIDLCString info;
|
||||
nsCString info;
|
||||
nsCOMPtr<nsISupports> secInfo;
|
||||
nsresult rv;
|
||||
|
||||
rv = mFile->GetElement("security-info", getter_Copies(info));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (info) {
|
||||
if (!info.IsVoid()) {
|
||||
rv = NS_DeserializeObject(info, getter_AddRefs(secInfo));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
@ -1322,12 +1322,12 @@ nsHttpHandler::PrefsChanged(nsIPrefBranch *prefs, const char *pref)
|
||||
}
|
||||
|
||||
if (PREF_CHANGED(HTTP_PREF("version"))) {
|
||||
nsXPIDLCString httpVersion;
|
||||
nsCString httpVersion;
|
||||
prefs->GetCharPref(HTTP_PREF("version"), getter_Copies(httpVersion));
|
||||
if (httpVersion) {
|
||||
if (!PL_strcmp(httpVersion, "1.1"))
|
||||
if (!httpVersion.IsVoid()) {
|
||||
if (httpVersion.EqualsLiteral("1.1"))
|
||||
mHttpVersion = NS_HTTP_VERSION_1_1;
|
||||
else if (!PL_strcmp(httpVersion, "0.9"))
|
||||
else if (httpVersion.EqualsLiteral("0.9"))
|
||||
mHttpVersion = NS_HTTP_VERSION_0_9;
|
||||
else
|
||||
mHttpVersion = NS_HTTP_VERSION_1_0;
|
||||
@ -1335,10 +1335,10 @@ nsHttpHandler::PrefsChanged(nsIPrefBranch *prefs, const char *pref)
|
||||
}
|
||||
|
||||
if (PREF_CHANGED(HTTP_PREF("proxy.version"))) {
|
||||
nsXPIDLCString httpVersion;
|
||||
nsCString httpVersion;
|
||||
prefs->GetCharPref(HTTP_PREF("proxy.version"), getter_Copies(httpVersion));
|
||||
if (httpVersion) {
|
||||
if (!PL_strcmp(httpVersion, "1.1"))
|
||||
if (!httpVersion.IsVoid()) {
|
||||
if (httpVersion.EqualsLiteral("1.1"))
|
||||
mProxyHttpVersion = NS_HTTP_VERSION_1_1;
|
||||
else
|
||||
mProxyHttpVersion = NS_HTTP_VERSION_1_0;
|
||||
|
@ -1226,16 +1226,18 @@ RDFServiceImpl::UnregisterDataSource(nsIRDFDataSource* aDataSource)
|
||||
|
||||
nsresult rv;
|
||||
|
||||
nsXPIDLCString uri;
|
||||
nsCString uri;
|
||||
rv = aDataSource->GetURI(getter_Copies(uri));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
//NS_ASSERTION(uri != nullptr, "datasource has no URI");
|
||||
if (! uri)
|
||||
if (uri.IsVoid())
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
PLHashEntry** hep =
|
||||
PL_HashTableRawLookup(mNamedDataSources, (*mNamedDataSources->keyHash)(uri), uri);
|
||||
PL_HashTableRawLookup(mNamedDataSources,
|
||||
(*mNamedDataSources->keyHash)(uri.get()),
|
||||
uri.get());
|
||||
|
||||
// It may well be that this datasource was never registered. If
|
||||
// so, don't unregister it.
|
||||
@ -1248,7 +1250,7 @@ RDFServiceImpl::UnregisterDataSource(nsIRDFDataSource* aDataSource)
|
||||
|
||||
MOZ_LOG(gLog, LogLevel::Debug,
|
||||
("rdfserv unregister-datasource [%p] %s",
|
||||
aDataSource, (const char*) uri));
|
||||
aDataSource, uri.get()));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -565,11 +565,11 @@ nsCommandLine::EnumerateValidators(EnumerateValidatorsCallback aCallback, void *
|
||||
while (NS_SUCCEEDED(strenum->HasMore(&hasMore)) && hasMore) {
|
||||
strenum->GetNext(entry);
|
||||
|
||||
nsXPIDLCString contractID;
|
||||
nsCString contractID;
|
||||
rv = catman->GetCategoryEntry("command-line-validator",
|
||||
entry.get(),
|
||||
getter_Copies(contractID));
|
||||
if (!contractID)
|
||||
if (contractID.IsVoid())
|
||||
continue;
|
||||
|
||||
nsCOMPtr<nsICommandLineValidator> clv(do_GetService(contractID.get()));
|
||||
|
@ -93,7 +93,7 @@ nsGetServiceFromCategory::operator()(const nsIID& aIID,
|
||||
void** aInstancePtr) const
|
||||
{
|
||||
nsresult rv;
|
||||
nsXPIDLCString value;
|
||||
nsCString value;
|
||||
nsCOMPtr<nsICategoryManager> catman;
|
||||
nsComponentManagerImpl* compMgr = nsComponentManagerImpl::gComponentManager;
|
||||
if (!compMgr) {
|
||||
@ -120,12 +120,12 @@ nsGetServiceFromCategory::operator()(const nsIID& aIID,
|
||||
if (NS_FAILED(rv)) {
|
||||
goto error;
|
||||
}
|
||||
if (!value) {
|
||||
if (value.IsVoid()) {
|
||||
rv = NS_ERROR_SERVICE_NOT_AVAILABLE;
|
||||
goto error;
|
||||
}
|
||||
|
||||
rv = compMgr->nsComponentManagerImpl::GetServiceByContractID(value,
|
||||
rv = compMgr->nsComponentManagerImpl::GetServiceByContractID(value.get(),
|
||||
aIID,
|
||||
aInstancePtr);
|
||||
if (NS_FAILED(rv)) {
|
||||
|
@ -463,11 +463,11 @@ nsDirectoryService::RegisterCategoryProviders()
|
||||
nsAutoCString entry;
|
||||
strings->GetNext(entry);
|
||||
|
||||
nsXPIDLCString contractID;
|
||||
nsCString contractID;
|
||||
catman->GetCategoryEntry(XPCOM_DIRECTORY_PROVIDER_CATEGORY, entry.get(),
|
||||
getter_Copies(contractID));
|
||||
|
||||
if (contractID) {
|
||||
if (!contractID.IsVoid()) {
|
||||
nsCOMPtr<nsIDirectoryServiceProvider> provider = do_GetService(contractID.get());
|
||||
if (provider) {
|
||||
RegisterProvider(provider);
|
||||
|
Loading…
Reference in New Issue
Block a user