From 96a031fd505ac4dab66444f7c8d4a73ee670d866 Mon Sep 17 00:00:00 2001 From: "scc%netscape.com" Date: Fri, 21 Apr 2000 06:56:47 +0000 Subject: [PATCH] making string conversions explicit git-svn-id: svn://10.0.0.236/trunk@66666 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/editor/base/nsEditorShell.cpp | 7 ++++--- mozilla/editor/base/nsHTMLEditor.cpp | 6 +++--- mozilla/editor/composer/src/nsEditorShell.cpp | 7 ++++--- mozilla/editor/libeditor/html/nsHTMLEditor.cpp | 6 +++--- .../xpfe/components/search/src/nsInternetSearchService.cpp | 7 ++++--- 5 files changed, 18 insertions(+), 15 deletions(-) diff --git a/mozilla/editor/base/nsEditorShell.cpp b/mozilla/editor/base/nsEditorShell.cpp index 6838073bbbe..1f93f977fc3 100644 --- a/mozilla/editor/base/nsEditorShell.cpp +++ b/mozilla/editor/base/nsEditorShell.cpp @@ -1270,7 +1270,8 @@ nsEditorShell::CheckAndSaveDocument(const PRUnichar *reasonToSave, PRBool *_retv nsAutoString saveMsg; GetBundleString(NS_ConvertASCIItoUCS2("SaveFilePrompt"), saveMsg); - saveMsg.ReplaceSubstring(NS_ConvertASCIItoUCS2("%title%"), title).ReplaceSubstring(NS_ConvertASCIItoUCS2("%reason%"), reasonToSaveStr); + saveMsg.ReplaceSubstring(NS_ConvertASCIItoUCS2("%title%"), title); + saveMsg.ReplaceSubstring(NS_ConvertASCIItoUCS2("%reason%"), reasonToSaveStr); nsAutoString saveDocString; GetBundleString(NS_ConvertASCIItoUCS2("SaveDocument"), saveDocString); @@ -2204,7 +2205,7 @@ nsEditorShell::Rewrap(PRBool aRespectNewlines) if (NS_FAILED(rv)) return rv; // Variables we'll need either way - nsAutoString format("text/plain"); + nsAutoString format; format.AssignWithConversion("text/plain"); nsAutoString current; nsString wrapped; nsCOMPtr nsied (do_QueryInterface(mEditor)); @@ -2268,7 +2269,7 @@ nsEditorShell::StripCites() if (NS_FAILED(rv)) return rv; // Variables we'll need either way - nsAutoString format("text/plain"); + nsAutoString format; format.AssignWithConversion("text/plain"); nsAutoString current; nsString stripped; nsCOMPtr nsied (do_QueryInterface(mEditor)); diff --git a/mozilla/editor/base/nsHTMLEditor.cpp b/mozilla/editor/base/nsHTMLEditor.cpp index 9300ceb1226..ad6c17a7e44 100644 --- a/mozilla/editor/base/nsHTMLEditor.cpp +++ b/mozilla/editor/base/nsHTMLEditor.cpp @@ -720,8 +720,8 @@ NS_IMETHODIMP nsHTMLEditor::EditorKeyPress(nsIDOMKeyEvent* aKeyEvent) else if (nsHTMLEditUtils::IsListItem(blockParent)) { nsAutoString indentstr; - if (isShift) indentstr = "outdent"; - else indentstr = "indent"; + if (isShift) indentstr.AssignWithConversion("outdent"); + else indentstr.AssignWithConversion("indent"); res = Indent(indentstr); bHandled = PR_TRUE; } @@ -2703,7 +2703,7 @@ nsHTMLEditor::SetCaretAfterElement(nsIDOMElement* aElement) NS_IMETHODIMP nsHTMLEditor::SetParagraphFormat(const nsString& aParagraphFormat) { //Kinda sad to waste memory just to force lower case - nsAutoString tag = aParagraphFormat; + nsAutoString tag; tag.Assign(aParagraphFormat); tag.ToLowerCase(); return InsertBasicBlock(tag); } diff --git a/mozilla/editor/composer/src/nsEditorShell.cpp b/mozilla/editor/composer/src/nsEditorShell.cpp index 6838073bbbe..1f93f977fc3 100644 --- a/mozilla/editor/composer/src/nsEditorShell.cpp +++ b/mozilla/editor/composer/src/nsEditorShell.cpp @@ -1270,7 +1270,8 @@ nsEditorShell::CheckAndSaveDocument(const PRUnichar *reasonToSave, PRBool *_retv nsAutoString saveMsg; GetBundleString(NS_ConvertASCIItoUCS2("SaveFilePrompt"), saveMsg); - saveMsg.ReplaceSubstring(NS_ConvertASCIItoUCS2("%title%"), title).ReplaceSubstring(NS_ConvertASCIItoUCS2("%reason%"), reasonToSaveStr); + saveMsg.ReplaceSubstring(NS_ConvertASCIItoUCS2("%title%"), title); + saveMsg.ReplaceSubstring(NS_ConvertASCIItoUCS2("%reason%"), reasonToSaveStr); nsAutoString saveDocString; GetBundleString(NS_ConvertASCIItoUCS2("SaveDocument"), saveDocString); @@ -2204,7 +2205,7 @@ nsEditorShell::Rewrap(PRBool aRespectNewlines) if (NS_FAILED(rv)) return rv; // Variables we'll need either way - nsAutoString format("text/plain"); + nsAutoString format; format.AssignWithConversion("text/plain"); nsAutoString current; nsString wrapped; nsCOMPtr nsied (do_QueryInterface(mEditor)); @@ -2268,7 +2269,7 @@ nsEditorShell::StripCites() if (NS_FAILED(rv)) return rv; // Variables we'll need either way - nsAutoString format("text/plain"); + nsAutoString format; format.AssignWithConversion("text/plain"); nsAutoString current; nsString stripped; nsCOMPtr nsied (do_QueryInterface(mEditor)); diff --git a/mozilla/editor/libeditor/html/nsHTMLEditor.cpp b/mozilla/editor/libeditor/html/nsHTMLEditor.cpp index 9300ceb1226..ad6c17a7e44 100644 --- a/mozilla/editor/libeditor/html/nsHTMLEditor.cpp +++ b/mozilla/editor/libeditor/html/nsHTMLEditor.cpp @@ -720,8 +720,8 @@ NS_IMETHODIMP nsHTMLEditor::EditorKeyPress(nsIDOMKeyEvent* aKeyEvent) else if (nsHTMLEditUtils::IsListItem(blockParent)) { nsAutoString indentstr; - if (isShift) indentstr = "outdent"; - else indentstr = "indent"; + if (isShift) indentstr.AssignWithConversion("outdent"); + else indentstr.AssignWithConversion("indent"); res = Indent(indentstr); bHandled = PR_TRUE; } @@ -2703,7 +2703,7 @@ nsHTMLEditor::SetCaretAfterElement(nsIDOMElement* aElement) NS_IMETHODIMP nsHTMLEditor::SetParagraphFormat(const nsString& aParagraphFormat) { //Kinda sad to waste memory just to force lower case - nsAutoString tag = aParagraphFormat; + nsAutoString tag; tag.Assign(aParagraphFormat); tag.ToLowerCase(); return InsertBasicBlock(tag); } diff --git a/mozilla/xpfe/components/search/src/nsInternetSearchService.cpp b/mozilla/xpfe/components/search/src/nsInternetSearchService.cpp index 4ae33169ec6..9941dc5c0f8 100755 --- a/mozilla/xpfe/components/search/src/nsInternetSearchService.cpp +++ b/mozilla/xpfe/components/search/src/nsInternetSearchService.cpp @@ -3466,7 +3466,8 @@ InternetSearchDataSource::GetData(const nsString &data, const char *sectionToFin if (attrib.EqualsIgnoreCase(attribToFind)) { line.Cut(0, equal+1); - value = line.Trim(" \t"); + line.Trim(" \t"); + value = line; // strip of any enclosing quotes PRUnichar quoteChar; @@ -3494,7 +3495,7 @@ InternetSearchDataSource::GetData(const nsString &data, const char *sectionToFin { value.Truncate(commentOffset); } - value = value.Trim(" \t"); + value.Trim(" \t"); } rv = NS_OK; break; @@ -4718,7 +4719,7 @@ InternetSearchDataSource::ConvertEntities(nsString &nameStr, PRBool removeHTMLFl if (trimWhiteSpaceFlag == PR_TRUE) { // trim name - nameStr = nameStr.Trim(" \t"); + nameStr.Trim(" \t"); } return(NS_OK);