Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Bug 1390428 (part 2, attempt 2) - Remove more nsXPIDLCString local va…
Browse files Browse the repository at this point in the history
…riables. r=erahm.
  • Loading branch information
nnethercote committed Aug 21, 2017
1 parent 97a4eb5 commit a801537
Show file tree
Hide file tree
Showing 36 changed files with 208 additions and 197 deletions.
4 changes: 2 additions & 2 deletions dom/base/nsContentUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7132,12 +7132,12 @@ nsContentUtils::FindInternalContentViewer(const nsACString& aType,

nsCOMPtr<nsIDocumentLoaderFactory> docFactory;

nsXPIDLCString contractID;
nsCString contractID;
nsresult rv = catMan->GetCategoryEntry("Gecko-Content-Viewers",
PromiseFlatCString(aType).get(),
getter_Copies(contractID));
if (NS_SUCCEEDED(rv)) {
docFactory = do_GetService(contractID);
docFactory = do_GetService(contractID.get());
if (docFactory && aLoaderType) {
if (contractID.EqualsLiteral(CONTENT_DLF_CONTRACTID))
*aLoaderType = TYPE_CONTENT;
Expand Down
8 changes: 4 additions & 4 deletions dom/base/nsDOMClassInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -806,9 +806,9 @@ nsDOMClassInfo::PostCreatePrototype(JSContext * cx, JSObject * aProto)
getter_AddRefs(if_info));

if (if_info) {
nsXPIDLCString name;
nsCString name;
if_info->GetName(getter_Copies(name));
NS_ASSERTION(nsCRT::strcmp(CutPrefix(name), mData->mClass.name) == 0,
NS_ASSERTION(nsCRT::strcmp(CutPrefix(name.get()), mData->mClass.name) == 0,
"Class name and proto chain interface name mismatch!");
}
}
Expand Down Expand Up @@ -959,11 +959,11 @@ DefineInterfaceConstants(JSContext *cx, JS::Handle<JSObject*> obj, const nsIID *

JS::Rooted<JS::Value> v(cx);
for (i = parent_constant_count; i < constant_count; i++) {
nsXPIDLCString name;
nsCString name;
rv = if_info->GetConstant(i, &v, getter_Copies(name));
NS_ENSURE_TRUE(NS_SUCCEEDED(rv), rv);

if (!::JS_DefineProperty(cx, obj, name, v,
if (!::JS_DefineProperty(cx, obj, name.get(), v,
JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT,
JS_STUBGETTER, JS_STUBSETTER)) {
return NS_ERROR_UNEXPECTED;
Expand Down
4 changes: 2 additions & 2 deletions dom/base/nsDocument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1007,12 +1007,12 @@ nsExternalResourceMap::PendingLoad::SetupViewer(nsIRequest* aRequest,
nsCOMPtr<nsICategoryManager> catMan =
do_GetService(NS_CATEGORYMANAGER_CONTRACTID);
NS_ENSURE_TRUE(catMan, NS_ERROR_NOT_AVAILABLE);
nsXPIDLCString contractId;
nsCString contractId;
nsresult rv = catMan->GetCategoryEntry("Gecko-Content-Viewers", type.get(),
getter_Copies(contractId));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDocumentLoaderFactory> docLoaderFactory =
do_GetService(contractId);
do_GetService(contractId.get());
NS_ENSURE_TRUE(docLoaderFactory, NS_ERROR_NOT_AVAILABLE);

nsCOMPtr<nsIContentViewer> viewer;
Expand Down
4 changes: 2 additions & 2 deletions dom/base/nsScriptNameSpaceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ nsScriptNameSpaceManager::OperateCategoryEntryHash(nsICategoryManager* aCategory
return NS_OK;
}

nsXPIDLCString contractId;
nsCString contractId;
rv = aCategoryManager->GetCategoryEntry(aCategory, categoryEntry.get(),
getter_Copies(contractId));
NS_ENSURE_SUCCESS(rv, rv);
Expand All @@ -325,7 +325,7 @@ nsScriptNameSpaceManager::OperateCategoryEntryHash(nsICategoryManager* aCategory
NS_ENSURE_SUCCESS(rv, rv);

nsCID *cidPtr;
rv = registrar->ContractIDToCID(contractId, &cidPtr);
rv = registrar->ContractIDToCID(contractId.get(), &cidPtr);

if (NS_FAILED(rv)) {
NS_WARNING("Bad contract id registed with the script namespace manager");
Expand Down
4 changes: 2 additions & 2 deletions dom/plugins/base/nsPluginHost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2708,11 +2708,11 @@ nsPluginHost::RegisterWithCategoryManager(const nsCString& aMimeType,
}

// Only delete the entry if a plugin registered for it
nsXPIDLCString value;
nsCString value;
nsresult rv = catMan->GetCategoryEntry("Gecko-Content-Viewers",
aMimeType.get(),
getter_Copies(value));
if (NS_SUCCEEDED(rv) && strcmp(value, contractId) == 0) {
if (NS_SUCCEEDED(rv) && strcmp(value.get(), contractId) == 0) {
catMan->DeleteCategoryEntry("Gecko-Content-Viewers",
aMimeType.get(),
true);
Expand Down
4 changes: 2 additions & 2 deletions dom/push/PushNotifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,14 +313,14 @@ PushDispatcher::DoNotifyObservers(nsISupports *aSubject, const char *aTopic,
nsCOMPtr<nsICategoryManager> catMan =
do_GetService(NS_CATEGORYMANAGER_CONTRACTID);
if (catMan) {
nsXPIDLCString contractId;
nsCString contractId;
nsresult rv = catMan->GetCategoryEntry("push",
mScope.BeginReading(),
getter_Copies(contractId));
if (NS_SUCCEEDED(rv)) {
// Ensure the service is created - we don't need to do anything with
// it though - we assume the service constructor attaches a listener.
nsCOMPtr<nsISupports> service = do_GetService(contractId);
nsCOMPtr<nsISupports> service = do_GetService(contractId.get());
}
}
return obsService->NotifyObservers(aSubject, aTopic,
Expand Down
12 changes: 6 additions & 6 deletions extensions/pref/autoconfig/src/nsReadConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ NS_IMETHODIMP nsReadConfig::Observe(nsISupports *aSubject, const char *aTopic, c
nsresult nsReadConfig::readConfigFile()
{
nsresult rv = NS_OK;
nsXPIDLCString lockFileName;
nsXPIDLCString lockVendor;
nsCString lockFileName;
nsCString lockVendor;
uint32_t fileNameLen = 0;

nsCOMPtr<nsIPrefBranch> defaultPrefBranch;
Expand Down Expand Up @@ -193,18 +193,18 @@ nsresult nsReadConfig::readConfigFile()
// If vendor is not nullptr, do this check
if (NS_SUCCEEDED(rv)) {

fileNameLen = strlen(lockFileName);
fileNameLen = strlen(lockFileName.get());

// lockVendor and lockFileName should be the same with the addtion of
// .cfg to the filename by checking this post reading of the cfg file
// this value can be set within the cfg file adding a level of security.

if (PL_strncmp(lockFileName, lockVendor, fileNameLen - 4) != 0)
if (PL_strncmp(lockFileName.get(), lockVendor.get(), fileNameLen - 4) != 0)
return NS_ERROR_FAILURE;
}

// get the value of the autoconfig url
nsXPIDLCString urlName;
nsCString urlName;
rv = prefBranch->GetCharPref("autoadmin.global_config_url",
getter_Copies(urlName));
if (NS_SUCCEEDED(rv) && !urlName.IsEmpty()) {
Expand All @@ -214,7 +214,7 @@ nsresult nsReadConfig::readConfigFile()
if (NS_FAILED(rv))
return NS_ERROR_OUT_OF_MEMORY;

rv = mAutoConfig->SetConfigURL(urlName);
rv = mAutoConfig->SetConfigURL(urlName.get());
if (NS_FAILED(rv))
return NS_ERROR_FAILURE;

Expand Down
5 changes: 3 additions & 2 deletions gfx/thebes/gfxSVGGlyphs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,12 @@ nsresult
gfxSVGGlyphsDocument::SetupPresentation()
{
nsCOMPtr<nsICategoryManager> catMan = do_GetService(NS_CATEGORYMANAGER_CONTRACTID);
nsXPIDLCString contractId;
nsCString contractId;
nsresult rv = catMan->GetCategoryEntry("Gecko-Content-Viewers", "image/svg+xml", getter_Copies(contractId));
NS_ENSURE_SUCCESS(rv, rv);

nsCOMPtr<nsIDocumentLoaderFactory> docLoaderFactory = do_GetService(contractId);
nsCOMPtr<nsIDocumentLoaderFactory> docLoaderFactory =
do_GetService(contractId.get());
NS_ASSERTION(docLoaderFactory, "Couldn't get DocumentLoaderFactory");

nsCOMPtr<nsIContentViewer> viewer;
Expand Down
4 changes: 2 additions & 2 deletions image/SVGDocumentWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,12 +331,12 @@ SVGDocumentWrapper::SetupViewer(nsIRequest* aRequest,
nsCOMPtr<nsICategoryManager> catMan =
do_GetService(NS_CATEGORYMANAGER_CONTRACTID);
NS_ENSURE_TRUE(catMan, NS_ERROR_NOT_AVAILABLE);
nsXPIDLCString contractId;
nsCString contractId;
nsresult rv = catMan->GetCategoryEntry("Gecko-Content-Viewers", IMAGE_SVG_XML,
getter_Copies(contractId));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDocumentLoaderFactory> docLoaderFactory =
do_GetService(contractId);
do_GetService(contractId.get());
NS_ENSURE_TRUE(docLoaderFactory, NS_ERROR_NOT_AVAILABLE);

nsCOMPtr<nsIContentViewer> viewer;
Expand Down
4 changes: 2 additions & 2 deletions intl/strres/nsStringBundle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ nsStringBundleService::FormatStatusMessage(nsresult aStatus,
nsresult rv;
uint32_t i, argCount = 0;
nsCOMPtr<nsIStringBundle> bundle;
nsXPIDLCString stringBundleURL;
nsCString stringBundleURL;

// XXX hack for mailnews who has already formatted their messages:
if (aStatus == NS_OK && aStatusArg) {
Expand Down Expand Up @@ -713,7 +713,7 @@ nsStringBundleService::FormatStatusMessage(nsresult aStatus,
rv = mErrorService->GetErrorStringBundle(NS_ERROR_GET_MODULE(aStatus),
getter_Copies(stringBundleURL));
if (NS_SUCCEEDED(rv)) {
getStringBundle(stringBundleURL, getter_AddRefs(bundle));
getStringBundle(stringBundleURL.get(), getter_AddRefs(bundle));
rv = FormatWithBundle(bundle, aStatus, argCount, argArray, result);
}
if (NS_FAILED(rv)) {
Expand Down
4 changes: 2 additions & 2 deletions js/xpconnect/src/XPCWrappedNativeInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,13 +333,13 @@ XPCNativeInterface::NewInstance(nsIInterfaceInfo* aInfo)
if (!failed) {
for (i = 0; i < constCount; i++) {
RootedValue constant(cx);
nsXPIDLCString namestr;
nsCString namestr;
if (NS_FAILED(aInfo->GetConstant(i, &constant, getter_Copies(namestr)))) {
failed = true;
break;
}

str = JS_AtomizeAndPinString(cx, namestr);
str = JS_AtomizeAndPinString(cx, namestr.get());
if (!str) {
NS_ERROR("bad constant name");
failed = true;
Expand Down
4 changes: 2 additions & 2 deletions modules/libpref/nsPrefBranch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ nsPrefBranch::GetDefaultFromPropertiesFile(const char *aPrefName,

// the default value contains a URL to a .properties file

nsXPIDLCString propertyFileURL;
nsCString propertyFileURL;
rv = PREF_CopyCharPref(aPrefName, getter_Copies(propertyFileURL), true);
if (NS_FAILED(rv))
return rv;
Expand All @@ -852,7 +852,7 @@ nsPrefBranch::GetDefaultFromPropertiesFile(const char *aPrefName,
return NS_ERROR_FAILURE;

nsCOMPtr<nsIStringBundle> bundle;
rv = bundleService->CreateBundle(propertyFileURL,
rv = bundleService->CreateBundle(propertyFileURL.get(),
getter_AddRefs(bundle));
if (NS_FAILED(rv))
return rv;
Expand Down
4 changes: 2 additions & 2 deletions netwerk/protocol/ftp/nsFtpConnectionThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,7 @@ nsFtpState::S_pass() {
// XXX Is UTF-8 the best choice?
AppendUTF16toUTF8(mPassword, passwordStr);
} else {
nsXPIDLCString anonPassword;
nsCString anonPassword;
bool useRealEmail = false;
nsCOMPtr<nsIPrefBranch> prefs =
do_GetService(NS_PREFSERVICE_CONTRACTID);
Expand All @@ -796,7 +796,7 @@ nsFtpState::S_pass() {
}
}
if (!anonPassword.IsEmpty()) {
passwordStr.AppendASCII(anonPassword);
passwordStr.AppendASCII(anonPassword.get());
} else {
// We need to default to a valid email address - bug 101027
// example.com is reserved (rfc2606), so use that
Expand Down
16 changes: 8 additions & 8 deletions netwerk/protocol/http/nsHttpHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1351,37 +1351,37 @@ nsHttpHandler::PrefsChanged(nsIPrefBranch *prefs, const char *pref)
}

if (PREF_CHANGED(HTTP_PREF("accept.default"))) {
nsXPIDLCString accept;
nsCString accept;
rv = prefs->GetCharPref(HTTP_PREF("accept.default"),
getter_Copies(accept));
if (NS_SUCCEEDED(rv)) {
rv = SetAccept(accept);
rv = SetAccept(accept.get());
MOZ_ASSERT(NS_SUCCEEDED(rv));
}
}

if (PREF_CHANGED(HTTP_PREF("accept-encoding"))) {
nsXPIDLCString acceptEncodings;
nsCString acceptEncodings;
rv = prefs->GetCharPref(HTTP_PREF("accept-encoding"),
getter_Copies(acceptEncodings));
if (NS_SUCCEEDED(rv)) {
rv = SetAcceptEncodings(acceptEncodings, false);
rv = SetAcceptEncodings(acceptEncodings.get(), false);
MOZ_ASSERT(NS_SUCCEEDED(rv));
}
}

if (PREF_CHANGED(HTTP_PREF("accept-encoding.secure"))) {
nsXPIDLCString acceptEncodings;
nsCString acceptEncodings;
rv = prefs->GetCharPref(HTTP_PREF("accept-encoding.secure"),
getter_Copies(acceptEncodings));
if (NS_SUCCEEDED(rv)) {
rv = SetAcceptEncodings(acceptEncodings, true);
rv = SetAcceptEncodings(acceptEncodings.get(), true);
MOZ_ASSERT(NS_SUCCEEDED(rv));
}
}

if (PREF_CHANGED(HTTP_PREF("default-socket-type"))) {
nsXPIDLCString sval;
nsCString sval;
rv = prefs->GetCharPref(HTTP_PREF("default-socket-type"),
getter_Copies(sval));
if (NS_SUCCEEDED(rv)) {
Expand All @@ -1393,7 +1393,7 @@ nsHttpHandler::PrefsChanged(nsIPrefBranch *prefs, const char *pref)
do_GetService(NS_SOCKETPROVIDERSERVICE_CONTRACTID));
if (sps) {
nsCOMPtr<nsISocketProvider> sp;
rv = sps->GetSocketProvider(sval, getter_AddRefs(sp));
rv = sps->GetSocketProvider(sval.get(), getter_AddRefs(sp));
if (NS_SUCCEEDED(rv)) {
// OK, this looks like a valid socket provider.
mDefaultSocketType.Assign(sval);
Expand Down
2 changes: 1 addition & 1 deletion netwerk/streamconv/converters/nsIndexedToHTML.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ nsIndexedToHTML::OnIndexAvailable(nsIRequest *aRequest,

// We don't know the file's character set yet, so retrieve the raw bytes
// which will be decoded by the HTML parser.
nsXPIDLCString loc;
nsCString loc;
aIndex->GetLocation(getter_Copies(loc));

// Adjust the length in case unescaping shortened the string.
Expand Down
8 changes: 4 additions & 4 deletions rdf/base/nsInMemoryDataSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -790,27 +790,27 @@ InMemoryDataSource::LogOperation(const char* aOperation,
if (! MOZ_LOG_TEST(gLog, LogLevel::Debug))
return;

nsXPIDLCString uri;
nsCString uri;
aSource->GetValue(getter_Copies(uri));
MOZ_LOG(gLog, LogLevel::Debug,
("InMemoryDataSource(%p): %s", this, aOperation));

MOZ_LOG(gLog, LogLevel::Debug,
(" [(%p)%s]--", aSource, (const char*) uri));
(" [(%p)%s]--", aSource, uri.get()));

aProperty->GetValue(getter_Copies(uri));

char tv = (aTruthValue ? '-' : '!');
MOZ_LOG(gLog, LogLevel::Debug,
(" --%c[(%p)%s]--", tv, aProperty, (const char*) uri));
(" --%c[(%p)%s]--", tv, aProperty, uri.get()));

nsCOMPtr<nsIRDFResource> resource;
nsCOMPtr<nsIRDFLiteral> literal;

if ((resource = do_QueryInterface(aTarget)) != nullptr) {
resource->GetValue(getter_Copies(uri));
MOZ_LOG(gLog, LogLevel::Debug,
(" -->[(%p)%s]", aTarget, (const char*) uri));
(" -->[(%p)%s]", aTarget, uri.get()));
}
else if ((literal = do_QueryInterface(aTarget)) != nullptr) {
nsString value;
Expand Down
4 changes: 2 additions & 2 deletions rdf/base/nsRDFContentSink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,10 +315,10 @@ RDFContentSinkImpl::~RDFContentSinkImpl()
// XXX we should save line numbers on the context stack: this'd
// be about 1000x more helpful.
if (resource && MOZ_LOG_TEST(gLog, LogLevel::Debug)) {
nsXPIDLCString uri;
nsCString uri;
resource->GetValue(getter_Copies(uri));
MOZ_LOG(gLog, LogLevel::Debug,
("rdfxml: uri=%s", (const char*) uri));
("rdfxml: uri=%s", uri.get()));
}

NS_IF_RELEASE(resource);
Expand Down
12 changes: 7 additions & 5 deletions rdf/base/nsRDFService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1177,12 +1177,14 @@ RDFServiceImpl::RegisterDataSource(nsIRDFDataSource* aDataSource, bool aReplace)

nsresult rv;

nsXPIDLCString uri;
nsCString uri;
rv = aDataSource->GetURI(getter_Copies(uri));
if (NS_FAILED(rv)) return rv;

PLHashEntry** hep =
PL_HashTableRawLookup(mNamedDataSources, (*mNamedDataSources->keyHash)(uri), uri);
PL_HashTableRawLookup(mNamedDataSources,
(*mNamedDataSources->keyHash)(uri.get()),
uri.get());

if (*hep) {
if (! aReplace)
Expand All @@ -1193,20 +1195,20 @@ RDFServiceImpl::RegisterDataSource(nsIRDFDataSource* aDataSource, bool aReplace)
// refcounts.
MOZ_LOG(gLog, LogLevel::Debug,
("rdfserv replace-datasource [%p] <-- [%p] %s",
(*hep)->value, aDataSource, (const char*) uri));
(*hep)->value, aDataSource, uri.get()));

(*hep)->value = aDataSource;
}
else {
const char* key = PL_strdup(uri);
const char* key = PL_strdup(uri.get());
if (! key)
return NS_ERROR_OUT_OF_MEMORY;

PL_HashTableAdd(mNamedDataSources, key, aDataSource);

MOZ_LOG(gLog, LogLevel::Debug,
("rdfserv register-datasource [%p] %s",
aDataSource, (const char*) uri));
aDataSource, uri.get()));

// N.B., we only hold a weak reference to the datasource, so don't
// addref.
Expand Down
Loading

0 comments on commit a801537

Please sign in to comment.