From 953490ff207075a01f868361eb02adb3a48a509f Mon Sep 17 00:00:00 2001 From: "scc%netscape.com" Date: Mon, 3 Apr 2000 11:39:09 +0000 Subject: [PATCH] making string conversions explicit --- layout/base/nsPresShell.cpp | 10 ++--- layout/generic/nsBulletFrame.cpp | 8 ++-- layout/generic/nsFrame.cpp | 14 +++--- layout/generic/nsGfxScrollFrame.cpp | 10 ++--- layout/generic/nsImageFrame.cpp | 2 +- layout/generic/nsImageMap.cpp | 50 +++++++++++----------- layout/generic/nsObjectFrame.cpp | 10 ++--- layout/generic/nsTextFrame.cpp | 10 ++--- layout/html/base/src/nsBulletFrame.cpp | 8 ++-- layout/html/base/src/nsFrame.cpp | 14 +++--- layout/html/base/src/nsGfxScrollFrame.cpp | 10 ++--- layout/html/base/src/nsHTMLImageLoader.cpp | 10 ++--- layout/html/base/src/nsImageFrame.cpp | 2 +- layout/html/base/src/nsImageMap.cpp | 50 +++++++++++----------- layout/html/base/src/nsObjectFrame.cpp | 10 ++--- layout/html/base/src/nsPresShell.cpp | 10 ++--- layout/html/base/src/nsTextFrame.cpp | 10 ++--- 17 files changed, 119 insertions(+), 119 deletions(-) diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 8bc174f8281..5bd1f2a9148 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -1190,7 +1190,7 @@ PresShell::GetActiveAlternateStyleSheet(nsString& aSheetTitle) if (mStyleSet) { PRInt32 count = mStyleSet->GetNumberOfDocStyleSheets(); PRInt32 index; - nsAutoString textHtml("text/html"); + nsAutoString textHtml; textHtml.AssignWithConversion("text/html"); for (index = 0; index < count; index++) { nsIStyleSheet* sheet = mStyleSet->GetDocStyleSheetAt(index); if (nsnull != sheet) { @@ -1217,7 +1217,7 @@ PresShell::SelectAlternateStyleSheet(const nsString& aSheetTitle) if (mDocument && mStyleSet) { PRInt32 count = mDocument->GetNumberOfStyleSheets(); PRInt32 index; - nsAutoString textHtml("text/html"); + nsAutoString textHtml; textHtml.AssignWithConversion("text/html"); for (index = 0; index < count; index++) { nsIStyleSheet* sheet = mDocument->GetStyleSheetAt(index); if (nsnull != sheet) { @@ -1249,7 +1249,7 @@ PresShell::ListAlternateStyleSheets(nsStringArray& aTitleList) if (mDocument) { PRInt32 count = mDocument->GetNumberOfStyleSheets(); PRInt32 index; - nsAutoString textHtml("text/html"); + nsAutoString textHtml; textHtml.AssignWithConversion("text/html"); for (index = 0; index < count; index++) { nsIStyleSheet* sheet = mDocument->GetStyleSheetAt(index); if (nsnull != sheet) { @@ -3554,7 +3554,7 @@ LogVerifyMessage(nsIFrame* k1, nsIFrame* k2, const char* aMsg) } } else { - name = "(null)"; + name.AssignWithConversion("(null)"); } fputs(name, stdout); @@ -3569,7 +3569,7 @@ LogVerifyMessage(nsIFrame* k1, nsIFrame* k2, const char* aMsg) } } else { - name = "(null)"; + name.AssignWithConversion("(null)"); } fputs(name, stdout); diff --git a/layout/generic/nsBulletFrame.cpp b/layout/generic/nsBulletFrame.cpp index eff5f701ac3..e3d920843f8 100644 --- a/layout/generic/nsBulletFrame.cpp +++ b/layout/generic/nsBulletFrame.cpp @@ -246,13 +246,13 @@ static void DecimalToText(PRInt32 ordinal, nsString& result) { char cbuf[40]; PR_snprintf(cbuf, sizeof(cbuf), "%ld", ordinal); - result.Append(cbuf); + result.AppendWithConversion(cbuf); } static void DecimalLeadingZeroToText(PRInt32 ordinal, nsString& result) { char cbuf[40]; PR_snprintf(cbuf, sizeof(cbuf), "%02ld", ordinal); - result.Append(cbuf); + result.AppendWithConversion(cbuf); } @@ -267,7 +267,7 @@ static void RomanToText(PRInt32 ordinal, nsString& result, const char* achars, c ordinal = 1; } nsAutoString addOn, decStr; - decStr.Append(ordinal, 10); + decStr.AppendWithConversion(ordinal, 10); PRIntn len = decStr.Length(); const PRUnichar* dp = decStr.GetUnicode(); const PRUnichar* end = dp + len; @@ -744,7 +744,7 @@ nsBulletFrame::GetListItemText(nsIPresContext* aCX, break; } - result.Append("."); + result.AppendWithConversion("."); } #define MIN_BULLET_SIZE 5 // from laytext.c diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index aaca070c5cb..406ef425069 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -1813,22 +1813,22 @@ nsFrame::GetFrameName(nsString& aResult) const nsresult nsFrame::MakeFrameName(const char* aType, nsString& aResult) const { - aResult = aType; + aResult.AssignWithConversion(aType); if (nsnull != mContent) { nsIAtom* tag; mContent->GetTag(tag); if ((tag != nsnull) && (tag != nsLayoutAtoms::textTagName)) { - aResult.Append("("); + aResult.AppendWithConversion("("); nsAutoString buf; tag->ToString(buf); aResult.Append(buf); NS_RELEASE(tag); - aResult.Append(")"); + aResult.AppendWithConversion(")"); } } char buf[40]; PR_snprintf(buf, sizeof(buf), "(%d)", ContentIndexInContainer(this)); - aResult.Append(buf); + aResult.AppendWithConversion(buf); return NS_OK; } #endif @@ -1840,21 +1840,21 @@ nsFrame::XMLQuote(nsString& aString) for (i = 0; i < len; i++) { PRUnichar ch = aString.CharAt(i); if (ch == '<') { - nsAutoString tmp("<"); + nsAutoString tmp; tmp.AssignWithConversion("<"); aString.Cut(i, 1); aString.Insert(tmp, i); len += 3; i += 3; } else if (ch == '>') { - nsAutoString tmp(">"); + nsAutoString tmp; tmp.AssignWithConversion(">"); aString.Cut(i, 1); aString.Insert(tmp, i); len += 3; i += 3; } else if (ch == '\"') { - nsAutoString tmp("""); + nsAutoString tmp; tmp.AssignWithConversion("""); aString.Cut(i, 1); aString.Insert(tmp, i); len += 5; diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index 8e181bc4e7c..617ee8702a3 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -281,14 +281,14 @@ nsGfxScrollFrame::CreateAnonymousContent(nsIPresContext* aPresContext, return NS_ERROR_FAILURE; nsCOMPtr content; - elementFactory->CreateInstanceByTag(nsAutoString("scrollbar"), getter_AddRefs(content)); - content->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::align, nsAutoString("horizontal"), PR_FALSE); + elementFactory->CreateInstanceByTag(NS_ConvertToString("scrollbar"), getter_AddRefs(content)); + content->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::align, NS_ConvertToString("horizontal"), PR_FALSE); aAnonymousChildren.AppendElement(content); // create vertical scrollbar content = nsnull; - elementFactory->CreateInstanceByTag(nsAutoString("scrollbar"), getter_AddRefs(content)); - content->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::align, nsAutoString("vertical"), PR_FALSE); + elementFactory->CreateInstanceByTag(NS_ConvertToString("scrollbar"), getter_AddRefs(content)); + content->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::align, NS_ConvertToString("vertical"), PR_FALSE); aAnonymousChildren.AppendElement(content); // XXX For GFX never have scrollbars @@ -1028,7 +1028,7 @@ nsGfxScrollFrameInner::SetAttribute(nsIBox* aBox, nsIAtom* aAtom, nscoord aSize, frame->GetContent(getter_AddRefs(content)); char ch[100]; sprintf(ch,"%d", aSize); - nsAutoString newValue(ch); + nsAutoString newValue; newValue.AssignWithConversion(ch); content->SetAttribute(kNameSpaceID_None, aAtom, newValue, aReflow); return PR_TRUE; } diff --git a/layout/generic/nsImageFrame.cpp b/layout/generic/nsImageFrame.cpp index f90eb20f200..64f5eb88aa7 100644 --- a/layout/generic/nsImageFrame.cpp +++ b/layout/generic/nsImageFrame.cpp @@ -785,7 +785,7 @@ nsImageFrame::HandleEvent(nsIPresContext* aPresContext, if (p.y < 0) p.y = 0; char cbuf[50]; PR_snprintf(cbuf, sizeof(cbuf), "?%d,%d", p.x, p.y); - absURL.Append(cbuf); + absURL.AppendWithConversion(cbuf); PRBool clicked = PR_FALSE; if (aEvent->message == NS_MOUSE_LEFT_BUTTON_UP) { *aEventStatus = nsEventStatus_eConsumeDoDefault; diff --git a/layout/generic/nsImageMap.cpp b/layout/generic/nsImageMap.cpp index e6729f24582..422041a4da8 100644 --- a/layout/generic/nsImageMap.cpp +++ b/layout/generic/nsImageMap.cpp @@ -327,37 +327,37 @@ void Area::ToHTML(nsString& aResult) } aResult.Truncate(); - aResult.Append("\"");'); + aResult.AppendWithConversion('>'); } /** @@ -376,11 +376,11 @@ void Area::BeginConvertToXIF(nsXIFConverter& aConverter) const mArea->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::alt, altText); } - nsAutoString tag("area"); + nsAutoString tag; tag.AssignWithConversion("area"); aConverter.BeginStartTag(tag); - nsAutoString name("shape"); + nsAutoString name; name.AssignWithConversion("shape"); nsAutoString shape; GetShapeName(shape); aConverter.AddAttribute(name,shape); @@ -390,36 +390,36 @@ void Area::BeginConvertToXIF(nsXIFConverter& aConverter) const if (nsnull != mCoords) { PRInt32 i, n = mNumCoords; for (i = 0; i < n; i++) { - coords.Append(mCoords[i], 10); + coords.AppendWithConversion(mCoords[i], 10); if (i < n - 1) { coords.Append(','); } } } - name.Assign("coords"); + name.AssignWithConversion("coords"); aConverter.AddAttribute(name,coords); - name.Assign("href"); + name.AssignWithConversion("href"); aConverter.AddAttribute(name,href); if (0 < target.Length()) { - name.Assign("target"); + name.AssignWithConversion("target"); aConverter.AddAttribute(name,target); } if (0 < altText.Length()) { - name.Assign("alt"); + name.AssignWithConversion("alt"); aConverter.AddAttribute(name,altText); } if (mSuppressFeedback) { - name.Assign("suppress"); + name.AssignWithConversion("suppress"); aConverter.AddAttribute(name); } } void Area::FinishConvertToXIF(nsXIFConverter& aConverter) const { - nsAutoString tag("area"); + nsAutoString tag; tag.AssignWithConversion("area"); aConverter.FinishStartTag(tag,PR_TRUE); } @@ -464,7 +464,7 @@ void DefaultArea::Draw(nsIPresContext* aCX, nsIRenderingContext& aRC) void DefaultArea::GetShapeName(nsString& aResult) const { - aResult.Append("default"); + aResult.AppendWithConversion("default"); } //---------------------------------------------------------------------- @@ -525,7 +525,7 @@ void RectArea::Draw(nsIPresContext* aCX, nsIRenderingContext& aRC) void RectArea::GetShapeName(nsString& aResult) const { - aResult.Append("rect"); + aResult.AppendWithConversion("rect"); } //---------------------------------------------------------------------- @@ -635,7 +635,7 @@ void PolyArea::Draw(nsIPresContext* aCX, nsIRenderingContext& aRC) void PolyArea::GetShapeName(nsString& aResult) const { - aResult.Append("polygon"); + aResult.AppendWithConversion("polygon"); } //---------------------------------------------------------------------- @@ -700,7 +700,7 @@ void CircleArea::Draw(nsIPresContext* aCX, nsIRenderingContext& aRC) void CircleArea::GetShapeName(nsString& aResult) const { - aResult.Append("circle"); + aResult.AppendWithConversion("circle"); } //---------------------------------------------------------------------- diff --git a/layout/generic/nsObjectFrame.cpp b/layout/generic/nsObjectFrame.cpp index 0ac7705bdae..65000353974 100644 --- a/layout/generic/nsObjectFrame.cpp +++ b/layout/generic/nsObjectFrame.cpp @@ -650,7 +650,7 @@ nsObjectFrame::Reflow(nsIPresContext* aPresContext, if (classid.Find("clsid:") != -1) { classid.Cut(0, 6); // Strip off the "clsid:". What's left is the class ID. - bJavaPluginClsid = (classid.Equals(JAVA_CLASS_ID)); + bJavaPluginClsid = (classid.EqualsWithConversion(JAVA_CLASS_ID)); } // if we find "java:" in the class id, or we match the Java classid number, we have a java applet @@ -702,7 +702,7 @@ nsObjectFrame::Reflow(nsIPresContext* aPresContext, { // These are some builtin types that we know about for now. // (Eventually this will move somewhere else.) - if (classid.Equals("browser")) + if (classid.EqualsWithConversion("browser")) { widgetCID = kCAppShellCID; rv = InstantiateWidget(aPresContext, aMetrics, aReflowState, widgetCID); @@ -1742,8 +1742,8 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetURL(const char *aURL, const char *aTarge if (NS_OK == rv) { - nsAutoString uniurl = nsAutoString(aURL); - nsAutoString unitarget = nsAutoString(aTarget); + nsAutoString uniurl; uniurl.AssignWithConversion(aURL); + nsAutoString unitarget; unitarget.AssignWithConversion(aTarget); nsAutoString fullurl; nsIURI* baseURL; @@ -1797,7 +1797,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::ShowStatus(const char *aStatusMsg) if(browserChrome) { - nsAutoString msg = nsAutoString(aStatusMsg); + nsAutoString msg; msg.AssignWithConversion(aStatusMsg); browserChrome->SetJSStatus(msg.GetUnicode()); } } diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp index 24492a481d3..7e5a07e905b 100644 --- a/layout/generic/nsTextFrame.cpp +++ b/layout/generic/nsTextFrame.cpp @@ -4385,14 +4385,14 @@ nsTextFrame::ToCString(nsString& aBuf, PRInt32* aTotalContentLength) const while (fragOffset < n) { PRUnichar ch = frag->CharAt(fragOffset++); if (ch == '\r') { - aBuf.Append("\\r"); + aBuf.AppendWithConversion("\\r"); } else if (ch == '\n') { - aBuf.Append("\\n"); + aBuf.AppendWithConversion("\\n"); } else if (ch == '\t') { - aBuf.Append("\\t"); + aBuf.AppendWithConversion("\\t"); } else if ((ch < ' ') || (ch >= 127)) { - aBuf.Append("\\0"); - aBuf.Append((PRInt32)ch, 8); + aBuf.AppendWithConversion("\\0"); + aBuf.AppendWithConversion((PRInt32)ch, 8); } else { aBuf.Append(ch); } diff --git a/layout/html/base/src/nsBulletFrame.cpp b/layout/html/base/src/nsBulletFrame.cpp index eff5f701ac3..e3d920843f8 100644 --- a/layout/html/base/src/nsBulletFrame.cpp +++ b/layout/html/base/src/nsBulletFrame.cpp @@ -246,13 +246,13 @@ static void DecimalToText(PRInt32 ordinal, nsString& result) { char cbuf[40]; PR_snprintf(cbuf, sizeof(cbuf), "%ld", ordinal); - result.Append(cbuf); + result.AppendWithConversion(cbuf); } static void DecimalLeadingZeroToText(PRInt32 ordinal, nsString& result) { char cbuf[40]; PR_snprintf(cbuf, sizeof(cbuf), "%02ld", ordinal); - result.Append(cbuf); + result.AppendWithConversion(cbuf); } @@ -267,7 +267,7 @@ static void RomanToText(PRInt32 ordinal, nsString& result, const char* achars, c ordinal = 1; } nsAutoString addOn, decStr; - decStr.Append(ordinal, 10); + decStr.AppendWithConversion(ordinal, 10); PRIntn len = decStr.Length(); const PRUnichar* dp = decStr.GetUnicode(); const PRUnichar* end = dp + len; @@ -744,7 +744,7 @@ nsBulletFrame::GetListItemText(nsIPresContext* aCX, break; } - result.Append("."); + result.AppendWithConversion("."); } #define MIN_BULLET_SIZE 5 // from laytext.c diff --git a/layout/html/base/src/nsFrame.cpp b/layout/html/base/src/nsFrame.cpp index aaca070c5cb..406ef425069 100644 --- a/layout/html/base/src/nsFrame.cpp +++ b/layout/html/base/src/nsFrame.cpp @@ -1813,22 +1813,22 @@ nsFrame::GetFrameName(nsString& aResult) const nsresult nsFrame::MakeFrameName(const char* aType, nsString& aResult) const { - aResult = aType; + aResult.AssignWithConversion(aType); if (nsnull != mContent) { nsIAtom* tag; mContent->GetTag(tag); if ((tag != nsnull) && (tag != nsLayoutAtoms::textTagName)) { - aResult.Append("("); + aResult.AppendWithConversion("("); nsAutoString buf; tag->ToString(buf); aResult.Append(buf); NS_RELEASE(tag); - aResult.Append(")"); + aResult.AppendWithConversion(")"); } } char buf[40]; PR_snprintf(buf, sizeof(buf), "(%d)", ContentIndexInContainer(this)); - aResult.Append(buf); + aResult.AppendWithConversion(buf); return NS_OK; } #endif @@ -1840,21 +1840,21 @@ nsFrame::XMLQuote(nsString& aString) for (i = 0; i < len; i++) { PRUnichar ch = aString.CharAt(i); if (ch == '<') { - nsAutoString tmp("<"); + nsAutoString tmp; tmp.AssignWithConversion("<"); aString.Cut(i, 1); aString.Insert(tmp, i); len += 3; i += 3; } else if (ch == '>') { - nsAutoString tmp(">"); + nsAutoString tmp; tmp.AssignWithConversion(">"); aString.Cut(i, 1); aString.Insert(tmp, i); len += 3; i += 3; } else if (ch == '\"') { - nsAutoString tmp("""); + nsAutoString tmp; tmp.AssignWithConversion("""); aString.Cut(i, 1); aString.Insert(tmp, i); len += 5; diff --git a/layout/html/base/src/nsGfxScrollFrame.cpp b/layout/html/base/src/nsGfxScrollFrame.cpp index 8e181bc4e7c..617ee8702a3 100644 --- a/layout/html/base/src/nsGfxScrollFrame.cpp +++ b/layout/html/base/src/nsGfxScrollFrame.cpp @@ -281,14 +281,14 @@ nsGfxScrollFrame::CreateAnonymousContent(nsIPresContext* aPresContext, return NS_ERROR_FAILURE; nsCOMPtr content; - elementFactory->CreateInstanceByTag(nsAutoString("scrollbar"), getter_AddRefs(content)); - content->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::align, nsAutoString("horizontal"), PR_FALSE); + elementFactory->CreateInstanceByTag(NS_ConvertToString("scrollbar"), getter_AddRefs(content)); + content->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::align, NS_ConvertToString("horizontal"), PR_FALSE); aAnonymousChildren.AppendElement(content); // create vertical scrollbar content = nsnull; - elementFactory->CreateInstanceByTag(nsAutoString("scrollbar"), getter_AddRefs(content)); - content->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::align, nsAutoString("vertical"), PR_FALSE); + elementFactory->CreateInstanceByTag(NS_ConvertToString("scrollbar"), getter_AddRefs(content)); + content->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::align, NS_ConvertToString("vertical"), PR_FALSE); aAnonymousChildren.AppendElement(content); // XXX For GFX never have scrollbars @@ -1028,7 +1028,7 @@ nsGfxScrollFrameInner::SetAttribute(nsIBox* aBox, nsIAtom* aAtom, nscoord aSize, frame->GetContent(getter_AddRefs(content)); char ch[100]; sprintf(ch,"%d", aSize); - nsAutoString newValue(ch); + nsAutoString newValue; newValue.AssignWithConversion(ch); content->SetAttribute(kNameSpaceID_None, aAtom, newValue, aReflow); return PR_TRUE; } diff --git a/layout/html/base/src/nsHTMLImageLoader.cpp b/layout/html/base/src/nsHTMLImageLoader.cpp index 7501f367c9c..cead184cc45 100644 --- a/layout/html/base/src/nsHTMLImageLoader.cpp +++ b/layout/html/base/src/nsHTMLImageLoader.cpp @@ -81,7 +81,7 @@ void nsHTMLImageLoader::SetURL(const nsString& aNewSpec) { mURLSpec = aNewSpec; - if (mBaseURL && !aNewSpec.Equals("")) { + if (mBaseURL && !aNewSpec.IsEmpty()) { nsString empty; nsresult rv; rv = NS_MakeAbsoluteURI(mURL, mURLSpec, mBaseURL); @@ -170,7 +170,7 @@ nsHTMLImageLoader::StartLoadImage(nsIPresContext* aPresContext) // We were not initialized! return NS_ERROR_NULL_POINTER; } - if (mURL.Equals("")) { + if (mURL.IsEmpty()) { return NS_OK; } @@ -179,14 +179,14 @@ nsHTMLImageLoader::StartLoadImage(nsIPresContext* aPresContext) // of the absolute url... nsAutoString internalImageURLSpec; nsString* urlSpec = &mURL; - if (mURLSpec.Compare(GOPHER_SPEC, PR_FALSE, GOPHER_SPEC_SIZE) == 0) { + if (mURLSpec.CompareWithConversion(GOPHER_SPEC, PR_FALSE, GOPHER_SPEC_SIZE) == 0) { // We found a special image source value that refers to a // builtin image. Rewrite the source url as a resource url. urlSpec = &internalImageURLSpec; mURLSpec.Mid(internalImageURLSpec, GOPHER_SPEC_SIZE, mURLSpec.Length() - GOPHER_SPEC_SIZE); - internalImageURLSpec.Insert("resource:/res/html/gopher-", 0); - internalImageURLSpec.Append(".gif"); + internalImageURLSpec.InsertWithConversion("resource:/res/html/gopher-", 0); + internalImageURLSpec.AppendWithConversion(".gif"); } // This is kind of sick, but its possible that we will get a diff --git a/layout/html/base/src/nsImageFrame.cpp b/layout/html/base/src/nsImageFrame.cpp index f90eb20f200..64f5eb88aa7 100644 --- a/layout/html/base/src/nsImageFrame.cpp +++ b/layout/html/base/src/nsImageFrame.cpp @@ -785,7 +785,7 @@ nsImageFrame::HandleEvent(nsIPresContext* aPresContext, if (p.y < 0) p.y = 0; char cbuf[50]; PR_snprintf(cbuf, sizeof(cbuf), "?%d,%d", p.x, p.y); - absURL.Append(cbuf); + absURL.AppendWithConversion(cbuf); PRBool clicked = PR_FALSE; if (aEvent->message == NS_MOUSE_LEFT_BUTTON_UP) { *aEventStatus = nsEventStatus_eConsumeDoDefault; diff --git a/layout/html/base/src/nsImageMap.cpp b/layout/html/base/src/nsImageMap.cpp index e6729f24582..422041a4da8 100644 --- a/layout/html/base/src/nsImageMap.cpp +++ b/layout/html/base/src/nsImageMap.cpp @@ -327,37 +327,37 @@ void Area::ToHTML(nsString& aResult) } aResult.Truncate(); - aResult.Append("\"");'); + aResult.AppendWithConversion('>'); } /** @@ -376,11 +376,11 @@ void Area::BeginConvertToXIF(nsXIFConverter& aConverter) const mArea->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::alt, altText); } - nsAutoString tag("area"); + nsAutoString tag; tag.AssignWithConversion("area"); aConverter.BeginStartTag(tag); - nsAutoString name("shape"); + nsAutoString name; name.AssignWithConversion("shape"); nsAutoString shape; GetShapeName(shape); aConverter.AddAttribute(name,shape); @@ -390,36 +390,36 @@ void Area::BeginConvertToXIF(nsXIFConverter& aConverter) const if (nsnull != mCoords) { PRInt32 i, n = mNumCoords; for (i = 0; i < n; i++) { - coords.Append(mCoords[i], 10); + coords.AppendWithConversion(mCoords[i], 10); if (i < n - 1) { coords.Append(','); } } } - name.Assign("coords"); + name.AssignWithConversion("coords"); aConverter.AddAttribute(name,coords); - name.Assign("href"); + name.AssignWithConversion("href"); aConverter.AddAttribute(name,href); if (0 < target.Length()) { - name.Assign("target"); + name.AssignWithConversion("target"); aConverter.AddAttribute(name,target); } if (0 < altText.Length()) { - name.Assign("alt"); + name.AssignWithConversion("alt"); aConverter.AddAttribute(name,altText); } if (mSuppressFeedback) { - name.Assign("suppress"); + name.AssignWithConversion("suppress"); aConverter.AddAttribute(name); } } void Area::FinishConvertToXIF(nsXIFConverter& aConverter) const { - nsAutoString tag("area"); + nsAutoString tag; tag.AssignWithConversion("area"); aConverter.FinishStartTag(tag,PR_TRUE); } @@ -464,7 +464,7 @@ void DefaultArea::Draw(nsIPresContext* aCX, nsIRenderingContext& aRC) void DefaultArea::GetShapeName(nsString& aResult) const { - aResult.Append("default"); + aResult.AppendWithConversion("default"); } //---------------------------------------------------------------------- @@ -525,7 +525,7 @@ void RectArea::Draw(nsIPresContext* aCX, nsIRenderingContext& aRC) void RectArea::GetShapeName(nsString& aResult) const { - aResult.Append("rect"); + aResult.AppendWithConversion("rect"); } //---------------------------------------------------------------------- @@ -635,7 +635,7 @@ void PolyArea::Draw(nsIPresContext* aCX, nsIRenderingContext& aRC) void PolyArea::GetShapeName(nsString& aResult) const { - aResult.Append("polygon"); + aResult.AppendWithConversion("polygon"); } //---------------------------------------------------------------------- @@ -700,7 +700,7 @@ void CircleArea::Draw(nsIPresContext* aCX, nsIRenderingContext& aRC) void CircleArea::GetShapeName(nsString& aResult) const { - aResult.Append("circle"); + aResult.AppendWithConversion("circle"); } //---------------------------------------------------------------------- diff --git a/layout/html/base/src/nsObjectFrame.cpp b/layout/html/base/src/nsObjectFrame.cpp index 0ac7705bdae..65000353974 100644 --- a/layout/html/base/src/nsObjectFrame.cpp +++ b/layout/html/base/src/nsObjectFrame.cpp @@ -650,7 +650,7 @@ nsObjectFrame::Reflow(nsIPresContext* aPresContext, if (classid.Find("clsid:") != -1) { classid.Cut(0, 6); // Strip off the "clsid:". What's left is the class ID. - bJavaPluginClsid = (classid.Equals(JAVA_CLASS_ID)); + bJavaPluginClsid = (classid.EqualsWithConversion(JAVA_CLASS_ID)); } // if we find "java:" in the class id, or we match the Java classid number, we have a java applet @@ -702,7 +702,7 @@ nsObjectFrame::Reflow(nsIPresContext* aPresContext, { // These are some builtin types that we know about for now. // (Eventually this will move somewhere else.) - if (classid.Equals("browser")) + if (classid.EqualsWithConversion("browser")) { widgetCID = kCAppShellCID; rv = InstantiateWidget(aPresContext, aMetrics, aReflowState, widgetCID); @@ -1742,8 +1742,8 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetURL(const char *aURL, const char *aTarge if (NS_OK == rv) { - nsAutoString uniurl = nsAutoString(aURL); - nsAutoString unitarget = nsAutoString(aTarget); + nsAutoString uniurl; uniurl.AssignWithConversion(aURL); + nsAutoString unitarget; unitarget.AssignWithConversion(aTarget); nsAutoString fullurl; nsIURI* baseURL; @@ -1797,7 +1797,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::ShowStatus(const char *aStatusMsg) if(browserChrome) { - nsAutoString msg = nsAutoString(aStatusMsg); + nsAutoString msg; msg.AssignWithConversion(aStatusMsg); browserChrome->SetJSStatus(msg.GetUnicode()); } } diff --git a/layout/html/base/src/nsPresShell.cpp b/layout/html/base/src/nsPresShell.cpp index 8bc174f8281..5bd1f2a9148 100644 --- a/layout/html/base/src/nsPresShell.cpp +++ b/layout/html/base/src/nsPresShell.cpp @@ -1190,7 +1190,7 @@ PresShell::GetActiveAlternateStyleSheet(nsString& aSheetTitle) if (mStyleSet) { PRInt32 count = mStyleSet->GetNumberOfDocStyleSheets(); PRInt32 index; - nsAutoString textHtml("text/html"); + nsAutoString textHtml; textHtml.AssignWithConversion("text/html"); for (index = 0; index < count; index++) { nsIStyleSheet* sheet = mStyleSet->GetDocStyleSheetAt(index); if (nsnull != sheet) { @@ -1217,7 +1217,7 @@ PresShell::SelectAlternateStyleSheet(const nsString& aSheetTitle) if (mDocument && mStyleSet) { PRInt32 count = mDocument->GetNumberOfStyleSheets(); PRInt32 index; - nsAutoString textHtml("text/html"); + nsAutoString textHtml; textHtml.AssignWithConversion("text/html"); for (index = 0; index < count; index++) { nsIStyleSheet* sheet = mDocument->GetStyleSheetAt(index); if (nsnull != sheet) { @@ -1249,7 +1249,7 @@ PresShell::ListAlternateStyleSheets(nsStringArray& aTitleList) if (mDocument) { PRInt32 count = mDocument->GetNumberOfStyleSheets(); PRInt32 index; - nsAutoString textHtml("text/html"); + nsAutoString textHtml; textHtml.AssignWithConversion("text/html"); for (index = 0; index < count; index++) { nsIStyleSheet* sheet = mDocument->GetStyleSheetAt(index); if (nsnull != sheet) { @@ -3554,7 +3554,7 @@ LogVerifyMessage(nsIFrame* k1, nsIFrame* k2, const char* aMsg) } } else { - name = "(null)"; + name.AssignWithConversion("(null)"); } fputs(name, stdout); @@ -3569,7 +3569,7 @@ LogVerifyMessage(nsIFrame* k1, nsIFrame* k2, const char* aMsg) } } else { - name = "(null)"; + name.AssignWithConversion("(null)"); } fputs(name, stdout); diff --git a/layout/html/base/src/nsTextFrame.cpp b/layout/html/base/src/nsTextFrame.cpp index 24492a481d3..7e5a07e905b 100644 --- a/layout/html/base/src/nsTextFrame.cpp +++ b/layout/html/base/src/nsTextFrame.cpp @@ -4385,14 +4385,14 @@ nsTextFrame::ToCString(nsString& aBuf, PRInt32* aTotalContentLength) const while (fragOffset < n) { PRUnichar ch = frag->CharAt(fragOffset++); if (ch == '\r') { - aBuf.Append("\\r"); + aBuf.AppendWithConversion("\\r"); } else if (ch == '\n') { - aBuf.Append("\\n"); + aBuf.AppendWithConversion("\\n"); } else if (ch == '\t') { - aBuf.Append("\\t"); + aBuf.AppendWithConversion("\\t"); } else if ((ch < ' ') || (ch >= 127)) { - aBuf.Append("\\0"); - aBuf.Append((PRInt32)ch, 8); + aBuf.AppendWithConversion("\\0"); + aBuf.AppendWithConversion((PRInt32)ch, 8); } else { aBuf.Append(ch); }