Fixing part of bug 209699. Eliminate bad usage of NS_ConvertU*. r=caillon@aillon.org, sr=alecf@flett.org
This commit is contained in:
@@ -309,7 +309,10 @@ nsPresContext::GetFontPreferences()
|
|||||||
|
|
||||||
// get font.minimum-size.[langGroup]
|
// get font.minimum-size.[langGroup]
|
||||||
PRInt32 size;
|
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);
|
rv = mPrefs->GetIntPref(pref.get(), &size);
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
if (unit == eUnit_px) {
|
if (unit == eUnit_px) {
|
||||||
@@ -324,7 +327,7 @@ nsPresContext::GetFontPreferences()
|
|||||||
nsCAutoString generic_dot_langGroup;
|
nsCAutoString generic_dot_langGroup;
|
||||||
for (PRInt32 eType = eDefaultFont_Variable; eType < eDefaultFont_COUNT; ++eType) {
|
for (PRInt32 eType = eDefaultFont_Variable; eType < eDefaultFont_COUNT; ++eType) {
|
||||||
generic_dot_langGroup.Assign(kGenericFont[eType]);
|
generic_dot_langGroup.Assign(kGenericFont[eType]);
|
||||||
generic_dot_langGroup.Append(NS_ConvertUCS2toUTF8(langGroup));
|
AppendUTF16toUTF8(langGroup, generic_dot_langGroup);
|
||||||
|
|
||||||
nsFont* font;
|
nsFont* font;
|
||||||
switch (eType) {
|
switch (eType) {
|
||||||
@@ -395,9 +398,10 @@ nsPresContext::GetFontPreferences()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_rbs
|
#ifdef DEBUG_rbs
|
||||||
nsCAutoString family(NS_ConvertUCS2toUTF8(font->name));
|
|
||||||
printf("%s Family-list:%s size:%d sizeAdjust:%.2f\n",
|
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
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4504,7 +4504,7 @@ NS_IMETHODIMP PresShell::GetLinkLocation(nsIDOMNode* aNode, nsAString& aLocation
|
|||||||
rv = baseURI->Resolve(NS_ConvertUCS2toUTF8(anchorText),spec);
|
rv = baseURI->Resolve(NS_ConvertUCS2toUTF8(anchorText),spec);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
anchorText = NS_ConvertUTF8toUCS2(spec);
|
CopyUTF8toUTF16(spec, anchorText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 "nsCOMPtr.h"
|
||||||
#include "nsIPresState.h"
|
#include "nsIPresState.h"
|
||||||
#include "nsHashtable.h"
|
#include "nsHashtable.h"
|
||||||
@@ -5,6 +42,7 @@
|
|||||||
#include "nsISupportsPrimitives.h"
|
#include "nsISupportsPrimitives.h"
|
||||||
#include "nsIComponentManager.h"
|
#include "nsIComponentManager.h"
|
||||||
#include "nsXPIDLString.h"
|
#include "nsXPIDLString.h"
|
||||||
|
#include "nsReadableUtils.h"
|
||||||
|
|
||||||
// Static IIDs/CIDs. Try to minimize these.
|
// Static IIDs/CIDs. Try to minimize these.
|
||||||
// None
|
// None
|
||||||
@@ -60,7 +98,7 @@ nsPresState::~nsPresState(void)
|
|||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsPresState::GetStateProperty(const nsAString& aName,
|
nsPresState::GetStateProperty(const nsAString& aName,
|
||||||
nsAString& aResult)
|
nsAString& aResult)
|
||||||
{
|
{
|
||||||
aResult.SetLength(0);
|
aResult.SetLength(0);
|
||||||
|
|
||||||
@@ -77,7 +115,7 @@ nsPresState::GetStateProperty(const nsAString& aName,
|
|||||||
nsCAutoString data;
|
nsCAutoString data;
|
||||||
supportsStr->GetData(data);
|
supportsStr->GetData(data);
|
||||||
|
|
||||||
aResult.Append(NS_ConvertUTF8toUCS2(data));
|
CopyUTF8toUTF16(data, aResult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -309,7 +309,10 @@ nsPresContext::GetFontPreferences()
|
|||||||
|
|
||||||
// get font.minimum-size.[langGroup]
|
// get font.minimum-size.[langGroup]
|
||||||
PRInt32 size;
|
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);
|
rv = mPrefs->GetIntPref(pref.get(), &size);
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
if (unit == eUnit_px) {
|
if (unit == eUnit_px) {
|
||||||
@@ -324,7 +327,7 @@ nsPresContext::GetFontPreferences()
|
|||||||
nsCAutoString generic_dot_langGroup;
|
nsCAutoString generic_dot_langGroup;
|
||||||
for (PRInt32 eType = eDefaultFont_Variable; eType < eDefaultFont_COUNT; ++eType) {
|
for (PRInt32 eType = eDefaultFont_Variable; eType < eDefaultFont_COUNT; ++eType) {
|
||||||
generic_dot_langGroup.Assign(kGenericFont[eType]);
|
generic_dot_langGroup.Assign(kGenericFont[eType]);
|
||||||
generic_dot_langGroup.Append(NS_ConvertUCS2toUTF8(langGroup));
|
AppendUTF16toUTF8(langGroup, generic_dot_langGroup);
|
||||||
|
|
||||||
nsFont* font;
|
nsFont* font;
|
||||||
switch (eType) {
|
switch (eType) {
|
||||||
@@ -395,9 +398,10 @@ nsPresContext::GetFontPreferences()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_rbs
|
#ifdef DEBUG_rbs
|
||||||
nsCAutoString family(NS_ConvertUCS2toUTF8(font->name));
|
|
||||||
printf("%s Family-list:%s size:%d sizeAdjust:%.2f\n",
|
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
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 "nsCOMPtr.h"
|
||||||
#include "nsIPresState.h"
|
#include "nsIPresState.h"
|
||||||
#include "nsHashtable.h"
|
#include "nsHashtable.h"
|
||||||
@@ -5,6 +42,7 @@
|
|||||||
#include "nsISupportsPrimitives.h"
|
#include "nsISupportsPrimitives.h"
|
||||||
#include "nsIComponentManager.h"
|
#include "nsIComponentManager.h"
|
||||||
#include "nsXPIDLString.h"
|
#include "nsXPIDLString.h"
|
||||||
|
#include "nsReadableUtils.h"
|
||||||
|
|
||||||
// Static IIDs/CIDs. Try to minimize these.
|
// Static IIDs/CIDs. Try to minimize these.
|
||||||
// None
|
// None
|
||||||
@@ -60,7 +98,7 @@ nsPresState::~nsPresState(void)
|
|||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsPresState::GetStateProperty(const nsAString& aName,
|
nsPresState::GetStateProperty(const nsAString& aName,
|
||||||
nsAString& aResult)
|
nsAString& aResult)
|
||||||
{
|
{
|
||||||
aResult.SetLength(0);
|
aResult.SetLength(0);
|
||||||
|
|
||||||
@@ -77,7 +115,7 @@ nsPresState::GetStateProperty(const nsAString& aName,
|
|||||||
nsCAutoString data;
|
nsCAutoString data;
|
||||||
supportsStr->GetData(data);
|
supportsStr->GetData(data);
|
||||||
|
|
||||||
aResult.Append(NS_ConvertUTF8toUCS2(data));
|
CopyUTF8toUTF16(data, aResult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -449,7 +449,7 @@ nsIsIndexFrame::OnSubmit(nsIPresContext* aPresContext)
|
|||||||
nsCAutoString relPath;
|
nsCAutoString relPath;
|
||||||
docURL->GetSpec(relPath);
|
docURL->GetSpec(relPath);
|
||||||
if (!relPath.IsEmpty()) {
|
if (!relPath.IsEmpty()) {
|
||||||
href = NS_ConvertUTF8toUCS2(relPath);
|
CopyUTF8toUTF16(relPath, href);
|
||||||
|
|
||||||
// If re-using the same URL, chop off old query string (bug 25330)
|
// If re-using the same URL, chop off old query string (bug 25330)
|
||||||
PRInt32 queryStart = href.FindChar('?');
|
PRInt32 queryStart = href.FindChar('?');
|
||||||
|
|||||||
@@ -476,7 +476,7 @@ PRBool nsObjectFrame::IsSupportedImage(nsIContent* aContent)
|
|||||||
|
|
||||||
nsAutoString uType;
|
nsAutoString uType;
|
||||||
nsresult rv = aContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::type, 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());
|
PRBool haveType = (rv == NS_CONTENT_ATTR_HAS_VALUE) && (!type.IsEmpty());
|
||||||
if (!haveType)
|
if (!haveType)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -573,10 +573,7 @@ nsPageFrame::DrawHeaderFooter(nsIPresContext* aPresContext,
|
|||||||
|
|
||||||
#ifdef DEBUG_PRINTING
|
#ifdef DEBUG_PRINTING
|
||||||
PR_PL(("Page: %p", this));
|
PR_PL(("Page: %p", this));
|
||||||
const char * s = NS_ConvertUCS2toUTF8(str).get();
|
PR_PL((" [%s]", NS_ConvertUCS2toUTF8(str).get()));
|
||||||
if (s) {
|
|
||||||
PR_PL((" [%s]", s));
|
|
||||||
}
|
|
||||||
char justStr[64];
|
char justStr[64];
|
||||||
switch (aJust) {
|
switch (aJust) {
|
||||||
case nsIPrintSettings::kJustLeft:strcpy(justStr, "Left");break;
|
case nsIPrintSettings::kJustLeft:strcpy(justStr, "Left");break;
|
||||||
|
|||||||
@@ -476,7 +476,7 @@ PRBool nsObjectFrame::IsSupportedImage(nsIContent* aContent)
|
|||||||
|
|
||||||
nsAutoString uType;
|
nsAutoString uType;
|
||||||
nsresult rv = aContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::type, 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());
|
PRBool haveType = (rv == NS_CONTENT_ATTR_HAS_VALUE) && (!type.IsEmpty());
|
||||||
if (!haveType)
|
if (!haveType)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -573,10 +573,7 @@ nsPageFrame::DrawHeaderFooter(nsIPresContext* aPresContext,
|
|||||||
|
|
||||||
#ifdef DEBUG_PRINTING
|
#ifdef DEBUG_PRINTING
|
||||||
PR_PL(("Page: %p", this));
|
PR_PL(("Page: %p", this));
|
||||||
const char * s = NS_ConvertUCS2toUTF8(str).get();
|
PR_PL((" [%s]", NS_ConvertUCS2toUTF8(str).get()));
|
||||||
if (s) {
|
|
||||||
PR_PL((" [%s]", s));
|
|
||||||
}
|
|
||||||
char justStr[64];
|
char justStr[64];
|
||||||
switch (aJust) {
|
switch (aJust) {
|
||||||
case nsIPrintSettings::kJustLeft:strcpy(justStr, "Left");break;
|
case nsIPrintSettings::kJustLeft:strcpy(justStr, "Left");break;
|
||||||
|
|||||||
@@ -4504,7 +4504,7 @@ NS_IMETHODIMP PresShell::GetLinkLocation(nsIDOMNode* aNode, nsAString& aLocation
|
|||||||
rv = baseURI->Resolve(NS_ConvertUCS2toUTF8(anchorText),spec);
|
rv = baseURI->Resolve(NS_ConvertUCS2toUTF8(anchorText),spec);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
anchorText = NS_ConvertUTF8toUCS2(spec);
|
CopyUTF8toUTF16(spec, anchorText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -449,7 +449,7 @@ nsIsIndexFrame::OnSubmit(nsIPresContext* aPresContext)
|
|||||||
nsCAutoString relPath;
|
nsCAutoString relPath;
|
||||||
docURL->GetSpec(relPath);
|
docURL->GetSpec(relPath);
|
||||||
if (!relPath.IsEmpty()) {
|
if (!relPath.IsEmpty()) {
|
||||||
href = NS_ConvertUTF8toUCS2(relPath);
|
CopyUTF8toUTF16(relPath, href);
|
||||||
|
|
||||||
// If re-using the same URL, chop off old query string (bug 25330)
|
// If re-using the same URL, chop off old query string (bug 25330)
|
||||||
PRInt32 queryStart = href.FindChar('?');
|
PRInt32 queryStart = href.FindChar('?');
|
||||||
|
|||||||
Reference in New Issue
Block a user