Fixing bug 232503. Start using Empty[C]String() to save a bit on code-size. r+sr=peterv@propagandism.org

This commit is contained in:
jst%mozilla.jstenback.com 2004-01-29 22:04:45 +00:00
parent d49d4a457e
commit 90431d8022
107 changed files with 299 additions and 275 deletions

View File

@ -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:

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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 <menubutton> like bookmarks
if (clickedContent->Tag() == nsXULAtoms::menubutton)
return;

View File

@ -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

View File

@ -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<nsIStringBundle> mStringBundle;
static const char* const sFormatNames[4];

View File

@ -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);

View File

@ -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

View File

@ -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,

View File

@ -1031,8 +1031,8 @@ nsXBLService::LoadBindingDocumentInfo(nsIContent* aBoundElement,
nsCOMPtr<nsIURL> 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.

View File

@ -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);
}

View File

@ -229,7 +229,7 @@ nsXMLContentSink::DidBuildModel()
if (mTitleText.IsEmpty()) {
nsCOMPtr<nsIDOMNSDocument> dom_doc(do_QueryInterface(mDocument));
if (dom_doc) {
dom_doc->SetTitle(NS_LITERAL_STRING(""));
dom_doc->SetTitle(EmptyString());
}
}

View File

@ -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;

View File

@ -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<nsIURI> baseURI = GetBaseURI();
Attributes()->UpdateStyleRule(baseURI, NS_LITERAL_STRING(""));
Attributes()->UpdateStyleRule(baseURI, EmptyString());
// AttributeChanged() will handle the style reresolution
}
}

View File

@ -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

View File

@ -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;
}

View File

@ -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);

View File

@ -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

View File

@ -691,7 +691,7 @@ nsWebShell::OnLeaveLink()
if (browserChrome) {
rv = browserChrome->SetStatus(nsIWebBrowserChrome::STATUS_LINK,
NS_LITERAL_STRING("").get());
EmptyString().get());
}
return rv;
}

View File

@ -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,

View File

@ -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);

View File

@ -225,8 +225,8 @@ nsStyleUpdatingCommand::GetCurrentState(nsIEditor *aEditor,
PRBool allOfSelectionHasProp = PR_FALSE;
nsCOMPtr<nsIAtom> 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<nsIAtom> bigAtom = do_GetAtom("big");
rv = htmlEditor->RemoveInlineProperty(bigAtom, NS_LITERAL_STRING(""));
rv = htmlEditor->RemoveInlineProperty(bigAtom, EmptyString());
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIAtom> 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

View File

@ -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()))
{

View File

@ -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);
}
}

View File

@ -1117,7 +1117,7 @@ nsEditor::MarkNodeDirty(nsIDOMNode* aNode)
// mark the node dirty.
nsCOMPtr<nsIDOMElement> 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<nsIDOMNode> newNode = do_QueryInterface(nodeAsText);

View File

@ -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 \

View File

@ -36,6 +36,8 @@
*
* ***** END LICENSE BLOCK ***** */
#ifdef NS_DEBUG
#include <stdio.h>
#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");

View File

@ -694,7 +694,7 @@ nsHTMLEditor::CheckPositionedElementBGandFG(nsIDOMElement * aElement,
res = mHTMLCSSUtils->GetDefaultViewCSS(aElement, getter_AddRefs(viewCSS));
if (NS_FAILED(res)) return res;
nsCOMPtr<nsIDOMCSSStyleDeclaration> 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<nsIDOMCSSValue> colorCssValue;

View File

@ -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

View File

@ -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("</A>"));
}
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);
}
}

View File

@ -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() {};

View File

@ -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;

View File

@ -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;

View File

@ -1193,7 +1193,7 @@ nsresult nsWebBrowserPersist::SaveURIInternal(
nsCOMPtr<nsIUploadChannel> 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));

View File

@ -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) {

View File

@ -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;
}

View File

@ -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");

View File

@ -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<mozISqlConnection> conn = do_CreateInstance(contractID.get());
if (! conn)

View File

@ -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;
}

View File

@ -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)

View File

@ -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);
}

View File

@ -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);
}
}

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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");

View File

@ -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<nsISchemaSimpleType> 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;
}

View File

@ -1258,7 +1258,7 @@ nsXMLHttpRequest::Send(nsIVariant *aBody)
nsCOMPtr<nsIUploadChannel> 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,

View File

@ -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<nsIDOMNode> child;
result = aNode->GetFirstChild(getter_AddRefs(child));
nsAutoString htmlInner(NS_LITERAL_STRING(""));
nsAutoString htmlInner;
while (child) {
nsAutoString innerString;
ToHTMLString(child, newIndentString, innerString, deepContent,

View File

@ -210,7 +210,7 @@ NS_IMETHODIMP mozXMLTermStream::Open(nsIDOMWindowInternal* aDOMWindow,
uri,
inputStream,
nsDependentCString(contentType),
NS_LITERAL_CSTRING(""));
EmptyCString());
if (NS_FAILED(result))
return result;

View File

@ -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();

View File

@ -133,7 +133,6 @@ main(int argc, char *argv[])
}
nsAutoString v;
v.Assign(NS_LITERAL_STRING(""));
PRUnichar *ptrv = nsnull;
char *value = nsnull;

View File

@ -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

View File

@ -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;

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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:

View File

@ -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);

View File

@ -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

View File

@ -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);

View File

@ -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);

View File

@ -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;
}

View File

@ -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)

View File

@ -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;

View File

@ -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 <dmose@netscape.com>
* Dan Mosedale <dmose@netscape.com>
*
* 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()

View File

@ -182,7 +182,7 @@ NS_IMETHODIMP nsAddrBookSession::GetUserProfileDirectory(nsFileSpec * *userDir)
NS_ENSURE_ARG_POINTER(userDir);
*userDir = nsnull;
nsresult rv;
nsresult rv;
nsCOMPtr<nsIFile> 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(""));
}
}
}

View File

@ -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);

View File

@ -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;

View File

@ -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

View File

@ -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)) {

View File

@ -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

View File

@ -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) {

View File

@ -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);

View File

@ -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));

View File

@ -101,7 +101,7 @@ NS_IMETHODIMP nsMsgProcessReport::Reset()
{
mProceeded = PR_FALSE;
mError = NS_OK;
mMessage.Assign(NS_LITERAL_STRING(""));
mMessage.Truncate();
return NS_OK;
}

View File

@ -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);

View File

@ -5691,7 +5691,7 @@ NS_IMETHODIMP nsPluginHostImpl::NewPluginURLStream(const nsString& aURL,
nsCOMPtr<nsIUploadChannel> 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)

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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());
}
}
}

View File

@ -473,7 +473,7 @@ nsHttpChannel::SetupTransaction()
nsCOMPtr<nsIURI> 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<nsIURL> url = do_QueryInterface(clone);
if (url)
url->SetRef(NS_LITERAL_CSTRING(""));
url->SetRef(EmptyCString());
nsCAutoString spec;
rv = clone->GetAsciiSpec(spec);

View File

@ -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);
//

View File

@ -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;

View File

@ -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;

View File

@ -192,7 +192,7 @@ nsIndexedToHTML::OnStartRequest(nsIRequest* request, nsISupports *aContext) {
nsCOMPtr<nsIURI> 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;

View File

@ -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;
}

View File

@ -214,10 +214,11 @@ RunTest(nsIFile *file)
if (uri)
uri->SetSpec(NS_LITERAL_CSTRING("foo://bar"));
const nsAFlatCString& empty = EmptyCString();
nsCOMPtr<nsIChannel> 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());

View File

@ -182,7 +182,7 @@ main(int argc, char* argv[])
// QI and set the upload stream
nsCOMPtr<nsIUploadChannel> uploadChannel(do_QueryInterface(channel));
uploadChannel->SetUploadStream(uploadStream, NS_LITERAL_CSTRING(""), -1);
uploadChannel->SetUploadStream(uploadStream, EmptyCString(), -1);
// create a dummy listener
InputTestConsumer* listener;

View File

@ -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();

View File

@ -130,7 +130,7 @@ nsRDFXMLParser::ParseString(nsIRDFDataSource* aSink, nsIURI* aBaseURI, const nsA
nsCOMPtr<nsIChannel> 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);

View File

@ -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))

View File

@ -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
{

View File

@ -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"

View File

@ -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"

View File

@ -932,7 +932,7 @@ nsMenuX::LoadSubMenu( nsIMenu * pParentMenu, nsIContent* inMenuItemContent )
if (!webShell)
return;
nsCOMPtr<nsISupports> 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;

View File

@ -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

View File

@ -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

Some files were not shown because too many files have changed in this diff Show More