diff --git a/mozilla/content/base/src/nsHTMLValue.cpp b/mozilla/content/base/src/nsHTMLValue.cpp
index 5b1e8d7aadd..a86f70b9253 100644
--- a/mozilla/content/base/src/nsHTMLValue.cpp
+++ b/mozilla/content/base/src/nsHTMLValue.cpp
@@ -266,37 +266,37 @@ void nsHTMLValue::AppendToString(nsString& aBuffer) const
}
else if ((eHTMLUnit_String == mUnit) || (eHTMLUnit_ColorName == mUnit)) {
if (nsnull != mValue.mString) {
- aBuffer.Append('"');
+ aBuffer.AppendWithConversion('"');
aBuffer.Append(*(mValue.mString));
- aBuffer.Append('"');
+ aBuffer.AppendWithConversion('"');
}
else {
- aBuffer.Append("null str");
+ aBuffer.AppendWithConversion("null str");
}
}
else if (eHTMLUnit_ISupports == mUnit) {
- aBuffer.Append("0x");
- aBuffer.Append((PRInt32)mValue.mISupports, 16);
+ aBuffer.AppendWithConversion("0x");
+ aBuffer.AppendInt((PRInt32)mValue.mISupports, 16);
}
else if (eHTMLUnit_Color == mUnit){
- aBuffer.Append("(0x");
- aBuffer.Append(NS_GET_R(mValue.mColor), 16);
- aBuffer.Append(" 0x");
- aBuffer.Append(NS_GET_G(mValue.mColor), 16);
- aBuffer.Append(" 0x");
- aBuffer.Append(NS_GET_B(mValue.mColor), 16);
- aBuffer.Append(" 0x");
- aBuffer.Append(NS_GET_A(mValue.mColor), 16);
- aBuffer.Append(')');
+ aBuffer.AppendWithConversion("(0x");
+ aBuffer.AppendInt(NS_GET_R(mValue.mColor), 16);
+ aBuffer.AppendWithConversion(" 0x");
+ aBuffer.AppendInt(NS_GET_G(mValue.mColor), 16);
+ aBuffer.AppendWithConversion(" 0x");
+ aBuffer.AppendInt(NS_GET_B(mValue.mColor), 16);
+ aBuffer.AppendWithConversion(" 0x");
+ aBuffer.AppendInt(NS_GET_A(mValue.mColor), 16);
+ aBuffer.AppendWithConversion(')');
}
else if (eHTMLUnit_Percent == mUnit) {
- aBuffer.Append(mValue.mFloat * 100.0f);
+ aBuffer.AppendFloat(mValue.mFloat * 100.0f);
}
else {
- aBuffer.Append(mValue.mInt, 10);
- aBuffer.Append("[0x");
- aBuffer.Append(mValue.mInt, 16);
- aBuffer.Append(']');
+ aBuffer.AppendInt(mValue.mInt, 10);
+ aBuffer.AppendWithConversion("[0x");
+ aBuffer.AppendInt(mValue.mInt, 16);
+ aBuffer.AppendWithConversion(']');
}
switch (mUnit) {
@@ -304,15 +304,15 @@ void nsHTMLValue::AppendToString(nsString& aBuffer) const
case eHTMLUnit_Empty: break;
case eHTMLUnit_String: break;
case eHTMLUnit_ColorName: break;
- case eHTMLUnit_ISupports: aBuffer.Append("ptr"); break;
+ case eHTMLUnit_ISupports: aBuffer.AppendWithConversion("ptr"); break;
case eHTMLUnit_Integer: break;
- case eHTMLUnit_Enumerated: aBuffer.Append("enum"); break;
- case eHTMLUnit_Proportional: aBuffer.Append("*"); break;
- case eHTMLUnit_Color: aBuffer.Append("rbga"); break;
- case eHTMLUnit_Percent: aBuffer.Append("%"); break;
- case eHTMLUnit_Pixel: aBuffer.Append("px"); break;
+ case eHTMLUnit_Enumerated: aBuffer.AppendWithConversion("enum"); break;
+ case eHTMLUnit_Proportional: aBuffer.AppendWithConversion("*"); break;
+ case eHTMLUnit_Color: aBuffer.AppendWithConversion("rbga"); break;
+ case eHTMLUnit_Percent: aBuffer.AppendWithConversion("%"); break;
+ case eHTMLUnit_Pixel: aBuffer.AppendWithConversion("px"); break;
}
- aBuffer.Append(' ');
+ aBuffer.AppendWithConversion(' ');
}
void nsHTMLValue::ToString(nsString& aBuffer) const
diff --git a/mozilla/content/base/src/nsStyleContext.cpp b/mozilla/content/base/src/nsStyleContext.cpp
index d1e974f4c78..1f04a34d318 100644
--- a/mozilla/content/base/src/nsStyleContext.cpp
+++ b/mozilla/content/base/src/nsStyleContext.cpp
@@ -1526,7 +1526,7 @@ void StyleUserInterfaceImpl::ResetFrom(const nsStyleUserInterface* aParent, nsIP
mUserSelect = NS_STYLE_USER_SELECT_AUTO;
mKeyEquivalent = PRUnichar(0); // XXX what type should this be?
mResizer = NS_STYLE_RESIZER_AUTO;
- mBehavior = "";
+ mBehavior.SetLength(0);
}
void StyleUserInterfaceImpl::SetFrom(const nsStyleUserInterface& aSource)
diff --git a/mozilla/content/events/src/nsEventStateManager.cpp b/mozilla/content/events/src/nsEventStateManager.cpp
index 6b64d7c9e37..eee45f695d3 100644
--- a/mozilla/content/events/src/nsEventStateManager.cpp
+++ b/mozilla/content/events/src/nsEventStateManager.cpp
@@ -1764,7 +1764,7 @@ nsEventStateManager::GetNextTabbableContent(nsIContent* aRootContent, nsIFrame*
child->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::disabled, value);
nsAutoString tabStr;
child->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::tabindex, tabStr);
- if (tabStr != "") {
+ if (!tabStr.IsEmpty()) {
PRInt32 errorCode;
tabIndex = tabStr.ToInteger(&errorCode);
}
diff --git a/mozilla/content/html/content/src/nsGenericHTMLElement.cpp b/mozilla/content/html/content/src/nsGenericHTMLElement.cpp
index 145495640f6..bb338503914 100644
--- a/mozilla/content/html/content/src/nsGenericHTMLElement.cpp
+++ b/mozilla/content/html/content/src/nsGenericHTMLElement.cpp
@@ -1274,26 +1274,25 @@ nsGenericHTMLElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute,
case eHTMLUnit_Integer:
aResult.Truncate();
- aResult.Append(value->GetIntValue(), 10);
+ aResult.AppendInt(value->GetIntValue(), 10);
break;
case eHTMLUnit_Pixel:
aResult.Truncate();
- aResult.Append(value->GetPixelValue(), 10);
+ aResult.AppendInt(value->GetPixelValue(), 10);
break;
case eHTMLUnit_Percent:
aResult.Truncate();
- aResult.Append(PRInt32(value->GetPercentValue() * 100.0f), 10);
- aResult.Append('%');
+ aResult.AppendInt(PRInt32(value->GetPercentValue() * 100.0f), 10);
+ aResult.AppendWithConversion('%');
break;
case eHTMLUnit_Color:
color = nscolor(value->GetColorValue());
PR_snprintf(cbuf, sizeof(cbuf), "#%02x%02x%02x",
NS_GET_R(color), NS_GET_G(color), NS_GET_B(color));
- aResult.Truncate();
- aResult.Append(cbuf);
+ aResult.AssignWithConversion(cbuf);
break;
default:
@@ -1492,7 +1491,7 @@ nsGenericHTMLElement::ListAttributes(FILE* out) const
// value
nsAutoString value;
GetAttribute(nameSpaceID, attr, value);
- buffer.Append("=");
+ buffer.AppendWithConversion("=");
buffer.Append(value);
fputs(" ", out);
@@ -1580,41 +1579,39 @@ void NS_QuoteForHTML(const nsString& aValue, nsString& aResult);
void
NS_QuoteForHTML(const nsString& aValue, nsString& aResult)
{
- aResult.Truncate();
const PRUnichar* cp = aValue.GetUnicode();
const PRUnichar* end = aValue.GetUnicode() + aValue.Length();
- aResult.Append('"');
+ aResult.AssignWithConversion('"');
while (cp < end) {
PRUnichar ch = *cp++;
if ((ch >= 0x20) && (ch <= 0x7f)) {
if (ch == '\"') {
- aResult.Append(""");
+ aResult.AppendWithConversion(""");
}
else {
aResult.Append(ch);
}
}
else {
- aResult.Append("");
- aResult.Append((PRInt32) ch, 10);
- aResult.Append(';');
+ aResult.AppendWithConversion("");
+ aResult.AppendInt((PRInt32) ch, 10);
+ aResult.AppendWithConversion(';');
}
}
- aResult.Append('"');
+ aResult.AppendWithConversion('"');
}
nsresult
nsGenericHTMLElement::ToHTMLString(nsString& aBuf) const
{
- aBuf.Truncate(0);
- aBuf.Append('<');
+ aBuf.AssignWithConversion('<');
if (nsnull != mTag) {
nsAutoString tmp;
mTag->ToString(tmp);
aBuf.Append(tmp);
} else {
- aBuf.Append("?NULL");
+ aBuf.AppendWithConversion("?NULL");
}
if (nsnull != mAttributes) {
@@ -1625,20 +1622,20 @@ nsGenericHTMLElement::ToHTMLString(nsString& aBuf) const
nsIAtom* atom = nsnull;
mAttributes->GetAttributeNameAt(index, atom);
atom->ToString(name);
- aBuf.Append(' ');
+ aBuf.AppendWithConversion(' ');
aBuf.Append(name);
value.Truncate();
GetAttribute(kNameSpaceID_None, atom, value);
NS_RELEASE(atom);
if (value.Length() > 0) {
- aBuf.Append('=');
+ aBuf.AppendWithConversion('=');
NS_QuoteForHTML(value, quotedValue);
aBuf.Append(quotedValue);
}
}
}
- aBuf.Append('>');
+ aBuf.AppendWithConversion('>');
return NS_OK;
}
@@ -1664,7 +1661,7 @@ nsGenericHTMLElement::AttributeToString(nsIAtom* aAttribute,
NS_RELEASE(cssRule);
}
else {
- aResult = "Unknown rule type";
+ aResult.AssignWithConversion("Unknown rule type");
}
NS_RELEASE(rule);
}
@@ -1705,7 +1702,7 @@ nsGenericHTMLElement::ParseCaseSensitiveEnumValue(const nsString& aValue,
nsHTMLValue& aResult)
{
while (nsnull != aTable->tag) {
- if (aValue.Equals(aTable->tag)) {
+ if (aValue.EqualsWithConversion(aTable->tag)) {
aResult.SetIntValue(aTable->value, eHTMLUnit_Enumerated);
return PR_TRUE;
}
@@ -1725,7 +1722,7 @@ nsGenericHTMLElement::EnumValueToString(const nsHTMLValue& aValue,
PRInt32 v = aValue.GetIntValue();
while (nsnull != aTable->tag) {
if (aTable->value == v) {
- aResult.Append(aTable->tag);
+ aResult.AppendWithConversion(aTable->tag);
if (aFoldCase) {
aResult.SetCharAt(nsCRT::ToUpper(aResult[0]), 0);
}
@@ -1804,14 +1801,14 @@ nsGenericHTMLElement::ValueOrPercentToString(const nsHTMLValue& aValue,
aResult.Truncate(0);
switch (aValue.GetUnit()) {
case eHTMLUnit_Integer:
- aResult.Append(aValue.GetIntValue(), 10);
+ aResult.AppendInt(aValue.GetIntValue(), 10);
return PR_TRUE;
case eHTMLUnit_Pixel:
- aResult.Append(aValue.GetPixelValue(), 10);
+ aResult.AppendInt(aValue.GetPixelValue(), 10);
return PR_TRUE;
case eHTMLUnit_Percent:
- aResult.Append(PRInt32(aValue.GetPercentValue() * 100.0f), 10);
- aResult.Append('%');
+ aResult.AppendInt(PRInt32(aValue.GetPercentValue() * 100.0f), 10);
+ aResult.AppendWithConversion('%');
return PR_TRUE;
default:
break;
@@ -1826,18 +1823,18 @@ nsGenericHTMLElement::ValueOrPercentOrProportionalToString(const nsHTMLValue& aV
aResult.Truncate(0);
switch (aValue.GetUnit()) {
case eHTMLUnit_Integer:
- aResult.Append(aValue.GetIntValue(), 10);
+ aResult.AppendInt(aValue.GetIntValue(), 10);
return PR_TRUE;
case eHTMLUnit_Pixel:
- aResult.Append(aValue.GetPixelValue(), 10);
+ aResult.AppendInt(aValue.GetPixelValue(), 10);
return PR_TRUE;
case eHTMLUnit_Percent:
- aResult.Append(PRInt32(aValue.GetPercentValue() * 100.0f), 10);
- aResult.Append('%');
+ aResult.AppendInt(PRInt32(aValue.GetPercentValue() * 100.0f), 10);
+ aResult.AppendWithConversion('%');
return PR_TRUE;
case eHTMLUnit_Proportional:
- aResult.Append(aValue.GetIntValue(), 10);
- aResult.Append('*');
+ aResult.AppendInt(aValue.GetIntValue(), 10);
+ aResult.AppendWithConversion('*');
return PR_TRUE;
default:
break;
@@ -1928,8 +1925,7 @@ nsGenericHTMLElement::ColorToString(const nsHTMLValue& aValue,
char buf[10];
PR_snprintf(buf, sizeof(buf), "#%02x%02x%02x",
NS_GET_R(v), NS_GET_G(v), NS_GET_B(v));
- aResult.Truncate(0);
- aResult.Append(buf);
+ aResult.AssignWithConversion(buf);
return PR_TRUE;
}
if ((aValue.GetUnit() == eHTMLUnit_ColorName) ||
diff --git a/mozilla/content/html/content/src/nsHTMLAnchorElement.cpp b/mozilla/content/html/content/src/nsHTMLAnchorElement.cpp
index e542786be0b..b7e0797fd97 100644
--- a/mozilla/content/html/content/src/nsHTMLAnchorElement.cpp
+++ b/mozilla/content/html/content/src/nsHTMLAnchorElement.cpp
@@ -395,8 +395,8 @@ nsHTMLAnchorElement::GetProtocol(nsString& aProtocol)
char* protocol;
result = url->GetScheme(&protocol);
if (result == NS_OK) {
- aProtocol.SetString(protocol);
- aProtocol.Append(":");
+ aProtocol.AssignWithConversion(protocol);
+ aProtocol.AppendWithConversion(":");
nsCRT::free(protocol);
}
NS_RELEASE(url);
@@ -420,13 +420,13 @@ nsHTMLAnchorElement::GetHost(nsString& aHost)
char* host;
result = url->GetHost(&host);
if (result == NS_OK) {
- aHost.SetString(host);
+ aHost.AssignWithConversion(host);
nsCRT::free(host);
PRInt32 port;
(void)url->GetPort(&port);
if (-1 != port) {
- aHost.Append(":");
- aHost.Append(port, 10);
+ aHost.AppendWithConversion(":");
+ aHost.AppendInt(port, 10);
}
}
NS_RELEASE(url);
@@ -450,7 +450,7 @@ nsHTMLAnchorElement::GetHostname(nsString& aHostname)
char* host;
result = url->GetHost(&host);
if (result == NS_OK) {
- aHostname.SetString(host);
+ aHostname.AssignWithConversion(host);
nsCRT::free(host);
}
NS_RELEASE(url);
@@ -491,7 +491,7 @@ nsHTMLAnchorElement::GetPathname(nsString& aPathname)
return result;
}
- aPathname.SetString(file);
+ aPathname.AssignWithConversion(file);
nsCRT::free(file);
return result;
@@ -516,8 +516,8 @@ nsHTMLAnchorElement::GetSearch(nsString& aSearch)
NS_RELEASE(url);
}
if (result == NS_OK && (nsnull != search) && ('\0' != *search)) {
- aSearch.SetString("?");
- aSearch.Append(search);
+ aSearch.AssignWithConversion("?");
+ aSearch.AppendWithConversion(search);
nsCRT::free(search);
}
else {
@@ -545,7 +545,7 @@ nsHTMLAnchorElement::GetPort(nsString& aPort)
PRInt32 port;
(void)url->GetPort(&port);
if (-1 != port) {
- aPort.Append(port, 10);
+ aPort.AppendInt(port, 10);
}
NS_RELEASE(url);
}
@@ -574,8 +574,8 @@ nsHTMLAnchorElement::GetHash(nsString& aHash)
NS_RELEASE(url);
}
if (result == NS_OK && (nsnull != ref) && ('\0' != *ref)) {
- aHash.SetString("#");
- aHash.Append(ref);
+ aHash.AssignWithConversion("#");
+ aHash.AppendWithConversion(ref);
nsCRT::free(ref);
}
else {
diff --git a/mozilla/content/html/content/src/nsHTMLAreaElement.cpp b/mozilla/content/html/content/src/nsHTMLAreaElement.cpp
index f7b94ebd322..b60fef57032 100644
--- a/mozilla/content/html/content/src/nsHTMLAreaElement.cpp
+++ b/mozilla/content/html/content/src/nsHTMLAreaElement.cpp
@@ -277,8 +277,8 @@ nsHTMLAreaElement::GetProtocol(nsString& aProtocol)
char* protocol;
result = url->GetScheme(&protocol);
if (result == NS_OK) {
- aProtocol.SetString(protocol);
- aProtocol.Append(":");
+ aProtocol.AssignWithConversion(protocol);
+ aProtocol.AppendWithConversion(":");
nsCRT::free(protocol);
}
NS_RELEASE(url);
@@ -302,13 +302,13 @@ nsHTMLAreaElement::GetHost(nsString& aHost)
char* host;
result = url->GetHost(&host);
if (result == NS_OK) {
- aHost.SetString(host);
+ aHost.AssignWithConversion(host);
nsCRT::free(host);
PRInt32 port;
(void)url->GetPort(&port);
if (-1 != port) {
- aHost.Append(":");
- aHost.Append(port, 10);
+ aHost.AppendWithConversion(":");
+ aHost.AppendInt(port, 10);
}
}
NS_RELEASE(url);
@@ -332,7 +332,7 @@ nsHTMLAreaElement::GetHostname(nsString& aHostname)
char* host;
result = url->GetHost(&host);
if (result == NS_OK) {
- aHostname.SetString(host);
+ aHostname.AssignWithConversion(host);
nsCRT::free(host);
}
NS_RELEASE(url);
@@ -356,7 +356,7 @@ nsHTMLAreaElement::GetPathname(nsString& aPathname)
char* file;
result = url->GetPath(&file);
if (result == NS_OK) {
- aPathname.SetString(file);
+ aPathname.AssignWithConversion(file);
nsCRT::free(file);
}
NS_IF_RELEASE(url);
@@ -385,8 +385,8 @@ nsHTMLAreaElement::GetSearch(nsString& aSearch)
NS_RELEASE(url);
}
if (result == NS_OK && (nsnull != search) && ('\0' != *search)) {
- aSearch.SetString("?");
- aSearch.Append(search);
+ aSearch.AssignWithConversion("?");
+ aSearch.AppendWithConversion(search);
nsCRT::free(search);
}
else {
@@ -414,7 +414,7 @@ nsHTMLAreaElement::GetPort(nsString& aPort)
PRInt32 port;
(void)url->GetPort(&port);
if (-1 != port) {
- aPort.Append(port, 10);
+ aPort.AppendInt(port, 10);
}
NS_RELEASE(url);
}
@@ -443,8 +443,8 @@ nsHTMLAreaElement::GetHash(nsString& aHash)
NS_RELEASE(url);
}
if (result == NS_OK && (nsnull != ref) && ('\0' != *ref)) {
- aHash.SetString("#");
- aHash.Append(ref);
+ aHash.AssignWithConversion("#");
+ aHash.AppendWithConversion(ref);
nsCRT::free(ref);
}
else {
diff --git a/mozilla/content/html/content/src/nsHTMLButtonElement.cpp b/mozilla/content/html/content/src/nsHTMLButtonElement.cpp
index 333f2bc9a8a..050ad9e77b9 100644
--- a/mozilla/content/html/content/src/nsHTMLButtonElement.cpp
+++ b/mozilla/content/html/content/src/nsHTMLButtonElement.cpp
@@ -245,13 +245,13 @@ nsHTMLButtonElement::SetDisabled(PRBool aValue)
nsHTMLValue empty(eHTMLUnit_Empty);
if (aValue) {
nsresult status = mInner.SetHTMLAttribute(nsHTMLAtoms::disabled, empty, PR_TRUE);
- mInner.SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::kClass, "DISABLED", PR_TRUE);
+ mInner.SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::kClass, NS_ConvertASCIItoUCS2("DISABLED"), PR_TRUE);
return status;
}
else {
mInner.UnsetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::disabled, PR_TRUE);
- mInner.SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::kClass, "", PR_TRUE);
+ mInner.SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::kClass, nsAutoString(), PR_TRUE);
return NS_OK;
}
}
diff --git a/mozilla/content/html/content/src/nsHTMLFontElement.cpp b/mozilla/content/html/content/src/nsHTMLFontElement.cpp
index 403fd9d8cd1..7e43af33329 100644
--- a/mozilla/content/html/content/src/nsHTMLFontElement.cpp
+++ b/mozilla/content/html/content/src/nsHTMLFontElement.cpp
@@ -173,15 +173,15 @@ nsHTMLFontElement::AttributeToString(nsIAtom* aAttribute,
(aAttribute == nsHTMLAtoms::fontWeight)) {
aResult.Truncate();
if (aValue.GetUnit() == eHTMLUnit_Enumerated) {
- aResult.Append(aValue.GetIntValue(), 10);
+ aResult.AppendInt(aValue.GetIntValue(), 10);
return NS_CONTENT_ATTR_HAS_VALUE;
}
else if (aValue.GetUnit() == eHTMLUnit_Integer) {
PRInt32 value = aValue.GetIntValue();
if (value >= 0) {
- aResult.Append('+');
+ aResult.AppendWithConversion('+');
}
- aResult.Append(value, 10);
+ aResult.AppendInt(value, 10);
return NS_CONTENT_ATTR_HAS_VALUE;
}
return NS_CONTENT_ATTR_NOT_THERE;
diff --git a/mozilla/content/html/document/src/nsHTMLContentSink.cpp b/mozilla/content/html/document/src/nsHTMLContentSink.cpp
index f6c025c4799..f9dae516296 100644
--- a/mozilla/content/html/document/src/nsHTMLContentSink.cpp
+++ b/mozilla/content/html/document/src/nsHTMLContentSink.cpp
@@ -589,7 +589,7 @@ HTMLContentSink::ReduceEntities(nsString& aString)
}
*cp = '\0';
PRInt32 ch;
- nsAutoString str(cbuf);
+ nsAutoString str; str.AssignWithConversion(cbuf);
dtd->ConvertEntityToUnicode(str, &ch);
if (ch < 0) {
@@ -983,7 +983,7 @@ HTMLContentSink::CreateContentObject(const nsIParserNode& aNode,
// XXX why is textarea not a container?
nsAutoString content;
if (eHTMLTag_textarea == aNodeType) {
- content = aNode.GetSkippedContent();
+ content.Assign(aNode.GetSkippedContent());
}
rv = MakeContentObject(aNodeType, atom, aForm, aWebShell,
aResult, &content);
@@ -1679,7 +1679,7 @@ SinkContext::AddLeaf(const nsIParserNode& aNode)
else {
// Map carriage returns to newlines
if (tmp.CharAt(0) == '\r') {
- tmp = "\n";
+ tmp.AssignWithConversion("\n");
}
rv = AddText(tmp);
}
@@ -2295,7 +2295,7 @@ HTMLContentSink::DidBuildModel(PRInt32 aQualityLevel)
}
if (nsnull == mTitle) {
- mHTMLDocument->SetTitle("");
+ mHTMLDocument->SetTitle(nsAutoString());
}
// XXX this is silly; who cares? RickG cares. It's part of the regression test. So don't bug me.
@@ -2765,7 +2765,7 @@ HTMLContentSink::OpenForm(const nsIParserNode& aNode)
mCurrentContext->IsCurrentContainer(eHTMLTag_tr) ||
mCurrentContext->IsCurrentContainer(eHTMLTag_col) ||
mCurrentContext->IsCurrentContainer(eHTMLTag_colgroup)) {
- nsAutoString tmp("form");
+ nsAutoString tmp; tmp.AssignWithConversion("form");
nsIAtom* atom = NS_NewAtom(tmp);
result = NS_NewHTMLFormElement(&content, atom);
if (NS_SUCCEEDED(result) && content) {
@@ -3053,7 +3053,7 @@ HTMLContentSink::AddDocTypeDecl(const nsIParserNode& aNode, PRInt32 aMode)
*/
docTypeStr.Mid(name, 0, publicStart);
- if (name.Equals("DOCTYPE", PR_TRUE, 7))
+ if (name.EqualsWithConversion("DOCTYPE", PR_TRUE, 7))
name.Cut(0, 7);
name.CompressWhitespace();
@@ -3099,9 +3099,9 @@ HTMLContentSink::AddDocTypeDecl(const nsIParserNode& aNode, PRInt32 aMode)
/*
* No 'PUBLIC' found, we assume we got a ''
*/
- name = docTypeStr;
+ name.Assign(docTypeStr);
- if (name.Equals("DOCTYPE", PR_TRUE, 7))
+ if (name.EqualsWithConversion("DOCTYPE", PR_TRUE, 7))
name.Cut(0, 7);
name.CompressWhitespace();
@@ -3142,10 +3142,10 @@ HTMLContentSink::AddDocTypeDecl(const nsIParserNode& aNode, PRInt32 aMode)
}
if (!name.Length()) {
- name.SetString("HTML");
+ name.AssignWithConversion("HTML");
}
- rv = domImpl->CreateDocumentType(name, publicId, nsAutoString(""),
+ rv = domImpl->CreateDocumentType(name, publicId, nsAutoString(),
getter_AddRefs(docType));
if (NS_FAILED(rv) || !docType) {
@@ -3242,7 +3242,8 @@ HTMLContentSink::StartLayout()
NS_RELEASE(url);
}
if (rv == NS_OK) {
- mRef = new nsString(ref);
+ mRef = new nsString;
+ mRef->AssignWithConversion(ref);
nsCRT::free(ref);
}
@@ -3438,7 +3439,7 @@ HTMLContentSink::ProcessBASETag(const nsIParserNode& aNode)
if(parent!=nsnull) {
// Create content object
- nsAutoString tag("BASE");
+ nsAutoString tag; tag.AssignWithConversion("BASE");
nsCOMPtr element;
result = NS_CreateHTMLElement(getter_AddRefs(element), tag);
if (NS_SUCCEEDED(result)) {
@@ -3693,9 +3694,9 @@ HTMLContentSink::ProcessStyleLink(nsIHTMLContent* aElement,
ParseLinkTypes(aRel, linkTypes);
PRBool isAlternate = PR_FALSE;
- if (-1 != linkTypes.IndexOf("stylesheet")) { // is it a stylesheet link?
+ if (-1 != linkTypes.IndexOf(NS_ConvertASCIItoUCS2("stylesheet"))) { // is it a stylesheet link?
- if (-1 != linkTypes.IndexOf("alternate")) { // if alternate, does it have title?
+ if (-1 != linkTypes.IndexOf(NS_ConvertASCIItoUCS2("alternate"))) { // if alternate, does it have title?
if (0 == aTitle.Length()) { // alternates must have title
return NS_OK; //return without error, for now
} else {
@@ -3719,7 +3720,7 @@ HTMLContentSink::ProcessStyleLink(nsIHTMLContent* aElement,
if (0 == mimeType.Length()) {
nsString extension;
aHref.Right(extension, 4);
- if (extension.Equals(".css")) {
+ if (extension.EqualsWithConversion(".css")) {
isStyleSheet = PR_TRUE; // strict mode + no mime type + '.css' extension
}
}
@@ -3740,7 +3741,7 @@ HTMLContentSink::ProcessStyleLink(nsIHTMLContent* aElement,
return NS_OK; // The URL is bad, move along, don't propogate the error (for now)
}
- if (-1 == linkTypes.IndexOf("alternate")) {
+ if (-1 == linkTypes.IndexOf(NS_ConvertASCIItoUCS2("alternate"))) {
if (0 < aTitle.Length()) { // possibly preferred sheet
if (0 == mPreferredStyle.Length()) {
mPreferredStyle = aTitle;
@@ -3790,7 +3791,7 @@ HTMLContentSink::ProcessLINKTag(const nsIParserNode& aNode)
if(parent!=nsnull) {
// Create content object
- nsAutoString tag("LINK");
+ nsAutoString tag; tag.AssignWithConversion("LINK");
nsIHTMLContent* element = nsnull;
result = NS_CreateHTMLElement(&element, tag);
if (NS_SUCCEEDED(result)) {
@@ -3905,7 +3906,7 @@ HTMLContentSink::ProcessMETATag(const nsIParserNode& aNode)
if (nsnull != parent) {
// Create content object
- nsAutoString tmp("meta");
+ nsAutoString tmp; tmp.AssignWithConversion("meta");
nsIAtom* atom = NS_NewAtom(tmp);
if (nsnull == atom) {
return NS_ERROR_OUT_OF_MEMORY;
@@ -3942,7 +3943,7 @@ HTMLContentSink::ProcessMETATag(const nsIParserNode& aNode)
if (NS_FAILED(rv)) return rv;
// see if we have a refresh "header".
- if (!header.Compare("refresh", PR_TRUE)) {
+ if (!header.CompareWithConversion("refresh", PR_TRUE)) {
// Refresh headers are parsed with the following format in mind
//
// By the time we are here, the following is true:
@@ -4062,7 +4063,7 @@ HTMLContentSink::ProcessMETATag(const nsIParserNode& aNode)
}
}
} // END refresh
- else if (!header.Compare("set-cookie", PR_TRUE)) {
+ else if (!header.CompareWithConversion("set-cookie", PR_TRUE)) {
nsCOMPtr cookieServ = do_GetService(NS_COOKIESERVICE_PROGID, &rv);
if (NS_FAILED(rv)) return rv;
@@ -4363,7 +4364,7 @@ HTMLContentSink::OnStreamComplete(nsIStreamLoader* aLoader,
if (NS_SUCCEEDED(rv)) {
- nsAutoString contentType(contenttypeheader);
+ nsAutoString contentType; contentType.AssignWithConversion( NS_STATIC_CAST(const char*, contenttypeheader) );
PRInt32 start = contentType.RFind("charset=", PR_TRUE ) ;
if(kNotFound != start)
@@ -4388,7 +4389,7 @@ HTMLContentSink::OnStreamComplete(nsIStreamLoader* aLoader,
if (NS_FAILED(rv) || (characterSet.Length() == 0)) {
//charset from script charset tag
- characterSet = mScriptCharset;
+ characterSet.Assign(mScriptCharset);
}
if (NS_FAILED(rv) || (characterSet.Length() == 0) ) {
@@ -4533,7 +4534,7 @@ HTMLContentSink::ProcessSCRIPTTag(const nsIParserNode& aNode)
return NS_ERROR_FAILURE;
}
nsIHTMLContent* parent = mCurrentContext->mStack[mCurrentContext->mStackPos-1].mContent;
- nsAutoString tag("SCRIPT");
+ nsAutoString tag; tag.AssignWithConversion("SCRIPT");
nsIHTMLContent* element = nsnull;
rv = NS_CreateHTMLElement(&element, tag);
if (NS_SUCCEEDED(rv)) {
@@ -4565,7 +4566,7 @@ HTMLContentSink::ProcessSCRIPTTag(const nsIParserNode& aNode)
// Create a text node holding the content
// First, get the text content of the script tag
nsAutoString script;
- script = aNode.GetSkippedContent();
+ script.Assign(aNode.GetSkippedContent());
if (script.Length() > 0) {
nsIContent* text;
@@ -4662,7 +4663,7 @@ HTMLContentSink::ProcessSTYLETag(const nsIParserNode& aNode)
if(parent!=nsnull) {
// Create content object
- nsAutoString tag("STYLE");
+ nsAutoString tag; tag.AssignWithConversion("STYLE");
nsIHTMLContent* element = nsnull;
rv = NS_CreateHTMLElement(&element, tag);
if (NS_SUCCEEDED(rv)) {
diff --git a/mozilla/content/html/document/src/nsHTMLDocument.cpp b/mozilla/content/html/document/src/nsHTMLDocument.cpp
index a3b1921c95f..462f312e722 100644
--- a/mozilla/content/html/document/src/nsHTMLDocument.cpp
+++ b/mozilla/content/html/document/src/nsHTMLDocument.cpp
@@ -362,7 +362,7 @@ nsHTMLDocument::Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup)
NS_IMETHODIMP
nsHTMLDocument::GetContentType(nsString& aContentType) const
{
- aContentType.Assign("text/html");
+ aContentType.AssignWithConversion("text/html");
return NS_OK;
}
@@ -395,8 +395,8 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
PRBool needsParser=PR_TRUE;
if (aCommand)
{
- nsAutoString command(aCommand);
- nsAutoString delayedView("view delayedContentLoad");
+ nsAutoString command; command.AssignWithConversion(aCommand);
+ nsAutoString delayedView; delayedView.AssignWithConversion("view delayedContentLoad");
if (command.Equals(delayedView)) {
needsParser = PR_FALSE;
}
@@ -408,7 +408,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
aDocListener);
if (NS_FAILED(rv)) { return rv; }
- nsAutoString charset = "ISO-8859-1"; // fallback value in case webShell return error
+ nsAutoString charset; charset.AssignWithConversion("ISO-8859-1"); // fallback value in case webShell return error
nsCharsetSource charsetSource = kCharsetFromWeakDocTypeDefault;
nsCOMPtr aURL;
@@ -427,7 +427,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
NS_RELEASE(lastModKey);
if (NS_SUCCEEDED(rv)) {
- lastModified.Assign(lastModHeader);
+ lastModified.AssignWithConversion( NS_STATIC_CAST(const char*, lastModHeader) );
SetLastModified(lastModified);
}
@@ -441,7 +441,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
NS_RELEASE(referrerKey);
if (NS_SUCCEEDED(rv)) {
- referrer.Assign(referrerHeader);
+ referrer.AssignWithConversion( NS_STATIC_CAST(const char*, referrerHeader) );
SetReferrer(referrer);
}
@@ -453,7 +453,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
NS_RELEASE(contentTypeKey);
if (NS_SUCCEEDED(rv)) {
nsAutoString contentType;
- contentType.Assign(contenttypeheader);
+ contentType.AssignWithConversion( NS_STATIC_CAST(const char*, contenttypeheader) );
PRInt32 start = contentType.RFind("charset=", PR_TRUE ) ;
if(kNotFound != start)
{
@@ -517,7 +517,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
"%c",
#endif
&prtime);
- lastModified.Assign(buf);
+ lastModified.AssignWithConversion(buf);
SetLastModified(lastModified);
}
@@ -1061,7 +1061,7 @@ nsHTMLDocument::SetHeaderData(nsIAtom* aHeaderField, const nsString& aData)
// switch alternate style sheets based on default
nsAutoString type;
nsAutoString title;
- nsAutoString textHtml("text/html");
+ nsAutoString textHtml; textHtml.AssignWithConversion("text/html");
PRInt32 index;
PRInt32 count = mStyleSheets.Count();
for (index = 0; index < count; index++) {
@@ -1473,7 +1473,7 @@ nsHTMLDocument::GetDomain(nsString& aDomain)
char *hostName;
if (NS_FAILED(uri->GetHost(&hostName)))
return NS_ERROR_FAILURE;
- aDomain.Assign(hostName);
+ aDomain.AssignWithConversion(hostName);
nsCRT::free(hostName);
return NS_OK;
@@ -1512,10 +1512,10 @@ nsHTMLDocument::SetDomain(const nsString& aDomain)
nsXPIDLCString path;
if (NS_FAILED(uri->GetPath(getter_Copies(path))))
return NS_ERROR_FAILURE;
- nsAutoString newURIString = (const char *)scheme;
- newURIString += "://";
+ nsAutoString newURIString; newURIString.AssignWithConversion( NS_STATIC_CAST(const char*, scheme) );
+ newURIString.AppendWithConversion("://");
newURIString += aDomain;
- newURIString += path;
+ newURIString.AppendWithConversion(path);
nsIURI *newURI;
if (NS_FAILED(NS_NewURI(&newURI, newURIString)))
return NS_ERROR_FAILURE;
@@ -1543,7 +1543,7 @@ nsHTMLDocument::GetURL(nsString& aURL)
if (nsnull != mDocumentURL) {
char* str;
mDocumentURL->GetSpec(&str);
- aURL = str;
+ aURL.AssignWithConversion(str);
nsCRT::free(str);
}
return NS_OK;
@@ -1568,7 +1568,7 @@ nsHTMLDocument::SetBody(nsIDOMHTMLElement* aBody)
return result;
}
- nsAutoString bodyStr("BODY");
+ nsAutoString bodyStr; bodyStr.AssignWithConversion("BODY");
nsIDOMNode * child;
root->GetFirstChild(&child);
@@ -1880,10 +1880,10 @@ nsHTMLDocument::Close()
nsresult result = NS_OK;
if ((nsnull != mParser) && mIsWriting) {
- nsAutoString emptyStr("