diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 2d4ca0e51431..f448869816ec 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -1908,7 +1908,7 @@ nsDocShell::FindChildWithName(const PRUnichar * aName, *_retval = nsnull; // if we don't find one, we return NS_OK and a null result - nsAutoString name(aName); + nsDependentString name(aName); nsXPIDLString childName; PRInt32 i, n = mChildren.Count(); for (i = 0; i < n; i++) { diff --git a/intl/uconv/src/nsCharsetConverterManager.cpp b/intl/uconv/src/nsCharsetConverterManager.cpp index 3180139f66a6..e14435677c8a 100644 --- a/intl/uconv/src/nsCharsetConverterManager.cpp +++ b/intl/uconv/src/nsCharsetConverterManager.cpp @@ -648,36 +648,26 @@ NS_IMETHODIMP nsCharsetConverterManager::GetCharsetAtom( const PRUnichar * aCharset, nsIAtom ** aResult) { - if (aCharset == NULL) return NS_ERROR_NULL_POINTER; - if (aResult == NULL) return NS_ERROR_NULL_POINTER; - *aResult = NULL; - - nsresult res; + NS_PRECONDITION(aCharset && aResult, "null param"); + if (!aCharset) + return NS_ERROR_NULL_POINTER; // We try to obtain the preferred name for this charset from the charset // aliases. If we don't get it from there, we just use the original string - nsAutoString charset(aCharset); - nsCOMPtr csAlias(do_GetService(kCharsetAliasCID, &res)); - NS_ASSERTION(NS_SUCCEEDED(res), "failed to get the CharsetAlias service"); - if (NS_SUCCEEDED(res)) { + nsDependentString charset(aCharset); + nsCOMPtr csAlias( do_GetService(kCharsetAliasCID) ); + NS_ASSERTION(csAlias, "failed to get the CharsetAlias service"); + if (csAlias) { nsAutoString pref; - res = csAlias->GetPreferred(charset, pref); + nsresult res = csAlias->GetPreferred(charset, pref); if (NS_SUCCEEDED(res)) { - charset.Assign(pref); + *aResult = NS_NewAtom(pref); + return *aResult ? NS_OK : NS_ERROR_OUT_OF_MEMORY; } } - // turn that cannonical name into an Atom - nsCOMPtr atom = getter_AddRefs(NS_NewAtom(charset)); - if (atom.get() == NULL) { - return NS_ERROR_OUT_OF_MEMORY; - } - - // everything was fine, set the result - *aResult = atom; - NS_ADDREF(*aResult); - - return NS_OK; + *aResult = NS_NewAtom(charset); + return *aResult ? NS_OK : NS_ERROR_OUT_OF_MEMORY; } NS_IMETHODIMP nsCharsetConverterManager::GetCharsetAtom2(