From 26a41b1754b7dac250d37181df58b9ee9921af14 Mon Sep 17 00:00:00 2001 From: "scc%netscape.com" Date: Sat, 15 Apr 2000 09:16:58 +0000 Subject: [PATCH] making string conversions explicit --- .../streamconv/converters/mozTXTToHTMLConv.cpp | 6 +++--- .../converters/nsFTPDirListingConv.cpp | 2 +- .../streamconv/converters/nsMultiMixedConv.cpp | 2 +- .../streamconv/converters/nsTXTToHTMLConv.cpp | 18 +++++++++--------- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/netwerk/streamconv/converters/mozTXTToHTMLConv.cpp b/netwerk/streamconv/converters/mozTXTToHTMLConv.cpp index de0b5b00e161..dc2eae6808bd 100644 --- a/netwerk/streamconv/converters/mozTXTToHTMLConv.cpp +++ b/netwerk/streamconv/converters/mozTXTToHTMLConv.cpp @@ -121,17 +121,17 @@ mozTXTToHTMLConv::UnescapeStr(const PRUnichar * aInString, PRInt32 aStartPos, PR subString = &aInString[i]; if (!nsCRT::strncmp(subString, "<", MinInt(4, aLength - remainingChars))) { - aOutString += '<'; + aOutString.AppendWithConversion('<'); i += 4; } else if (!nsCRT::strncmp(subString, ">", MinInt(4, aLength - remainingChars))) { - aOutString += '>'; + aOutString.AppendWithConversion('>'); i += 4; } else if (!nsCRT::strncmp(subString, "&", MinInt(5, aLength - remainingChars))) { - aOutString += '&'; + aOutString.AppendWithConversion('&'); i += 5; } else diff --git a/netwerk/streamconv/converters/nsFTPDirListingConv.cpp b/netwerk/streamconv/converters/nsFTPDirListingConv.cpp index 8a089c91b57c..1ecbd58dd5dd 100644 --- a/netwerk/streamconv/converters/nsFTPDirListingConv.cpp +++ b/netwerk/streamconv/converters/nsFTPDirListingConv.cpp @@ -863,7 +863,7 @@ nsFTPDirListingConv::DigestBufferLines(char *aBuffer, nsCAutoString &aString) { // CONTENT LENGTH if (!thisEntry->mSupressSize) { - aString.Append(thisEntry->mContentLen); + aString.AppendInt(thisEntry->mContentLen); } else { aString.Append('0'); } diff --git a/netwerk/streamconv/converters/nsMultiMixedConv.cpp b/netwerk/streamconv/converters/nsMultiMixedConv.cpp index fb42ce1465b4..11c05e3046e1 100644 --- a/netwerk/streamconv/converters/nsMultiMixedConv.cpp +++ b/netwerk/streamconv/converters/nsMultiMixedConv.cpp @@ -294,7 +294,7 @@ nsMultiMixedConv::BuildURI(nsIChannel *aChannel, nsIURI **_retval) { nsCAutoString dummyURIStr(uriSpec); dummyURIStr.Append("##"); - dummyURIStr.Append((PRInt32) mPartCount, 10 /* radix */); + dummyURIStr.AppendInt(mPartCount, 10 /* radix */); return mIOService->NewURI(dummyURIStr.GetBuffer(), nsnull, _retval); } diff --git a/netwerk/streamconv/converters/nsTXTToHTMLConv.cpp b/netwerk/streamconv/converters/nsTXTToHTMLConv.cpp index 63d1c25420b0..aef319346999 100644 --- a/netwerk/streamconv/converters/nsTXTToHTMLConv.cpp +++ b/netwerk/streamconv/converters/nsTXTToHTMLConv.cpp @@ -56,7 +56,7 @@ nsTXTToHTMLConv::AsyncConvertData(const PRUnichar *aFromType, // nsIStreamObserver methods NS_IMETHODIMP nsTXTToHTMLConv::OnStartRequest(nsIChannel *aChannel, nsISupports *aContext) { - mBuffer = "\n"; + mBuffer.AssignWithConversion("<html>\n<head><title>"); mBuffer.Append(mPageTitle); mBuffer.AppendWithConversion("\n\n"); if (mPreFormatHTML) { // Use
 tags
@@ -78,7 +78,7 @@ nsTXTToHTMLConv::OnStopRequest(nsIChannel *aChannel, nsISupports *aContext,
     if (mPreFormatHTML) {
       mBuffer.AppendWithConversion("
\n"); } - mBuffer += "\n"; + mBuffer.AppendWithConversion("\n"); nsCOMPtr inputData; nsCOMPtr inputDataSup; @@ -125,7 +125,7 @@ nsTXTToHTMLConv::OnDataAvailable(nsIChannel *aChannel, nsISupports *aContext, if (NS_FAILED(rv)) return rv; buffer[read] = '\0'; - mBuffer += buffer; + mBuffer.AppendWithConversion(buffer); amtRead += read; PRInt32 front = -1, back = -1, tokenLoc = -1, cursor = 0; @@ -199,14 +199,14 @@ nsTXTToHTMLConv::Init() { convToken *token = new convToken; if (!token) return NS_ERROR_OUT_OF_MEMORY; token->prepend = PR_TRUE; - token->token = "http://"; // XXX need to iterate through all protos + token->token.AssignWithConversion("http://"); // XXX need to iterate through all protos mTokens.AppendElement(token); token = new convToken; if (!token) return NS_ERROR_OUT_OF_MEMORY; token->prepend = PR_TRUE; - token->token = '@'; - token->modText = "mailto:"; + token->token.AssignWithConversion('@'); + token->modText.AssignWithConversion("mailto:"); mTokens.AppendElement(token); return rv; @@ -244,16 +244,16 @@ nsTXTToHTMLConv::CatHTML(PRInt32 front, PRInt32 back) { // href is implied PRInt32 modLen = mToken->modText.Length(); mBuffer.Mid(linkText, front, back-front); - mBuffer.Insert("modText, cursor); cursor += modLen-front+back; - mBuffer.Insert("\">", cursor); + mBuffer.InsertWithConversion("\">", cursor); cursor += 2; mBuffer.Insert(linkText, cursor); cursor += linkText.Length(); - mBuffer.Insert("", cursor); + mBuffer.InsertWithConversion("", cursor); cursor += 4; } mToken = nsnull; // indicates completeness