diff --git a/content/base/src/nsPrintEngine.cpp b/content/base/src/nsPrintEngine.cpp index d543eadcd01..a1ae19dd52b 100644 --- a/content/base/src/nsPrintEngine.cpp +++ b/content/base/src/nsPrintEngine.cpp @@ -2152,7 +2152,7 @@ nsPrintEngine::GetDisplayTitleAndURL(nsPrintObject* aPO, *aTitle = nsCRT::strdup(aPO->mDocTitle); } else { switch (aDefType) { - case eDocTitleDefBlank: *aTitle = ToNewUnicode(NS_LITERAL_STRING("")); + case eDocTitleDefBlank: *aTitle = ToNewUnicode(EmptyString()); break; case eDocTitleDefURLDoc: diff --git a/content/base/src/nsScriptLoader.cpp b/content/base/src/nsScriptLoader.cpp index 0572a7ae0b5..97be06c2924 100644 --- a/content/base/src/nsScriptLoader.cpp +++ b/content/base/src/nsScriptLoader.cpp @@ -167,7 +167,7 @@ nsScriptLoader::~nsScriptLoader() for (PRInt32 i = 0; i < count; i++) { nsScriptLoadRequest* req = mPendingRequests[i]; if (req) { - req->FireScriptAvailable(NS_ERROR_ABORT, NS_LITERAL_STRING("")); + req->FireScriptAvailable(NS_ERROR_ABORT, EmptyString()); } } @@ -545,7 +545,7 @@ nsScriptLoader::FireErrorNotification(nsresult aResult, observer->ScriptAvailable(aResult, aElement, PR_TRUE, PR_FALSE, nsnull, 0, - NS_LITERAL_STRING("")); + EmptyString()); } } @@ -553,7 +553,7 @@ nsScriptLoader::FireErrorNotification(nsresult aResult, aObserver->ScriptAvailable(aResult, aElement, PR_TRUE, PR_FALSE, nsnull, 0, - NS_LITERAL_STRING("")); + EmptyString()); } return aResult; @@ -738,7 +738,7 @@ nsScriptLoader::OnStreamComplete(nsIStreamLoader* aLoader, if (NS_FAILED(aStatus)) { mPendingRequests.RemoveObject(request); - FireScriptAvailable(aStatus, request, NS_LITERAL_STRING("")); + FireScriptAvailable(aStatus, request, EmptyString()); ProcessPendingReqests(); return NS_OK; } @@ -748,7 +748,7 @@ nsScriptLoader::OnStreamComplete(nsIStreamLoader* aLoader, if (!mDocument) { mPendingRequests.RemoveObject(request); FireScriptAvailable(NS_ERROR_NOT_AVAILABLE, request, - NS_LITERAL_STRING("")); + EmptyString()); ProcessPendingReqests(); return NS_OK; } @@ -765,7 +765,7 @@ nsScriptLoader::OnStreamComplete(nsIStreamLoader* aLoader, if (NS_SUCCEEDED(rv) && !requestSucceeded) { mPendingRequests.RemoveObject(request); FireScriptAvailable(NS_ERROR_NOT_AVAILABLE, request, - NS_LITERAL_STRING("")); + EmptyString()); ProcessPendingReqests(); return NS_OK; } @@ -861,7 +861,7 @@ nsScriptLoader::OnStreamComplete(nsIStreamLoader* aLoader, "Could not convert external JavaScript to Unicode!"); if (NS_FAILED(rv)) { mPendingRequests.RemoveObject(request); - FireScriptAvailable(rv, request, NS_LITERAL_STRING("")); + FireScriptAvailable(rv, request, EmptyString()); ProcessPendingReqests(); return NS_OK; } @@ -881,7 +881,7 @@ nsScriptLoader::OnStreamComplete(nsIStreamLoader* aLoader, mDocument->SetPrincipal(newPrincipal); } else { mPendingRequests.RemoveObject(request); - FireScriptAvailable(rv, request, NS_LITERAL_STRING("")); + FireScriptAvailable(rv, request, EmptyString()); ProcessPendingReqests(); return NS_OK; } diff --git a/content/events/src/nsDOMEvent.cpp b/content/events/src/nsDOMEvent.cpp index 2d1b5f9f0d8..84fd97a1c98 100644 --- a/content/events/src/nsDOMEvent.cpp +++ b/content/events/src/nsDOMEvent.cpp @@ -580,7 +580,7 @@ NS_METHOD nsDOMEvent::GetText(nsString& aText) aText = *mText; return NS_OK; } - aText.Assign(NS_LITERAL_STRING("")); + aText.Truncate(); return NS_ERROR_FAILURE; } diff --git a/content/events/src/nsEventStateManager.cpp b/content/events/src/nsEventStateManager.cpp index 1bbb3a6aee7..2b72182a707 100644 --- a/content/events/src/nsEventStateManager.cpp +++ b/content/events/src/nsEventStateManager.cpp @@ -1059,9 +1059,9 @@ nsEventStateManager::CreateClickHoldTimer(nsIPresContext* inPresContext, // check for the |popup| attribute nsAutoString popup; clickedContent->GetAttr(kNameSpaceID_None, nsXULAtoms::popup, popup); - if (popup != NS_LITERAL_STRING("")) + if (!popup.IsEmpty()) return; - + // check for a like bookmarks if (clickedContent->Tag() == nsXULAtoms::menubutton) return; diff --git a/content/html/content/src/nsHTMLInputElement.cpp b/content/html/content/src/nsHTMLInputElement.cpp index a080181a61f..cbde80ec74a 100644 --- a/content/html/content/src/nsHTMLInputElement.cpp +++ b/content/html/content/src/nsHTMLInputElement.cpp @@ -621,8 +621,8 @@ nsHTMLInputElement::SetDefaultChecked(PRBool aDefaultChecked) nsresult rv; if (aDefaultChecked) { - rv = SetAttr(kNameSpaceID_None, nsHTMLAtoms::checked, - NS_LITERAL_STRING(""), PR_TRUE); + rv = SetAttr(kNameSpaceID_None, nsHTMLAtoms::checked, EmptyString(), + PR_TRUE); } else { rv = UnsetAttr(kNameSpaceID_None, nsHTMLAtoms::checked, PR_TRUE); } @@ -1817,7 +1817,7 @@ nsHTMLInputElement::StringToAttribute(nsIAtom* aAttribute, // If the type is being changed to file, set the element value // to the empty string. This is for security. if (table->value == NS_FORM_INPUT_FILE) { - SetValue(NS_LITERAL_STRING("")); + SetValue(EmptyString()); } aResult.SetIntValue(table->value, eHTMLUnit_Enumerated); mType = table->value; // set the type of this input @@ -2210,7 +2210,7 @@ nsHTMLInputElement::Reset() case NS_FORM_INPUT_FILE: { // Resetting it to blank should not perform security check - rv = SetValueInternal(NS_LITERAL_STRING(""), nsnull); + rv = SetValueInternal(EmptyString(), nsnull); break; } // Value is the same as defaultValue for hidden inputs diff --git a/content/html/document/src/nsMediaDocument.h b/content/html/document/src/nsMediaDocument.h index 7616a9b080f..2e70835895f 100644 --- a/content/html/document/src/nsMediaDocument.h +++ b/content/html/document/src/nsMediaDocument.h @@ -82,7 +82,7 @@ protected: const char* const* aFormatNames = sFormatNames, PRInt32 aWidth = 0, PRInt32 aHeight = 0, - const nsAString& aStatus = NS_LITERAL_STRING("")); + const nsAString& aStatus = EmptyString()); nsCOMPtr mStringBundle; static const char* const sFormatNames[4]; diff --git a/content/html/style/src/nsCSSLoader.cpp b/content/html/style/src/nsCSSLoader.cpp index 4d08f834ae3..cebf0d1e3f6 100644 --- a/content/html/style/src/nsCSSLoader.cpp +++ b/content/html/style/src/nsCSSLoader.cpp @@ -678,8 +678,8 @@ ReportToConsole(const PRUnichar* aMessageName, const PRUnichar **aParams, getter_Copies(errorText)); NS_ENSURE_SUCCESS(rv, rv); rv = errorObject->Init(errorText.get(), - NS_LITERAL_STRING("").get(), /* file name */ - NS_LITERAL_STRING("").get(), /* source line */ + EmptyString().get(), /* file name */ + EmptyString().get(), /* source line */ 0, /* line number */ 0, /* column number */ aErrorFlags, @@ -1783,7 +1783,7 @@ CSSLoaderImpl::LoadChildSheet(nsICSSStyleSheet* aParentSheet, state, getter_AddRefs(sheet)); NS_ENSURE_SUCCESS(rv, rv); - NS_NAMED_LITERAL_STRING(empty, ""); + const nsAString& empty = EmptyString(); rv = PrepareSheet(sheet, empty, empty, aMedia); NS_ENSURE_SUCCESS(rv, rv); @@ -1855,7 +1855,7 @@ CSSLoaderImpl::InternalLoadAgentSheet(nsIURI* aURL, getter_AddRefs(sheet)); NS_ENSURE_SUCCESS(rv, rv); - NS_NAMED_LITERAL_STRING(empty, ""); + const nsAString& empty = EmptyString(); rv = PrepareSheet(sheet, empty, empty, nsnull); NS_ENSURE_SUCCESS(rv, rv); diff --git a/content/html/style/src/nsDOMCSSDeclaration.cpp b/content/html/style/src/nsDOMCSSDeclaration.cpp index 34384fc6ad1..fe91961ebee 100644 --- a/content/html/style/src/nsDOMCSSDeclaration.cpp +++ b/content/html/style/src/nsDOMCSSDeclaration.cpp @@ -45,6 +45,7 @@ #include "nsCSSProps.h" #include "nsCOMPtr.h" #include "nsIURL.h" +#include "nsReadableUtils.h" #include "nsContentUtils.h" @@ -325,17 +326,17 @@ CSS2PropertiesTearoff::QueryInterface(REFNSIID aIID, void** aInstancePtr) // nsIDOMNSCSS2Properties #define CSS_PROP(name_, id_, method_, datastruct_, member_, type_, iscoord_) \ - NS_IMETHODIMP \ - CSS2PropertiesTearoff::Get##method_(nsAString& aValue) \ - { \ - return mOuter->GetPropertyValue(NS_LITERAL_STRING(#name_), aValue); \ - } \ - \ - NS_IMETHODIMP \ - CSS2PropertiesTearoff::Set##method_(const nsAString& aValue) \ - { \ - return mOuter->SetProperty(NS_LITERAL_STRING(#name_), aValue, \ - NS_LITERAL_STRING("")); \ + NS_IMETHODIMP \ + CSS2PropertiesTearoff::Get##method_(nsAString& aValue) \ + { \ + return mOuter->GetPropertyValue(NS_LITERAL_STRING(#name_), aValue); \ + } \ + \ + NS_IMETHODIMP \ + CSS2PropertiesTearoff::Set##method_(const nsAString& aValue) \ + { \ + return mOuter->SetProperty(NS_LITERAL_STRING(#name_), aValue, \ + EmptyString()); \ } #define CSS_PROP_LIST_EXCLUDE_INTERNAL diff --git a/content/xbl/src/nsXBLContentSink.cpp b/content/xbl/src/nsXBLContentSink.cpp index c6b327d786c..d8bb3e7f775 100644 --- a/content/xbl/src/nsXBLContentSink.cpp +++ b/content/xbl/src/nsXBLContentSink.cpp @@ -274,7 +274,7 @@ nsXBLContentSink::ReportUnexpectedElement(nsIAtom* aElementName, rv = errorObject->Init(errorText.get(), NS_ConvertUTF8toUCS2(documentURI).get(), - NS_LITERAL_STRING("").get(), /* source line */ + EmptyString().get(), /* source line */ aLineNumber, 0, /* column number */ nsIScriptError::errorFlag, diff --git a/content/xbl/src/nsXBLService.cpp b/content/xbl/src/nsXBLService.cpp index 28cff7cc917..9875e8e0179 100644 --- a/content/xbl/src/nsXBLService.cpp +++ b/content/xbl/src/nsXBLService.cpp @@ -1031,8 +1031,8 @@ nsXBLService::LoadBindingDocumentInfo(nsIContent* aBoundElement, nsCOMPtr documentURI(do_QueryInterface(uriClone, &rv)); NS_ENSURE_TRUE(documentURI, rv); - - documentURI->SetRef(NS_LITERAL_CSTRING("")); + + documentURI->SetRef(EmptyCString()); #ifdef MOZ_XUL // We've got a file. Check our XBL document cache. diff --git a/content/xml/content/src/nsXMLElement.cpp b/content/xml/content/src/nsXMLElement.cpp index a1aa5e7bba6..6050a006a5e 100644 --- a/content/xml/content/src/nsXMLElement.cpp +++ b/content/xml/content/src/nsXMLElement.cpp @@ -312,7 +312,7 @@ nsXMLElement::MaybeTriggerAutoLink(nsIDocShell *aShell) rv = DocShellToPresContext(aShell, getter_AddRefs(pc)); if (NS_SUCCEEDED(rv)) { rv = TriggerLink(pc, verb, base, uri, - NS_LITERAL_STRING(""), PR_TRUE); + EmptyString(), PR_TRUE); return SpecialAutoLoadReturn(rv,verb); } diff --git a/content/xml/document/src/nsXMLContentSink.cpp b/content/xml/document/src/nsXMLContentSink.cpp index db5dd7e1c68..c3f76e80116 100644 --- a/content/xml/document/src/nsXMLContentSink.cpp +++ b/content/xml/document/src/nsXMLContentSink.cpp @@ -229,7 +229,7 @@ nsXMLContentSink::DidBuildModel() if (mTitleText.IsEmpty()) { nsCOMPtr dom_doc(do_QueryInterface(mDocument)); if (dom_doc) { - dom_doc->SetTitle(NS_LITERAL_STRING("")); + dom_doc->SetTitle(EmptyString()); } } diff --git a/content/xml/document/src/nsXMLPrettyPrinter.cpp b/content/xml/document/src/nsXMLPrettyPrinter.cpp index fe022bb6b31..c9c85eeda2f 100644 --- a/content/xml/document/src/nsXMLPrettyPrinter.cpp +++ b/content/xml/document/src/nsXMLPrettyPrinter.cpp @@ -97,7 +97,7 @@ nsXMLPrettyPrinter::PrettyPrint(nsIDocument* aDocument) do_QueryInterface(defaultView); if (defaultCSSView) { defaultCSSView->GetComputedStyle(frameElem, - NS_LITERAL_STRING(""), + EmptyString(), getter_AddRefs(computedStyle)); } } @@ -186,9 +186,10 @@ nsXMLPrettyPrinter::PrettyPrint(nsIDocument* aDocument) NS_ASSERTION(binding, "Prettyprint binding doesn't implement nsIObserver"); NS_ENSURE_TRUE(binding, NS_ERROR_UNEXPECTED); - rv = binding->Observe(resultFragment, "prettyprint-dom-created", NS_LITERAL_STRING("").get()); + rv = binding->Observe(resultFragment, "prettyprint-dom-created", + EmptyString().get()); NS_ENSURE_SUCCESS(rv, rv); - + // Observe the document so we know when to switch to "normal" view aDocument->AddObserver(this); mDocument = aDocument; diff --git a/content/xul/content/src/nsXULElement.cpp b/content/xul/content/src/nsXULElement.cpp index 6fc91a997e5..18da4310c47 100644 --- a/content/xul/content/src/nsXULElement.cpp +++ b/content/xul/content/src/nsXULElement.cpp @@ -2506,10 +2506,10 @@ nsXULElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, PRBool aNotify) if (aNameSpaceID == kNameSpaceID_None) { if (aName == nsXULAtoms::clazz) { // If CLASS is being unset, delete our class list. - Attributes()->UpdateClassList(NS_LITERAL_STRING("")); + Attributes()->UpdateClassList(EmptyString()); } else if (aName == nsXULAtoms::style) { nsCOMPtr baseURI = GetBaseURI(); - Attributes()->UpdateStyleRule(baseURI, NS_LITERAL_STRING("")); + Attributes()->UpdateStyleRule(baseURI, EmptyString()); // AttributeChanged() will handle the style reresolution } } diff --git a/directory/xpcom/base/src/nsLDAPChannel.cpp b/directory/xpcom/base/src/nsLDAPChannel.cpp index 48175df493d..bbd778b665a 100644 --- a/directory/xpcom/base/src/nsLDAPChannel.cpp +++ b/directory/xpcom/base/src/nsLDAPChannel.cpp @@ -640,7 +640,7 @@ nsLDAPChannel::AsyncOpen(nsIStreamListener* aListener, // rv = mConnection->Init(host.get(), port, (options & nsILDAPURL::OPT_SECURE) ? PR_TRUE - : PR_FALSE, NS_LITERAL_CSTRING(""), this, nsnull); + : PR_FALSE, EmptyCString(), this, nsnull); switch (rv) { case NS_OK: break; @@ -672,7 +672,7 @@ nsLDAPChannel::AsyncOpen(nsIStreamListener* aListener, // kick off a bind operation // PR_LOG(gLDAPLogModule, PR_LOG_DEBUG, ("initiating SimpleBind\n")); - rv = mCurrentOperation->SimpleBind(NS_LITERAL_CSTRING("")); + rv = mCurrentOperation->SimpleBind(EmptyCString()); if (NS_FAILED(rv)) { // XXXdmose better error handling / passthrough; deal with password diff --git a/directory/xpcom/base/src/nsLDAPConnection.cpp b/directory/xpcom/base/src/nsLDAPConnection.cpp index 1e8f4a4a401..27c38368865 100644 --- a/directory/xpcom/base/src/nsLDAPConnection.cpp +++ b/directory/xpcom/base/src/nsLDAPConnection.cpp @@ -330,7 +330,7 @@ nsLDAPConnection::GetErrorString(PRUnichar **_retval) // make a copy using the XPCOM shared allocator // - *_retval = ToNewUnicode(NS_ConvertUTF8toUCS2(rv)); + *_retval = UTF8ToNewUnicode(nsDependentCString(rv)); if (!*_retval) { return NS_ERROR_OUT_OF_MEMORY; } diff --git a/directory/xpcom/base/src/nsLDAPMessage.cpp b/directory/xpcom/base/src/nsLDAPMessage.cpp index 32293ae73e1..6e1058fe840 100644 --- a/directory/xpcom/base/src/nsLDAPMessage.cpp +++ b/directory/xpcom/base/src/nsLDAPMessage.cpp @@ -513,7 +513,7 @@ nsLDAPMessage::GetValues(const char *aAttr, PRUint32 *aCount, // PRUint32 i; for ( i = 0 ; i < numVals ; i++ ) { - (*aValues)[i] = ToNewUnicode(NS_ConvertUTF8toUCS2(values[i])); + (*aValues)[i] = UTF8ToNewUnicode(nsDependentCString(values[i])); if ( ! (*aValues)[i] ) { NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(i, aValues); ldap_value_free(values); diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index bdd5e168274..aef3a7bad9e 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -992,7 +992,7 @@ nsresult nsDocShell::FindTarget(const PRUnichar *aWindowTarget, else if (name.EqualsIgnoreCase("_blank") || name.EqualsIgnoreCase("_new")) { mustMakeNewWindow = PR_TRUE; - name.Assign(NS_LITERAL_STRING("")); + name.Truncate(); } else if(name.EqualsIgnoreCase("_parent")) { @@ -1065,7 +1065,7 @@ nsresult nsDocShell::FindTarget(const PRUnichar *aWindowTarget, // Neither is from the origin domain, send load to a new window (_blank) mustMakeNewWindow = PR_TRUE; - name.Assign(NS_LITERAL_STRING("")); + name.Truncate(); } // else (target's parent from origin domain) allow this load } // else (no parent) allow this load since shell is a toplevel window } // else (target from origin domain) allow this load @@ -1084,9 +1084,9 @@ nsresult nsDocShell::FindTarget(const PRUnichar *aWindowTarget, return NS_ERROR_FAILURE; } - rv = parentWindow->Open(NS_LITERAL_STRING(""), // URL to load + rv = parentWindow->Open(EmptyString(), // URL to load name, // Window name - NS_LITERAL_STRING(""), // Window features + EmptyString(), // Window features getter_AddRefs(newWindow)); if (NS_FAILED(rv)) return rv; @@ -5385,7 +5385,7 @@ nsDocShell::DoURILoad(nsIURI * aURI, NS_ASSERTION(uploadChannel, "http must support nsIUploadChannel"); // we really need to have a content type associated with this stream!! - uploadChannel->SetUploadStream(aPostData, NS_LITERAL_CSTRING(""), -1); + uploadChannel->SetUploadStream(aPostData, EmptyCString(), -1); /* If there is a valid postdata *and* it is a History Load, * set up the cache key on the channel, to retrieve the * data *only* from the cache. If it is a normal reload, the @@ -5857,7 +5857,7 @@ nsDocShell::ScrollIfAnchor(nsIURI * aURI, PRBool * aWasAnchor, else { // Tell the shell it's at an anchor, without scrolling. - shell->GoToAnchor(NS_LITERAL_STRING(""), PR_FALSE); + shell->GoToAnchor(EmptyString(), PR_FALSE); // An empty anchor was found, but if it's a load from history, // we don't have to jump to the top of the page. Scrollbar diff --git a/docshell/base/nsWebShell.cpp b/docshell/base/nsWebShell.cpp index 22b9364cf26..c47531b6035 100644 --- a/docshell/base/nsWebShell.cpp +++ b/docshell/base/nsWebShell.cpp @@ -691,7 +691,7 @@ nsWebShell::OnLeaveLink() if (browserChrome) { rv = browserChrome->SetStatus(nsIWebBrowserChrome::STATUS_LINK, - NS_LITERAL_STRING("").get()); + EmptyString().get()); } return rv; } diff --git a/dom/src/base/nsGlobalWindow.cpp b/dom/src/base/nsGlobalWindow.cpp index d1bd86829fa..ab8512ee6c3 100644 --- a/dom/src/base/nsGlobalWindow.cpp +++ b/dom/src/base/nsGlobalWindow.cpp @@ -2284,7 +2284,7 @@ GlobalWindowImpl::Alert(const nsAString& aString) const PRUnichar *title = nsnull; nsresult rv = CheckSecurityIsChromeCaller(&isChrome); if (NS_FAILED(rv) || !isChrome) { - MakeScriptDialogTitle(NS_LITERAL_STRING(""), newTitle); + MakeScriptDialogTitle(EmptyString(), newTitle); title = newTitle.get(); } NS_WARN_IF_FALSE(!isChrome, "chrome shouldn't be calling alert(), use the prompt service"); @@ -2315,7 +2315,7 @@ GlobalWindowImpl::Confirm(const nsAString& aString, PRBool* aReturn) const PRUnichar *title = nsnull; nsresult rv = CheckSecurityIsChromeCaller(&isChrome); if (NS_FAILED(rv) || !isChrome) { - MakeScriptDialogTitle(NS_LITERAL_STRING(""), newTitle); + MakeScriptDialogTitle(EmptyString(), newTitle); title = newTitle.get(); } NS_WARN_IF_FALSE(!isChrome, diff --git a/dom/src/jsurl/nsJSProtocolHandler.cpp b/dom/src/jsurl/nsJSProtocolHandler.cpp index 8e0469b12ea..ee01b0f18f5 100644 --- a/dom/src/jsurl/nsJSProtocolHandler.cpp +++ b/dom/src/jsurl/nsJSProtocolHandler.cpp @@ -389,7 +389,7 @@ nsresult nsJSChannel::Init(nsIURI *aURI) // treat it as html. rv = NS_NewInputStreamChannel(getter_AddRefs(channel), aURI, mIOThunk, NS_LITERAL_CSTRING("text/html"), - NS_LITERAL_CSTRING("")); + EmptyCString()); if (NS_FAILED(rv)) return rv; rv = mIOThunk->Init(aURI); diff --git a/editor/composer/src/nsComposerCommands.cpp b/editor/composer/src/nsComposerCommands.cpp index 656cbad6928..2cca3a1afeb 100644 --- a/editor/composer/src/nsComposerCommands.cpp +++ b/editor/composer/src/nsComposerCommands.cpp @@ -225,8 +225,8 @@ nsStyleUpdatingCommand::GetCurrentState(nsIEditor *aEditor, PRBool allOfSelectionHasProp = PR_FALSE; nsCOMPtr styleAtom = do_GetAtom(aTagName); - rv = htmlEditor->GetInlineProperty(styleAtom, NS_LITERAL_STRING(""), - NS_LITERAL_STRING(""), + rv = htmlEditor->GetInlineProperty(styleAtom, EmptyString(), + EmptyString(), &firstOfSelectionHasProp, &anyOfSelectionHasProp, &allOfSelectionHasProp); @@ -353,8 +353,7 @@ nsListCommand::ToggleState(nsIEditor *aEditor, const char* aTagName) rv = editor->RemoveList(listType); else { - nsString empty; - rv = editor->MakeOrChangeList(listType, PR_FALSE, empty); + rv = editor->MakeOrChangeList(listType, PR_FALSE, EmptyString()); } return rv; @@ -484,7 +483,7 @@ nsRemoveListCommand::DoCommand(const char *aCommandName, nsISupports *refCon) if (editor) { // This removes any list type - rv = editor->RemoveList(nsString()); + rv = editor->RemoveList(EmptyString()); } return rv; @@ -769,15 +768,15 @@ nsFontFaceStateCommand::SetState(nsIEditor *aEditor, nsString& newState) if (newState.Equals(NS_LITERAL_STRING("tt"))) { // The old "teletype" attribute - rv = htmlEditor->SetInlineProperty(ttAtom, NS_LITERAL_STRING(""), - NS_LITERAL_STRING("")); + rv = htmlEditor->SetInlineProperty(ttAtom, EmptyString(), + EmptyString()); // Clear existing font face rv = htmlEditor->RemoveInlineProperty(fontAtom, NS_LITERAL_STRING("face")); } else { // Remove any existing TT nodes - rv = htmlEditor->RemoveInlineProperty(ttAtom, NS_LITERAL_STRING("")); + rv = htmlEditor->RemoveInlineProperty(ttAtom, EmptyString()); if (newState.IsEmpty() || newState.Equals(NS_LITERAL_STRING("normal"))) { rv = htmlEditor->RemoveInlineProperty(fontAtom, NS_LITERAL_STRING("face")); @@ -814,7 +813,7 @@ nsFontSizeStateCommand::GetCurrentState(nsIEditor *aEditor, PRBool firstHas, anyHas, allHas; nsresult rv = htmlEditor->GetInlinePropertyWithAttrValue(fontAtom, NS_LITERAL_STRING("size"), - NS_LITERAL_STRING(""), + EmptyString(), &firstHas, &anyHas, &allHas, outStateString); if (NS_FAILED(rv)) return rv; @@ -855,11 +854,11 @@ nsFontSizeStateCommand::SetState(nsIEditor *aEditor, nsString& newState) if (NS_FAILED(rv)) return rv; nsCOMPtr bigAtom = do_GetAtom("big"); - rv = htmlEditor->RemoveInlineProperty(bigAtom, NS_LITERAL_STRING("")); + rv = htmlEditor->RemoveInlineProperty(bigAtom, EmptyString()); if (NS_FAILED(rv)) return rv; nsCOMPtr smallAtom = do_GetAtom("small"); - rv = htmlEditor->RemoveInlineProperty(smallAtom, NS_LITERAL_STRING("")); + rv = htmlEditor->RemoveInlineProperty(smallAtom, EmptyString()); if (NS_FAILED(rv)) return rv; } else { // set the size diff --git a/editor/composer/src/nsEditingSession.cpp b/editor/composer/src/nsEditingSession.cpp index 2235d3c05e4..e2c1f6a80ed 100644 --- a/editor/composer/src/nsEditingSession.cpp +++ b/editor/composer/src/nsEditingSession.cpp @@ -318,7 +318,7 @@ nsEditingSession::SetupEditorOnWindow(nsIDOMWindow *aWindow) { nsAutoString mimeType; if (NS_SUCCEEDED(nsdoc->GetContentType(mimeType))) - mimeCType = NS_ConvertUCS2toUTF8(mimeType); + CopyUTF16toUTF8(mimeType, mimeCType); if (IsSupportedTextType(mimeCType.get())) { diff --git a/editor/composer/src/nsEditorSpellCheck.cpp b/editor/composer/src/nsEditorSpellCheck.cpp index 087207f2d0f..49841a9fdaa 100644 --- a/editor/composer/src/nsEditorSpellCheck.cpp +++ b/editor/composer/src/nsEditorSpellCheck.cpp @@ -180,7 +180,7 @@ nsEditorSpellCheck::InitSpellChecker(nsIEditor* aEditor, PRBool aEnableSelection nsCAutoString utf8DictName; rv = packageRegistry->GetSelectedLocale(NS_LITERAL_CSTRING("navigator"), utf8DictName); - dictName = NS_ConvertUTF8toUCS2(utf8DictName); + CopyUTF8toUTF16(utf8DictName, dictName); } } diff --git a/editor/libeditor/base/nsEditor.cpp b/editor/libeditor/base/nsEditor.cpp index 54f5277b9bb..e461a7e3d80 100644 --- a/editor/libeditor/base/nsEditor.cpp +++ b/editor/libeditor/base/nsEditor.cpp @@ -1117,7 +1117,7 @@ nsEditor::MarkNodeDirty(nsIDOMNode* aNode) // mark the node dirty. nsCOMPtr element (do_QueryInterface(aNode)); if (element) - element->SetAttribute(NS_LITERAL_STRING("_moz_dirty"), NS_LITERAL_STRING("")); + element->SetAttribute(NS_LITERAL_STRING("_moz_dirty"), EmptyString()); return NS_OK; } @@ -2333,7 +2333,7 @@ NS_IMETHODIMP nsEditor::InsertTextImpl(const nsAString& aStringToInsert, if (!nodeAsText) { // create a text node - res = aDoc->CreateTextNode(nsAutoString(), getter_AddRefs(nodeAsText)); + res = aDoc->CreateTextNode(EmptyString(), getter_AddRefs(nodeAsText)); if (NS_FAILED(res)) return res; if (!nodeAsText) return NS_ERROR_NULL_POINTER; nsCOMPtr newNode = do_QueryInterface(nodeAsText); diff --git a/editor/libeditor/html/Makefile.in b/editor/libeditor/html/Makefile.in index a7933992625..b245ac3f441 100644 --- a/editor/libeditor/html/Makefile.in +++ b/editor/libeditor/html/Makefile.in @@ -42,7 +42,7 @@ REQUIRES = xpcom \ pref \ gfx \ widget \ - view \ + view \ $(NULL) # Building the full blown HTML Editor so add its source files and objects: @@ -60,7 +60,7 @@ CPPSRCS = \ nsHTMLObjectResizer.cpp \ nsHTMLEditorMouseListener.cpp \ nsHTMLInlineTableEditor.cpp \ - nsHTMLURIRefObject.cpp \ + nsHTMLURIRefObject.cpp \ nsTableEditor.cpp \ nsWSRunObject.cpp \ TypeInState.cpp \ diff --git a/editor/libeditor/html/TextEditorTest.cpp b/editor/libeditor/html/TextEditorTest.cpp index a563291ac7a..e77463c655b 100644 --- a/editor/libeditor/html/TextEditorTest.cpp +++ b/editor/libeditor/html/TextEditorTest.cpp @@ -36,6 +36,8 @@ * * ***** END LICENSE BLOCK ***** */ +#ifdef NS_DEBUG + #include #include "nsIEditor.h" @@ -49,7 +51,6 @@ #include "nsEditProperty.h" #include "nsString.h" -#ifdef NS_DEBUG #define TEST_RESULT(r) { if (NS_FAILED(r)) {printf("FAILURE result=%X\n", r); return r; } } #define TEST_POINTER(p) { if (!p) {printf("FAILURE null pointer\n"); return NS_ERROR_NULL_POINTER; } } @@ -190,14 +191,16 @@ nsresult TextEditorTest::TestTextProperties() PRBool all = PR_FALSE; PRBool first=PR_FALSE; - result = htmlEditor->GetInlineProperty(nsEditProperty::b, nsString(), nsString(), &first, &any, &all); + const nsAFlatString& empty = EmptyString(); + + result = htmlEditor->GetInlineProperty(nsEditProperty::b, empty, empty, &first, &any, &all); TEST_RESULT(result); NS_ASSERTION(PR_FALSE==first, "first should be false"); NS_ASSERTION(PR_FALSE==any, "any should be false"); NS_ASSERTION(PR_FALSE==all, "all should be false"); - result = htmlEditor->SetInlineProperty(nsEditProperty::b, nsString(), nsString()); + result = htmlEditor->SetInlineProperty(nsEditProperty::b, empty, empty); TEST_RESULT(result); - result = htmlEditor->GetInlineProperty(nsEditProperty::b, nsString(), nsString(), &first, &any, &all); + result = htmlEditor->GetInlineProperty(nsEditProperty::b, empty, empty, &first, &any, &all); TEST_RESULT(result); NS_ASSERTION(PR_TRUE==first, "first should be true"); NS_ASSERTION(PR_TRUE==any, "any should be true"); @@ -206,9 +209,9 @@ nsresult TextEditorTest::TestTextProperties() // remove the bold we just set printf("set the whole first text node to not bold\n"); - result = htmlEditor->RemoveInlineProperty(nsEditProperty::b, nsString()); + result = htmlEditor->RemoveInlineProperty(nsEditProperty::b, empty); TEST_RESULT(result); - result = htmlEditor->GetInlineProperty(nsEditProperty::b, nsString(), nsString(), &first, &any, &all); + result = htmlEditor->GetInlineProperty(nsEditProperty::b, empty, empty, &first, &any, &all); TEST_RESULT(result); NS_ASSERTION(PR_FALSE==first, "first should be false"); NS_ASSERTION(PR_FALSE==any, "any should be false"); @@ -219,23 +222,23 @@ nsresult TextEditorTest::TestTextProperties() printf("set the first text node (1, length-1) to bold and italic, and (2, length-1) to underline.\n"); selection->Collapse(textNode, 1); selection->Extend(textNode, length-1); - result = htmlEditor->SetInlineProperty(nsEditProperty::b, nsString(), nsString()); + result = htmlEditor->SetInlineProperty(nsEditProperty::b, empty, empty); TEST_RESULT(result); - result = htmlEditor->GetInlineProperty(nsEditProperty::b, nsString(), nsString(), &first, &any, &all); + result = htmlEditor->GetInlineProperty(nsEditProperty::b, empty, empty, &first, &any, &all); TEST_RESULT(result); NS_ASSERTION(PR_TRUE==first, "first should be true"); NS_ASSERTION(PR_TRUE==any, "any should be true"); NS_ASSERTION(PR_TRUE==all, "all should be true"); mEditor->DebugDumpContent(); // make all that same text italic - result = htmlEditor->SetInlineProperty(nsEditProperty::i, nsString(), nsString()); + result = htmlEditor->SetInlineProperty(nsEditProperty::i, empty, empty); TEST_RESULT(result); - result = htmlEditor->GetInlineProperty(nsEditProperty::i, nsString(), nsString(), &first, &any, &all); + result = htmlEditor->GetInlineProperty(nsEditProperty::i, empty, empty, &first, &any, &all); TEST_RESULT(result); NS_ASSERTION(PR_TRUE==first, "first should be true"); NS_ASSERTION(PR_TRUE==any, "any should be true"); NS_ASSERTION(PR_TRUE==all, "all should be true"); - result = htmlEditor->GetInlineProperty(nsEditProperty::b, nsString(), nsString(), &first, &any, &all); + result = htmlEditor->GetInlineProperty(nsEditProperty::b, empty, empty, &first, &any, &all); TEST_RESULT(result); NS_ASSERTION(PR_TRUE==first, "first should be true"); NS_ASSERTION(PR_TRUE==any, "any should be true"); @@ -256,9 +259,9 @@ nsresult TextEditorTest::TestTextProperties() NS_ASSERTION(length==915, "wrong text node"); selection->Collapse(textNode, 1); selection->Extend(textNode, length-2); - result = htmlEditor->SetInlineProperty(nsEditProperty::u, nsString(), nsString()); + result = htmlEditor->SetInlineProperty(nsEditProperty::u, empty, empty); TEST_RESULT(result); - result = htmlEditor->GetInlineProperty(nsEditProperty::u, nsString(), nsString(), &first, &any, &all); + result = htmlEditor->GetInlineProperty(nsEditProperty::u, empty, empty, &first, &any, &all); TEST_RESULT(result); NS_ASSERTION(PR_TRUE==first, "first should be true"); NS_ASSERTION(PR_TRUE==any, "any should be true"); diff --git a/editor/libeditor/html/nsHTMLAbsPosition.cpp b/editor/libeditor/html/nsHTMLAbsPosition.cpp index 5c7cee3b95a..58d644e2281 100644 --- a/editor/libeditor/html/nsHTMLAbsPosition.cpp +++ b/editor/libeditor/html/nsHTMLAbsPosition.cpp @@ -694,7 +694,7 @@ nsHTMLEditor::CheckPositionedElementBGandFG(nsIDOMElement * aElement, res = mHTMLCSSUtils->GetDefaultViewCSS(aElement, getter_AddRefs(viewCSS)); if (NS_FAILED(res)) return res; nsCOMPtr cssDecl; - res = viewCSS->GetComputedStyle(aElement, nsString(), getter_AddRefs(cssDecl)); + res = viewCSS->GetComputedStyle(aElement, EmptyString(), getter_AddRefs(cssDecl)); if (NS_FAILED(res)) return res; // from these declarations, get the one we want and that one only nsCOMPtr colorCssValue; diff --git a/editor/libeditor/html/nsHTMLCSSUtils.cpp b/editor/libeditor/html/nsHTMLCSSUtils.cpp index 45be6b45c84..ddf9d654aac 100644 --- a/editor/libeditor/html/nsHTMLCSSUtils.cpp +++ b/editor/libeditor/html/nsHTMLCSSUtils.cpp @@ -76,11 +76,7 @@ void ProcessDefaultValue(const nsAString * aInputString, nsAString & aOutputStri const char * aDefaultValueString, const char * aPrependString, const char* aAppendString) { - if (aDefaultValueString) { - aOutputString.Assign(NS_ConvertASCIItoUCS2(aDefaultValueString)); - } - else - aOutputString.Truncate(); + CopyASCIItoUTF16(aDefaultValueString, aOutputString); } static @@ -718,7 +714,7 @@ nsHTMLCSSUtils::GetDefaultBackgroundColor(nsAString & aColor) } } if (returnColor) { - aColor.Assign(NS_ConvertASCIItoUCS2(returnColor)); + CopyASCIItoUTF16(returnColor, aColor); } return NS_OK; } @@ -738,7 +734,7 @@ nsHTMLCSSUtils::GetDefaultLengthUnit(nsAString & aLengthUnit) getter_Copies(returnLengthUnit)); if (NS_FAILED(result)) return result; if (returnLengthUnit) { - aLengthUnit.Assign(NS_ConvertASCIItoUCS2(returnLengthUnit)); + CopyASCIItoUTF16(returnLengthUnit, aLengthUnit); } } return NS_OK; @@ -1448,7 +1444,7 @@ nsHTMLCSSUtils::SetCSSProperty(nsIDOMElement * aElement, return cssDecl->SetProperty(aProperty, aValue, - nsString()); + EmptyString()); } nsresult diff --git a/editor/libeditor/html/nsHTMLDataTransfer.cpp b/editor/libeditor/html/nsHTMLDataTransfer.cpp index 784c6ea3807..e9fc1fc5d7e 100644 --- a/editor/libeditor/html/nsHTMLDataTransfer.cpp +++ b/editor/libeditor/html/nsHTMLDataTransfer.cpp @@ -229,7 +229,9 @@ NS_IMETHODIMP nsHTMLEditor::LoadHTML(const nsAString & aInputString) NS_IMETHODIMP nsHTMLEditor::InsertHTML(const nsAString & aInString) { - return InsertHTMLWithContext(aInString, nsString(), nsString(), nsString(), + const nsAFlatString& empty = EmptyString(); + + return InsertHTMLWithContext(aInString, empty, empty, empty, nsnull, nsnull, 0, PR_TRUE); } @@ -1106,8 +1108,10 @@ NS_IMETHODIMP nsHTMLEditor::InsertFromTransferable(nsITransferable *transferable stuffToPaste.Append(NS_LITERAL_STRING("")); } nsAutoEditBatch beginBatching(this); + + const nsAFlatString& empty = EmptyString(); rv = InsertHTMLWithContext(stuffToPaste, - nsString(), nsString(), flavor, + empty, empty, flavor, aSourceDoc, aDestinationNode, aDestOffset, aDoDeleteSelection); @@ -1609,8 +1613,9 @@ NS_IMETHODIMP nsHTMLEditor::PasteNoFormatting(PRInt32 aSelectionType) // Get the Data from the clipboard if (NS_SUCCEEDED(clipboard->GetData(trans, aSelectionType)) && IsModifiable()) { - rv = InsertFromTransferable(trans, nsnull, nsString(), nsString(), - nsnull, 0, PR_TRUE); + const nsAFlatString& empty = EmptyString(); + rv = InsertFromTransferable(trans, nsnull, empty, empty, nsnull, 0, + PR_TRUE); } } diff --git a/editor/libeditor/html/nsHTMLEditRules.h b/editor/libeditor/html/nsHTMLEditRules.h index 4dc459fec18..35eb880b18c 100644 --- a/editor/libeditor/html/nsHTMLEditRules.h +++ b/editor/libeditor/html/nsHTMLEditRules.h @@ -48,6 +48,7 @@ #include "nsString.h" #include "nsEditorUtils.h" #include "TypeInState.h" +#include "nsReadableUtils.h" class nsVoidArray; class nsIDOMElement; @@ -58,7 +59,7 @@ struct StyleCache : public PropItem { PRBool mPresent; - StyleCache() : PropItem(nsnull, nsString(), nsString()), mPresent(PR_FALSE){}; + StyleCache() : PropItem(nsnull, EmptyString(), EmptyString()), mPresent(PR_FALSE){}; StyleCache(nsIAtom *aTag, const nsAString &aAttr, const nsAString &aValue) : PropItem(aTag, aAttr, aValue), mPresent(PR_FALSE) {}; ~StyleCache() {}; diff --git a/embedding/browser/gtk/src/EmbedStream.cpp b/embedding/browser/gtk/src/EmbedStream.cpp index eb51344e10e..6e470a5b56f 100644 --- a/embedding/browser/gtk/src/EmbedStream.cpp +++ b/embedding/browser/gtk/src/EmbedStream.cpp @@ -35,6 +35,7 @@ #include "EmbedStream.h" #include "EmbedPrivate.h" #include "EmbedWindow.h" +#include "nsReadableUtils.h" // nsIInputStream interface @@ -120,7 +121,7 @@ EmbedStream::OpenStream(const char *aBaseURI, const char *aContentType) rv = NS_NewInputStreamChannel(getter_AddRefs(mChannel), uri, NS_STATIC_CAST(nsIInputStream *, this), nsDependentCString(aContentType), - NS_LITERAL_CSTRING("")); + EmptyCString()); if (NS_FAILED(rv)) return rv; diff --git a/embedding/browser/photon/src/EmbedStream.cpp b/embedding/browser/photon/src/EmbedStream.cpp index 787dd619b0d..876cd364e2c 100644 --- a/embedding/browser/photon/src/EmbedStream.cpp +++ b/embedding/browser/photon/src/EmbedStream.cpp @@ -34,6 +34,7 @@ #include "EmbedStream.h" #include "EmbedPrivate.h" #include "EmbedWindow.h" +#include "nsReadableUtils.h" // nsIInputStream interface @@ -119,7 +120,7 @@ EmbedStream::OpenStream(const char *aBaseURI, const char *aContentType) rv = NS_NewInputStreamChannel(getter_AddRefs(mChannel), uri, NS_STATIC_CAST(nsIInputStream *, this), nsDependentCString(aContentType), - NS_LITERAL_CSTRING("") ); + EmptyCString()); if (NS_FAILED(rv)) return rv; diff --git a/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp b/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp index 421a45e2afb..4fe315bb4fd 100644 --- a/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp +++ b/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp @@ -1193,7 +1193,7 @@ nsresult nsWebBrowserPersist::SaveURIInternal( nsCOMPtr uploadChannel(do_QueryInterface(httpChannel)); NS_ASSERTION(uploadChannel, "http must support nsIUploadChannel"); // Attach the postdata to the http channel - uploadChannel->SetUploadStream(aPostData, NS_LITERAL_CSTRING(""), -1); + uploadChannel->SetUploadStream(aPostData, EmptyCString(), -1); } } @@ -3128,7 +3128,7 @@ nsWebBrowserPersist::FixupURI(nsAString &aURI) nsAutoString newValue; // remove username/password if present - fileAsURI->SetUserPass(NS_LITERAL_CSTRING("")); + fileAsURI->SetUserPass(EmptyCString()); // reset node attribute // Use relative or absolute links @@ -3241,7 +3241,7 @@ nsWebBrowserPersist::FixupAnchor(nsIDOMNode *aNode) mCurrentCharset.get(), relativeURI); if (NS_SUCCEEDED(rv) && newURI) { - newURI->SetUserPass(NS_LITERAL_CSTRING("")); + newURI->SetUserPass(EmptyCString()); nsCAutoString uriSpec; newURI->GetSpec(uriSpec); attrNode->SetNodeValue(NS_ConvertUTF8toUCS2(uriSpec)); diff --git a/extensions/finger/nsFingerChannel.cpp b/extensions/finger/nsFingerChannel.cpp index 82082cbe122..f887b824fec 100644 --- a/extensions/finger/nsFingerChannel.cpp +++ b/extensions/finger/nsFingerChannel.cpp @@ -239,8 +239,8 @@ nsFingerChannel::AsyncOpen(nsIStreamListener *aListener, nsISupports *ctxt) rv = mURI->GetPath(userHost); nsAutoString title; - title = NS_LITERAL_STRING("Finger information for ") - + NS_ConvertUTF8toUCS2(userHost); + title = NS_LITERAL_STRING("Finger information for "); + AppendUTF8toUTF16(userHost, title); conv->SetTitle(title.get()); conv->PreFormatHTML(PR_TRUE); @@ -425,8 +425,8 @@ nsFingerChannel::OnTransportStatus(nsITransport *trans, nsresult status, { // suppress status notification if channel is no longer pending! if (mProgressSink && NS_SUCCEEDED(mStatus) && mPump && !(mLoadFlags & LOAD_BACKGROUND)) { - NS_ConvertUTF8toUCS2 host(mHost); - mProgressSink->OnStatus(this, nsnull, status, host.get()); + mProgressSink->OnStatus(this, nsnull, status, + NS_ConvertUTF8toUCS2(mHost).get()); if (status == nsISocketTransport::STATUS_RECEIVING_FROM || status == nsISocketTransport::STATUS_SENDING_TO) { diff --git a/extensions/inspector/base/src/inFlasher.cpp b/extensions/inspector/base/src/inFlasher.cpp index fb536fd409f..297eeca9a6f 100644 --- a/extensions/inspector/base/src/inFlasher.cpp +++ b/extensions/inspector/base/src/inFlasher.cpp @@ -46,6 +46,7 @@ #include "nsIWidget.h" #include "nsIPresShell.h" #include "nsIFrame.h" +#include "nsReadableUtils.h" #include "prprf.h" @@ -77,7 +78,7 @@ inFlasher::GetColor(nsAString& aColor) char buf[10]; PR_snprintf(buf, sizeof(buf), "#%02x%02x%02x", NS_GET_R(mColor), NS_GET_G(mColor), NS_GET_B(mColor)); - aColor.Assign(NS_ConvertASCIItoUCS2(buf)); + CopyASCIItoUTF16(buf, aColor); return NS_OK; } diff --git a/extensions/pref/autoconfig/src/nsAutoConfig.cpp b/extensions/pref/autoconfig/src/nsAutoConfig.cpp index 729f8fd804c..b226be45512 100644 --- a/extensions/pref/autoconfig/src/nsAutoConfig.cpp +++ b/extensions/pref/autoconfig/src/nsAutoConfig.cpp @@ -221,7 +221,7 @@ NS_IMETHODIMP nsAutoConfig::Observe(nsISupports *aSubject, rv = profile->GetCurrentProfile(getter_Copies(profileName)); if (NS_SUCCEEDED(rv)) { // setting the member variable to the current profile name - mCurrProfile = NS_ConvertUCS2toUTF8(profileName); + CopyUTF16toUTF8(profileName, mCurrProfile); } else { NS_WARNING("nsAutoConfig::GetCurrentProfile() failed"); diff --git a/extensions/sql/base/src/mozSqlService.cpp b/extensions/sql/base/src/mozSqlService.cpp index 674033b0334..81967d4a6ad 100644 --- a/extensions/sql/base/src/mozSqlService.cpp +++ b/extensions/sql/base/src/mozSqlService.cpp @@ -340,9 +340,8 @@ mozSqlService::GetNewConnection(nsIRDFResource* aAlias, mozISqlConnection **_ret if (NS_FAILED(rv)) return rv; - nsCAutoString contractID( - NS_LITERAL_CSTRING("@mozilla.org/sql/connection;1?type=") + - NS_ConvertUCS2toUTF8(type)); + nsCAutoString contractID("@mozilla.org/sql/connection;1?type="); + AppendUTF16toUTF8(type, contractID); nsCOMPtr conn = do_CreateInstance(contractID.get()); if (! conn) diff --git a/extensions/sql/pgsql/src/mozSqlConnectionPgsql.cpp b/extensions/sql/pgsql/src/mozSqlConnectionPgsql.cpp index 052db7c5d9d..2f98a20505f 100644 --- a/extensions/sql/pgsql/src/mozSqlConnectionPgsql.cpp +++ b/extensions/sql/pgsql/src/mozSqlConnectionPgsql.cpp @@ -81,7 +81,7 @@ nsresult mozSqlConnectionPgsql::Setup() { if (PQstatus(mConnection) == CONNECTION_BAD) { - mErrorMessage.Assign(NS_ConvertUTF8toUCS2(PQerrorMessage(mConnection))); + CopyUTF8toUTF16(PQerrorMessage(mConnection), mErrorMessage); mConnection = nsnull; return NS_ERROR_FAILURE; } @@ -93,6 +93,7 @@ mozSqlConnectionPgsql::Setup() PRInt32 stat = PQresultStatus(result); if (stat != PGRES_COMMAND_OK) { mErrorMessage.Assign(NS_ConvertUTF8toUCS2(PQresultErrorMessage(result))); + CopyUTF8toUTF16(PQresultErrorMessage(result), mErrorMessage); PQfinish(mConnection); mConnection = nsnull; return NS_ERROR_FAILURE; @@ -102,7 +103,7 @@ mozSqlConnectionPgsql::Setup() PGresult* result = PQexec(mConnection, "select version()"); PRInt32 stat = PQresultStatus(result); if (stat != PGRES_TUPLES_OK) { - mErrorMessage.Assign(NS_ConvertUTF8toUCS2(PQresultErrorMessage(result))); + CopyUTF8toUTF16(PQresultErrorMessage(result), mErrorMessage); return NS_ERROR_FAILURE; } char* version = PQgetvalue(result, 0, 0); @@ -185,7 +186,7 @@ mozSqlConnectionPgsql::RealExec(const nsAString& aQuery, free(query); stat = PQresultStatus(types); if (stat != PGRES_TUPLES_OK) { - mErrorMessage.Assign(NS_ConvertUTF8toUCS2(PQresultErrorMessage(types))); + CopyUTF8toUTF16(PQresultErrorMessage(types), mErrorMessage); return NS_ERROR_FAILURE; } @@ -214,7 +215,7 @@ mozSqlConnectionPgsql::RealExec(const nsAString& aQuery, mLastID = PQoidValue(r); } else { - mErrorMessage.Assign(NS_ConvertUTF8toUCS2(PQresultErrorMessage(r))); + CopyUTF8toUTF16(PQresultErrorMessage(r), mErrorMessage); return NS_ERROR_FAILURE; } @@ -225,7 +226,7 @@ nsresult mozSqlConnectionPgsql::CancelExec() { if (!PQrequestCancel(mConnection)) { - mErrorMessage.Assign(NS_ConvertUTF8toUCS2(PQerrorMessage(mConnection))); + CopyUTF8toUTF16(PQerrorMessage(mConnection), mErrorMessage); return NS_ERROR_FAILURE; } diff --git a/extensions/sql/pgsql/src/mozSqlResultPgsql.cpp b/extensions/sql/pgsql/src/mozSqlResultPgsql.cpp index 61168f8ac4c..71216e30764 100644 --- a/extensions/sql/pgsql/src/mozSqlResultPgsql.cpp +++ b/extensions/sql/pgsql/src/mozSqlResultPgsql.cpp @@ -72,7 +72,7 @@ mozSqlResultPgsql::BuildColumnInfo() { for (PRInt32 i = 0; i < PQnfields(mResult); i++) { char* n = PQfname(mResult, i); - PRUnichar* name = ToNewUnicode(NS_ConvertUTF8toUCS2(n)); + PRUnichar* name = UTF8ToNewUnicode(n); PRInt32 type = GetColType(i); PRInt32 size = PQfsize(mResult, i); PRInt32 mod = PQfmod(mResult, i); @@ -106,7 +106,7 @@ mozSqlResultPgsql::BuildRows() cell->SetNull(PR_FALSE); PRInt32 type = cell->GetType(); if (type == mozISqlResult::TYPE_STRING) - cell->SetString(ToNewUnicode(NS_ConvertUTF8toUCS2(value))); + cell->SetString(UTF8ToNewUnicode(value)); else if (type == mozISqlResult::TYPE_INT) PR_sscanf(value, "%d", &cell->mInt); else if (type == mozISqlResult::TYPE_FLOAT) diff --git a/extensions/transformiix/source/xslt/functions/txKeyFunctionCall.cpp b/extensions/transformiix/source/xslt/functions/txKeyFunctionCall.cpp index 855780d5466..4a934db4096 100644 --- a/extensions/transformiix/source/xslt/functions/txKeyFunctionCall.cpp +++ b/extensions/transformiix/source/xslt/functions/txKeyFunctionCall.cpp @@ -323,7 +323,7 @@ nsresult txXSLKey::indexDocument(const txXPathNode& aDocument, { txKeyValueHashKey key(mName, txXPathNodeUtils::getUniqueIdentifier(aDocument), - NS_LITERAL_STRING("")); + EmptyString()); return indexTree(aDocument, key, aKeyValueHash, aEs); } diff --git a/extensions/transformiix/source/xslt/txInstructions.cpp b/extensions/transformiix/source/xslt/txInstructions.cpp index fa73a859dc8..6c3c667a4aa 100644 --- a/extensions/transformiix/source/xslt/txInstructions.cpp +++ b/extensions/transformiix/source/xslt/txInstructions.cpp @@ -376,10 +376,12 @@ txCopy::execute(txExecutionState& aEs) switch (txXPathNodeUtils::getNodeType(node)) { case txXPathNodeType::DOCUMENT_NODE: { - // "close" current element to ensure that no attributes are added - aEs.mResultHandler->characters(NS_LITERAL_STRING(""), PR_FALSE); + const nsAFlatString& empty = EmptyString(); - rv = aEs.pushString(NS_LITERAL_STRING("")); + // "close" current element to ensure that no attributes are added + aEs.mResultHandler->characters(empty, PR_FALSE); + + rv = aEs.pushString(empty); NS_ENSURE_SUCCESS(rv, rv); rv = aEs.pushInt(kNameSpaceID_None); @@ -408,7 +410,7 @@ txCopy::execute(txExecutionState& aEs) { rv = copyNode(node, aEs); NS_ENSURE_SUCCESS(rv, rv); - + aEs.gotoInstruction(mBailTarget); } } diff --git a/extensions/transformiix/source/xslt/txStylesheetCompileHandlers.cpp b/extensions/transformiix/source/xslt/txStylesheetCompileHandlers.cpp index 6bd464617af..cdb7ff8ceb9 100644 --- a/extensions/transformiix/source/xslt/txStylesheetCompileHandlers.cpp +++ b/extensions/transformiix/source/xslt/txStylesheetCompileHandlers.cpp @@ -1133,7 +1133,7 @@ txFnEndTopVariable(txStylesheetCompilerState& aState) // No children were found. NS_ASSERTION(!var->mValue, "There shouldn't be a select-expression here"); - var->mValue = new txLiteralExpr(NS_LITERAL_STRING("")); + var->mValue = new txLiteralExpr(EmptyString()); NS_ENSURE_TRUE(var->mValue, NS_ERROR_OUT_OF_MEMORY); } else if (!var->mValue) { @@ -2128,7 +2128,7 @@ txFnEndParam(txStylesheetCompilerState& aState) // No children were found. NS_ASSERTION(!var->mValue, "There shouldn't be a select-expression here"); - var->mValue = new txLiteralExpr(NS_LITERAL_STRING("")); + var->mValue = new txLiteralExpr(EmptyString()); NS_ENSURE_TRUE(var->mValue, NS_ERROR_OUT_OF_MEMORY); } @@ -2406,7 +2406,7 @@ txFnEndVariable(txStylesheetCompilerState& aState) // No children were found. NS_ASSERTION(!var->mValue, "There shouldn't be a select-expression here"); - var->mValue = new txLiteralExpr(NS_LITERAL_STRING("")); + var->mValue = new txLiteralExpr(EmptyString()); NS_ENSURE_TRUE(var->mValue, NS_ERROR_OUT_OF_MEMORY); } @@ -2569,7 +2569,7 @@ txFnEndWithParam(txStylesheetCompilerState& aState) // No children were found. NS_ASSERTION(!var->mValue, "There shouldn't be a select-expression here"); - var->mValue = new txLiteralExpr(NS_LITERAL_STRING("")); + var->mValue = new txLiteralExpr(EmptyString()); NS_ENSURE_TRUE(var->mValue, NS_ERROR_OUT_OF_MEMORY); } diff --git a/extensions/typeaheadfind/src/nsTypeAheadFind.cpp b/extensions/typeaheadfind/src/nsTypeAheadFind.cpp index 64cc8ce772a..e78f4d94f48 100644 --- a/extensions/typeaheadfind/src/nsTypeAheadFind.cpp +++ b/extensions/typeaheadfind/src/nsTypeAheadFind.cpp @@ -2516,7 +2516,7 @@ nsTypeAheadFind::GetTargetIfTypeAheadOkay(nsIDOMEvent *aEvent, if (lastShell != presShell) { mFocusedWeakShell = do_GetWeakReference(presShell); CancelFind(); - DisplayStatus(PR_FALSE, nsnull, PR_TRUE, NS_LITERAL_STRING("").get()); // Clear status + DisplayStatus(PR_FALSE, nsnull, PR_TRUE, EmptyString().get()); // Clear status } return NS_OK; } diff --git a/extensions/wallet/src/wallet.cpp b/extensions/wallet/src/wallet.cpp index c8ba97a5862..47e11ee101a 100644 --- a/extensions/wallet/src/wallet.cpp +++ b/extensions/wallet/src/wallet.cpp @@ -3869,7 +3869,7 @@ public: #ifdef AutoCapture PRIVATE PRBool wallet_IsNewValue(nsIDOMNode* elementNode, nsString valueOnForm) { - if (valueOnForm.Equals(NS_LITERAL_STRING(""))) { + if (valueOnForm.Equals(EmptyString())) { return PR_FALSE; } nsIDOMHTMLInputElement* inputElement; diff --git a/extensions/webservices/schema/src/nsSchema.cpp b/extensions/webservices/schema/src/nsSchema.cpp index cf2f81c4519..0ed8ad6c934 100644 --- a/extensions/webservices/schema/src/nsSchema.cpp +++ b/extensions/webservices/schema/src/nsSchema.cpp @@ -22,6 +22,7 @@ */ #include "nsSchemaPrivate.h" +#include "nsReadableUtils.h" //////////////////////////////////////////////////////////// // @@ -34,14 +35,16 @@ nsSchema::nsSchema(nsISchemaCollection* aCollection, mCollection = aCollection; // Weak reference if (aSchemaElement) { - aSchemaElement->GetAttributeNS(NS_LITERAL_STRING(""), + const nsAFlatString& empty = EmptyString(); + + aSchemaElement->GetAttributeNS(empty, NS_LITERAL_STRING("targetNamespace"), mTargetNamespace); mTargetNamespace.Trim(" \r\n\t"); aSchemaElement->GetNamespaceURI(mSchemaNamespace); nsAutoString elementFormDefault; - aSchemaElement->GetAttributeNS(NS_LITERAL_STRING(""), + aSchemaElement->GetAttributeNS(empty, NS_LITERAL_STRING("elementFormDefault"), elementFormDefault); elementFormDefault.Trim(" \r\n\t"); diff --git a/extensions/webservices/schema/src/nsSchemaLoader.cpp b/extensions/webservices/schema/src/nsSchemaLoader.cpp index 51c985be89f..c5294285ccc 100644 --- a/extensions/webservices/schema/src/nsSchemaLoader.cpp +++ b/extensions/webservices/schema/src/nsSchemaLoader.cpp @@ -1161,9 +1161,10 @@ nsSchemaLoader::ProcessElement(nsSchema* aSchema, else { nsAutoString value; nsSchemaElement* elementInst; + const nsAString& empty = EmptyString(); - rv = aElement->GetAttributeNS(NS_LITERAL_STRING(""), - NS_LITERAL_STRING("name"), + + rv = aElement->GetAttributeNS(empty, NS_LITERAL_STRING("name"), value); if (NS_FAILED(rv)) @@ -1180,22 +1181,19 @@ nsSchemaLoader::ProcessElement(nsSchema* aSchema, elementInst->SetMaxOccurs(maxOccurs); nsAutoString defaultValue, fixedValue; - rv = aElement->GetAttributeNS(NS_LITERAL_STRING(""), - NS_LITERAL_STRING("default"), + rv = aElement->GetAttributeNS(empty, NS_LITERAL_STRING("default"), defaultValue); if (NS_FAILED(rv)) return rv; - rv = aElement->GetAttributeNS(NS_LITERAL_STRING(""), - NS_LITERAL_STRING("fixed"), + rv = aElement->GetAttributeNS(empty, NS_LITERAL_STRING("fixed"), fixedValue); if (NS_FAILED(rv)) return rv; elementInst->SetConstraints(defaultValue, fixedValue); - rv = aElement->GetAttributeNS(NS_LITERAL_STRING(""), - NS_LITERAL_STRING("nillable"), value); + rv = aElement->GetAttributeNS(empty, NS_LITERAL_STRING("nillable"), value); if (NS_FAILED(rv)) return rv; value.Trim(" \r\n\t"); @@ -1204,8 +1202,7 @@ nsSchemaLoader::ProcessElement(nsSchema* aSchema, if (value.Equals(NS_LITERAL_STRING("true"))) flags |= nsSchemaElement::NILLABLE; - rv = aElement->GetAttributeNS(NS_LITERAL_STRING(""), - NS_LITERAL_STRING("abstract"), value); + rv = aElement->GetAttributeNS(empty, NS_LITERAL_STRING("abstract"), value); if (NS_FAILED(rv)) return rv; value.Trim(" \r\n\t"); @@ -1233,8 +1230,7 @@ nsSchemaLoader::ProcessElement(nsSchema* aSchema, flags |= nsSchemaElement::FORM_QUALIFIED; } else { - rv = aElement->GetAttributeNS(NS_LITERAL_STRING(""), - NS_LITERAL_STRING("form"), + rv = aElement->GetAttributeNS(empty, NS_LITERAL_STRING("form"), value); if (NS_FAILED(rv)) return rv; @@ -1758,8 +1754,7 @@ nsSchemaLoader::ProcessSimpleContentRestriction(nsSchema* aSchema, nsSchemaRestrictionType* restrictionInst; nsCOMPtr simpleBase; - restrictionInst = new nsSchemaRestrictionType(aSchema, - NS_LITERAL_STRING("")); + restrictionInst = new nsSchemaRestrictionType(aSchema, EmptyString()); if (!restrictionInst) { return NS_ERROR_OUT_OF_MEMORY; } @@ -1961,8 +1956,7 @@ nsSchemaLoader::ProcessComplexContent(nsSchema* aSchema, if (baseGroup) { // Create a new model group that's going to be the a sequence // of the base model group and the content below - sequenceInst = new nsSchemaModelGroup(aSchema, - NS_LITERAL_STRING("")); + sequenceInst = new nsSchemaModelGroup(aSchema, EmptyString()); if (!sequenceInst) { return NS_ERROR_OUT_OF_MEMORY; } diff --git a/extensions/xmlextras/base/src/nsXMLHttpRequest.cpp b/extensions/xmlextras/base/src/nsXMLHttpRequest.cpp index 11d9c7cf344..830b97b6986 100644 --- a/extensions/xmlextras/base/src/nsXMLHttpRequest.cpp +++ b/extensions/xmlextras/base/src/nsXMLHttpRequest.cpp @@ -1258,7 +1258,7 @@ nsXMLHttpRequest::Send(nsIVariant *aBody) nsCOMPtr uploadChannel(do_QueryInterface(httpChannel)); NS_ASSERTION(uploadChannel, "http must support nsIUploadChannel"); - rv = uploadChannel->SetUploadStream(postDataStream, NS_LITERAL_CSTRING(""), -1); + rv = uploadChannel->SetUploadStream(postDataStream, EmptyCString(), -1); // Reset the method to its original value if (httpChannel) { httpChannel->SetRequestMethod(method); @@ -1278,7 +1278,7 @@ nsXMLHttpRequest::Send(nsIVariant *aBody) } // Create an empty document from it (resets current document as well) - nsString emptyStr; + const nsAString& emptyStr = EmptyString(); rv = implementation->CreateDocument(emptyStr, emptyStr, nsnull, diff --git a/extensions/xmlterm/base/mozXMLTermSession.cpp b/extensions/xmlterm/base/mozXMLTermSession.cpp index 52156425342..143a1b376e7 100644 --- a/extensions/xmlterm/base/mozXMLTermSession.cpp +++ b/extensions/xmlterm/base/mozXMLTermSession.cpp @@ -152,9 +152,9 @@ mozXMLTermSession::mozXMLTermSession() : mEntryOutputLines(0), mPreTextBufferLines(0), - mPreTextIncomplete(nsAutoString()), - mPreTextBuffered(nsAutoString()), - mPreTextDisplayed(nsAutoString()), + mPreTextIncomplete(), + mPreTextBuffered(), + mPreTextDisplayed(), mScreenNode(nsnull), mScreenRows(0), @@ -165,11 +165,11 @@ mozXMLTermSession::mozXMLTermSession() : mRestoreInputEcho(PR_FALSE), mCountExportHTML(0), - mLastExportHTML(nsAutoString()), + mLastExportHTML(), - mShellPrompt(nsAutoString()), - mPromptHTML(nsAutoString()), - mFragmentBuffer(nsAutoString()) + mShellPrompt(), + mPromptHTML(), + mFragmentBuffer() { } @@ -265,8 +265,7 @@ NS_IMETHODIMP mozXMLTermSession::Init(mozIXMLTerminal* aXMLTerminal, #if 0 nsAutoString prefaceText ("Preface"); - nsAutoString nullStyle (""); - result = AppendOutput(prefaceText, nullStyle, PR_TRUE); + result = AppendOutput(prefaceText, EmptyString(), PR_TRUE); #endif XMLT_LOG(mozXMLTermSession::Init,31,("exiting\n")); @@ -4398,7 +4397,7 @@ NS_IMETHODIMP mozXMLTermSession::ToHTMLString(nsIDOMNode* aNode, nsCOMPtr child; result = aNode->GetFirstChild(getter_AddRefs(child)); - nsAutoString htmlInner(NS_LITERAL_STRING("")); + nsAutoString htmlInner; while (child) { nsAutoString innerString; ToHTMLString(child, newIndentString, innerString, deepContent, diff --git a/extensions/xmlterm/base/mozXMLTermStream.cpp b/extensions/xmlterm/base/mozXMLTermStream.cpp index 6389e89731f..fa1c1229103 100644 --- a/extensions/xmlterm/base/mozXMLTermStream.cpp +++ b/extensions/xmlterm/base/mozXMLTermStream.cpp @@ -210,7 +210,7 @@ NS_IMETHODIMP mozXMLTermStream::Open(nsIDOMWindowInternal* aDOMWindow, uri, inputStream, nsDependentCString(contentType), - NS_LITERAL_CSTRING("")); + EmptyCString()); if (NS_FAILED(result)) return result; diff --git a/htmlparser/src/CNavDTD.cpp b/htmlparser/src/CNavDTD.cpp index 938ba796198..fb64cafed62 100644 --- a/htmlparser/src/CNavDTD.cpp +++ b/htmlparser/src/CNavDTD.cpp @@ -2975,7 +2975,7 @@ nsresult CNavDTD::OpenTransientStyles(eHTMLTags aChildTag){ // precedence over the residual style tags' size info.. // *Note: Make sure that this attribute is transient since it // should not get carried over to cases other than heading. - CAttributeToken theAttrToken(NS_LITERAL_STRING("_moz-rs-heading"),NS_LITERAL_STRING("")); + CAttributeToken theAttrToken(NS_LITERAL_STRING("_moz-rs-heading"), EmptyString()); theNode->AddAttribute(&theAttrToken); result = OpenContainer(theNode,theNodeTag,PR_FALSE,theStack); theNode->PopAttributeToken(); diff --git a/intl/strres/tests/StringBundleTest.cpp b/intl/strres/tests/StringBundleTest.cpp index 2c889296416..00201022643 100644 --- a/intl/strres/tests/StringBundleTest.cpp +++ b/intl/strres/tests/StringBundleTest.cpp @@ -133,7 +133,6 @@ main(int argc, char *argv[]) } nsAutoString v; - v.Assign(NS_LITERAL_STRING("")); PRUnichar *ptrv = nsnull; char *value = nsnull; diff --git a/intl/uconv/src/nsCharsetConverterManager.cpp b/intl/uconv/src/nsCharsetConverterManager.cpp index 24f08e7ceba..45cc9b0b728 100644 --- a/intl/uconv/src/nsCharsetConverterManager.cpp +++ b/intl/uconv/src/nsCharsetConverterManager.cpp @@ -342,14 +342,14 @@ NS_IMETHODIMP nsCharsetConverterManager::GetDecoderList(nsIUTF8StringEnumerator ** aResult) { return GetList(NS_LITERAL_CSTRING(NS_UNICODEDECODER_NAME), - NS_LITERAL_CSTRING(""), aResult); + EmptyCString(), aResult); } NS_IMETHODIMP nsCharsetConverterManager::GetEncoderList(nsIUTF8StringEnumerator ** aResult) { return GetList(NS_LITERAL_CSTRING(NS_UNICODEENCODER_NAME), - NS_LITERAL_CSTRING(""), aResult); + EmptyCString(), aResult); } NS_IMETHODIMP diff --git a/layout/forms/nsGfxButtonControlFrame.cpp b/layout/forms/nsGfxButtonControlFrame.cpp index 3d302a1e9c4..9d268452cf1 100644 --- a/layout/forms/nsGfxButtonControlFrame.cpp +++ b/layout/forms/nsGfxButtonControlFrame.cpp @@ -307,7 +307,7 @@ nsGfxButtonControlFrame::GetDefaultLabel(nsString& aString) rv = nsFormControlHelper::GetLocalizedString(propname, NS_LITERAL_STRING("Browse").get(), aString); } else { - aString.Assign(NS_LITERAL_STRING("")); + aString.Truncate(); rv = NS_OK; } return rv; diff --git a/layout/generic/nsPageFrame.cpp b/layout/generic/nsPageFrame.cpp index 3df94b7d7a7..d7d7a0f0078 100644 --- a/layout/generic/nsPageFrame.cpp +++ b/layout/generic/nsPageFrame.cpp @@ -358,7 +358,7 @@ nsPageFrame::ProcessSpecialCodes(const nsString& aStr, nsString& aNewStr) if (mPD->mDateTimeStr != nsnull) { aNewStr.ReplaceSubstring(kDate.get(), mPD->mDateTimeStr); } else { - aNewStr.ReplaceSubstring(kDate.get(), NS_LITERAL_STRING("").get()); + aNewStr.ReplaceSubstring(kDate.get(), EmptyString().get()); } return; } diff --git a/layout/html/base/src/nsPageFrame.cpp b/layout/html/base/src/nsPageFrame.cpp index 3df94b7d7a7..d7d7a0f0078 100644 --- a/layout/html/base/src/nsPageFrame.cpp +++ b/layout/html/base/src/nsPageFrame.cpp @@ -358,7 +358,7 @@ nsPageFrame::ProcessSpecialCodes(const nsString& aStr, nsString& aNewStr) if (mPD->mDateTimeStr != nsnull) { aNewStr.ReplaceSubstring(kDate.get(), mPD->mDateTimeStr); } else { - aNewStr.ReplaceSubstring(kDate.get(), NS_LITERAL_STRING("").get()); + aNewStr.ReplaceSubstring(kDate.get(), EmptyString().get()); } return; } diff --git a/layout/html/forms/src/nsGfxButtonControlFrame.cpp b/layout/html/forms/src/nsGfxButtonControlFrame.cpp index 3d302a1e9c4..9d268452cf1 100644 --- a/layout/html/forms/src/nsGfxButtonControlFrame.cpp +++ b/layout/html/forms/src/nsGfxButtonControlFrame.cpp @@ -307,7 +307,7 @@ nsGfxButtonControlFrame::GetDefaultLabel(nsString& aString) rv = nsFormControlHelper::GetLocalizedString(propname, NS_LITERAL_STRING("Browse").get(), aString); } else { - aString.Assign(NS_LITERAL_STRING("")); + aString.Truncate(); rv = NS_OK; } return rv; diff --git a/layout/printing/nsPrintEngine.cpp b/layout/printing/nsPrintEngine.cpp index d543eadcd01..a1ae19dd52b 100644 --- a/layout/printing/nsPrintEngine.cpp +++ b/layout/printing/nsPrintEngine.cpp @@ -2152,7 +2152,7 @@ nsPrintEngine::GetDisplayTitleAndURL(nsPrintObject* aPO, *aTitle = nsCRT::strdup(aPO->mDocTitle); } else { switch (aDefType) { - case eDocTitleDefBlank: *aTitle = ToNewUnicode(NS_LITERAL_STRING("")); + case eDocTitleDefBlank: *aTitle = ToNewUnicode(EmptyString()); break; case eDocTitleDefURLDoc: diff --git a/layout/style/nsCSSLoader.cpp b/layout/style/nsCSSLoader.cpp index 4d08f834ae3..cebf0d1e3f6 100644 --- a/layout/style/nsCSSLoader.cpp +++ b/layout/style/nsCSSLoader.cpp @@ -678,8 +678,8 @@ ReportToConsole(const PRUnichar* aMessageName, const PRUnichar **aParams, getter_Copies(errorText)); NS_ENSURE_SUCCESS(rv, rv); rv = errorObject->Init(errorText.get(), - NS_LITERAL_STRING("").get(), /* file name */ - NS_LITERAL_STRING("").get(), /* source line */ + EmptyString().get(), /* file name */ + EmptyString().get(), /* source line */ 0, /* line number */ 0, /* column number */ aErrorFlags, @@ -1783,7 +1783,7 @@ CSSLoaderImpl::LoadChildSheet(nsICSSStyleSheet* aParentSheet, state, getter_AddRefs(sheet)); NS_ENSURE_SUCCESS(rv, rv); - NS_NAMED_LITERAL_STRING(empty, ""); + const nsAString& empty = EmptyString(); rv = PrepareSheet(sheet, empty, empty, aMedia); NS_ENSURE_SUCCESS(rv, rv); @@ -1855,7 +1855,7 @@ CSSLoaderImpl::InternalLoadAgentSheet(nsIURI* aURL, getter_AddRefs(sheet)); NS_ENSURE_SUCCESS(rv, rv); - NS_NAMED_LITERAL_STRING(empty, ""); + const nsAString& empty = EmptyString(); rv = PrepareSheet(sheet, empty, empty, nsnull); NS_ENSURE_SUCCESS(rv, rv); diff --git a/layout/style/nsDOMCSSDeclaration.cpp b/layout/style/nsDOMCSSDeclaration.cpp index 34384fc6ad1..fe91961ebee 100644 --- a/layout/style/nsDOMCSSDeclaration.cpp +++ b/layout/style/nsDOMCSSDeclaration.cpp @@ -45,6 +45,7 @@ #include "nsCSSProps.h" #include "nsCOMPtr.h" #include "nsIURL.h" +#include "nsReadableUtils.h" #include "nsContentUtils.h" @@ -325,17 +326,17 @@ CSS2PropertiesTearoff::QueryInterface(REFNSIID aIID, void** aInstancePtr) // nsIDOMNSCSS2Properties #define CSS_PROP(name_, id_, method_, datastruct_, member_, type_, iscoord_) \ - NS_IMETHODIMP \ - CSS2PropertiesTearoff::Get##method_(nsAString& aValue) \ - { \ - return mOuter->GetPropertyValue(NS_LITERAL_STRING(#name_), aValue); \ - } \ - \ - NS_IMETHODIMP \ - CSS2PropertiesTearoff::Set##method_(const nsAString& aValue) \ - { \ - return mOuter->SetProperty(NS_LITERAL_STRING(#name_), aValue, \ - NS_LITERAL_STRING("")); \ + NS_IMETHODIMP \ + CSS2PropertiesTearoff::Get##method_(nsAString& aValue) \ + { \ + return mOuter->GetPropertyValue(NS_LITERAL_STRING(#name_), aValue); \ + } \ + \ + NS_IMETHODIMP \ + CSS2PropertiesTearoff::Set##method_(const nsAString& aValue) \ + { \ + return mOuter->SetProperty(NS_LITERAL_STRING(#name_), aValue, \ + EmptyString()); \ } #define CSS_PROP_LIST_EXCLUDE_INTERNAL diff --git a/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp b/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp index 36e2b91ff40..ef80e276c53 100644 --- a/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp +++ b/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp @@ -815,7 +815,7 @@ NS_IMETHODIMP nsTreeBodyFrame::GetColumnIndex(const PRUnichar *aColID, PRInt32 * NS_IMETHODIMP nsTreeBodyFrame::GetColumnID(PRInt32 colIndex, nsAString & _retval) { - _retval = NS_LITERAL_STRING(""); + _retval.Truncate(); for (nsTreeColumn* currCol = mColumns; currCol; currCol = currCol->GetNext()) { if (currCol->GetColIndex() == colIndex) { _retval = currCol->GetID(); @@ -2243,7 +2243,7 @@ nsTreeBodyFrame::PaintColumn(nsTreeColumn* aColumn, aColumn->GetElement()->GetAttr(kNameSpaceID_None, nsXULAtoms::insertbefore, attr); if (attr.Equals(NS_LITERAL_STRING("true"))) mScratchArray->AppendElement(nsXULAtoms::insertbefore); - attr.Assign(NS_LITERAL_STRING("")); + attr.Truncate(); aColumn->GetElement()->GetAttr(kNameSpaceID_None, nsXULAtoms::insertafter, attr); if (attr.Equals(NS_LITERAL_STRING("true"))) mScratchArray->AppendElement(nsXULAtoms::insertafter); diff --git a/layout/xul/base/src/tree/src/nsTreeBoxObject.cpp b/layout/xul/base/src/tree/src/nsTreeBoxObject.cpp index eb1d80af72f..44856f196b6 100644 --- a/layout/xul/base/src/tree/src/nsTreeBoxObject.cpp +++ b/layout/xul/base/src/tree/src/nsTreeBoxObject.cpp @@ -251,7 +251,7 @@ NS_IMETHODIMP nsTreeBoxObject::GetColumnIndex(const PRUnichar *aColID, PRInt32 * NS_IMETHODIMP nsTreeBoxObject::GetColumnID(PRInt32 colIndex, nsAString & _retval) { - _retval = NS_LITERAL_STRING(""); + _retval.Truncate(); nsITreeBoxObject* body = GetTreeBody(); if (body) return body->GetColumnID(colIndex, _retval); diff --git a/mailnews/addrbook/src/nsAbAutoCompleteSession.h b/mailnews/addrbook/src/nsAbAutoCompleteSession.h index 3a38eeda65b..407243a44eb 100644 --- a/mailnews/addrbook/src/nsAbAutoCompleteSession.h +++ b/mailnews/addrbook/src/nsAbAutoCompleteSession.h @@ -40,6 +40,7 @@ #include "msgCore.h" #include "nsCOMPtr.h" +#include "nsReadableUtils.h" #include "nsIMsgHeaderParser.h" #include "nsIAbDirectory.h" #include "nsIAbAutoCompleteSession.h" @@ -156,13 +157,15 @@ public: PRBool isMailList, nsAbAutoCompleteSession::MatchType type) { - mNickName = nsCRT::strdup(nickName ? nickName : NS_STATIC_CAST(const PRUnichar*, NS_LITERAL_STRING("").get())); - mDisplayName = nsCRT::strdup(displayName ? displayName : NS_STATIC_CAST(const PRUnichar*, NS_LITERAL_STRING("").get())); - mFirstName = nsCRT::strdup(firstName ? firstName : NS_STATIC_CAST(const PRUnichar*, NS_LITERAL_STRING("").get())); - mLastName = nsCRT::strdup(lastName ? lastName : NS_STATIC_CAST(const PRUnichar*, NS_LITERAL_STRING("").get())); - mEmailAddress = nsCRT::strdup(emailAddress ? emailAddress : NS_STATIC_CAST(const PRUnichar*, NS_LITERAL_STRING("").get())); - mNotes = nsCRT::strdup(notes ? notes : NS_STATIC_CAST(const PRUnichar*, NS_LITERAL_STRING("").get())); - mDirName = nsCRT::strdup(dirName ? dirName : NS_STATIC_CAST(const PRUnichar *, NS_LITERAL_STRING("").get())); + const PRUnichar *empty = EmptyString().get(); + + mNickName = nsCRT::strdup(nickName ? nickName : empty); + mDisplayName = nsCRT::strdup(displayName ? displayName : empty); + mFirstName = nsCRT::strdup(firstName ? firstName : empty); + mLastName = nsCRT::strdup(lastName ? lastName : empty); + mEmailAddress = nsCRT::strdup(emailAddress ? emailAddress : empty); + mNotes = nsCRT::strdup(notes ? notes : empty); + mDirName = nsCRT::strdup(dirName ? dirName : empty); mIsMailList = isMailList; mType = type; } diff --git a/mailnews/addrbook/src/nsAbLDAPChangeLogQuery.cpp b/mailnews/addrbook/src/nsAbLDAPChangeLogQuery.cpp index 6ed52a46048..adf57fa680f 100644 --- a/mailnews/addrbook/src/nsAbLDAPChangeLogQuery.cpp +++ b/mailnews/addrbook/src/nsAbLDAPChangeLogQuery.cpp @@ -91,7 +91,7 @@ NS_IMETHODIMP nsAbLDAPChangeLogQuery::DoReplicationQuery() return NS_ERROR_NOT_INITIALIZED; #ifdef USE_AUTHDLG - return ConnectToLDAPServer(mURL, NS_LITERAL_CSTRING("")); + return ConnectToLDAPServer(mURL, EmptyCString()); #else mDataProcessor->PopulateAuthData(); return ConnectToLDAPServer(mURL, mAuthDN); @@ -130,11 +130,12 @@ NS_IMETHODIMP nsAbLDAPChangeLogQuery::QueryRootDSE() if(!mInitialized) return NS_ERROR_NOT_INITIALIZED; - return mOperation->SearchExt(NS_LITERAL_CSTRING(""), nsILDAPURL::SCOPE_BASE, - NS_LITERAL_CSTRING("objectclass=*"), - MozillaLdapPropertyRelator::rootDSEAttribCount, - MozillaLdapPropertyRelator::changeLogRootDSEAttribs, - 0, 0); + return + mOperation->SearchExt(EmptyCString(), nsILDAPURL::SCOPE_BASE, + NS_LITERAL_CSTRING("objectclass=*"), + MozillaLdapPropertyRelator::rootDSEAttribCount, + MozillaLdapPropertyRelator::changeLogRootDSEAttribs, + 0, 0); } NS_IMETHODIMP nsAbLDAPChangeLogQuery::QueryChangeLog(const nsACString & aChangeLogDN, PRInt32 aLastChangeNo) diff --git a/mailnews/addrbook/src/nsAbLDAPReplicationData.cpp b/mailnews/addrbook/src/nsAbLDAPReplicationData.cpp index e526f7dc0dd..b6b36378880 100644 --- a/mailnews/addrbook/src/nsAbLDAPReplicationData.cpp +++ b/mailnews/addrbook/src/nsAbLDAPReplicationData.cpp @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * @@ -263,14 +264,15 @@ NS_IMETHODIMP nsAbLDAPProcessReplicationData::PopulateAuthData() nsAutoString passwordFound; // Get password entry corresponding to the server URI we are passing in. - rv = passwordMgrInt->FindPasswordEntry(serverUri, NS_LITERAL_STRING(""), NS_LITERAL_STRING(""), - hostFound, userNameFound, passwordFound); + rv = passwordMgrInt->FindPasswordEntry(serverUri, EmptyString(), + EmptyString(), hostFound, + userNameFound, passwordFound); if (NS_FAILED(rv)) return rv; if (!passwordFound.IsEmpty()) // XXX This needs CopyUCS2toUTF8 - mAuthPswd.Assign(NS_ConvertUCS2toUTF8(passwordFound)); + CopyUTF16toUTF8(passwordFound, mAuthPswd); } return rv; diff --git a/mailnews/addrbook/src/nsAbLDAPReplicationQuery.cpp b/mailnews/addrbook/src/nsAbLDAPReplicationQuery.cpp index 797a72068e7..20289e83245 100644 --- a/mailnews/addrbook/src/nsAbLDAPReplicationQuery.cpp +++ b/mailnews/addrbook/src/nsAbLDAPReplicationQuery.cpp @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * @@ -20,7 +21,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * Dan Mosedale + * Dan Mosedale * * 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 @@ -165,8 +166,8 @@ NS_IMETHODIMP nsAbLDAPReplicationQuery::ConnectToLDAPServer(nsILDAPURL *aURL, co // initialize the LDAP connection return mConnection->Init(host.get(), port, - (options & nsILDAPURL::OPT_SECURE) ? PR_TRUE : PR_FALSE, - aAuthDN, listener, nsnull); + (options & nsILDAPURL::OPT_SECURE) ? PR_TRUE : PR_FALSE, + aAuthDN, listener, nsnull); } NS_IMETHODIMP nsAbLDAPReplicationQuery::Init(const nsACString & aPrefName, nsIWebProgressListener *aProgressListener) @@ -192,7 +193,7 @@ NS_IMETHODIMP nsAbLDAPReplicationQuery::Init(const nsACString & aPrefName, nsIWe NS_IMETHODIMP nsAbLDAPReplicationQuery::DoReplicationQuery() { - return ConnectToLDAPServer(mURL, NS_LITERAL_CSTRING("")); + return ConnectToLDAPServer(mURL, EmptyCString()); } NS_IMETHODIMP nsAbLDAPReplicationQuery::QueryAllEntries() diff --git a/mailnews/addrbook/src/nsAddrBookSession.cpp b/mailnews/addrbook/src/nsAddrBookSession.cpp index 83feee34eb4..9f28e148204 100644 --- a/mailnews/addrbook/src/nsAddrBookSession.cpp +++ b/mailnews/addrbook/src/nsAddrBookSession.cpp @@ -182,7 +182,7 @@ NS_IMETHODIMP nsAddrBookSession::GetUserProfileDirectory(nsFileSpec * *userDir) NS_ENSURE_ARG_POINTER(userDir); *userDir = nsnull; - nsresult rv; + nsresult rv; nsCOMPtr profileDir; nsCAutoString pathBuf; @@ -250,10 +250,10 @@ NS_IMETHODIMP nsAddrBookSession::GenerateNameFromCard(nsIAbCard *card, PRInt32 g else { if (lastName.Length()) *aName = ToNewUnicode(lastName); - else if (firstName.Length()) + else { + // aName may be empty here, but that's ok. *aName = ToNewUnicode(firstName); - else - *aName = ToNewUnicode(NS_LITERAL_STRING("")); + } } } diff --git a/mailnews/addrbook/src/nsAddressBook.cpp b/mailnews/addrbook/src/nsAddressBook.cpp index 59916ace02f..0517f6b92ae 100644 --- a/mailnews/addrbook/src/nsAddressBook.cpp +++ b/mailnews/addrbook/src/nsAddressBook.cpp @@ -1669,7 +1669,7 @@ nsAddressBook::ExportDirectoryToLDIF(nsIAbDirectory *aDirectory, nsILocalFile *a if (length != writeCount) return NS_ERROR_FAILURE; - valueCStr = ""; + valueCStr.Truncate(); for (i = 0; i < EXPORT_ATTRIBUTES_TABLE_COUNT; i++) { if (EXPORT_ATTRIBUTES_TABLE[i].ldapPropertyName) { @@ -1682,7 +1682,7 @@ nsAddressBook::ExportDirectoryToLDIF(nsIAbDirectory *aDirectory, nsILocalFile *a else if (value.Equals(NS_LITERAL_STRING("plaintext").get())) value = NS_LITERAL_STRING("false"); else - value = NS_LITERAL_STRING(""); // unknown. + value.Truncate(); // unknown. } if (!value.IsEmpty()) { @@ -1692,7 +1692,7 @@ nsAddressBook::ExportDirectoryToLDIF(nsIAbDirectory *aDirectory, nsILocalFile *a valueCStr += LDIF_LINEBREAK; } else - valueCStr = ""; + valueCStr.Truncate(); length = valueCStr.Length(); if (length) { @@ -1701,7 +1701,7 @@ nsAddressBook::ExportDirectoryToLDIF(nsIAbDirectory *aDirectory, nsILocalFile *a if (length != writeCount) return NS_ERROR_FAILURE; } - valueCStr = ""; + valueCStr.Truncate(); } else { // something we don't support yet @@ -2038,7 +2038,7 @@ NS_IMETHODIMP nsAddressBook::HandleContent(const char * aContentType, const char rv = parentWindow->OpenDialog( NS_LITERAL_STRING("chrome://messenger/content/addressbook/abNewCardDialog.xul"), - NS_LITERAL_STRING(""), + EmptyString(), NS_LITERAL_STRING("chrome,resizable=no,titlebar,modal,centerscreen"), ifptr, getter_AddRefs(dialogWindow)); NS_ENSURE_SUCCESS(rv, rv); diff --git a/mailnews/base/src/nsMessenger.cpp b/mailnews/base/src/nsMessenger.cpp index 19794b7f1c3..6eb225284d7 100644 --- a/mailnews/base/src/nsMessenger.cpp +++ b/mailnews/base/src/nsMessenger.cpp @@ -1123,12 +1123,14 @@ nsMessenger::SaveAs(const char *aURI, PRBool aAsFile, nsIMsgIdentity *aIdentity, if (NS_FAILED(rv)) goto done; + const nsAFlatCString& empty = EmptyCString(); + saveListener->m_channel = nsnull; rv = NS_NewInputStreamChannel(getter_AddRefs(saveListener->m_channel), url, nsnull, // inputStream - NS_LITERAL_CSTRING(""), // contentType - NS_LITERAL_CSTRING("")); // contentCharset + empty, // contentType + empty); // contentCharset NS_ASSERTION(NS_SUCCEEDED(rv), "NS_NewInputStreamChannel failed"); if (NS_FAILED(rv)) goto done; diff --git a/mailnews/base/src/nsMsgFolderDataSource.cpp b/mailnews/base/src/nsMsgFolderDataSource.cpp index 8a2f8659c7b..745354deb54 100644 --- a/mailnews/base/src/nsMsgFolderDataSource.cpp +++ b/mailnews/base/src/nsMsgFolderDataSource.cpp @@ -54,6 +54,7 @@ #include "nsString.h" #include "nsCOMPtr.h" #include "nsXPIDLString.h" +#include "nsReadableUtils.h" #include "nsIMsgMailSession.h" #include "nsIMsgCopyService.h" @@ -1599,7 +1600,7 @@ nsMsgFolderDataSource::createCharsetNode(nsIMsgFolder *folder, nsIRDFNode **targ if (NS_SUCCEEDED(rv)) createNode(NS_ConvertASCIItoUCS2(charset).get(), target, getRDFService()); else - createNode(NS_LITERAL_STRING("").get(), target, getRDFService()); + createNode(EmptyString().get(), target, getRDFService()); return NS_OK; } @@ -1913,7 +1914,7 @@ nsMsgFolderDataSource::GetNumMessagesNode(PRInt32 aNumMessages, nsIRDFNode **nod if(numMessages == kDisplayQuestionCount) createNode(NS_LITERAL_STRING("???").get(), node, getRDFService()); else if (numMessages == kDisplayBlankCount || numMessages == 0) - createNode(NS_LITERAL_STRING("").get(), node, getRDFService()); + createNode(EmptyString().get(), node, getRDFService()); else createIntNode(numMessages, node, getRDFService()); return NS_OK; @@ -1924,7 +1925,7 @@ nsMsgFolderDataSource::GetFolderSizeNode(PRInt32 aFolderSize, nsIRDFNode **aNode { PRUint32 folderSize = aFolderSize; if (folderSize == kDisplayBlankCount || folderSize == 0) - createNode(NS_LITERAL_STRING("").get(), aNode, getRDFService()); + createNode(EmptyString().get(), aNode, getRDFService()); else if(folderSize == kDisplayQuestionCount) createNode(NS_LITERAL_STRING("???").get(), aNode, getRDFService()); else diff --git a/mailnews/base/src/nsMsgRDFUtils.cpp b/mailnews/base/src/nsMsgRDFUtils.cpp index 46fa90e13dc..1c0487b2167 100644 --- a/mailnews/base/src/nsMsgRDFUtils.cpp +++ b/mailnews/base/src/nsMsgRDFUtils.cpp @@ -39,6 +39,7 @@ #include "prprf.h" #include "nsCOMPtr.h" #include "nsMemory.h" +#include "nsReadableUtils.h" nsresult createNode(const PRUnichar *str, nsIRDFNode **node, nsIRDFService *rdfService) { @@ -52,7 +53,7 @@ nsresult createNode(const PRUnichar *str, nsIRDFNode **node, nsIRDFService *rdfS rv = rdfService->GetLiteral(str, getter_AddRefs(value)); } else { - rv = rdfService->GetLiteral(NS_LITERAL_STRING("").get(), getter_AddRefs(value)); + rv = rdfService->GetLiteral(EmptyString().get(), getter_AddRefs(value)); } if (NS_SUCCEEDED(rv)) { diff --git a/mailnews/base/util/nsMsgDBFolder.cpp b/mailnews/base/util/nsMsgDBFolder.cpp index 86ef4a919dc..8d59234d286 100644 --- a/mailnews/base/util/nsMsgDBFolder.cpp +++ b/mailnews/base/util/nsMsgDBFolder.cpp @@ -534,7 +534,7 @@ nsresult nsMsgDBFolder::ReadDBFolderInfo(PRBool force) PRBool defaultUsed; folderInfo->GetCharacterSet(&mCharset, &defaultUsed); if (defaultUsed) - mCharset.Assign(NS_LITERAL_STRING("")); + mCharset.Truncate(); folderInfo->GetCharacterSetOverride(&mCharsetOverride); if (db) { @@ -1989,9 +1989,12 @@ nsresult nsMsgDBFolder::PromptForCachePassword(nsIMsgIncomingServer *server, nsI nsAutoString userNameFound; nsAutoString passwordFound; + const nsAFlatString& empty = EmptyString(); + // Get password entry corresponding to the host URI we are passing in. - rv = passwordMgrInt->FindPasswordEntry(currServerUri, NS_LITERAL_STRING(""), NS_LITERAL_STRING(""), - hostFound, userNameFound, passwordFound); + rv = passwordMgrInt->FindPasswordEntry(currServerUri, empty, empty, + hostFound, userNameFound, + passwordFound); if (NS_FAILED(rv)) break; // compare the user-entered password with the saved password with diff --git a/mailnews/base/util/nsMsgI18N.cpp b/mailnews/base/util/nsMsgI18N.cpp index 6da51250eb9..a97ab95c279 100644 --- a/mailnews/base/util/nsMsgI18N.cpp +++ b/mailnews/base/util/nsMsgI18N.cpp @@ -111,7 +111,7 @@ nsresult nsMsgI18NConvertFromUnicode(const nsAFlatCString& aCharset, char localbuf[512]; PRInt32 consumedLen = 0; - outString.Assign(""); + outString.Truncate(); // convert while (consumedLen < originalUnicharLength) { @@ -172,7 +172,7 @@ nsresult nsMsgI18NConvertToUnicode(const nsAFlatCString& aCharset, PRUnichar localbuf[512]; PRInt32 consumedLen = 0; - outString.Assign(NS_LITERAL_STRING("")); + outString.Truncate(); // convert while (consumedLen < originalLength) { diff --git a/mailnews/base/util/nsMsgIncomingServer.cpp b/mailnews/base/util/nsMsgIncomingServer.cpp index 2efb829e956..0333258f1ed 100644 --- a/mailnews/base/util/nsMsgIncomingServer.cpp +++ b/mailnews/base/util/nsMsgIncomingServer.cpp @@ -821,8 +821,10 @@ nsMsgIncomingServer::GetPasswordWithUI(const PRUnichar * aPromptMessage, const nsAutoString userNameFound; nsAutoString passwordFound; + const nsAFlatString& empty = EmptyString(); + // Get password entry corresponding to the host URI we are passing in. - if (NS_SUCCEEDED(passwordMgrInt->FindPasswordEntry(currServerUri, NS_LITERAL_STRING(""), NS_LITERAL_STRING(""), + if (NS_SUCCEEDED(passwordMgrInt->FindPasswordEntry(currServerUri, empty, empty, hostFound, userNameFound, passwordFound))) { m_password.AssignWithConversion(passwordFound); diff --git a/mailnews/compose/src/nsMsgCompose.cpp b/mailnews/compose/src/nsMsgCompose.cpp index 6070f989177..a91479e80ff 100644 --- a/mailnews/compose/src/nsMsgCompose.cpp +++ b/mailnews/compose/src/nsMsgCompose.cpp @@ -143,7 +143,7 @@ static nsresult GetReplyHeaderInfo(PRInt32* reply_header_type, rv = prefs->CopyUnicharPref("mailnews.reply_header_locale", reply_header_locale); if (NS_FAILED(rv) || !*reply_header_locale) - *reply_header_locale = nsCRT::strdup(NS_LITERAL_STRING("").get()); + *reply_header_locale = nsCRT::strdup(EmptyString().get()); rv = prefs->GetLocalizedUnicharPref("mailnews.reply_header_authorwrote", reply_header_authorwrote); if (NS_FAILED(rv) || !*reply_header_authorwrote) @@ -2383,9 +2383,7 @@ QuotingOutputStreamListener::InsertToCompose(nsIEditor *aEditor, docshell->SetAppType(nsIDocShell::APP_TYPE_MAIL); if (aHTMLEditor) - mailEditor->InsertAsCitedQuotation(mMsgBody, - NS_LITERAL_STRING(""), - PR_TRUE, + mailEditor->InsertAsCitedQuotation(mMsgBody, EmptyString(), PR_TRUE, getter_AddRefs(nodeInserted)); else mailEditor->InsertAsQuotation(mMsgBody, getter_AddRefs(nodeInserted)); diff --git a/mailnews/compose/src/nsMsgSendReport.cpp b/mailnews/compose/src/nsMsgSendReport.cpp index f0d16ea443f..345248f46ce 100644 --- a/mailnews/compose/src/nsMsgSendReport.cpp +++ b/mailnews/compose/src/nsMsgSendReport.cpp @@ -101,7 +101,7 @@ NS_IMETHODIMP nsMsgProcessReport::Reset() { mProceeded = PR_FALSE; mError = NS_OK; - mMessage.Assign(NS_LITERAL_STRING("")); + mMessage.Truncate(); return NS_OK; } diff --git a/mailnews/news/src/nsNNTPProtocol.cpp b/mailnews/news/src/nsNNTPProtocol.cpp index 9519f218337..ec52c74eae0 100644 --- a/mailnews/news/src/nsNNTPProtocol.cpp +++ b/mailnews/news/src/nsNNTPProtocol.cpp @@ -3976,7 +3976,7 @@ PRInt32 nsNNTPProtocol::GetNextGroupNeedingCounts( nsISupports** pNextGroup, PRI if (m_newsRCListCount) { // clear the status text. - rv = SetProgressStatus(NS_LITERAL_STRING("").get()); + rv = SetProgressStatus(EmptyString().get()); NS_ENSURE_SUCCESS(rv, rv); SetProgressBarPercent(0, -1); diff --git a/modules/plugin/base/src/nsPluginHostImpl.cpp b/modules/plugin/base/src/nsPluginHostImpl.cpp index 13bef677188..642b8873cd9 100644 --- a/modules/plugin/base/src/nsPluginHostImpl.cpp +++ b/modules/plugin/base/src/nsPluginHostImpl.cpp @@ -5691,7 +5691,7 @@ NS_IMETHODIMP nsPluginHostImpl::NewPluginURLStream(const nsString& aURL, nsCOMPtr uploadChannel(do_QueryInterface(httpChannel)); NS_ASSERTION(uploadChannel, "http must support nsIUploadChannel"); - uploadChannel->SetUploadStream(postDataStream, NS_LITERAL_CSTRING(""), -1); + uploadChannel->SetUploadStream(postDataStream, EmptyCString(), -1); } if (aHeadersData) diff --git a/netwerk/base/public/nsNetUtil.h b/netwerk/base/public/nsNetUtil.h index 004a807c2b0..bfcd6299fcd 100644 --- a/netwerk/base/public/nsNetUtil.h +++ b/netwerk/base/public/nsNetUtil.h @@ -288,8 +288,8 @@ inline nsresult NS_NewInputStreamChannel(nsIChannel **result, nsIURI *uri, nsIInputStream *stream, - const nsACString &contentType = NS_LITERAL_CSTRING(""), - const nsACString &contentCharset = NS_LITERAL_CSTRING("")) + const nsACString &contentType = EmptyCString(), + const nsACString &contentCharset = EmptyCString()) { nsresult rv; static NS_DEFINE_CID(kInputStreamChannelCID, NS_INPUTSTREAMCHANNEL_CID); diff --git a/netwerk/protocol/about/src/nsAboutBlank.cpp b/netwerk/protocol/about/src/nsAboutBlank.cpp index ecde1c25cc1..cd5d4ef6c01 100644 --- a/netwerk/protocol/about/src/nsAboutBlank.cpp +++ b/netwerk/protocol/about/src/nsAboutBlank.cpp @@ -58,7 +58,7 @@ nsAboutBlank::NewChannel(nsIURI *aURI, nsIChannel **result) rv = NS_NewInputStreamChannel(&channel, aURI, in, NS_LITERAL_CSTRING("text/html"), - NS_LITERAL_CSTRING("")); + EmptyCString()); if (NS_FAILED(rv)) return rv; *result = channel; diff --git a/netwerk/protocol/about/src/nsAboutBloat.cpp b/netwerk/protocol/about/src/nsAboutBloat.cpp index c267e96c983..2c72d9a2cdc 100644 --- a/netwerk/protocol/about/src/nsAboutBloat.cpp +++ b/netwerk/protocol/about/src/nsAboutBloat.cpp @@ -149,7 +149,7 @@ nsAboutBloat::NewChannel(nsIURI *aURI, nsIChannel **result) nsIChannel* channel; rv = NS_NewInputStreamChannel(&channel, aURI, inStr, NS_LITERAL_CSTRING("text/plain"), - NS_LITERAL_CSTRING("")); + EmptyCString()); if (NS_FAILED(rv)) return rv; *result = channel; diff --git a/netwerk/protocol/about/src/nsAboutCache.cpp b/netwerk/protocol/about/src/nsAboutCache.cpp index edd628c9110..b42815ed1a1 100644 --- a/netwerk/protocol/about/src/nsAboutCache.cpp +++ b/netwerk/protocol/about/src/nsAboutCache.cpp @@ -146,7 +146,7 @@ nsAboutCache::NewChannel(nsIURI *aURI, nsIChannel **result) nsIChannel* channel; rv = NS_NewInputStreamChannel(&channel, aURI, inStr, NS_LITERAL_CSTRING("text/html"), - NS_LITERAL_CSTRING("")); + EmptyCString()); if (NS_FAILED(rv)) return rv; *result = channel; diff --git a/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp b/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp index 6dbb26fe100..864a25dd6a4 100644 --- a/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp +++ b/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp @@ -1141,7 +1141,7 @@ nsFtpState::R_pass() { nsresult rv = mURL->GetPrePath(prePath); NS_ASSERTION(NS_SUCCEEDED(rv), "Failed to get prepath"); if (NS_SUCCEEDED(rv)) { - pm->RemoveUser(prePath, NS_LITERAL_STRING("")); + pm->RemoveUser(prePath, EmptyString()); } } } diff --git a/netwerk/protocol/http/src/nsHttpChannel.cpp b/netwerk/protocol/http/src/nsHttpChannel.cpp index 6177e77e5f9..a31c1f8fcd3 100644 --- a/netwerk/protocol/http/src/nsHttpChannel.cpp +++ b/netwerk/protocol/http/src/nsHttpChannel.cpp @@ -473,7 +473,7 @@ nsHttpChannel::SetupTransaction() nsCOMPtr tempURI; rv = mURI->Clone(getter_AddRefs(tempURI)); if (NS_FAILED(rv)) return rv; - rv = tempURI->SetUserPass(NS_LITERAL_CSTRING("")); + rv = tempURI->SetUserPass(EmptyCString()); if (NS_FAILED(rv)) return rv; rv = tempURI->GetAsciiSpec(path); if (NS_FAILED(rv)) return rv; @@ -1709,7 +1709,7 @@ nsHttpChannel::SetupReplacementChannel(nsIURI *newURI, // replicate original call to SetUploadStream... if (mUploadStreamHasHeaders) - uploadChannel->SetUploadStream(mUploadStream, NS_LITERAL_CSTRING(""), -1); + uploadChannel->SetUploadStream(mUploadStream, EmptyCString(), -1); else { const char *ctype = mRequestHead.PeekHeader(nsHttp::Content_Type); const char *clen = mRequestHead.PeekHeader(nsHttp::Content_Length); @@ -2947,12 +2947,12 @@ nsHttpChannel::SetReferrer(nsIURI *referrer) if (NS_FAILED(rv)) return rv; // strip away any userpass; we don't want to be giving out passwords ;-) - clone->SetUserPass(NS_LITERAL_CSTRING("")); + clone->SetUserPass(EmptyCString()); // strip away any fragment per RFC 2616 section 14.36 nsCOMPtr url = do_QueryInterface(clone); if (url) - url->SetRef(NS_LITERAL_CSTRING("")); + url->SetRef(EmptyCString()); nsCAutoString spec; rv = clone->GetAsciiSpec(spec); diff --git a/netwerk/protocol/res/src/nsResProtocolHandler.cpp b/netwerk/protocol/res/src/nsResProtocolHandler.cpp index ecc34ab38cb..2cb496ad1e9 100644 --- a/netwerk/protocol/res/src/nsResProtocolHandler.cpp +++ b/netwerk/protocol/res/src/nsResProtocolHandler.cpp @@ -155,7 +155,7 @@ nsResProtocolHandler::Init() // // make resource:/// point to the application directory // - rv = AddSpecialDir(NS_OS_CURRENT_PROCESS_DIR, NS_LITERAL_CSTRING("")); + rv = AddSpecialDir(NS_OS_CURRENT_PROCESS_DIR, EmptyCString()); NS_ENSURE_SUCCESS(rv, rv); // diff --git a/netwerk/streamconv/converters/nsFTPDirListingConv.cpp b/netwerk/streamconv/converters/nsFTPDirListingConv.cpp index 09e29511aa5..5f53e365fd5 100644 --- a/netwerk/streamconv/converters/nsFTPDirListingConv.cpp +++ b/netwerk/streamconv/converters/nsFTPDirListingConv.cpp @@ -114,7 +114,7 @@ nsFTPDirListingConv::AsyncConvertData(const PRUnichar *aFromType, const PRUnicha uri, nsnull, NS_LITERAL_CSTRING(APPLICATION_HTTP_INDEX_FORMAT), - NS_LITERAL_CSTRING("")); + EmptyCString()); NS_RELEASE(uri); if (NS_FAILED(rv)) return rv; @@ -283,7 +283,7 @@ nsFTPDirListingConv::GetHeaders(nsACString& headers, nsCAutoString spec; uri->GetPassword(pw); if (!pw.IsEmpty()) { - rv = uri->SetPassword(NS_LITERAL_CSTRING("")); + rv = uri->SetPassword(EmptyCString()); if (NS_FAILED(rv)) return rv; rv = uri->GetAsciiSpec(spec); if (NS_FAILED(rv)) return rv; diff --git a/netwerk/streamconv/converters/nsGopherDirListingConv.cpp b/netwerk/streamconv/converters/nsGopherDirListingConv.cpp index 85e23e3657e..34ec826f695 100644 --- a/netwerk/streamconv/converters/nsGopherDirListingConv.cpp +++ b/netwerk/streamconv/converters/nsGopherDirListingConv.cpp @@ -139,7 +139,7 @@ nsGopherDirListingConv::AsyncConvertData(const PRUnichar *aFromType, mUri, nsnull, NS_LITERAL_CSTRING(APPLICATION_HTTP_INDEX_FORMAT), - NS_LITERAL_CSTRING("")); + EmptyCString()); if (NS_FAILED(rv)) return rv; return NS_OK; diff --git a/netwerk/streamconv/converters/nsIndexedToHTML.cpp b/netwerk/streamconv/converters/nsIndexedToHTML.cpp index ddfcf81019b..182c9a24a0c 100644 --- a/netwerk/streamconv/converters/nsIndexedToHTML.cpp +++ b/netwerk/streamconv/converters/nsIndexedToHTML.cpp @@ -192,7 +192,7 @@ nsIndexedToHTML::OnStartRequest(nsIRequest* request, nsISupports *aContext) { nsCOMPtr newUri; rv = uri->Clone(getter_AddRefs(newUri)); if (NS_FAILED(rv)) return rv; - rv = newUri->SetPassword(NS_LITERAL_CSTRING("")); + rv = newUri->SetPassword(EmptyCString()); if (NS_FAILED(rv)) return rv; rv = newUri->GetAsciiSpec(titleUri); if (NS_FAILED(rv)) return rv; diff --git a/netwerk/streamconv/converters/nsTXTToHTMLConv.cpp b/netwerk/streamconv/converters/nsTXTToHTMLConv.cpp index e62e02e396d..b48621853e4 100644 --- a/netwerk/streamconv/converters/nsTXTToHTMLConv.cpp +++ b/netwerk/streamconv/converters/nsTXTToHTMLConv.cpp @@ -96,7 +96,7 @@ nsTXTToHTMLConv::OnStartRequest(nsIRequest* request, nsISupports *aContext) { rv = mListener->OnDataAvailable(request, aContext, inputData, 0, mBuffer.Length()); if (NS_FAILED(rv)) return rv; - mBuffer.Assign(NS_LITERAL_STRING("")); + mBuffer.Truncate(); return rv; } diff --git a/netwerk/test/TestStreamChannel.cpp b/netwerk/test/TestStreamChannel.cpp index 475dc9aa11c..b8b4d74d5ed 100644 --- a/netwerk/test/TestStreamChannel.cpp +++ b/netwerk/test/TestStreamChannel.cpp @@ -214,10 +214,11 @@ RunTest(nsIFile *file) if (uri) uri->SetSpec(NS_LITERAL_CSTRING("foo://bar")); + const nsAFlatCString& empty = EmptyCString(); + nsCOMPtr chan; - rv = NS_NewInputStreamChannel(getter_AddRefs(chan), uri, stream, - NS_LITERAL_CSTRING(""), - NS_LITERAL_CSTRING("")); + rv = NS_NewInputStreamChannel(getter_AddRefs(chan), uri, stream, empty, + empty); if (NS_FAILED(rv)) return rv; rv = chan->SetNotificationCallbacks(new MyCallbacks()); diff --git a/netwerk/test/TestUpload.cpp b/netwerk/test/TestUpload.cpp index 50ae63d6a67..149dbff478c 100644 --- a/netwerk/test/TestUpload.cpp +++ b/netwerk/test/TestUpload.cpp @@ -182,7 +182,7 @@ main(int argc, char* argv[]) // QI and set the upload stream nsCOMPtr uploadChannel(do_QueryInterface(channel)); - uploadChannel->SetUploadStream(uploadStream, NS_LITERAL_CSTRING(""), -1); + uploadChannel->SetUploadStream(uploadStream, EmptyCString(), -1); // create a dummy listener InputTestConsumer* listener; diff --git a/parser/htmlparser/src/CNavDTD.cpp b/parser/htmlparser/src/CNavDTD.cpp index 938ba796198..fb64cafed62 100644 --- a/parser/htmlparser/src/CNavDTD.cpp +++ b/parser/htmlparser/src/CNavDTD.cpp @@ -2975,7 +2975,7 @@ nsresult CNavDTD::OpenTransientStyles(eHTMLTags aChildTag){ // precedence over the residual style tags' size info.. // *Note: Make sure that this attribute is transient since it // should not get carried over to cases other than heading. - CAttributeToken theAttrToken(NS_LITERAL_STRING("_moz-rs-heading"),NS_LITERAL_STRING("")); + CAttributeToken theAttrToken(NS_LITERAL_STRING("_moz-rs-heading"), EmptyString()); theNode->AddAttribute(&theAttrToken); result = OpenContainer(theNode,theNodeTag,PR_FALSE,theStack); theNode->PopAttributeToken(); diff --git a/rdf/base/src/nsRDFXMLParser.cpp b/rdf/base/src/nsRDFXMLParser.cpp index dbfcf241543..ed3f370ab84 100644 --- a/rdf/base/src/nsRDFXMLParser.cpp +++ b/rdf/base/src/nsRDFXMLParser.cpp @@ -130,7 +130,7 @@ nsRDFXMLParser::ParseString(nsIRDFDataSource* aSink, nsIURI* aBaseURI, const nsA nsCOMPtr channel; rv = NS_NewInputStreamChannel(getter_AddRefs(channel), aBaseURI, stream, NS_LITERAL_CSTRING("text/xml"), - NS_LITERAL_CSTRING("")); + EmptyCString()); if (NS_FAILED(rv)) return rv; listener->OnStartRequest(channel, nsnull); diff --git a/rdf/chrome/src/nsChromeRegistry.cpp b/rdf/chrome/src/nsChromeRegistry.cpp index 5791f0401f8..df17e1ad158 100644 --- a/rdf/chrome/src/nsChromeRegistry.cpp +++ b/rdf/chrome/src/nsChromeRegistry.cpp @@ -2846,10 +2846,12 @@ nsChromeRegistry::GetProfileRoot(nsACString& aFileURL) defaultUserChromeFile->AppendNative(NS_LITERAL_CSTRING("chrome")); defaultUserChromeFile->AppendNative(NS_LITERAL_CSTRING("userChrome-example.css")); + const nsAFlatCString& empty = EmptyCString(); + // copy along // It aint an error if these files dont exist - (void) defaultUserContentFile->CopyToNative(userChromeDir, NS_LITERAL_CSTRING("")); - (void) defaultUserChromeFile->CopyToNative(userChromeDir, NS_LITERAL_CSTRING("")); + defaultUserContentFile->CopyToNative(userChromeDir, empty); + defaultUserChromeFile->CopyToNative(userChromeDir, empty); } } if (NS_FAILED(rv)) diff --git a/rdf/datasource/src/nsFileSystemDataSource.cpp b/rdf/datasource/src/nsFileSystemDataSource.cpp index 7f516ea755b..842ca9ac6b4 100644 --- a/rdf/datasource/src/nsFileSystemDataSource.cpp +++ b/rdf/datasource/src/nsFileSystemDataSource.cpp @@ -1676,7 +1676,7 @@ FileSystemDataSource::GetExtension(nsIRDFResource *source, nsIRDFLiteral **aResu PRInt32 lastDot = filename.RFindChar('.'); if (lastDot == -1) { - gRDFService->GetLiteral(NS_LITERAL_STRING("").get(), aResult); + gRDFService->GetLiteral(EmptyString().get(), aResult); } else { diff --git a/uriloader/base/nsURILoader.cpp b/uriloader/base/nsURILoader.cpp index baf84f00e78..98cdcb0de04 100644 --- a/uriloader/base/nsURILoader.cpp +++ b/uriloader/base/nsURILoader.cpp @@ -410,7 +410,7 @@ nsresult nsDocumentOpenInfo::DispatchContent(nsIRequest *request, nsISupports * { nsAutoString dispToken; // Get the disposition type - rv = mimehdrpar->GetParameter(disposition, "", NS_LITERAL_CSTRING(""), + rv = mimehdrpar->GetParameter(disposition, "", EmptyCString(), PR_FALSE, nsnull, dispToken); // RFC 2183, section 2.8 says that an unknown disposition // value should be treated as "attachment" diff --git a/uriloader/exthandler/nsExternalHelperAppService.cpp b/uriloader/exthandler/nsExternalHelperAppService.cpp index 76941325824..78cc1d016cf 100644 --- a/uriloader/exthandler/nsExternalHelperAppService.cpp +++ b/uriloader/exthandler/nsExternalHelperAppService.cpp @@ -215,7 +215,7 @@ static PRBool GetFilenameAndExtensionFromChannel(nsIChannel* aChannel, return PR_FALSE; nsAutoString dispToken; // Get the disposition type - rv = mimehdrpar->GetParameter(disp, "", NS_LITERAL_CSTRING(""), PR_FALSE, + rv = mimehdrpar->GetParameter(disp, "", EmptyCString(), PR_FALSE, nsnull, dispToken); // RFC 2183, section 2.8 says that an unknown disposition // value should be treated as "attachment" diff --git a/widget/src/cocoa/nsMenuX.cpp b/widget/src/cocoa/nsMenuX.cpp index 106f0c2f979..7ff05926f81 100644 --- a/widget/src/cocoa/nsMenuX.cpp +++ b/widget/src/cocoa/nsMenuX.cpp @@ -932,7 +932,7 @@ nsMenuX::LoadSubMenu( nsIMenu * pParentMenu, nsIContent* inMenuItemContent ) if (!webShell) return; nsCOMPtr supports(do_QueryInterface(pParentMenu)); - pnsMenu->Create(supports, menuName, NS_LITERAL_STRING(""), mManager, webShell, inMenuItemContent); + pnsMenu->Create(supports, menuName, EmptyString(), mManager, webShell, inMenuItemContent); // set if it's enabled or disabled nsAutoString disabled; diff --git a/widget/src/gtk/nsGtkIMEHelper.cpp b/widget/src/gtk/nsGtkIMEHelper.cpp index da3dd07e681..6070e30d863 100644 --- a/widget/src/gtk/nsGtkIMEHelper.cpp +++ b/widget/src/gtk/nsGtkIMEHelper.cpp @@ -131,7 +131,7 @@ void nsGtkIMEHelper::SetupUnicodeDecoder() do_GetService(NS_PLATFORMCHARSET_CONTRACTID, &result); if (platform && NS_SUCCEEDED(result)) { nsCAutoString charset; - charset.Assign(NS_LITERAL_CSTRING("")); + charset.Truncate(); result = platform->GetCharset(kPlatformCharsetSel_Menu, charset); if (NS_FAILED(result) || charset.IsEmpty()) { charset.Assign(NS_LITERAL_CSTRING("ISO-8859-1")); // default diff --git a/widget/src/mac/nsMacEventHandler.cpp b/widget/src/mac/nsMacEventHandler.cpp index 8a40c9bc280..32158e8b5a4 100644 --- a/widget/src/mac/nsMacEventHandler.cpp +++ b/widget/src/mac/nsMacEventHandler.cpp @@ -2449,7 +2449,7 @@ nsresult nsMacEventHandler::UnicodeHandleUpdateInputArea(PRUnichar* text, long c // This is needed when we input some uncommitted text, and then delete all of them // When the last delete come, we will got a text_size = 0 and fixedLength = 0 // In that case, we need to send a text event to clean up the input hole.... - mIMECompositionStr->Assign(NS_LITERAL_STRING("")); + mIMECompositionStr->Truncate(); #ifdef DEBUG_TSM printf("3.====================================\n"); #endif diff --git a/widget/src/mac/nsMenu.cpp b/widget/src/mac/nsMenu.cpp index 4caeff236d6..15e2cbbae8b 100644 --- a/widget/src/mac/nsMenu.cpp +++ b/widget/src/mac/nsMenu.cpp @@ -1120,7 +1120,7 @@ nsMenu::LoadSubMenu( nsIMenu * pParentMenu, nsIContent* inMenuItemContent ) if (!webShell) return; nsCOMPtr supports(do_QueryInterface(pParentMenu)); - pnsMenu->Create(supports, menuName, NS_LITERAL_STRING(""), mManager, webShell, inMenuItemContent); + pnsMenu->Create(supports, menuName, EmptyString(), mManager, webShell, inMenuItemContent); // set if it's enabled or disabled nsAutoString disabled; diff --git a/widget/src/mac/nsMenuX.cpp b/widget/src/mac/nsMenuX.cpp index c92b98a2945..473a559b9d0 100644 --- a/widget/src/mac/nsMenuX.cpp +++ b/widget/src/mac/nsMenuX.cpp @@ -938,7 +938,7 @@ nsMenuX::LoadSubMenu( nsIMenu * pParentMenu, nsIContent* inMenuItemContent ) if (!webShell) return; nsCOMPtr supports(do_QueryInterface(pParentMenu)); - pnsMenu->Create(supports, menuName, NS_LITERAL_STRING(""), mManager, webShell, inMenuItemContent); + pnsMenu->Create(supports, menuName, EmptyString(), mManager, webShell, inMenuItemContent); // set if it's enabled or disabled nsAutoString disabled; diff --git a/xpcom/components/nsCategoryManager.cpp b/xpcom/components/nsCategoryManager.cpp index 8641552fb81..d9b210e9cf0 100644 --- a/xpcom/components/nsCategoryManager.cpp +++ b/xpcom/components/nsCategoryManager.cpp @@ -792,7 +792,7 @@ NS_CreateServicesFromCategory(const char *category, // try an observer, if it implements it. nsCOMPtr observer = do_QueryInterface(instance, &rv); if (NS_SUCCEEDED(rv) && observer) - observer->Observe(origin, observerTopic, NS_LITERAL_STRING("").get()); + observer->Observe(origin, observerTopic, EmptyString().get()); } } return (nFailed ? NS_ERROR_FAILURE : NS_OK); diff --git a/xpfe/bootstrap/nsAppRunner.cpp b/xpfe/bootstrap/nsAppRunner.cpp index 6c2450df559..24987d92cb9 100644 --- a/xpfe/bootstrap/nsAppRunner.cpp +++ b/xpfe/bootstrap/nsAppRunner.cpp @@ -469,7 +469,7 @@ static nsresult OpenWindow(const nsAFlatCString& aChromeURL, static nsresult OpenWindow(const nsAFlatCString& aChromeURL, PRInt32 aWidth, PRInt32 aHeight) { - return OpenWindow(aChromeURL, NS_LITERAL_STRING(""), aWidth, aHeight); + return OpenWindow(aChromeURL, EmptyString(), aWidth, aHeight); } static nsresult OpenWindow(const nsAFlatCString& aChromeURL, diff --git a/xpfe/components/autocomplete/src/nsLDAPAutoCompleteSession.cpp b/xpfe/components/autocomplete/src/nsLDAPAutoCompleteSession.cpp index 60a3a7012d1..7732861ad92 100644 --- a/xpfe/components/autocomplete/src/nsLDAPAutoCompleteSession.cpp +++ b/xpfe/components/autocomplete/src/nsLDAPAutoCompleteSession.cpp @@ -931,7 +931,7 @@ nsLDAPAutoCompleteSession::StartLDAPSearch() nsCAutoString searchFilter; rv = ldapSvc->CreateFilter(MAX_AUTOCOMPLETE_FILTER_SIZE, mFilterTemplate, - prefix, suffix, NS_LITERAL_CSTRING(""), + prefix, suffix, EmptyCString(), NS_ConvertUCS2toUTF8(mSearchString), searchFilter); if (NS_FAILED(rv)) { diff --git a/xpfe/components/bookmarks/src/nsBookmarksService.cpp b/xpfe/components/bookmarks/src/nsBookmarksService.cpp index eee118cd223..3e40039416b 100644 --- a/xpfe/components/bookmarks/src/nsBookmarksService.cpp +++ b/xpfe/components/bookmarks/src/nsBookmarksService.cpp @@ -307,7 +307,7 @@ bm_AddRefGlobals() gRDF->GetLiteral(NS_LITERAL_STRING("true").get(), &kTrueLiteral); - gRDF->GetLiteral(NS_LITERAL_STRING("").get(), &kEmptyLiteral); + gRDF->GetLiteral(EmptyString().get(), &kEmptyLiteral); gRDF->GetDateLiteral(0, &kEmptyDate); diff --git a/xpfe/components/search/src/nsInternetSearchService.cpp b/xpfe/components/search/src/nsInternetSearchService.cpp index 6312200e2b3..66107b66d6b 100755 --- a/xpfe/components/search/src/nsInternetSearchService.cpp +++ b/xpfe/components/search/src/nsInternetSearchService.cpp @@ -3950,7 +3950,7 @@ InternetSearchDataSource::DoSearch(nsIRDFResource *source, nsIRDFResource *engin { nsCOMPtr uploadChannel(do_QueryInterface(httpChannel)); NS_ASSERTION(uploadChannel, "http must support nsIUploadChannel"); - uploadChannel->SetUploadStream(postDataStream, NS_LITERAL_CSTRING(""), -1); + uploadChannel->SetUploadStream(postDataStream, EmptyCString(), -1); } } }