From 9415220bc1344eac6fbac76f9900adc310abc5d2 Mon Sep 17 00:00:00 2001 From: "sicking%bigfoot.com" Date: Sun, 19 Jan 2003 23:17:13 +0000 Subject: [PATCH] Remove txAtom.h and remove uses of special tx-macros for atoms. b=157142 r=Pike sr=peterv --- extensions/transformiix/source/base/txAtom.h | 0 .../transformiix/source/base/txAtoms.cpp | 2 +- extensions/transformiix/source/base/txAtoms.h | 2 +- .../source/base/txExpandedNameMap.cpp | 8 +- .../transformiix/source/xml/XMLUtils.cpp | 8 +- extensions/transformiix/source/xml/XMLUtils.h | 2 +- .../source/xml/dom/mozImpl/MozillaAttr.cpp | 2 +- .../source/xml/dom/mozImpl/mozilladom.h | 2 +- .../source/xml/dom/standalone/Attr.cpp | 16 ++-- .../source/xml/dom/standalone/Element.cpp | 27 +++---- .../xml/dom/standalone/NodeDefinition.cpp | 2 +- .../dom/standalone/ProcessingInstruction.cpp | 7 +- .../source/xml/dom/standalone/dom.h | 8 +- .../source/xpath/BooleanFunctionCall.cpp | 2 +- extensions/transformiix/source/xpath/Expr.h | 12 +-- .../transformiix/source/xpath/ExprParser.cpp | 37 ++++----- .../transformiix/source/xpath/ExprParser.h | 2 +- .../source/xpath/FunctionCall.cpp | 10 +-- .../source/xpath/NodeSetFunctionCall.cpp | 9 +-- .../source/xpath/NumberFunctionCall.cpp | 2 +- .../source/xpath/StringFunctionCall.cpp | 2 +- .../source/xpath/VariableRefExpr.cpp | 8 +- .../source/xpath/txIXPathContext.h | 2 +- .../transformiix/source/xpath/txNameTest.cpp | 13 +--- .../source/xpath/txNodeTypeTest.cpp | 20 ++--- .../source/xslt/ProcessorState.cpp | 7 +- .../source/xslt/XSLTProcessor.cpp | 78 +++++-------------- .../xslt/functions/CurrentFunctionCall.cpp | 2 +- .../xslt/functions/DocumentFunctionCall.cpp | 2 +- .../xslt/functions/ElementAvailableFnCall.cpp | 2 +- .../functions/FunctionAvailableFnCall.cpp | 2 +- .../xslt/functions/GenerateIdFunctionCall.cpp | 2 +- .../functions/SystemPropertyFunctionCall.cpp | 2 +- .../functions/txFormatNumberFunctionCall.cpp | 2 +- .../xslt/functions/txKeyFunctionCall.cpp | 2 +- .../transformiix/source/xslt/txHTMLOutput.cpp | 10 +-- .../source/xslt/txPatternParser.cpp | 14 ++-- .../transformiix/source/xslt/txXMLOutput.cpp | 3 +- .../transformiix/source/xslt/txXSLTNumber.cpp | 10 +-- .../source/xslt/txXSLTPatterns.cpp | 4 +- .../source/xslt/util/txNodeSorter.h | 2 +- 41 files changed, 134 insertions(+), 215 deletions(-) delete mode 100644 extensions/transformiix/source/base/txAtom.h diff --git a/extensions/transformiix/source/base/txAtom.h b/extensions/transformiix/source/base/txAtom.h deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/extensions/transformiix/source/base/txAtoms.cpp b/extensions/transformiix/source/base/txAtoms.cpp index 7300ab0a96c..8c5c49caa73 100644 --- a/extensions/transformiix/source/base/txAtoms.cpp +++ b/extensions/transformiix/source/base/txAtoms.cpp @@ -100,7 +100,7 @@ MBool txHTMLAtoms::init() #undef TX_ATOM #define TX_ATOM(_name, _value) \ -TX_IF_RELEASE_ATOM(_name) +NS_IF_RELEASE(_name) void txXMLAtoms::shutdown() { diff --git a/extensions/transformiix/source/base/txAtoms.h b/extensions/transformiix/source/base/txAtoms.h index 8cab54670c9..c5fa8831df1 100644 --- a/extensions/transformiix/source/base/txAtoms.h +++ b/extensions/transformiix/source/base/txAtoms.h @@ -39,7 +39,7 @@ #ifndef TRANSFRMX_ATOMS_H #define TRANSFRMX_ATOMS_H -#include "txAtom.h" +#include "nsIAtom.h" #include "baseutils.h" /* diff --git a/extensions/transformiix/source/base/txExpandedNameMap.cpp b/extensions/transformiix/source/base/txExpandedNameMap.cpp index 31ca35807f0..3b71a912911 100644 --- a/extensions/transformiix/source/base/txExpandedNameMap.cpp +++ b/extensions/transformiix/source/base/txExpandedNameMap.cpp @@ -85,7 +85,7 @@ nsresult txExpandedNameMap::add(const txExpandedName& aKey, TxObject* aValue) mItems[mItemCount].mNamespaceID = aKey.mNamespaceID; mItems[mItemCount].mLocalName = aKey.mLocalName; - TX_IF_ADDREF_ATOM(mItems[mItemCount].mLocalName); + NS_IF_ADDREF(mItems[mItemCount].mLocalName); mItems[mItemCount].mValue = aValue; ++mItemCount; @@ -130,7 +130,7 @@ nsresult txExpandedNameMap::set(const txExpandedName& aKey, TxObject* aValue) mItems[mItemCount].mNamespaceID = aKey.mNamespaceID; mItems[mItemCount].mLocalName = aKey.mLocalName; - TX_IF_ADDREF_ATOM(mItems[mItemCount].mLocalName); + NS_IF_ADDREF(mItems[mItemCount].mLocalName); mItems[mItemCount].mValue = aValue; ++mItemCount; @@ -167,7 +167,7 @@ TxObject* txExpandedNameMap::remove(const txExpandedName& aKey) for (i = 0; i < mItemCount; ++i) { if (mItems[i].mLocalName == aKey.mLocalName && mItems[i].mNamespaceID == aKey.mNamespaceID) { - TX_IF_RELEASE_ATOM(mItems[i].mLocalName); + NS_IF_RELEASE(mItems[i].mLocalName); if (mOwnsValues) { delete mItems[i].mValue; } @@ -190,7 +190,7 @@ void txExpandedNameMap::clear() { int i; for (i = 0; i < mItemCount; ++i) { - TX_IF_RELEASE_ATOM(mItems[i].mLocalName); + NS_IF_RELEASE(mItems[i].mLocalName); if (mOwnsValues) { delete mItems[i].mValue; } diff --git a/extensions/transformiix/source/xml/XMLUtils.cpp b/extensions/transformiix/source/xml/XMLUtils.cpp index 94ce2c21965..2ab7d178cc5 100644 --- a/extensions/transformiix/source/xml/XMLUtils.cpp +++ b/extensions/transformiix/source/xml/XMLUtils.cpp @@ -32,6 +32,7 @@ #include "XMLUtils.h" #include "nsString.h" #include "txAtoms.h" +#include "txStringUtils.h" nsresult txExpandedName::init(const nsAString& aQName, Node* aResolver, @@ -210,13 +211,10 @@ MBool XMLUtils::getXMLSpacePreserve(Node* aNode) if (parent->getNodeType() == Node::ELEMENT_NODE) { Element* elem = (Element*)parent; if (elem->getAttr(txXMLAtoms::space, kNameSpaceID_XML, value)) { - nsIAtom* val = TX_GET_ATOM(value); - if (val == txXMLAtoms::preserve) { - TX_IF_RELEASE_ATOM(val); + if (TX_StringEqualsAtom(value, txXMLAtoms::preserve)) { return MB_TRUE; } - if (val == txXMLAtoms::_default) { - TX_IF_RELEASE_ATOM(val); + if (TX_StringEqualsAtom(value, txXMLAtoms::_default)) { return MB_FALSE; } } diff --git a/extensions/transformiix/source/xml/XMLUtils.h b/extensions/transformiix/source/xml/XMLUtils.h index 5a4804d7f36..88961dd1ab0 100644 --- a/extensions/transformiix/source/xml/XMLUtils.h +++ b/extensions/transformiix/source/xml/XMLUtils.h @@ -33,7 +33,7 @@ #include "baseutils.h" #include "dom.h" #include "nsDependentSubstring.h" -#include "txAtom.h" +#include "nsIAtom.h" #include "txError.h" class txExpandedName { diff --git a/extensions/transformiix/source/xml/dom/mozImpl/MozillaAttr.cpp b/extensions/transformiix/source/xml/dom/mozImpl/MozillaAttr.cpp index bf89eeeda57..359b344213e 100644 --- a/extensions/transformiix/source/xml/dom/mozImpl/MozillaAttr.cpp +++ b/extensions/transformiix/source/xml/dom/mozImpl/MozillaAttr.cpp @@ -95,6 +95,6 @@ MBool Attr::getLocalName(nsIAtom** aLocalName) } *aLocalName = mLocalName; NS_ENSURE_TRUE(*aLocalName, MB_FALSE); - TX_ADDREF_ATOM(*aLocalName); + NS_ADDREF(*aLocalName); return MB_TRUE; } diff --git a/extensions/transformiix/source/xml/dom/mozImpl/mozilladom.h b/extensions/transformiix/source/xml/dom/mozImpl/mozilladom.h index 1e0d1c3432f..6226397010b 100644 --- a/extensions/transformiix/source/xml/dom/mozImpl/mozilladom.h +++ b/extensions/transformiix/source/xml/dom/mozImpl/mozilladom.h @@ -47,7 +47,7 @@ #include "nsIContent.h" #include "nsINameSpaceManager.h" #include "pldhash.h" -#include "txAtom.h" +#include "nsIAtom.h" #include "TxObject.h" #define kTxNsNodeIndexOffset 0x00000000; diff --git a/extensions/transformiix/source/xml/dom/standalone/Attr.cpp b/extensions/transformiix/source/xml/dom/standalone/Attr.cpp index 1adca9e1934..e299992a759 100644 --- a/extensions/transformiix/source/xml/dom/standalone/Attr.cpp +++ b/extensions/transformiix/source/xml/dom/standalone/Attr.cpp @@ -37,26 +37,25 @@ Attr::Attr(const nsAString& name, Document* owner): { int idx = nodeName.FindChar(':'); if (idx == kNotFound) { - mLocalName = TX_GET_ATOM(nodeName); + mLocalName = do_GetAtom(nodeName); if (mLocalName == txXMLAtoms::xmlns) mNamespaceID = kNameSpaceID_XMLNS; else mNamespaceID = kNameSpaceID_None; } else { - mLocalName = TX_GET_ATOM(Substring(nodeName, idx + 1, - nodeName.Length() - (idx + 1))); + mLocalName = do_GetAtom(Substring(nodeName, idx + 1, + nodeName.Length() - (idx + 1))); // namespace handling has to be handled late, the attribute must // be added to the tree to resolve the prefix, unless it's // xmlns or xml, try to do that here - nsIAtom* prefixAtom = TX_GET_ATOM(Substring(nodeName, 0, idx)); + nsCOMPtr prefixAtom = do_GetAtom(Substring(nodeName, 0, idx)); if (prefixAtom == txXMLAtoms::xmlns) mNamespaceID = kNameSpaceID_XMLNS; else if (prefixAtom == txXMLAtoms::xml) mNamespaceID = kNameSpaceID_XML; else mNamespaceID = kNameSpaceID_Unknown; - TX_IF_RELEASE_ATOM(prefixAtom); } } @@ -70,7 +69,7 @@ Attr::Attr(const nsAString& aNamespaceURI, else mNamespaceID = txNamespaceManager::getNamespaceID(aNamespaceURI); - XMLUtils::getLocalPart(nodeName, &mLocalName); + XMLUtils::getLocalPart(nodeName, getter_AddRefs(mLocalName)); } // @@ -78,7 +77,6 @@ Attr::Attr(const nsAString& aNamespaceURI, // Attr::~Attr() { - TX_IF_RELEASE_ATOM(mLocalName); } void Attr::setNodeValue(const nsAString& aValue) @@ -109,7 +107,7 @@ MBool Attr::getLocalName(nsIAtom** aLocalName) if (!aLocalName) return MB_FALSE; *aLocalName = mLocalName; - TX_ADDREF_ATOM(*aLocalName); + NS_ADDREF(*aLocalName); return MB_TRUE; } @@ -126,7 +124,7 @@ PRInt32 Attr::getNamespaceID() mNamespaceID = kNameSpaceID_None; PRInt32 idx = nodeName.FindChar(':'); if (idx != kNotFound) { - nsCOMPtr prefixAtom = TX_GET_ATOM(Substring(nodeName, 0, idx)); + nsCOMPtr prefixAtom = do_GetAtom(Substring(nodeName, 0, idx)); mNamespaceID = lookupNamespaceID(prefixAtom); } return mNamespaceID; diff --git a/extensions/transformiix/source/xml/dom/standalone/Element.cpp b/extensions/transformiix/source/xml/dom/standalone/Element.cpp index 0309183a644..2075a803447 100644 --- a/extensions/transformiix/source/xml/dom/standalone/Element.cpp +++ b/extensions/transformiix/source/xml/dom/standalone/Element.cpp @@ -42,11 +42,11 @@ Element::Element(const nsAString& tagName, Document* owner) : int idx = tagName.FindChar(':'); if (idx == kNotFound) { - mLocalName = TX_GET_ATOM(tagName); + mLocalName = do_GetAtom(tagName); } else { - mLocalName = TX_GET_ATOM(Substring(tagName, idx + 1, - tagName.Length() - (idx + 1))); + mLocalName = do_GetAtom(Substring(tagName, idx + 1, + tagName.Length() - (idx + 1))); } } @@ -69,7 +69,6 @@ Element::Element(const nsAString& aNamespaceURI, Element::~Element() { mAttributes.clear(); - TX_IF_RELEASE_ATOM(mLocalName); } Node* Element::appendChild(Node* newChild) @@ -104,7 +103,7 @@ MBool Element::getLocalName(nsIAtom** aLocalName) if (!aLocalName) return MB_FALSE; *aLocalName = mLocalName; - TX_ADDREF_ATOM(*aLocalName); + NS_ADDREF(*aLocalName); return MB_TRUE; } @@ -182,14 +181,12 @@ void Element::setAttributeNS(const nsAString& aNamespaceURI, AttrMap::ListItem* item = mAttributes.firstItem; while (item) { foundNode = (Attr*)item->node; - nsIAtom* attrName; - if (foundNode->getLocalName(&attrName) && + nsCOMPtr attrName; + if (foundNode->getLocalName(getter_AddRefs(attrName)) && namespaceID == foundNode->getNamespaceID() && localName == attrName) { - TX_IF_RELEASE_ATOM(attrName); break; } - TX_IF_RELEASE_ATOM(attrName); foundNode = 0; item = item->next; } @@ -226,15 +223,13 @@ MBool Element::getAttr(nsIAtom* aLocalName, PRInt32 aNSID, AttrMap::ListItem* item = mAttributes.firstItem; while (item) { Attr* attrNode = (Attr*)item->node; - nsIAtom* localName; - if (attrNode->getLocalName(&localName) && + nsCOMPtr localName; + if (attrNode->getLocalName(getter_AddRefs(localName)) && aNSID == attrNode->getNamespaceID() && aLocalName == localName) { attrNode->getNodeValue(aValue); - TX_IF_RELEASE_ATOM(localName); return MB_TRUE; } - TX_IF_RELEASE_ATOM(localName); item = item->next; } return MB_FALSE; @@ -249,14 +244,12 @@ MBool Element::hasAttr(nsIAtom* aLocalName, PRInt32 aNSID) AttrMap::ListItem* item = mAttributes.firstItem; while (item) { Attr* attrNode = (Attr*)item->node; - nsIAtom* localName; - if (attrNode->getLocalName(&localName) && + nsCOMPtr localName; + if (attrNode->getLocalName(getter_AddRefs(localName)) && aNSID == attrNode->getNamespaceID() && aLocalName == localName) { - TX_IF_RELEASE_ATOM(localName); return MB_TRUE; } - TX_IF_RELEASE_ATOM(localName); item = item->next; } return MB_FALSE; diff --git a/extensions/transformiix/source/xml/dom/standalone/NodeDefinition.cpp b/extensions/transformiix/source/xml/dom/standalone/NodeDefinition.cpp index 3b0cb9fa3ce..e4de2448539 100644 --- a/extensions/transformiix/source/xml/dom/standalone/NodeDefinition.cpp +++ b/extensions/transformiix/source/xml/dom/standalone/NodeDefinition.cpp @@ -309,7 +309,7 @@ PRInt32 NodeDefinition::lookupNamespaceID(nsIAtom* aPrefix) if (aPrefix && (aPrefix != txXMLAtoms::_empty)) { // We have a prefix, search for xmlns:prefix attributes. nsAutoString prefixString; - TX_GET_ATOM_STRING(aPrefix, prefixString); + aPrefix->ToString(prefixString); name.Append(prefixString); } else { diff --git a/extensions/transformiix/source/xml/dom/standalone/ProcessingInstruction.cpp b/extensions/transformiix/source/xml/dom/standalone/ProcessingInstruction.cpp index b499034a328..0ed78fe33bf 100644 --- a/extensions/transformiix/source/xml/dom/standalone/ProcessingInstruction.cpp +++ b/extensions/transformiix/source/xml/dom/standalone/ProcessingInstruction.cpp @@ -30,7 +30,7 @@ // #include "dom.h" -#include "txAtom.h" +#include "nsIAtom.h" // //Construct a text object with the specified document owner and data @@ -41,7 +41,7 @@ ProcessingInstruction::ProcessingInstruction(const nsAString& theTarget, NodeDefinition(Node::PROCESSING_INSTRUCTION_NODE, theTarget, theData, owner) { - mLocalName = TX_GET_ATOM(nodeName); + mLocalName = do_GetAtom(nodeName); } // @@ -49,7 +49,6 @@ ProcessingInstruction::ProcessingInstruction(const nsAString& theTarget, // ProcessingInstruction::~ProcessingInstruction() { - TX_IF_RELEASE_ATOM(mLocalName); } // @@ -62,6 +61,6 @@ MBool ProcessingInstruction::getLocalName(nsIAtom** aLocalName) if (!aLocalName) return MB_FALSE; *aLocalName = mLocalName; - TX_ADDREF_ATOM(*aLocalName); + NS_ADDREF(*aLocalName); return MB_TRUE; } diff --git a/extensions/transformiix/source/xml/dom/standalone/dom.h b/extensions/transformiix/source/xml/dom/standalone/dom.h index 3c68d2a68cf..1e7457c26f9 100644 --- a/extensions/transformiix/source/xml/dom/standalone/dom.h +++ b/extensions/transformiix/source/xml/dom/standalone/dom.h @@ -39,7 +39,7 @@ #endif #include "List.h" -#include "txAtom.h" +#include "nsIAtom.h" #include "baseutils.h" #include "nsString.h" #include "nsVoidArray.h" @@ -431,7 +431,7 @@ class Element : public NodeDefinition Document* aOwner); AttrMap mAttributes; - nsIAtom* mLocalName; + nsCOMPtr mLocalName; PRInt32 mNamespaceID; }; @@ -470,7 +470,7 @@ class Attr : public NodeDefinition Element* ownerElement; - nsIAtom* mLocalName; + nsCOMPtr mLocalName; PRInt32 mNamespaceID; }; @@ -495,7 +495,7 @@ class ProcessingInstruction : public NodeDefinition ProcessingInstruction(const nsAString& theTarget, const nsAString& theData, Document* owner); - nsIAtom* mLocalName; + nsCOMPtr mLocalName; }; class txNamespaceManager diff --git a/extensions/transformiix/source/xpath/BooleanFunctionCall.cpp b/extensions/transformiix/source/xpath/BooleanFunctionCall.cpp index b6a82a11256..50181ae862c 100644 --- a/extensions/transformiix/source/xpath/BooleanFunctionCall.cpp +++ b/extensions/transformiix/source/xpath/BooleanFunctionCall.cpp @@ -154,6 +154,6 @@ nsresult BooleanFunctionCall::getNameAtom(nsIAtom** aAtom) return NS_ERROR_FAILURE; } } - TX_ADDREF_ATOM(*aAtom); + NS_ADDREF(*aAtom); return NS_OK; } diff --git a/extensions/transformiix/source/xpath/Expr.h b/extensions/transformiix/source/xpath/Expr.h index 6af1886bced..f816a5d8945 100644 --- a/extensions/transformiix/source/xpath/Expr.h +++ b/extensions/transformiix/source/xpath/Expr.h @@ -39,7 +39,7 @@ #include "dom.h" #include "List.h" #include "nsString.h" -#include "txAtom.h" +#include "nsIAtom.h" #include "TxObject.h" /* @@ -232,8 +232,8 @@ public: TX_DECL_NODE_TEST; private: - nsIAtom* mPrefix; - nsIAtom* mLocalName; + nsCOMPtr mPrefix; + nsCOMPtr mLocalName; PRInt32 mNamespace; Node::NodeType mNodeType; }; @@ -267,7 +267,7 @@ public: private: NodeType mNodeType; - nsIAtom* mNodeName; + nsCOMPtr mNodeName; }; /** @@ -560,8 +560,8 @@ public: TX_DECL_EXPR; private: - nsIAtom* mPrefix; - nsIAtom* mLocalName; + nsCOMPtr mPrefix; + nsCOMPtr mLocalName; PRInt32 mNamespace; }; diff --git a/extensions/transformiix/source/xpath/ExprParser.cpp b/extensions/transformiix/source/xpath/ExprParser.cpp index 7a848de88a3..19e6214eacc 100644 --- a/extensions/transformiix/source/xpath/ExprParser.cpp +++ b/extensions/transformiix/source/xpath/ExprParser.cpp @@ -326,17 +326,16 @@ Expr* ExprParser::createFilterExpr(ExprLexer& lexer, txIParseContext* aContext) break; case Token::VAR_REFERENCE : { - nsIAtom *prefix, *lName; + nsCOMPtr prefix, lName; PRInt32 nspace; - nsresult rv = resolveQName(tok->value, prefix, aContext, - lName, nspace); + nsresult rv = resolveQName(tok->value, *getter_AddRefs(prefix), + aContext, *getter_AddRefs(lName), + nspace); if (NS_FAILED(rv)) { // XXX error report namespace resolve failed return 0; } expr = new VariableRefExpr(prefix, lName, nspace); - TX_IF_RELEASE_ATOM(prefix); - TX_IF_RELEASE_ATOM(lName); } break; case Token::L_PAREN: @@ -490,16 +489,15 @@ Expr* ExprParser::createFunctionCall(ExprLexer& lexer, fnCall = new NumberFunctionCall(NumberFunctionCall::FLOOR); } else { - nsIAtom *prefix, *lName; + nsCOMPtr prefix, lName; PRInt32 namespaceID; - rv = resolveQName(tok->value, prefix, aContext, lName, namespaceID); + rv = resolveQName(tok->value, *getter_AddRefs(prefix), aContext, + *getter_AddRefs(lName), namespaceID); if (NS_FAILED(rv)) { // XXX error report namespace resolve failed return 0; } rv = aContext->resolveFunctionCall(lName, namespaceID, fnCall); - TX_IF_RELEASE_ATOM(prefix); - TX_IF_RELEASE_ATOM(lName); // XXX this should be removed once we don't return // NS_ERROR_NOT_IMPLEMENTED for unparsed-entity-uri(). As should the @@ -640,10 +638,12 @@ LocationStep* ExprParser::createLocationStep(ExprLexer& lexer, case Token::CNAME : { // resolve QName - nsIAtom *prefix, *lName; + nsCOMPtr prefix, lName; PRInt32 nspace; - nsresult rv = resolveQName(tok->value, prefix, aContext, - lName, nspace); + nsresult rv = resolveQName(tok->value, + *getter_AddRefs(prefix), + aContext, + *getter_AddRefs(lName), nspace); if (NS_FAILED(rv)) { // XXX error report namespace resolve failed return 0; @@ -658,8 +658,6 @@ LocationStep* ExprParser::createLocationStep(ExprLexer& lexer, Node::ELEMENT_NODE); break; } - TX_IF_RELEASE_ATOM(prefix); - TX_IF_RELEASE_ATOM(lName); } if (!nodeTest) { //XXX ErrorReport: out of memory @@ -1019,22 +1017,21 @@ nsresult ExprParser::resolveQName(const nsAString& aQName, aNamespace = kNameSpaceID_None; PRInt32 idx = aQName.FindChar(':'); if (idx > 0) { - aPrefix = TX_GET_ATOM(Substring(aQName, 0, (PRUint32)idx)); + aPrefix = NS_NewAtom(Substring(aQName, 0, (PRUint32)idx)); if (!aPrefix) { return NS_ERROR_OUT_OF_MEMORY; } - aLocalName = TX_GET_ATOM(Substring(aQName, (PRUint32)idx + 1, - aQName.Length() - (idx + 1))); + aLocalName = NS_NewAtom(Substring(aQName, (PRUint32)idx + 1, + aQName.Length() - (idx + 1))); if (!aLocalName) { - TX_RELEASE_ATOM(aPrefix); - aPrefix = 0; + NS_RELEASE(aPrefix); return NS_ERROR_OUT_OF_MEMORY; } return aContext->resolveNamespacePrefix(aPrefix, aNamespace); } // the lexer dealt with idx == 0 aPrefix = 0; - aLocalName = TX_GET_ATOM(aQName); + aLocalName = NS_NewAtom(aQName); if (!aLocalName) { return NS_ERROR_OUT_OF_MEMORY; } diff --git a/extensions/transformiix/source/xpath/ExprParser.h b/extensions/transformiix/source/xpath/ExprParser.h index 1986c290e5b..873cb1005cd 100644 --- a/extensions/transformiix/source/xpath/ExprParser.h +++ b/extensions/transformiix/source/xpath/ExprParser.h @@ -33,7 +33,7 @@ #define MITREXSL_EXPRPARSER_H #include "baseutils.h" -#include "txAtom.h" +#include "nsIAtom.h" #include "txError.h" class AttributeValueTemplate; diff --git a/extensions/transformiix/source/xpath/FunctionCall.cpp b/extensions/transformiix/source/xpath/FunctionCall.cpp index 62be1fcd8c3..f0c2c262112 100644 --- a/extensions/transformiix/source/xpath/FunctionCall.cpp +++ b/extensions/transformiix/source/xpath/FunctionCall.cpp @@ -25,7 +25,7 @@ #include "Expr.h" #include "ExprResult.h" -#include "txAtom.h" +#include "nsIAtom.h" #include "txIXPathContext.h" /** @@ -176,15 +176,13 @@ MBool FunctionCall::requireParams(int paramCountMin, txIEvalContext* aContext) **/ void FunctionCall::toString(nsAString& aDest) { - nsIAtom* functionNameAtom = 0; + nsCOMPtr functionNameAtom; nsAutoString functionName; - if (!NS_SUCCEEDED(getNameAtom(&functionNameAtom)) || - !TX_GET_ATOM_STRING(functionNameAtom, functionName)) { + if (NS_FAILED(getNameAtom(getter_AddRefs(functionNameAtom))) || + NS_FAILED(functionNameAtom->ToString(functionName))) { NS_ASSERTION(0, "Can't get function name."); - TX_IF_RELEASE_ATOM(functionNameAtom); return; } - TX_RELEASE_ATOM(functionNameAtom); aDest.Append(functionName); aDest.Append(PRUnichar('(')); diff --git a/extensions/transformiix/source/xpath/NodeSetFunctionCall.cpp b/extensions/transformiix/source/xpath/NodeSetFunctionCall.cpp index 1c693a32ba5..29826a82462 100644 --- a/extensions/transformiix/source/xpath/NodeSetFunctionCall.cpp +++ b/extensions/transformiix/source/xpath/NodeSetFunctionCall.cpp @@ -161,12 +161,11 @@ ExprResult* NodeSetFunctionCall::evaluate(txIEvalContext* aContext) { case LOCAL_NAME: { nsAutoString localName; - nsIAtom* localNameAtom; - node->getLocalName(&localNameAtom); + nsCOMPtr localNameAtom; + node->getLocalName(getter_AddRefs(localNameAtom)); if (localNameAtom) { // Node has a localName - TX_GET_ATOM_STRING(localNameAtom, localName); - TX_RELEASE_ATOM(localNameAtom); + localNameAtom->ToString(localName); } return new StringResult(localName); @@ -264,6 +263,6 @@ nsresult NodeSetFunctionCall::getNameAtom(nsIAtom** aAtom) return NS_ERROR_FAILURE; } } - TX_ADDREF_ATOM(*aAtom); + NS_ADDREF(*aAtom); return NS_OK; } diff --git a/extensions/transformiix/source/xpath/NumberFunctionCall.cpp b/extensions/transformiix/source/xpath/NumberFunctionCall.cpp index d229ecf5480..99b55b999ed 100644 --- a/extensions/transformiix/source/xpath/NumberFunctionCall.cpp +++ b/extensions/transformiix/source/xpath/NumberFunctionCall.cpp @@ -172,6 +172,6 @@ nsresult NumberFunctionCall::getNameAtom(nsIAtom** aAtom) return NS_ERROR_FAILURE; } } - TX_ADDREF_ATOM(*aAtom); + NS_ADDREF(*aAtom); return NS_OK; } diff --git a/extensions/transformiix/source/xpath/StringFunctionCall.cpp b/extensions/transformiix/source/xpath/StringFunctionCall.cpp index 15783de60bc..cbd45695a52 100644 --- a/extensions/transformiix/source/xpath/StringFunctionCall.cpp +++ b/extensions/transformiix/source/xpath/StringFunctionCall.cpp @@ -310,6 +310,6 @@ nsresult StringFunctionCall::getNameAtom(nsIAtom** aAtom) return NS_ERROR_FAILURE; } } - TX_ADDREF_ATOM(*aAtom); + NS_ADDREF(*aAtom); return NS_OK; } diff --git a/extensions/transformiix/source/xpath/VariableRefExpr.cpp b/extensions/transformiix/source/xpath/VariableRefExpr.cpp index 077998aafb6..8339a1a345b 100644 --- a/extensions/transformiix/source/xpath/VariableRefExpr.cpp +++ b/extensions/transformiix/source/xpath/VariableRefExpr.cpp @@ -42,8 +42,6 @@ VariableRefExpr::VariableRefExpr(nsIAtom* aPrefix, nsIAtom* aLocalName, NS_ASSERTION(mLocalName, "VariableRefExpr without local name?"); if (mPrefix == txXMLAtoms::_empty) mPrefix = 0; - TX_IF_ADDREF_ATOM(mPrefix); - TX_IF_ADDREF_ATOM(mLocalName); } /* @@ -51,8 +49,6 @@ VariableRefExpr::VariableRefExpr(nsIAtom* aPrefix, nsIAtom* aLocalName, */ VariableRefExpr::~VariableRefExpr() { - TX_IF_RELEASE_ATOM(mPrefix); - TX_IF_RELEASE_ATOM(mLocalName); } /** @@ -86,11 +82,11 @@ void VariableRefExpr::toString(nsAString& aDest) aDest.Append(PRUnichar('$')); if (mPrefix) { nsAutoString prefix; - TX_GET_ATOM_STRING(mPrefix, prefix); + mPrefix->ToString(prefix); aDest.Append(prefix); aDest.Append(PRUnichar(':')); } nsAutoString lname; - TX_GET_ATOM_STRING(mLocalName, lname); + mLocalName->ToString(lname); aDest.Append(lname); } //-- toString diff --git a/extensions/transformiix/source/xpath/txIXPathContext.h b/extensions/transformiix/source/xpath/txIXPathContext.h index f3e2474c2b6..4e73cecf6f5 100644 --- a/extensions/transformiix/source/xpath/txIXPathContext.h +++ b/extensions/transformiix/source/xpath/txIXPathContext.h @@ -40,7 +40,7 @@ #define __TX_I_XPATH_CONTEXT #include "baseutils.h" -#include "txAtom.h" +#include "nsIAtom.h" #include "txError.h" class ExprResult; diff --git a/extensions/transformiix/source/xpath/txNameTest.cpp b/extensions/transformiix/source/xpath/txNameTest.cpp index 44a8193011d..7b63a478a4c 100644 --- a/extensions/transformiix/source/xpath/txNameTest.cpp +++ b/extensions/transformiix/source/xpath/txNameTest.cpp @@ -35,14 +35,10 @@ txNameTest::txNameTest(nsIAtom* aPrefix, nsIAtom* aLocalName, PRInt32 aNSID, if (aPrefix == txXMLAtoms::_empty) mPrefix = 0; NS_ASSERTION(aLocalName, "txNameTest without a local name?"); - TX_IF_ADDREF_ATOM(mPrefix); - TX_IF_ADDREF_ATOM(mLocalName); } txNameTest::~txNameTest() { - TX_IF_RELEASE_ATOM(mPrefix); - TX_IF_RELEASE_ATOM(mLocalName); } /* @@ -66,12 +62,9 @@ MBool txNameTest::matches(Node* aNode, txIMatchContext* aContext) return MB_TRUE; // Compare local-names - nsIAtom* localName; - aNode->getLocalName(&localName); - MBool result = localName == mLocalName; - TX_IF_RELEASE_ATOM(localName); - - return result; + nsCOMPtr localName; + aNode->getLocalName(getter_AddRefs(localName)); + return localName == mLocalName; } /* diff --git a/extensions/transformiix/source/xpath/txNodeTypeTest.cpp b/extensions/transformiix/source/xpath/txNodeTypeTest.cpp index 7ff1f4b9842..76e8fd5132b 100644 --- a/extensions/transformiix/source/xpath/txNodeTypeTest.cpp +++ b/extensions/transformiix/source/xpath/txNodeTypeTest.cpp @@ -24,25 +24,24 @@ */ #include "Expr.h" -#include "txAtom.h" +#include "nsIAtom.h" #include "txIXPathContext.h" /* * Creates a new txNodeTypeTest of the given type */ txNodeTypeTest::txNodeTypeTest(NodeType aNodeType) - : mNodeType(aNodeType), mNodeName(0) + : mNodeType(aNodeType) { } txNodeTypeTest::~txNodeTypeTest() { - TX_IF_RELEASE_ATOM(mNodeName); } void txNodeTypeTest::setNodeName(const nsAString& aName) { - mNodeName = TX_GET_ATOM(aName); + mNodeName = do_GetAtom(aName); } /* @@ -64,13 +63,10 @@ MBool txNodeTypeTest::matches(Node* aNode, txIMatchContext* aContext) !aContext->isStripSpaceAllowed(aNode); case PI_TYPE: if (type == Node::PROCESSING_INSTRUCTION_NODE) { - nsIAtom* localName = 0; - MBool result; - result = !mNodeName || - (aNode->getLocalName(&localName) && - localName == mNodeName); - TX_IF_RELEASE_ATOM(localName); - return result; + nsCOMPtr localName; + return !mNodeName || + (aNode->getLocalName(getter_AddRefs(localName)) && + localName == mNodeName); } return MB_FALSE; case NODE_TYPE: @@ -107,7 +103,7 @@ void txNodeTypeTest::toString(nsAString& aDest) aDest.Append(NS_LITERAL_STRING("processing-instruction(")); if (mNodeName) { nsAutoString str; - TX_GET_ATOM_STRING(mNodeName, str); + mNodeName->ToString(str); aDest.Append(PRUnichar('\'')); aDest.Append(str); aDest.Append(PRUnichar('\'')); diff --git a/extensions/transformiix/source/xslt/ProcessorState.cpp b/extensions/transformiix/source/xslt/ProcessorState.cpp index 40a26cb962a..b518b682107 100644 --- a/extensions/transformiix/source/xslt/ProcessorState.cpp +++ b/extensions/transformiix/source/xslt/ProcessorState.cpp @@ -154,12 +154,11 @@ void ProcessorState::addAttributeSet(Element* aAttributeSet, PRInt32 nsID = node->getNamespaceID(); if (nsID != kNameSpaceID_XSLT) continue; - nsIAtom* nodeName; - if (!node->getLocalName(&nodeName) || !nodeName) + nsCOMPtr nodeName; + if (!node->getLocalName(getter_AddRefs(nodeName)) || !nodeName) continue; if (nodeName == txXSLTAtoms::attribute) attSet->append(node); - TX_RELEASE_ATOM(nodeName); } node = node->getNextSibling(); } @@ -485,7 +484,7 @@ Node* ProcessorState::findTemplate(Node* aNode, #ifdef PR_LOGGING nsAutoString mode, nodeName; if (aMode.mLocalName) { - TX_GET_ATOM_STRING(aMode.mLocalName, mode); + aMode.mLocalName->ToString(mode); } aNode->getNodeName(nodeName); if (matchTemplate) { diff --git a/extensions/transformiix/source/xslt/XSLTProcessor.cpp b/extensions/transformiix/source/xslt/XSLTProcessor.cpp index 6c2db0424ff..7daa483aef7 100644 --- a/extensions/transformiix/source/xslt/XSLTProcessor.cpp +++ b/extensions/transformiix/source/xslt/XSLTProcessor.cpp @@ -333,8 +333,8 @@ txXSLTProcessor::processAction(Node* aAction, } Expr* expr = 0; - nsIAtom* localName; - aAction->getLocalName(&localName); + nsCOMPtr localName; + aAction->getLocalName(getter_AddRefs(localName)); // xsl:apply-imports if (localName == txXSLTAtoms::applyImports) { ProcessorState::TemplateRule* curr; @@ -345,7 +345,6 @@ txXSLTProcessor::processAction(Node* aAction, if (!curr) { aPs->receiveError(NS_LITERAL_STRING("apply-imports not allowed here"), NS_ERROR_FAILURE); - TX_RELEASE_ATOM(localName); return; } @@ -365,13 +364,11 @@ txXSLTProcessor::processAction(Node* aAction, expr = gNodeExpr; if (!expr) { - TX_RELEASE_ATOM(localName); return; } ExprResult* exprResult = expr->evaluate(aPs->getEvalContext()); if (!exprResult) { - TX_RELEASE_ATOM(localName); return; } @@ -379,7 +376,6 @@ txXSLTProcessor::processAction(Node* aAction, NodeSet* nodeSet = (NodeSet*)exprResult; if (nodeSet->isEmpty()) { delete nodeSet; - TX_RELEASE_ATOM(localName); return; } @@ -389,12 +385,11 @@ txXSLTProcessor::processAction(Node* aAction, while (child) { if (child->getNodeType() == Node::ELEMENT_NODE && child->getNamespaceID() == kNameSpaceID_XSLT) { - nsIAtom* childLocalName; - child->getLocalName(&childLocalName); + nsCOMPtr childLocalName; + child->getLocalName(getter_AddRefs(childLocalName)); if (childLocalName == txXSLTAtoms::sort) { sorter.addSortElement((Element*)child); } - TX_IF_RELEASE_ATOM(childLocalName); } child = child->getNextSibling(); } @@ -412,7 +407,6 @@ txXSLTProcessor::processAction(Node* aAction, rv = mode.init(modeStr, actionElement, MB_FALSE); if (NS_FAILED(rv)) { aPs->receiveError(NS_LITERAL_STRING("malformed mode-name in xsl:apply-templates")); - TX_IF_RELEASE_ATOM(localName); return; } } @@ -444,7 +438,6 @@ txXSLTProcessor::processAction(Node* aAction, if (!actionElement->getAttr(txXSLTAtoms::name, kNameSpaceID_None, nameAttr)) { aPs->receiveError(NS_LITERAL_STRING("missing required name attribute for xsl:attribute"), NS_ERROR_FAILURE); - TX_RELEASE_ATOM(localName); return; } @@ -457,18 +450,13 @@ txXSLTProcessor::processAction(Node* aAction, aPs->receiveError(NS_LITERAL_STRING("error processing xsl:attribute, ") + name + NS_LITERAL_STRING(" is not a valid QName."), NS_ERROR_FAILURE); - TX_RELEASE_ATOM(localName); return; } - nsIAtom* nameAtom = TX_GET_ATOM(name); - if (nameAtom == txXMLAtoms::xmlns) { - TX_RELEASE_ATOM(nameAtom); + if (TX_StringEqualsAtom(name, txXMLAtoms::xmlns)) { aPs->receiveError(NS_LITERAL_STRING("error processing xsl:attribute, name is xmlns."), NS_ERROR_FAILURE); - TX_RELEASE_ATOM(localName); return; } - TX_IF_RELEASE_ATOM(nameAtom); // Determine namespace URI from the namespace attribute or // from the prefix of the name (using the xslt action element). @@ -495,7 +483,6 @@ txXSLTProcessor::processAction(Node* aAction, // XXX Should verify that this is correct behaviour. Signal error too? if (resultNsID == kNameSpaceID_Unknown) { - TX_RELEASE_ATOM(localName); return; } @@ -546,13 +533,12 @@ txXSLTProcessor::processAction(Node* aAction, } Element* xslTemplate = (Element*)condition; - nsIAtom* conditionLocalName; - condition->getLocalName(&conditionLocalName); + nsCOMPtr conditionLocalName; + condition->getLocalName(getter_AddRefs(conditionLocalName)); if (conditionLocalName == txXSLTAtoms::when) { expr = aPs->getExpr(xslTemplate, ProcessorState::TestAttr); if (!expr) { - TX_RELEASE_ATOM(conditionLocalName); condition = condition->getNextSibling(); continue; } @@ -569,7 +555,6 @@ txXSLTProcessor::processAction(Node* aAction, processChildren(xslTemplate, aPs); caseFound = MB_TRUE; } - TX_IF_RELEASE_ATOM(conditionLocalName); condition = condition->getNextSibling(); } // end for-each child of xsl:choose } @@ -597,7 +582,6 @@ txXSLTProcessor::processAction(Node* aAction, else if (localName == txXSLTAtoms::copyOf) { expr = aPs->getExpr(actionElement, ProcessorState::SelectAttr); if (!expr) { - TX_RELEASE_ATOM(localName); return; } @@ -611,7 +595,6 @@ txXSLTProcessor::processAction(Node* aAction, if (!actionElement->getAttr(txXSLTAtoms::name, kNameSpaceID_None, nameAttr)) { aPs->receiveError(NS_LITERAL_STRING("missing required name attribute for xsl:element"), NS_ERROR_FAILURE); - TX_RELEASE_ATOM(localName); return; } @@ -626,7 +609,6 @@ txXSLTProcessor::processAction(Node* aAction, NS_ERROR_FAILURE); // XXX We should processChildren without creating attributes or // namespace nodes. - TX_RELEASE_ATOM(localName); return; } @@ -654,7 +636,6 @@ txXSLTProcessor::processAction(Node* aAction, NS_ERROR_FAILURE); // XXX We should processChildren without creating attributes or // namespace nodes. - TX_RELEASE_ATOM(localName); return; } @@ -669,13 +650,11 @@ txXSLTProcessor::processAction(Node* aAction, else if (localName == txXSLTAtoms::forEach) { expr = aPs->getExpr(actionElement, ProcessorState::SelectAttr); if (!expr) { - TX_RELEASE_ATOM(localName); return; } ExprResult* exprResult = expr->evaluate(aPs->getEvalContext()); if (!exprResult) { - TX_RELEASE_ATOM(localName); return; } @@ -683,7 +662,6 @@ txXSLTProcessor::processAction(Node* aAction, NodeSet* nodeSet = (NodeSet*)exprResult; if (nodeSet->isEmpty()) { delete nodeSet; - TX_RELEASE_ATOM(localName); return; } txNodeSetContext evalContext(nodeSet, aPs); @@ -696,16 +674,14 @@ txXSLTProcessor::processAction(Node* aAction, while (child) { unsigned short nodeType = child->getNodeType(); if (nodeType == Node::ELEMENT_NODE) { - nsIAtom* childLocalName; - child->getLocalName(&childLocalName); + nsCOMPtr childLocalName; + child->getLocalName(getter_AddRefs(childLocalName)); if (child->getNamespaceID() != kNameSpaceID_XSLT || childLocalName != txXSLTAtoms::sort) { // xsl:sort must occur first - TX_IF_RELEASE_ATOM(childLocalName); break; } sorter.addSortElement((Element*)child); - TX_RELEASE_ATOM(childLocalName); } else if ((nodeType == Node::TEXT_NODE || nodeType == Node::CDATA_SECTION_NODE) && @@ -741,13 +717,11 @@ txXSLTProcessor::processAction(Node* aAction, else if (localName == txXSLTAtoms::_if) { expr = aPs->getExpr(actionElement, ProcessorState::TestAttr); if (!expr) { - TX_RELEASE_ATOM(localName); return; } ExprResult* exprResult = expr->evaluate(aPs->getEvalContext()); if (!exprResult) { - TX_RELEASE_ATOM(localName); return; } @@ -782,7 +756,6 @@ txXSLTProcessor::processAction(Node* aAction, if (!actionElement->getAttr(txXSLTAtoms::name, kNameSpaceID_None, nameAttr)) { aPs->receiveError(NS_LITERAL_STRING("missing required name attribute for xsl:processing-instruction"), NS_ERROR_FAILURE); - TX_RELEASE_ATOM(localName); return; } @@ -834,7 +807,6 @@ txXSLTProcessor::processAction(Node* aAction, else if (localName == txXSLTAtoms::valueOf) { expr = aPs->getExpr(actionElement, ProcessorState::SelectAttr); if (!expr) { - TX_RELEASE_ATOM(localName); return; } @@ -843,7 +815,6 @@ txXSLTProcessor::processAction(Node* aAction, if (!exprResult) { aPs->receiveError(NS_LITERAL_STRING("null ExprResult"), NS_ERROR_FAILURE); - TX_RELEASE_ATOM(localName); return; } exprResult->stringValue(value); @@ -875,12 +846,10 @@ txXSLTProcessor::processAction(Node* aAction, if (NS_FAILED(rv)) { aPs->receiveError(NS_LITERAL_STRING("bad name for xsl:variable"), NS_ERROR_FAILURE); - TX_RELEASE_ATOM(localName); return; } ExprResult* exprResult = processVariable(actionElement, aPs); if (!exprResult) { - TX_RELEASE_ATOM(localName); return; } @@ -892,7 +861,6 @@ txXSLTProcessor::processAction(Node* aAction, NS_ERROR_FAILURE); } } - TX_IF_RELEASE_ATOM(localName); } void @@ -1125,10 +1093,9 @@ txXSLTProcessor::processParameters(Element* aAction, while (tmpNode) { if (tmpNode->getNodeType() == Node::ELEMENT_NODE && tmpNode->getNamespaceID() == kNameSpaceID_XSLT) { - nsIAtom* localName; - tmpNode->getLocalName(&localName); + nsCOMPtr localName; + tmpNode->getLocalName(getter_AddRefs(localName)); if (localName != txXSLTAtoms::withParam) { - TX_IF_RELEASE_ATOM(localName); tmpNode = tmpNode->getNextSibling(); continue; } @@ -1156,7 +1123,6 @@ txXSLTProcessor::processParameters(Element* aAction, NS_ERROR_FAILURE); return rv; } - TX_RELEASE_ATOM(localName); } tmpNode = tmpNode->getNextSibling(); } @@ -1189,9 +1155,9 @@ txXSLTProcessor::processStylesheet(Document* aStylesheet, Element* elem = aStylesheet->getDocumentElement(); - nsIAtom* localName; + nsCOMPtr localName; PRInt32 namespaceID = elem->getNamespaceID(); - elem->getLocalName(&localName); + elem->getLocalName(getter_AddRefs(localName)); if (((localName == txXSLTAtoms::stylesheet) || (localName == txXSLTAtoms::transform)) && @@ -1201,13 +1167,11 @@ txXSLTProcessor::processStylesheet(Document* aStylesheet, else { NS_ASSERTION(aImportFrame->current(), "no current importframe"); if (!aImportFrame->current()) { - TX_IF_RELEASE_ATOM(localName); return; } aPs->addLREStylesheet(aStylesheet, (ProcessorState::ImportFrame*)aImportFrame->current()); } - TX_IF_RELEASE_ATOM(localName); } void @@ -1228,14 +1192,12 @@ txXSLTProcessor::processTemplate(Node* aTemplate, while (tmpNode) { int nodeType = tmpNode->getNodeType(); if (nodeType == Node::ELEMENT_NODE) { - nsIAtom* localName; - tmpNode->getLocalName(&localName); + nsCOMPtr localName; + tmpNode->getLocalName(getter_AddRefs(localName)); if (tmpNode->getNamespaceID() != kNameSpaceID_XSLT || localName != txXSLTAtoms::param) { - TX_RELEASE_ATOM(localName); break; } - TX_RELEASE_ATOM(localName); Element* action = (Element*)tmpNode; txExpandedName paramName; @@ -1319,8 +1281,8 @@ txXSLTProcessor::processTopLevel(Element* aStylesheet, Node* node = aStylesheet->getFirstChild(); while (node && !importsDone) { if (node->getNodeType() == Node::ELEMENT_NODE) { - nsIAtom* localName; - node->getLocalName(&localName); + nsCOMPtr localName; + node->getLocalName(getter_AddRefs(localName)); if (node->getNamespaceID() == kNameSpaceID_XSLT && localName == txXSLTAtoms::import) { Element* element = (Element*)node; @@ -1352,7 +1314,6 @@ txXSLTProcessor::processTopLevel(Element* aStylesheet, else { importsDone = MB_TRUE; } - TX_IF_RELEASE_ATOM(localName); } if (!importsDone) node = node->getNextSibling(); @@ -1365,8 +1326,8 @@ txXSLTProcessor::processTopLevel(Element* aStylesheet, continue; } - nsIAtom* localName; - node->getLocalName(&localName); + nsCOMPtr localName; + node->getLocalName(getter_AddRefs(localName)); Element* element = (Element*)node; // xsl:attribute-set if (localName == txXSLTAtoms::attributeSet) { @@ -1585,7 +1546,6 @@ txXSLTProcessor::processTopLevel(Element* aStylesheet, currentFrame); } } - TX_IF_RELEASE_ATOM(localName); node = node->getNextSibling(); } } diff --git a/extensions/transformiix/source/xslt/functions/CurrentFunctionCall.cpp b/extensions/transformiix/source/xslt/functions/CurrentFunctionCall.cpp index 9e0ce71a5dc..322eb334913 100644 --- a/extensions/transformiix/source/xslt/functions/CurrentFunctionCall.cpp +++ b/extensions/transformiix/source/xslt/functions/CurrentFunctionCall.cpp @@ -28,6 +28,6 @@ ExprResult* CurrentFunctionCall::evaluate(txIEvalContext* aContext) nsresult CurrentFunctionCall::getNameAtom(nsIAtom** aAtom) { *aAtom = txXSLTAtoms::current; - TX_ADDREF_ATOM(*aAtom); + NS_ADDREF(*aAtom); return NS_OK; } diff --git a/extensions/transformiix/source/xslt/functions/DocumentFunctionCall.cpp b/extensions/transformiix/source/xslt/functions/DocumentFunctionCall.cpp index 6418abf6dc8..61a1da3bbcc 100644 --- a/extensions/transformiix/source/xslt/functions/DocumentFunctionCall.cpp +++ b/extensions/transformiix/source/xslt/functions/DocumentFunctionCall.cpp @@ -131,6 +131,6 @@ ExprResult* DocumentFunctionCall::evaluate(txIEvalContext* aContext) nsresult DocumentFunctionCall::getNameAtom(nsIAtom** aAtom) { *aAtom = txXSLTAtoms::document; - TX_ADDREF_ATOM(*aAtom); + NS_ADDREF(*aAtom); return NS_OK; } diff --git a/extensions/transformiix/source/xslt/functions/ElementAvailableFnCall.cpp b/extensions/transformiix/source/xslt/functions/ElementAvailableFnCall.cpp index ae117f9786a..45ae8c55ef4 100644 --- a/extensions/transformiix/source/xslt/functions/ElementAvailableFnCall.cpp +++ b/extensions/transformiix/source/xslt/functions/ElementAvailableFnCall.cpp @@ -136,6 +136,6 @@ ExprResult* ElementAvailableFunctionCall::evaluate(txIEvalContext* aContext) nsresult ElementAvailableFunctionCall::getNameAtom(nsIAtom** aAtom) { *aAtom = txXSLTAtoms::elementAvailable; - TX_ADDREF_ATOM(*aAtom); + NS_ADDREF(*aAtom); return NS_OK; } diff --git a/extensions/transformiix/source/xslt/functions/FunctionAvailableFnCall.cpp b/extensions/transformiix/source/xslt/functions/FunctionAvailableFnCall.cpp index a40822d547b..0ece240f0ba 100644 --- a/extensions/transformiix/source/xslt/functions/FunctionAvailableFnCall.cpp +++ b/extensions/transformiix/source/xslt/functions/FunctionAvailableFnCall.cpp @@ -135,6 +135,6 @@ ExprResult* FunctionAvailableFunctionCall::evaluate(txIEvalContext* aContext) nsresult FunctionAvailableFunctionCall::getNameAtom(nsIAtom** aAtom) { *aAtom = txXSLTAtoms::functionAvailable; - TX_ADDREF_ATOM(*aAtom); + NS_ADDREF(*aAtom); return NS_OK; } diff --git a/extensions/transformiix/source/xslt/functions/GenerateIdFunctionCall.cpp b/extensions/transformiix/source/xslt/functions/GenerateIdFunctionCall.cpp index 00ac12f8dec..a91754924d0 100644 --- a/extensions/transformiix/source/xslt/functions/GenerateIdFunctionCall.cpp +++ b/extensions/transformiix/source/xslt/functions/GenerateIdFunctionCall.cpp @@ -96,6 +96,6 @@ ExprResult* GenerateIdFunctionCall::evaluate(txIEvalContext* aContext) nsresult GenerateIdFunctionCall::getNameAtom(nsIAtom** aAtom) { *aAtom = txXSLTAtoms::generateId; - TX_ADDREF_ATOM(*aAtom); + NS_ADDREF(*aAtom); return NS_OK; } diff --git a/extensions/transformiix/source/xslt/functions/SystemPropertyFunctionCall.cpp b/extensions/transformiix/source/xslt/functions/SystemPropertyFunctionCall.cpp index 6e829889049..42bcc691f33 100644 --- a/extensions/transformiix/source/xslt/functions/SystemPropertyFunctionCall.cpp +++ b/extensions/transformiix/source/xslt/functions/SystemPropertyFunctionCall.cpp @@ -67,6 +67,6 @@ ExprResult* SystemPropertyFunctionCall::evaluate(txIEvalContext* aContext) nsresult SystemPropertyFunctionCall::getNameAtom(nsIAtom** aAtom) { *aAtom = txXSLTAtoms::systemProperty; - TX_ADDREF_ATOM(*aAtom); + NS_ADDREF(*aAtom); return NS_OK; } diff --git a/extensions/transformiix/source/xslt/functions/txFormatNumberFunctionCall.cpp b/extensions/transformiix/source/xslt/functions/txFormatNumberFunctionCall.cpp index e64d6cec7b0..ae5f6b0a15d 100644 --- a/extensions/transformiix/source/xslt/functions/txFormatNumberFunctionCall.cpp +++ b/extensions/transformiix/source/xslt/functions/txFormatNumberFunctionCall.cpp @@ -392,7 +392,7 @@ ExprResult* txFormatNumberFunctionCall::evaluate(txIEvalContext* aContext) nsresult txFormatNumberFunctionCall::getNameAtom(nsIAtom** aAtom) { *aAtom = txXSLTAtoms::formatNumber; - TX_ADDREF_ATOM(*aAtom); + NS_ADDREF(*aAtom); return NS_OK; } diff --git a/extensions/transformiix/source/xslt/functions/txKeyFunctionCall.cpp b/extensions/transformiix/source/xslt/functions/txKeyFunctionCall.cpp index 4c6cc880183..618504bae64 100644 --- a/extensions/transformiix/source/xslt/functions/txKeyFunctionCall.cpp +++ b/extensions/transformiix/source/xslt/functions/txKeyFunctionCall.cpp @@ -109,7 +109,7 @@ ExprResult* txKeyFunctionCall::evaluate(txIEvalContext* aContext) nsresult txKeyFunctionCall::getNameAtom(nsIAtom** aAtom) { *aAtom = txXSLTAtoms::key; - TX_ADDREF_ATOM(*aAtom); + NS_ADDREF(*aAtom); return NS_OK; } diff --git a/extensions/transformiix/source/xslt/txHTMLOutput.cpp b/extensions/transformiix/source/xslt/txHTMLOutput.cpp index b606644f0a2..a3aa649799c 100644 --- a/extensions/transformiix/source/xslt/txHTMLOutput.cpp +++ b/extensions/transformiix/source/xslt/txHTMLOutput.cpp @@ -216,7 +216,7 @@ void txHTMLOutput::attribute(const nsAString& aName, localPart.Equals(aValue, txCaseInsensitiveStringComparator())) { txListIterator iter(&mAttributes); txAttribute* setAtt = 0; - nsIAtom* localName = TX_GET_ATOM(localPart); + nsCOMPtr localName = do_GetAtom(localPart); txExpandedName att(aNsID, localName); while ((setAtt = (txAttribute*)iter.next())) { if (setAtt->mName == att) { @@ -229,7 +229,6 @@ void txHTMLOutput::attribute(const nsAString& aName, setAtt->mShorthand = MB_TRUE; mAttributes.add(setAtt); } - TX_IF_RELEASE_ATOM(localName); } } if (!shortHand) @@ -304,18 +303,17 @@ void txHTMLOutput::startElement(const nsAString& aName, { txXMLOutput::startElement(aName, aNsID); - nsIAtom* localAtom; + nsCOMPtr localAtom; if (aNsID == kNameSpaceID_None) { nsAutoString localName; TX_ToLowerCase(aName, localName); - localAtom = TX_GET_ATOM(localName); + localAtom = do_GetAtom(localName); } else { - localAtom = TX_GET_ATOM(aName); + localAtom = do_GetAtom(aName); } NS_ASSERTION(localAtom, "Can't get atom"); txExpandedName* currentElement = new txExpandedName(aNsID, localAtom); - TX_IF_RELEASE_ATOM(localAtom); NS_ASSERTION(currentElement, "Can't create currentElement"); if (currentElement) mCurrentElements.push(currentElement); diff --git a/extensions/transformiix/source/xslt/txPatternParser.cpp b/extensions/transformiix/source/xslt/txPatternParser.cpp index 5828e956e31..ef16e03b0c3 100644 --- a/extensions/transformiix/source/xslt/txPatternParser.cpp +++ b/extensions/transformiix/source/xslt/txPatternParser.cpp @@ -262,15 +262,14 @@ nsresult txPatternParser::createKeyPattern(ExprLexer& aLexer, if (!XMLUtils::isValidQName(key)) return NS_ERROR_XPATH_PARSE_FAILED; - nsIAtom *prefix = 0, *localName = 0; + nsCOMPtr prefix, localName; PRInt32 namespaceID; - nsresult rv = resolveQName(key, prefix, aContext, localName, namespaceID); + nsresult rv = resolveQName(key, *getter_AddRefs(prefix), aContext, + *getter_AddRefs(localName), namespaceID); if (NS_FAILED(rv)) return rv; aPattern = new txKeyPattern(aPs, prefix, localName, namespaceID, value); - TX_IF_RELEASE_ATOM(prefix); - TX_RELEASE_ATOM(localName); return aPattern ? NS_OK : NS_ERROR_OUT_OF_MEMORY; } @@ -302,9 +301,10 @@ nsresult txPatternParser::createStepPattern(ExprLexer& aLexer, txNodeTest* nodeTest = 0; if (tok->type == Token::CNAME) { // resolve QName - nsIAtom *prefix, *lName; + nsCOMPtr prefix, lName; PRInt32 nspace; - rv = resolveQName(tok->value, prefix, aContext, lName, nspace); + rv = resolveQName(tok->value, *getter_AddRefs(prefix), aContext, + *getter_AddRefs(lName), nspace); if (NS_FAILED(rv)) { // XXX error report namespace resolve failed return rv; @@ -317,8 +317,6 @@ nsresult txPatternParser::createStepPattern(ExprLexer& aLexer, nodeTest = new txNameTest(prefix, lName, nspace, Node::ELEMENT_NODE); } - TX_IF_RELEASE_ATOM(prefix); - TX_IF_RELEASE_ATOM(lName); if (!nodeTest) { return NS_ERROR_OUT_OF_MEMORY; } diff --git a/extensions/transformiix/source/xslt/txXMLOutput.cpp b/extensions/transformiix/source/xslt/txXMLOutput.cpp index 1e85a93d9df..6f75e11ba37 100644 --- a/extensions/transformiix/source/xslt/txXMLOutput.cpp +++ b/extensions/transformiix/source/xslt/txXMLOutput.cpp @@ -246,9 +246,8 @@ void txXMLOutput::startElement(const nsAString& aName, mCDATASections.push((void*)mInCDATASection); mInCDATASection = MB_FALSE; - nsIAtom* localName = TX_GET_ATOM(aName); + nsCOMPtr localName = do_GetAtom(aName); txExpandedName currentElement(aNsID, localName); - TX_IF_RELEASE_ATOM(localName); txListIterator iter(&(mOutputFormat.mCDATASectionElements)); while (iter.hasNext()) { if (currentElement == *(txExpandedName*)iter.next()) { diff --git a/extensions/transformiix/source/xslt/txXSLTNumber.cpp b/extensions/transformiix/source/xslt/txXSLTNumber.cpp index 03b3dac0ad8..5437936c54a 100644 --- a/extensions/transformiix/source/xslt/txXSLTNumber.cpp +++ b/extensions/transformiix/source/xslt/txXSLTNumber.cpp @@ -150,12 +150,11 @@ nsresult txXSLTNumber::getValueList(Element* aNumberElement, switch (currNode->getNodeType()) { case Node::ELEMENT_NODE: { - nsIAtom* localName = 0; - currNode->getLocalName(&localName); + nsCOMPtr localName; + currNode->getLocalName(getter_AddRefs(localName)); nodeTest = new txNameTest(0, localName, currNode->getNamespaceID(), Node::ELEMENT_NODE); - TX_IF_RELEASE_ATOM(localName); break; } case Node::TEXT_NODE: @@ -218,9 +217,9 @@ nsresult txXSLTNumber::getValueList(Element* aNumberElement, // Generate list of values depending on the value of the level-attribute nsAutoString levelStr; - nsIAtom* level = 0; + nsCOMPtr level; if (aNumberElement->getAttr(txXSLTAtoms::level, kNameSpaceID_None, levelStr)) { - level = TX_GET_ATOM(levelStr); + level = do_GetAtom(levelStr); } // level = "single" @@ -325,7 +324,6 @@ nsresult txXSLTNumber::getValueList(Element* aNumberElement, if (ownsCountPattern) { delete countPattern; } - TX_IF_RELEASE_ATOM(level); return NS_OK; } diff --git a/extensions/transformiix/source/xslt/txXSLTPatterns.cpp b/extensions/transformiix/source/xslt/txXSLTPatterns.cpp index 7fc32ee810e..bf6f1ff90b0 100644 --- a/extensions/transformiix/source/xslt/txXSLTPatterns.cpp +++ b/extensions/transformiix/source/xslt/txXSLTPatterns.cpp @@ -456,11 +456,11 @@ void txKeyPattern::toString(nsAString& aDest) aDest.Append(NS_LITERAL_STRING("key('")); nsAutoString tmp; if (mPrefix) { - TX_GET_ATOM_STRING(mPrefix, tmp); + mPrefix->ToString(tmp); aDest.Append(tmp); aDest.Append(PRUnichar(':')); } - TX_GET_ATOM_STRING(mName.mLocalName, tmp); + mName.mLocalName->ToString(tmp); aDest.Append(tmp); aDest.Append(NS_LITERAL_STRING(", ")); aDest.Append(mValue); diff --git a/extensions/transformiix/source/xslt/util/txNodeSorter.h b/extensions/transformiix/source/xslt/util/txNodeSorter.h index 2b1ca5eeec7..2596e10dd0f 100644 --- a/extensions/transformiix/source/xslt/util/txNodeSorter.h +++ b/extensions/transformiix/source/xslt/util/txNodeSorter.h @@ -42,7 +42,7 @@ #include "baseutils.h" #include "List.h" -#include "txAtom.h" +#include "nsIAtom.h" class Element; class Expr;