diff --git a/mozilla/content/base/src/nsContentAreaDragDrop.cpp b/mozilla/content/base/src/nsContentAreaDragDrop.cpp index f65f1e2cc17..87646c8936c 100644 --- a/mozilla/content/base/src/nsContentAreaDragDrop.cpp +++ b/mozilla/content/base/src/nsContentAreaDragDrop.cpp @@ -386,7 +386,7 @@ nsContentAreaDragDrop::ExtractURLFromData(const nsACString & inFlavor, nsISuppor if ( file ) { nsCAutoString url; NS_GetURLSpecFromFile(file, url); - outURL = NS_ConvertUTF8toUCS2(url); + CopyUTF8toUTF16(url, outURL); } } } diff --git a/mozilla/content/base/src/nsDocument.cpp b/mozilla/content/base/src/nsDocument.cpp index 95bfea94b54..1d80a74e4bf 100644 --- a/mozilla/content/base/src/nsDocument.cpp +++ b/mozilla/content/base/src/nsDocument.cpp @@ -867,7 +867,7 @@ nsDocument::AddPrincipal(nsIPrincipal *aNewPrincipal) NS_IMETHODIMP nsDocument::GetContentType(nsAString& aContentType) { - aContentType = NS_ConvertUTF8toUCS2(mContentType); + CopyUTF8toUTF16(mContentType, aContentType); return NS_OK; } @@ -879,7 +879,7 @@ nsDocument::SetContentType(const nsAString& aContentType) mContentType.Equals(NS_ConvertUCS2toUTF8(aContentType)), "Do you really want to change the content-type?"); - mContentType = NS_ConvertUCS2toUTF8(aContentType); + CopyUTF16toUTF8(aContentType, mContentType); return NS_OK; } @@ -3403,13 +3403,13 @@ nsDocument::IsSupported(const nsAString& aFeature, const nsAString& aVersion, NS_IMETHODIMP nsDocument::GetBaseURI(nsAString &aURI) { - aURI.Truncate(); + nsCAutoString spec; if (mDocumentBaseURL) { - nsCAutoString spec; mDocumentBaseURL->GetSpec(spec); - aURI = NS_ConvertUTF8toUCS2(spec); } + CopyUTF8toUTF16(spec, aURI); + return NS_OK; } diff --git a/mozilla/content/base/src/nsGenericElement.cpp b/mozilla/content/base/src/nsGenericElement.cpp index 7cd2aad0d94..91261e00019 100644 --- a/mozilla/content/base/src/nsGenericElement.cpp +++ b/mozilla/content/base/src/nsGenericElement.cpp @@ -191,11 +191,8 @@ nsNode3Tearoff::GetBaseURI(nsAString& aURI) nsCOMPtr uri; nsCOMPtr doc; - mContent->GetDocument(getter_AddRefs(doc)); - aURI.Truncate(); - // XML content can use the XML Base (W3C spec) way of setting the // base per element. We look at this node and its ancestors until we // find the first XML content and get it's base. @@ -226,11 +223,13 @@ nsNode3Tearoff::GetBaseURI(nsAString& aURI) } } + nsCAutoString spec; + if (uri) { - nsCAutoString spec; uri->GetSpec(spec); - aURI = NS_ConvertUTF8toUCS2(spec); } + + CopyUTF8toUTF16(spec, aURI); return NS_OK; } @@ -1689,7 +1688,7 @@ nsGenericElement::SetDocument(nsIDocument* aDocument, PRBool aDeep, mDocument = aDocument; } - if (PR_TRUE == aDeep) { + if (aDeep) { SetDocumentInChildrenOf(this, aDocument, aCompileEventHandlers); } @@ -3120,11 +3119,14 @@ nsresult nsGenericContainerElement::NormalizeAttrString(const nsAString& aStr, nsINodeInfo** aNodeInfo) { - NS_ConvertUCS2toUTF8 utf8String(aStr); if (mAttributes) { + NS_ConvertUCS2toUTF8 utf8String(aStr); + PRInt32 indx, count = mAttributes->Count(); for (indx = 0; indx < count; indx++) { - nsGenericAttribute* attr = (nsGenericAttribute*)mAttributes->ElementAt(indx); + nsGenericAttribute* attr = + (nsGenericAttribute*)mAttributes->ElementAt(indx); + if (attr->mNodeInfo->QualifiedNameEquals(utf8String)) { NS_ADDREF(*aNodeInfo = attr->mNodeInfo); diff --git a/mozilla/content/base/src/nsNameSpaceManager.cpp b/mozilla/content/base/src/nsNameSpaceManager.cpp index 8d4dcdc2a5c..7937f8fe98f 100644 --- a/mozilla/content/base/src/nsNameSpaceManager.cpp +++ b/mozilla/content/base/src/nsNameSpaceManager.cpp @@ -486,7 +486,7 @@ NameSpaceManagerImpl::GetElementFactory(PRInt32 aNameSpaceID, if (!uri.IsEmpty()) { nsCAutoString contract_id(NS_ELEMENT_FACTORY_CONTRACTID_PREFIX); - contract_id.Append(NS_ConvertUCS2toUTF8(uri)); + AppendUTF16toUTF8(uri, contract_id); ef = do_GetService(contract_id.get()); } diff --git a/mozilla/content/html/content/src/nsGenericHTMLElement.cpp b/mozilla/content/html/content/src/nsGenericHTMLElement.cpp index 69b34bbaaa4..fd88ba0acf1 100644 --- a/mozilla/content/html/content/src/nsGenericHTMLElement.cpp +++ b/mozilla/content/html/content/src/nsGenericHTMLElement.cpp @@ -4429,7 +4429,7 @@ nsGenericHTMLElement::SetProtocolInHrefString(const nsAString &aHref, nsCAutoString newHref; uri->GetSpec(newHref); - aResult.Assign(NS_ConvertUTF8toUCS2(newHref)); + CopyUTF8toUTF16(newHref, aResult); return NS_OK; } @@ -4451,7 +4451,7 @@ nsGenericHTMLElement::SetHostnameInHrefString(const nsAString &aHref, nsCAutoString newHref; uri->GetSpec(newHref); - aResult.Assign(NS_ConvertUTF8toUCS2(newHref)); + CopyUTF8toUTF16(newHref, aResult); return NS_OK; } @@ -4476,7 +4476,8 @@ nsGenericHTMLElement::SetPathnameInHrefString(const nsAString &aHref, nsCAutoString newHref; uri->GetSpec(newHref); - aResult.Assign(NS_ConvertUTF8toUCS2(newHref)); + + CopyUTF8toUTF16(newHref, aResult); return NS_OK; } @@ -4507,6 +4508,7 @@ nsGenericHTMLElement::SetHostInHrefString(const nsAString &aHref, aResult.Assign(NS_ConvertUTF8toUCS2(scheme) + NS_LITERAL_STRING("://") + NS_ConvertUTF8toUCS2(userpass) + aHost + NS_ConvertUTF8toUCS2(path)); + return NS_OK; } @@ -4531,7 +4533,8 @@ nsGenericHTMLElement::SetSearchInHrefString(const nsAString &aHref, nsCAutoString newHref; uri->GetSpec(newHref); - aResult.Assign(NS_ConvertUTF8toUCS2(newHref)); + + CopyUTF8toUTF16(newHref, aResult); return NS_OK; } @@ -4557,7 +4560,8 @@ nsGenericHTMLElement::SetHashInHrefString(const nsAString &aHref, nsCAutoString newHref; uri->GetSpec(newHref); - aResult.Assign(NS_ConvertUTF8toUCS2(newHref)); + + CopyUTF8toUTF16(newHref, aResult); return NS_OK; } @@ -4584,7 +4588,8 @@ nsGenericHTMLElement::SetPortInHrefString(const nsAString &aHref, nsCAutoString newHref; uri->GetSpec(newHref); - aResult.Assign(NS_ConvertUTF8toUCS2(newHref)); + + CopyUTF8toUTF16(newHref, aResult); return NS_OK; } @@ -4654,7 +4659,7 @@ nsGenericHTMLElement::GetHostFromHrefString(const nsAString& aHref, // error. Some URI's just don't have a hostport. if (NS_SUCCEEDED(rv)) { - aHost.Assign(NS_ConvertUTF8toUCS2(hostport)); + CopyUTF8toUTF16(hostport, aHost); } return NS_OK; @@ -4678,7 +4683,7 @@ nsGenericHTMLElement::GetHostnameFromHrefString(const nsAString& aHref, // Failure to get the host from the URI isn't necessarily an // error. Some URI's just don't have a host. - aHostname.Assign(NS_ConvertUTF8toUCS2(host)); + CopyUTF8toUTF16(host, aHostname); } return NS_OK; @@ -4709,7 +4714,7 @@ nsGenericHTMLElement::GetPathnameFromHrefString(const nsAString& aHref, if (NS_FAILED(rv)) return rv; - aPathname.Assign(NS_ConvertUTF8toUCS2(file)); + CopyUTF8toUTF16(file, aPathname); return NS_OK; } @@ -4740,7 +4745,7 @@ nsGenericHTMLElement::GetSearchFromHrefString(const nsAString& aHref, return rv; if (!search.IsEmpty()) { - aSearch.Assign(NS_LITERAL_STRING("?") + NS_ConvertUTF8toUCS2(search)); + CopyUTF8toUTF16(NS_LITERAL_CSTRING("?") + search, aSearch); } return NS_OK; diff --git a/mozilla/content/html/content/src/nsHTMLAnchorElement.cpp b/mozilla/content/html/content/src/nsHTMLAnchorElement.cpp index e6e27f4d975..ce213285f81 100644 --- a/mozilla/content/html/content/src/nsHTMLAnchorElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLAnchorElement.cpp @@ -357,13 +357,12 @@ nsHTMLAnchorElement::HandleDOMEvent(nsIPresContext* aPresContext, NS_IMETHODIMP nsHTMLAnchorElement::GetHref(nsAString& aValue) { - char *buf; - nsresult rv = GetHrefUTF8(&buf); + nsXPIDLCString buf; + nsresult rv = GetHrefUTF8(getter_Copies(buf)); if (NS_FAILED(rv)) return rv; - if (buf) { - aValue.Assign(NS_ConvertUTF8toUCS2(buf)); - nsCRT::free(buf); - } + + CopyUTF8toUTF16(buf, aValue); + // NS_IMPL_STRING_ATTR does nothing where we have (buf == null) return NS_OK; } diff --git a/mozilla/content/html/content/src/nsHTMLInputElement.cpp b/mozilla/content/html/content/src/nsHTMLInputElement.cpp index f6e540efa0a..44db087fc03 100644 --- a/mozilla/content/html/content/src/nsHTMLInputElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLInputElement.cpp @@ -676,7 +676,7 @@ nsHTMLInputElement::GetValue(nsAString& aValue) if (!GET_BOOLBIT(mBitField, BF_VALUE_CHANGED) || !mValue) { GetDefaultValue(aValue); } else { - aValue = NS_ConvertUTF8toUCS2(mValue); + CopyUTF8toUTF16(mValue, aValue); } } diff --git a/mozilla/content/html/content/src/nsHTMLTextAreaElement.cpp b/mozilla/content/html/content/src/nsHTMLTextAreaElement.cpp index e6329a5e014..da798bbf3ff 100644 --- a/mozilla/content/html/content/src/nsHTMLTextAreaElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLTextAreaElement.cpp @@ -452,7 +452,7 @@ nsHTMLTextAreaElement::GetValueInternal(nsAString& aValue, PRBool aIgnoreWrap) if (!mValueChanged || !mValue) { GetDefaultValue(aValue); } else { - aValue = NS_ConvertUTF8toUCS2(mValue); + CopyUTF8toUTF16(mValue, aValue); } } } diff --git a/mozilla/content/html/document/src/nsHTMLContentSink.cpp b/mozilla/content/html/document/src/nsHTMLContentSink.cpp index 2f292ab10ff..769b81b9780 100644 --- a/mozilla/content/html/document/src/nsHTMLContentSink.cpp +++ b/mozilla/content/html/document/src/nsHTMLContentSink.cpp @@ -4338,7 +4338,8 @@ HTMLContentSink::ScrollToRef(PRBool aReallyScroll) nsresult rv = NS_ERROR_FAILURE; // We assume that the bytes are in UTF-8, as it says in the spec: // http://www.w3.org/TR/html4/appendix/notes.html#h-B.2.1 - nsAutoString ref = NS_ConvertUTF8toUCS2(unescapedRef); + nsAutoString ref; + CopyUTF8toUTF16(unescapedRef, ref); PRInt32 i, ns = mDocument->GetNumberOfShells(); for (i = 0; i < ns; i++) { diff --git a/mozilla/content/html/document/src/nsHTMLDocument.cpp b/mozilla/content/html/document/src/nsHTMLDocument.cpp index 74f9b945216..0375ba66afb 100644 --- a/mozilla/content/html/document/src/nsHTMLDocument.cpp +++ b/mozilla/content/html/document/src/nsHTMLDocument.cpp @@ -1865,8 +1865,7 @@ nsHTMLDocument::GetBaseURI(nsAString &aURI) nsCAutoString spec; uri->GetSpec(spec); - // XXX: CopyUTF8toUCS2()? - aURI = NS_ConvertUTF8toUCS2(spec); + CopyUTF8toUTF16(spec, aURI); } return NS_OK; @@ -1952,7 +1951,8 @@ nsHTMLDocument::GetDomain(nsAString& aDomain) nsCAutoString hostName; if (NS_FAILED(uri->GetHost(hostName))) return NS_ERROR_FAILURE; - aDomain.Assign(NS_ConvertUTF8toUCS2(hostName)); + + CopyUTF8toUTF16(hostName, aDomain); return NS_OK; } @@ -2044,14 +2044,14 @@ nsHTMLDocument::WasDomainSet(PRBool* aDomainWasSet) NS_IMETHODIMP nsHTMLDocument::GetURL(nsAString& aURL) { + nsCAutoString str; + if (mDocumentURL) { - nsCAutoString str; mDocumentURL->GetSpec(str); - aURL.Assign(NS_ConvertUTF8toUCS2(str)); - } else { - aURL.Truncate(); } + CopyUTF8toUTF16(str, aURL); + return NS_OK; } @@ -4626,13 +4626,11 @@ nsHTMLDocument::QueryCommandValue(const nsAString & commandID, if (cmdToDispatch.Equals("cmd_fontFace")) rv = cmdParams->GetStringValue("state_attribute", _retval); else { - char *cStringResult = nsnull; - rv = cmdParams->GetCStringValue("state_attribute", &cStringResult); - if (NS_SUCCEEDED(rv) && cStringResult && cStringResult[0]) - _retval.Assign(NS_ConvertUTF8toUCS2(cStringResult)); + nsXPIDLCString cStringResult; + rv = cmdParams->GetCStringValue("state_attribute", + getter_Copies(cStringResult)); - if (cStringResult) - nsMemory::Free(cStringResult); + CopyUTF8toUTF16(cStringResult, _retval); } return rv; diff --git a/mozilla/content/html/style/src/nsCSSStyleSheet.cpp b/mozilla/content/html/style/src/nsCSSStyleSheet.cpp index 9fc2ff1945c..738074a728a 100644 --- a/mozilla/content/html/style/src/nsCSSStyleSheet.cpp +++ b/mozilla/content/html/style/src/nsCSSStyleSheet.cpp @@ -2522,15 +2522,14 @@ CSSStyleSheetImpl::GetParentStyleSheet(nsIDOMStyleSheet** aParentStyleSheet) NS_IMETHODIMP CSSStyleSheetImpl::GetHref(nsAString& aHref) { + nsCAutoString str; + if (mInner && mInner->mURL) { - nsCAutoString str; mInner->mURL->GetSpec(str); - aHref.Assign(NS_ConvertUTF8toUCS2(str)); - } - else { - aHref.Truncate(); } + CopyUTF8toUTF16(str, aHref); + return NS_OK; } diff --git a/mozilla/content/svg/document/src/nsSVGDocument.cpp b/mozilla/content/svg/document/src/nsSVGDocument.cpp index f527a965d58..671a7c3218d 100644 --- a/mozilla/content/svg/document/src/nsSVGDocument.cpp +++ b/mozilla/content/svg/document/src/nsSVGDocument.cpp @@ -82,7 +82,7 @@ nsSVGDocument::StartDocumentLoad(const char* aCommand, nsCAutoString referrer; rv = httpChannel->GetResponseHeader(NS_LITERAL_CSTRING("referrer"), referrer); if (NS_SUCCEEDED(rv)) { - mReferrer = NS_ConvertUTF8toUCS2(referrer); + CopyUTF8toUTF16(referrer, mReferrer); } } @@ -104,30 +104,29 @@ nsSVGDocument::GetReferrer(nsAString& aReferrer) { NS_IMETHODIMP nsSVGDocument::GetDomain(nsAString& aDomain) { - if (!mDocumentURL) { - aDomain.Truncate(); - } else { - nsCAutoString domain; + nsCAutoString domain; + + if (mDocumentURL) { nsresult rv = mDocumentURL->GetHost(domain); if (NS_FAILED(rv)) return rv; - - aDomain.Assign(NS_ConvertUTF8toUCS2(domain)); } + + CopyUTF8toUTF16(domain, aDomain); return NS_OK; } NS_IMETHODIMP nsSVGDocument::GetURL(nsAString& aURL) { - if (!mDocumentURL) { - aURL.Truncate(); - } else { - nsCAutoString url; + nsCAutoString url; + + if (mDocumentURL) { nsresult rv = mDocumentURL->GetSpec(url); if (NS_FAILED(rv)) return rv; - aURL.Assign(NS_ConvertUTF8toUCS2(url)); } - + + CopyUTF8toUTF16(url, aURL); + return NS_OK; } diff --git a/mozilla/content/xbl/src/nsXBLProtoImplProperty.cpp b/mozilla/content/xbl/src/nsXBLProtoImplProperty.cpp index a8c9a33fdc6..373d3f9ed1a 100644 --- a/mozilla/content/xbl/src/nsXBLProtoImplProperty.cpp +++ b/mozilla/content/xbl/src/nsXBLProtoImplProperty.cpp @@ -215,20 +215,16 @@ nsXBLProtoImplProperty::CompileMember(nsIScriptContext* aContext, const nsCStrin nsresult rv = NS_OK; // Do we have a getter? - nsAutoString getter(mGetterText); - nsMemory::Free(mGetterText); - mGetterText = nsnull; nsCAutoString functionUri; - if (!getter.IsEmpty() && aClassObject) { - functionUri = aClassStr; - functionUri += NS_LITERAL_CSTRING("."); - functionUri += NS_ConvertUCS2toUTF8(mName); + if (*mGetterText && aClassObject) { + functionUri = aClassStr + NS_LITERAL_CSTRING("."); + AppendUTF16toUTF8(mName, functionUri); functionUri += NS_LITERAL_CSTRING(" (getter)"); rv = aContext->CompileFunction(aClassObject, nsCAutoString("onget"), 0, nsnull, - getter, + nsDependentString(mGetterText), functionUri.get(), 0, PR_FALSE, @@ -248,22 +244,22 @@ nsXBLProtoImplProperty::CompileMember(nsIScriptContext* aContext, const nsCStrin /*chaining to return failure*/ } } // if getter is not empty + + nsMemory::Free(mGetterText); + mGetterText = nsnull; + nsresult rvG=rv; // Do we have a setter? - nsAutoString setter(mSetterText); - nsMemory::Free(mSetterText); - mSetterText = nsnull; - if (!setter.IsEmpty() && aClassObject) { - functionUri = aClassStr; - functionUri += NS_LITERAL_CSTRING("."); - functionUri += NS_ConvertUCS2toUTF8(mName); + if (*mSetterText && aClassObject) { + functionUri = aClassStr + NS_LITERAL_CSTRING("."); + AppendUTF16toUTF8(mName, functionUri); functionUri += NS_LITERAL_CSTRING(" (setter)"); rv = aContext->CompileFunction(aClassObject, nsCAutoString("onset"), 1, gPropertyArgs, - setter, + nsDependentString(mSetterText), functionUri.get(), 0, PR_FALSE, @@ -284,5 +280,8 @@ nsXBLProtoImplProperty::CompileMember(nsIScriptContext* aContext, const nsCStrin } } // if setter wasn't empty.... + nsMemory::Free(mSetterText); + mSetterText = nsnull; + return NS_SUCCEEDED(rv) ? rvG : rv; } diff --git a/mozilla/content/xbl/src/nsXBLService.cpp b/mozilla/content/xbl/src/nsXBLService.cpp index 079d4651b83..ab1bbf27964 100644 --- a/mozilla/content/xbl/src/nsXBLService.cpp +++ b/mozilla/content/xbl/src/nsXBLService.cpp @@ -567,7 +567,7 @@ nsXBLService::LoadBindings(nsIContent* aContent, const nsAString& aURL, PRBool a // See if the URIs match. nsCAutoString uri; styleBinding->GetBindingURI(uri); - if (uri.EqualsWithConversion(NS_ConvertUCS2toUTF8(aURL).get())) + if (uri.Equals(NS_ConvertUCS2toUTF8(aURL))) return NS_OK; else { FlushStyleBindings(aContent); diff --git a/mozilla/content/xml/content/src/nsXMLElement.cpp b/mozilla/content/xml/content/src/nsXMLElement.cpp index de3c519c585..6e039d63d66 100644 --- a/mozilla/content/xml/content/src/nsXMLElement.cpp +++ b/mozilla/content/xml/content/src/nsXMLElement.cpp @@ -177,13 +177,13 @@ nsXMLElement::GetXMLBaseURI(nsIURI **aURI) // think a value of "./this:that" would have a scheme of "./that" NS_ConvertUCS2toUTF8 str(value); - - rv = MakeURI(str,nsnull,aURI); + + rv = MakeURI(str, nsnull, aURI); if (NS_FAILED(rv)) break; if (!base.IsEmpty()) { // XXXdarin base is always empty - str = NS_ConvertUCS2toUTF8(base); + CopyUTF16toUTF8(base, str); nsCAutoString resolvedStr; rv = (*aURI)->Resolve(str, resolvedStr); if (NS_FAILED(rv)) break; @@ -224,8 +224,7 @@ nsXMLElement::GetXMLBaseURI(nsIURI **aURI) *aURI = docBase.get(); NS_IF_ADDREF(*aURI); // nsCOMPtr releases this once } else { - NS_ConvertUCS2toUTF8 str(base); - rv = MakeURI(str,docBase,aURI); + rv = MakeURI(NS_ConvertUCS2toUTF8(base), docBase, aURI); } } @@ -328,13 +327,12 @@ static nsresult CheckLoadURI(nsIURI *aBaseURI, const nsAString& aURI, *aAbsURI = nsnull; nsresult rv; - rv = MakeURI(str,aBaseURI,aAbsURI); + rv = MakeURI(str, aBaseURI, aAbsURI); if (NS_SUCCEEDED(rv)) { nsCOMPtr securityManager = do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv); if (NS_SUCCEEDED(rv)) { - rv= securityManager->CheckLoadURI(aBaseURI, - *aAbsURI, + rv = securityManager->CheckLoadURI(aBaseURI, *aAbsURI, nsIScriptSecurityManager::DISALLOW_FROM_MAIL); } } diff --git a/mozilla/content/xml/document/src/nsXMLContentSink.cpp b/mozilla/content/xml/document/src/nsXMLContentSink.cpp index 1c41586cb1b..235c11b98ba 100644 --- a/mozilla/content/xml/document/src/nsXMLContentSink.cpp +++ b/mozilla/content/xml/document/src/nsXMLContentSink.cpp @@ -1094,7 +1094,8 @@ nsXMLContentSink::ProcessHeaderData(nsIAtom* aHeader,const nsAString& aValue,nsI nsCOMPtr reefer = do_QueryInterface(mDocShell); if (reefer) { - rv = reefer->SetupRefreshURIFromHeader(baseURI, NS_ConvertUCS2toUTF8(aValue)); + rv = reefer->SetupRefreshURIFromHeader(baseURI, + NS_ConvertUCS2toUTF8(aValue)); if (NS_FAILED(rv)) return rv; } } // END refresh @@ -1141,7 +1142,9 @@ nsXMLContentSink::ProcessHeaderData(nsIAtom* aHeader,const nsAString& aValue,nsI mParser->GetChannel(getter_AddRefs(channel)); } - rv = cookieServ->SetCookieString(codebaseURI, prompt, NS_ConvertUCS2toUTF8(aValue).get(), channel); + rv = cookieServ->SetCookieString(codebaseURI, prompt, + NS_ConvertUCS2toUTF8(aValue).get(), + channel); if (NS_FAILED(rv)) return rv; } // END set-cookie diff --git a/mozilla/content/xul/templates/src/nsRuleNetwork.cpp b/mozilla/content/xul/templates/src/nsRuleNetwork.cpp index e3876efbff9..42dc92cf35a 100644 --- a/mozilla/content/xul/templates/src/nsRuleNetwork.cpp +++ b/mozilla/content/xul/templates/src/nsRuleNetwork.cpp @@ -57,6 +57,7 @@ #include "nsIContent.h" #include "nsRuleNetwork.h" #include "plhash.h" +#include "nsReadableUtils.h" #include "prlog.h" #ifdef PR_LOGGING @@ -401,7 +402,7 @@ Value::ToCString(nsACString& aResult) aResult = "[nsIRDFLiteral \""; const PRUnichar* s; lit->GetValueConst(&s); - aResult += NS_ConvertUCS2toUTF8(s); + AppendUTF16toUTF8(s, aResult); aResult += "\"]"; break; } @@ -414,7 +415,7 @@ Value::ToCString(nsACString& aResult) case eString: aResult = "[string \""; - aResult += NS_ConvertUCS2toUTF8(mString); + AppendUTF16toUTF8(mString, aResult); aResult += "\"]"; break; diff --git a/mozilla/content/xul/templates/src/nsXULContentUtils.cpp b/mozilla/content/xul/templates/src/nsXULContentUtils.cpp index 3231ffa2355..b0870860b17 100644 --- a/mozilla/content/xul/templates/src/nsXULContentUtils.cpp +++ b/mozilla/content/xul/templates/src/nsXULContentUtils.cpp @@ -344,7 +344,7 @@ nsXULContentUtils::MakeElementURI(nsIDocument* aDocument, const nsAString& aElem if (aElementID.FindChar(':') > 0) { // Assume it's absolute already. Use as is. - aURI.Assign(NS_ConvertUCS2toUTF8(aElementID)); + CopyUTF16toUTF8(aElementID, aURI); } else { nsresult rv; @@ -364,7 +364,7 @@ nsXULContentUtils::MakeElementURI(nsIDocument* aDocument, const nsAString& aElem if (aElementID.First() != '#') { aURI.Append('#'); } - aURI.Append(NS_ConvertUCS2toUTF8(aElementID)); + AppendUTF16toUTF8(aElementID, aURI); #else nsXPIDLCString spec; rv = NS_MakeAbsoluteURI(nsCAutoString(aElementID), docURL, getter_Copies(spec)); diff --git a/mozilla/content/xul/templates/src/nsXULTemplateBuilder.cpp b/mozilla/content/xul/templates/src/nsXULTemplateBuilder.cpp index 618b07737da..76bf01c7ee2 100644 --- a/mozilla/content/xul/templates/src/nsXULTemplateBuilder.cpp +++ b/mozilla/content/xul/templates/src/nsXULTemplateBuilder.cpp @@ -1034,7 +1034,9 @@ nsXULTemplateBuilder::SubstituteText(nsTemplateMatch& aMatch, const char *uri = nsnull; member->GetValueConst(&uri); - aResult = NS_ConvertUTF8toUCS2(uri); + + CopyUTF8toUTF16(uri, aResult); + return NS_OK; } diff --git a/mozilla/layout/style/nsCSSStyleSheet.cpp b/mozilla/layout/style/nsCSSStyleSheet.cpp index 9fc2ff1945c..738074a728a 100644 --- a/mozilla/layout/style/nsCSSStyleSheet.cpp +++ b/mozilla/layout/style/nsCSSStyleSheet.cpp @@ -2522,15 +2522,14 @@ CSSStyleSheetImpl::GetParentStyleSheet(nsIDOMStyleSheet** aParentStyleSheet) NS_IMETHODIMP CSSStyleSheetImpl::GetHref(nsAString& aHref) { + nsCAutoString str; + if (mInner && mInner->mURL) { - nsCAutoString str; mInner->mURL->GetSpec(str); - aHref.Assign(NS_ConvertUTF8toUCS2(str)); - } - else { - aHref.Truncate(); } + CopyUTF8toUTF16(str, aHref); + return NS_OK; }