diff --git a/mozilla/layout/base/nsPresContext.cpp b/mozilla/layout/base/nsPresContext.cpp index 12a16e16973..8835ff916c2 100644 --- a/mozilla/layout/base/nsPresContext.cpp +++ b/mozilla/layout/base/nsPresContext.cpp @@ -309,7 +309,10 @@ nsPresContext::GetFontPreferences() // get font.minimum-size.[langGroup] PRInt32 size; - pref.Assign("font.minimum-size."); pref.Append(NS_ConvertUCS2toUTF8(langGroup)); + + pref.Assign("font.minimum-size."); + AppendUTF16toUTF8(langGroup, pref); + rv = mPrefs->GetIntPref(pref.get(), &size); if (NS_SUCCEEDED(rv)) { if (unit == eUnit_px) { @@ -324,7 +327,7 @@ nsPresContext::GetFontPreferences() nsCAutoString generic_dot_langGroup; for (PRInt32 eType = eDefaultFont_Variable; eType < eDefaultFont_COUNT; ++eType) { generic_dot_langGroup.Assign(kGenericFont[eType]); - generic_dot_langGroup.Append(NS_ConvertUCS2toUTF8(langGroup)); + AppendUTF16toUTF8(langGroup, generic_dot_langGroup); nsFont* font; switch (eType) { @@ -395,9 +398,10 @@ nsPresContext::GetFontPreferences() } #ifdef DEBUG_rbs - nsCAutoString family(NS_ConvertUCS2toUTF8(font->name)); printf("%s Family-list:%s size:%d sizeAdjust:%.2f\n", - generic_dot_langGroup.get(), family.get(), font->size, font->sizeAdjust); + generic_dot_langGroup.get(), + NS_ConvertUCS2toUTF8(font->name).get(), font->size, + font->sizeAdjust); #endif } } diff --git a/mozilla/layout/base/nsPresShell.cpp b/mozilla/layout/base/nsPresShell.cpp index cd6ee190df9..12d303c3a3c 100644 --- a/mozilla/layout/base/nsPresShell.cpp +++ b/mozilla/layout/base/nsPresShell.cpp @@ -4504,7 +4504,7 @@ NS_IMETHODIMP PresShell::GetLinkLocation(nsIDOMNode* aNode, nsAString& aLocation rv = baseURI->Resolve(NS_ConvertUCS2toUTF8(anchorText),spec); NS_ENSURE_SUCCESS(rv, rv); - anchorText = NS_ConvertUTF8toUCS2(spec); + CopyUTF8toUTF16(spec, anchorText); } } } diff --git a/mozilla/layout/base/nsPresState.cpp b/mozilla/layout/base/nsPresState.cpp index 0fb923dc2dc..8b24d5fce53 100644 --- a/mozilla/layout/base/nsPresState.cpp +++ b/mozilla/layout/base/nsPresState.cpp @@ -1,3 +1,40 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: NPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Netscape Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the NPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the NPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + #include "nsCOMPtr.h" #include "nsIPresState.h" #include "nsHashtable.h" @@ -5,6 +42,7 @@ #include "nsISupportsPrimitives.h" #include "nsIComponentManager.h" #include "nsXPIDLString.h" +#include "nsReadableUtils.h" // Static IIDs/CIDs. Try to minimize these. // None @@ -60,7 +98,7 @@ nsPresState::~nsPresState(void) NS_IMETHODIMP nsPresState::GetStateProperty(const nsAString& aName, - nsAString& aResult) + nsAString& aResult) { aResult.SetLength(0); @@ -77,7 +115,7 @@ nsPresState::GetStateProperty(const nsAString& aName, nsCAutoString data; supportsStr->GetData(data); - aResult.Append(NS_ConvertUTF8toUCS2(data)); + CopyUTF8toUTF16(data, aResult); } } diff --git a/mozilla/layout/base/src/nsPresContext.cpp b/mozilla/layout/base/src/nsPresContext.cpp index 12a16e16973..8835ff916c2 100644 --- a/mozilla/layout/base/src/nsPresContext.cpp +++ b/mozilla/layout/base/src/nsPresContext.cpp @@ -309,7 +309,10 @@ nsPresContext::GetFontPreferences() // get font.minimum-size.[langGroup] PRInt32 size; - pref.Assign("font.minimum-size."); pref.Append(NS_ConvertUCS2toUTF8(langGroup)); + + pref.Assign("font.minimum-size."); + AppendUTF16toUTF8(langGroup, pref); + rv = mPrefs->GetIntPref(pref.get(), &size); if (NS_SUCCEEDED(rv)) { if (unit == eUnit_px) { @@ -324,7 +327,7 @@ nsPresContext::GetFontPreferences() nsCAutoString generic_dot_langGroup; for (PRInt32 eType = eDefaultFont_Variable; eType < eDefaultFont_COUNT; ++eType) { generic_dot_langGroup.Assign(kGenericFont[eType]); - generic_dot_langGroup.Append(NS_ConvertUCS2toUTF8(langGroup)); + AppendUTF16toUTF8(langGroup, generic_dot_langGroup); nsFont* font; switch (eType) { @@ -395,9 +398,10 @@ nsPresContext::GetFontPreferences() } #ifdef DEBUG_rbs - nsCAutoString family(NS_ConvertUCS2toUTF8(font->name)); printf("%s Family-list:%s size:%d sizeAdjust:%.2f\n", - generic_dot_langGroup.get(), family.get(), font->size, font->sizeAdjust); + generic_dot_langGroup.get(), + NS_ConvertUCS2toUTF8(font->name).get(), font->size, + font->sizeAdjust); #endif } } diff --git a/mozilla/layout/base/src/nsPresState.cpp b/mozilla/layout/base/src/nsPresState.cpp index 0fb923dc2dc..8b24d5fce53 100644 --- a/mozilla/layout/base/src/nsPresState.cpp +++ b/mozilla/layout/base/src/nsPresState.cpp @@ -1,3 +1,40 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: NPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Netscape Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the NPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the NPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + #include "nsCOMPtr.h" #include "nsIPresState.h" #include "nsHashtable.h" @@ -5,6 +42,7 @@ #include "nsISupportsPrimitives.h" #include "nsIComponentManager.h" #include "nsXPIDLString.h" +#include "nsReadableUtils.h" // Static IIDs/CIDs. Try to minimize these. // None @@ -60,7 +98,7 @@ nsPresState::~nsPresState(void) NS_IMETHODIMP nsPresState::GetStateProperty(const nsAString& aName, - nsAString& aResult) + nsAString& aResult) { aResult.SetLength(0); @@ -77,7 +115,7 @@ nsPresState::GetStateProperty(const nsAString& aName, nsCAutoString data; supportsStr->GetData(data); - aResult.Append(NS_ConvertUTF8toUCS2(data)); + CopyUTF8toUTF16(data, aResult); } } diff --git a/mozilla/layout/forms/nsIsIndexFrame.cpp b/mozilla/layout/forms/nsIsIndexFrame.cpp index 9451da9c073..0f73675aa44 100644 --- a/mozilla/layout/forms/nsIsIndexFrame.cpp +++ b/mozilla/layout/forms/nsIsIndexFrame.cpp @@ -449,7 +449,7 @@ nsIsIndexFrame::OnSubmit(nsIPresContext* aPresContext) nsCAutoString relPath; docURL->GetSpec(relPath); if (!relPath.IsEmpty()) { - href = NS_ConvertUTF8toUCS2(relPath); + CopyUTF8toUTF16(relPath, href); // If re-using the same URL, chop off old query string (bug 25330) PRInt32 queryStart = href.FindChar('?'); diff --git a/mozilla/layout/generic/nsObjectFrame.cpp b/mozilla/layout/generic/nsObjectFrame.cpp index f95cc8948c1..53b35db039d 100644 --- a/mozilla/layout/generic/nsObjectFrame.cpp +++ b/mozilla/layout/generic/nsObjectFrame.cpp @@ -476,7 +476,7 @@ PRBool nsObjectFrame::IsSupportedImage(nsIContent* aContent) nsAutoString uType; nsresult rv = aContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::type, uType); - nsCAutoString type = NS_ConvertUCS2toUTF8(uType); + NS_ConvertUCS2toUTF8 type(uType); PRBool haveType = (rv == NS_CONTENT_ATTR_HAS_VALUE) && (!type.IsEmpty()); if (!haveType) { diff --git a/mozilla/layout/generic/nsPageFrame.cpp b/mozilla/layout/generic/nsPageFrame.cpp index e251e8e9f1c..983b9bbcbcd 100644 --- a/mozilla/layout/generic/nsPageFrame.cpp +++ b/mozilla/layout/generic/nsPageFrame.cpp @@ -573,10 +573,7 @@ nsPageFrame::DrawHeaderFooter(nsIPresContext* aPresContext, #ifdef DEBUG_PRINTING PR_PL(("Page: %p", this)); - const char * s = NS_ConvertUCS2toUTF8(str).get(); - if (s) { - PR_PL((" [%s]", s)); - } + PR_PL((" [%s]", NS_ConvertUCS2toUTF8(str).get())); char justStr[64]; switch (aJust) { case nsIPrintSettings::kJustLeft:strcpy(justStr, "Left");break; diff --git a/mozilla/layout/html/base/src/nsObjectFrame.cpp b/mozilla/layout/html/base/src/nsObjectFrame.cpp index f95cc8948c1..53b35db039d 100644 --- a/mozilla/layout/html/base/src/nsObjectFrame.cpp +++ b/mozilla/layout/html/base/src/nsObjectFrame.cpp @@ -476,7 +476,7 @@ PRBool nsObjectFrame::IsSupportedImage(nsIContent* aContent) nsAutoString uType; nsresult rv = aContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::type, uType); - nsCAutoString type = NS_ConvertUCS2toUTF8(uType); + NS_ConvertUCS2toUTF8 type(uType); PRBool haveType = (rv == NS_CONTENT_ATTR_HAS_VALUE) && (!type.IsEmpty()); if (!haveType) { diff --git a/mozilla/layout/html/base/src/nsPageFrame.cpp b/mozilla/layout/html/base/src/nsPageFrame.cpp index e251e8e9f1c..983b9bbcbcd 100644 --- a/mozilla/layout/html/base/src/nsPageFrame.cpp +++ b/mozilla/layout/html/base/src/nsPageFrame.cpp @@ -573,10 +573,7 @@ nsPageFrame::DrawHeaderFooter(nsIPresContext* aPresContext, #ifdef DEBUG_PRINTING PR_PL(("Page: %p", this)); - const char * s = NS_ConvertUCS2toUTF8(str).get(); - if (s) { - PR_PL((" [%s]", s)); - } + PR_PL((" [%s]", NS_ConvertUCS2toUTF8(str).get())); char justStr[64]; switch (aJust) { case nsIPrintSettings::kJustLeft:strcpy(justStr, "Left");break; diff --git a/mozilla/layout/html/base/src/nsPresShell.cpp b/mozilla/layout/html/base/src/nsPresShell.cpp index cd6ee190df9..12d303c3a3c 100644 --- a/mozilla/layout/html/base/src/nsPresShell.cpp +++ b/mozilla/layout/html/base/src/nsPresShell.cpp @@ -4504,7 +4504,7 @@ NS_IMETHODIMP PresShell::GetLinkLocation(nsIDOMNode* aNode, nsAString& aLocation rv = baseURI->Resolve(NS_ConvertUCS2toUTF8(anchorText),spec); NS_ENSURE_SUCCESS(rv, rv); - anchorText = NS_ConvertUTF8toUCS2(spec); + CopyUTF8toUTF16(spec, anchorText); } } } diff --git a/mozilla/layout/html/forms/src/nsIsIndexFrame.cpp b/mozilla/layout/html/forms/src/nsIsIndexFrame.cpp index 9451da9c073..0f73675aa44 100644 --- a/mozilla/layout/html/forms/src/nsIsIndexFrame.cpp +++ b/mozilla/layout/html/forms/src/nsIsIndexFrame.cpp @@ -449,7 +449,7 @@ nsIsIndexFrame::OnSubmit(nsIPresContext* aPresContext) nsCAutoString relPath; docURL->GetSpec(relPath); if (!relPath.IsEmpty()) { - href = NS_ConvertUTF8toUCS2(relPath); + CopyUTF8toUTF16(relPath, href); // If re-using the same URL, chop off old query string (bug 25330) PRInt32 queryStart = href.FindChar('?');