More use of EmptyString(). Bug 232691, patch by Vidar Braut Haarr

<vhaarr+bmo@gmail.com>, r+sr=bzbarsky
This commit is contained in:
bzbarsky%mit.edu 2005-09-12 01:28:51 +00:00
Родитель ef75c4d792
Коммит f623ba1819
16 изменённых файлов: 37 добавлений и 51 удалений

Просмотреть файл

@ -278,8 +278,7 @@ NS_IMETHODIMP nsAccessNodeWrap::GetComputedStyleDeclaration(nsIDOMCSSStyleDeclar
return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMCSSStyleDeclaration> cssDecl;
nsAutoString empty;
viewCSS->GetComputedStyle(domElement, empty, getter_AddRefs(cssDecl));
viewCSS->GetComputedStyle(domElement, EmptyString(), getter_AddRefs(cssDecl));
if (cssDecl) {
*aCssDecl = cssDecl;
NS_ADDREF(*aCssDecl);

Просмотреть файл

@ -451,8 +451,7 @@ nsGenericDOMDataNode::InsertData(PRUint32 aOffset,
nsresult
nsGenericDOMDataNode::DeleteData(PRUint32 aOffset, PRUint32 aCount)
{
nsAutoString empty;
return ReplaceData(aOffset, aCount, empty);
return ReplaceData(aOffset, aCount, EmptyString());
}
nsresult

Просмотреть файл

@ -234,7 +234,6 @@ nsNode3Tearoff::GetTextContent(nsIContent *aContent,
NS_NewContentIterator(getter_AddRefs(iter));
iter->Init(aContent);
nsString tempString;
aTextContent.Truncate();
while (!iter->IsDone()) {
nsIContent *content = iter->GetCurrentNode();
@ -2032,9 +2031,8 @@ nsGenericElement::HandleDOMEvent(nsPresContext* aPresContext,
if (NS_FAILED(ret = GetListenerManager(getter_AddRefs(listenerManager)))) {
return ret;
}
nsAutoString empty;
if (NS_FAILED(ret = listenerManager->CreateEvent(aPresContext, aEvent,
empty, aDOMEvent)))
EmptyString(), aDOMEvent)))
return ret;
}

Просмотреть файл

@ -393,8 +393,7 @@ nsPlainTextSerializer::AppendElementStart(nsIDOMElement *aElement,
rv = DoOpenContainer(nsnull, id);
}
else {
nsAutoString empty;
rv = DoAddLeaf(nsnull, id, empty);
rv = DoAddLeaf(nsnull, id, EmptyString());
}
mContent = 0;
@ -1748,7 +1747,6 @@ nsPlainTextSerializer::Write(const nsAString& aString)
// If needed, strip out all "end of lines"
// and multiple whitespace between words
PRInt32 nextpos;
nsAutoString tempstr;
const PRUnichar * offsetIntoBuffer = nsnull;
while (bol < totLen) { // Loop over lines

Просмотреть файл

@ -684,9 +684,7 @@ nsXMLDocument::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
}
// Create an empty document
nsAutoString emptyStr;
emptyStr.Truncate();
rv = NS_NewDOMDocument(getter_AddRefs(newDoc), emptyStr, emptyStr,
rv = NS_NewDOMDocument(getter_AddRefs(newDoc), EmptyString(), EmptyString(),
newDocType, mDocumentURI);
if (NS_FAILED(rv)) return rv;

Просмотреть файл

@ -692,9 +692,8 @@ nsXTFElementWrapper::HandleDOMEvent(nsPresContext* aPresContext,
if (NS_FAILED(rv = GetListenerManager(getter_AddRefs(listenerManager))))
return rv;
nsAutoString empty;
if (NS_FAILED(rv = listenerManager->CreateEvent(aPresContext, aEvent,
empty, aDOMEvent)))
EmptyString(), aDOMEvent)))
return rv;
}
if (!*aDOMEvent)

Просмотреть файл

@ -2048,8 +2048,10 @@ nsXULElement::HandleDOMEvent(nsPresContext* aPresContext, nsEvent* aEvent,
NS_ERROR("Unable to instantiate a listener manager on this event.");
return ret;
}
nsAutoString empty;
if (NS_FAILED(ret = listenerManager->CreateEvent(aPresContext, aEvent, empty, aDOMEvent))) {
if (NS_FAILED(ret = listenerManager->CreateEvent(aPresContext,
aEvent,
EmptyString(),
aDOMEvent))) {
NS_ERROR("This event will fail without the ability to create the event early.");
return ret;
}
@ -2118,8 +2120,10 @@ nsXULElement::HandleDOMEvent(nsPresContext* aPresContext, nsEvent* aEvent,
if (NS_FAILED(ret = GetListenerManager(getter_AddRefs(listenerManager)))) {
return ret;
}
nsAutoString empty;
if (NS_FAILED(ret = listenerManager->CreateEvent(aPresContext, aEvent, empty, aDOMEvent)))
if (NS_FAILED(ret = listenerManager->CreateEvent(aPresContext,
aEvent,
EmptyString(),
aDOMEvent)))
return ret;
if (!*aDOMEvent) {

Просмотреть файл

@ -212,8 +212,7 @@ NS_IMETHODIMP CreateElementTxn::RedoTransaction(void)
nsCOMPtr<nsIDOMCharacterData>nodeAsText = do_QueryInterface(mNewNode);
if (nodeAsText)
{
nsAutoString nullString;
nodeAsText->SetData(nullString);
nodeAsText->SetData(EmptyString());
}
// now, reinsert mNewNode

Просмотреть файл

@ -558,28 +558,26 @@ nsHTMLEditor::AbsolutelyPositionElement(nsIDOMElement * aElement,
}
}
else {
nsAutoString emptyStr;
mHTMLCSSUtils->RemoveCSSProperty(aElement,
nsEditProperty::cssPosition,
emptyStr, PR_FALSE);
EmptyString(), PR_FALSE);
mHTMLCSSUtils->RemoveCSSProperty(aElement,
nsEditProperty::cssTop,
emptyStr, PR_FALSE);
EmptyString(), PR_FALSE);
mHTMLCSSUtils->RemoveCSSProperty(aElement,
nsEditProperty::cssLeft,
emptyStr, PR_FALSE);
EmptyString(), PR_FALSE);
mHTMLCSSUtils->RemoveCSSProperty(aElement,
nsEditProperty::cssZIndex,
emptyStr, PR_FALSE);
EmptyString(), PR_FALSE);
if (!nsHTMLEditUtils::IsImage(aElement)) {
mHTMLCSSUtils->RemoveCSSProperty(aElement,
nsEditProperty::cssWidth,
emptyStr, PR_FALSE);
EmptyString(), PR_FALSE);
mHTMLCSSUtils->RemoveCSSProperty(aElement,
nsEditProperty::cssHeight,
emptyStr, PR_FALSE);
EmptyString(), PR_FALSE);
}
PRBool hasStyleOrIdOrClass;

Просмотреть файл

@ -346,10 +346,9 @@ nsHTMLEditor::GetPositionAndDimensions(nsIDOMElement * aElement,
res = mHTMLCSSUtils->GetDefaultViewCSS(aElement, getter_AddRefs(viewCSS));
if (NS_FAILED(res)) return res;
nsAutoString empty;
nsCOMPtr<nsIDOMCSSStyleDeclaration> cssDecl;
// Get the all the computed css styles attached to the element node
res = viewCSS->GetComputedStyle(aElement, empty, getter_AddRefs(cssDecl));
res = viewCSS->GetComputedStyle(aElement, EmptyString(), getter_AddRefs(cssDecl));
if (NS_FAILED(res)) return res;
aBorderLeft = GetCSSFloatValue(cssDecl, NS_LITERAL_STRING("border-left-width"));

Просмотреть файл

@ -565,11 +565,11 @@ nsHTMLCSSUtils::GetCSSInlinePropertyBase(nsIDOMNode *aNode, nsIAtom *aProperty,
switch (aStyleType) {
case COMPUTED_STYLE_TYPE:
if (element && aViewCSS) {
nsAutoString empty, value, propString;
nsAutoString value, propString;
nsCOMPtr<nsIDOMCSSStyleDeclaration> cssDecl;
aProperty->ToString(propString);
// Get the all the computed css styles attached to the element node
res = aViewCSS->GetComputedStyle(element, empty, getter_AddRefs(cssDecl));
res = aViewCSS->GetComputedStyle(element, EmptyString(), getter_AddRefs(cssDecl));
if (NS_FAILED(res)) return res;
// from these declarations, get the one we want and that one only
res = cssDecl->GetPropertyValue(propString, value);

Просмотреть файл

@ -222,14 +222,13 @@ nsWebDAVService::CreatePropfindDocument(nsIURI *resourceURI,
privImpl->Init(resourceURI);
nsCOMPtr<nsIDOMDocument> doc;
nsAutoString emptyString;
rv = implementation->CreateDocument(mDAVNSString, emptyString, nsnull,
rv = implementation->CreateDocument(mDAVNSString, EmptyString(), nsnull,
getter_AddRefs(doc));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDocument> baseDoc = do_QueryInterface(doc);
baseDoc->SetXMLDeclaration(NS_LITERAL_STRING("1.0").get(),
emptyString.get(), -1);
EmptyString().get(), -1);
baseDoc->SetDocumentURI(resourceURI);
nsCOMPtr<nsIDOMElement> elt;

Просмотреть файл

@ -45,15 +45,15 @@
* that was to overdo it a bit, when the code probably does not survive... (XXX)
*/
void
XPathCompilerException(const char *aMsg,
nsAString &aExpression,
PRInt32 aOffset = -1,
PRInt32 aLength = -1)
XPathCompilerException(const char *aMsg,
const nsAString &aExpression,
PRInt32 aOffset = -1,
PRInt32 aLength = -1)
{
printf("XPathCompilerException: %s, %s [o: %d, l: %d]\n",
aMsg,
NS_ConvertUCS2toUTF8(aExpression).get(), aOffset, aLength);
printf("WARNING: Houston we have a problem, and unlike Apollo 13, we're not going to make it!\n");
NS_ABORT();
}
@ -561,8 +561,7 @@ nsXFormsXPathParser::PathExpr()
if (DoRelative()) {
RelativeLocationPath();
} else {
nsAutoString nullstr;
XPathCompilerException("After / in a filter expression it is required to have a reletive path expression", nullstr);
XPathCompilerException("After / in a filter expression it is required to have a reletive path expression", EmptyString());
}
}

Просмотреть файл

@ -565,10 +565,9 @@ nsDOMParser::ParseFromStream(nsIInputStream *stream,
// Create an empty document from it
nsCOMPtr<nsIDOMDocument> domDocument;
nsAutoString emptyStr;
rv = implementation->CreateDocument(emptyStr,
emptyStr,
nsnull,
rv = implementation->CreateDocument(EmptyString(),
EmptyString(),
nsnull,
getter_AddRefs(domDocument));
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;

Просмотреть файл

@ -414,8 +414,7 @@ nsSVGLibartGlyphMetricsFT::InitializeFace()
if (!font_data.font_entry) {
// try to find *any* font
nsAutoString empty;
FindFont(empty, PR_FALSE, (void*)&font_data);
FindFont(EmptyString(), PR_FALSE, (void*)&font_data);
}
if (!font_data.font_entry) {

Просмотреть файл

@ -1565,8 +1565,7 @@ nsBrowserWindow::CreateToolBar(PRInt32 aWidth)
widget->SetForegroundColor(NS_RGB(0, 0, 0));
widget->SetBackgroundColor(NS_RGB(255, 255, 255));
PRUint32 size;
nsAutoString empty;
mLocation->SetText(empty, size);
mLocation->SetText(EmptyString(), size);
mLocation->SetMaxTextLength(MAX_TEXT_LENGTH);
NS_RELEASE(widget);
}