From ead4b5d13d5a31972e82b83bc11000235c754b73 Mon Sep 17 00:00:00 2001 From: "peterv%propagandism.org" Date: Tue, 4 May 2004 19:36:39 +0000 Subject: [PATCH] Fix for bug 187907 (Expr::toString should be removed or debug-only). r=Pike, sr=jst. git-svn-id: svn://10.0.0.236/trunk@155931 18797224-902f-48f8-a5cc-f745e15eee43 --- .../transformiix/source/base/Makefile.in | 6 +- .../source/base/txStringUtils.cpp | 28 --------- .../transformiix/source/base/txStringUtils.h | 10 +++- .../source/xpath/AdditiveExpr.cpp | 17 ++---- .../source/xpath/AttributeValueTemplate.cpp | 17 ++---- .../transformiix/source/xpath/BooleanExpr.cpp | 18 ++---- .../source/xpath/BooleanFunctionCall.cpp | 5 +- .../transformiix/source/xpath/Expr.h | 60 ++++++++++++++----- .../transformiix/source/xpath/ExprParser.cpp | 8 ++- .../transformiix/source/xpath/FilterExpr.cpp | 13 ++-- .../source/xpath/FunctionCall.cpp | 20 +++---- .../source/xpath/LocationStep.cpp | 14 ++--- .../source/xpath/MultiplicativeExpr.cpp | 18 ++---- .../source/xpath/NodeSetFunctionCall.cpp | 5 +- .../source/xpath/NumberFunctionCall.cpp | 5 +- .../transformiix/source/xpath/PathExpr.cpp | 15 ++--- .../source/xpath/PredicateList.cpp | 5 +- .../source/xpath/RelationalExpr.cpp | 2 + .../transformiix/source/xpath/RootExpr.cpp | 24 ++------ .../source/xpath/StringFunctionCall.cpp | 5 +- .../transformiix/source/xpath/UnaryExpr.cpp | 13 ++-- .../transformiix/source/xpath/UnionExpr.cpp | 17 ++---- .../source/xpath/VariableRefExpr.cpp | 15 ++--- .../source/xpath/nsXPathNSResolver.cpp | 2 +- .../source/xpath/txLiteralExpr.cpp | 2 + .../transformiix/source/xpath/txNameTest.cpp | 10 ++-- .../source/xpath/txNodeTypeTest.cpp | 10 ++-- .../xslt/functions/CurrentFunctionCall.cpp | 5 +- .../xslt/functions/DocumentFunctionCall.cpp | 5 +- .../xslt/functions/ElementAvailableFnCall.cpp | 5 +- .../functions/FunctionAvailableFnCall.cpp | 5 +- .../xslt/functions/GenerateIdFunctionCall.cpp | 5 +- .../functions/SystemPropertyFunctionCall.cpp | 5 +- .../functions/txFormatNumberFunctionCall.cpp | 21 ++++++- .../xslt/functions/txKeyFunctionCall.cpp | 5 +- .../source/xslt/txPatternParser.cpp | 10 +++- .../source/xslt/txStandaloneXSLTProcessor.cpp | 10 ++-- .../transformiix/source/xslt/txStylesheet.cpp | 2 + .../xslt/txStylesheetCompileHandlers.cpp | 3 +- .../source/xslt/txStylesheetCompiler.cpp | 2 +- .../source/xslt/txXSLTPatterns.cpp | 39 ++++++++---- .../transformiix/source/xslt/txXSLTPatterns.h | 50 +++++++++++----- 42 files changed, 293 insertions(+), 243 deletions(-) diff --git a/mozilla/extensions/transformiix/source/base/Makefile.in b/mozilla/extensions/transformiix/source/base/Makefile.in index 0c9681e9914..ae8c8c7af37 100644 --- a/mozilla/extensions/transformiix/source/base/Makefile.in +++ b/mozilla/extensions/transformiix/source/base/Makefile.in @@ -66,11 +66,11 @@ CPPSRCS = Double.cpp \ txAtoms.cpp \ txExpandedNameMap.cpp \ txNamespaceMap.cpp \ - txURIUtils.cpp \ - txStringUtils.cpp + txURIUtils.cpp ifdef TX_EXE -CPPSRCS += SimpleErrorObserver.cpp +CPPSRCS += SimpleErrorObserver.cpp \ + txStringUtils.cpp endif # we don't want the shared lib, but we want to force the creation of a diff --git a/mozilla/extensions/transformiix/source/base/txStringUtils.cpp b/mozilla/extensions/transformiix/source/base/txStringUtils.cpp index f477a6da090..6a22b755f55 100644 --- a/mozilla/extensions/transformiix/source/base/txStringUtils.cpp +++ b/mozilla/extensions/transformiix/source/base/txStringUtils.cpp @@ -40,32 +40,6 @@ #include "txStringUtils.h" #include "nsDependentString.h" -PRBool -TX_StringEqualsAtom(const nsASingleFragmentString& aString, nsIAtom* aAtom) -{ - const char* ASCIIAtom; - aAtom->GetUTF8String(&ASCIIAtom); - - PRUint32 UTF16Length = aString.Length(); - if (strlen(ASCIIAtom) != UTF16Length) { - return PR_FALSE; - } - - const PRUnichar* UTF16Iter; - aString.BeginReading(UTF16Iter); - - while (*ASCIIAtom) { - if (PRUnichar(*ASCIIAtom) != *UTF16Iter) { - return PR_FALSE; - } - ++ASCIIAtom; - ++UTF16Iter; - } - - return PR_TRUE; -} - -#ifdef TX_EXE int txCaseInsensitiveStringComparator::operator()(const char_type* lhs, const char_type* rhs, @@ -177,5 +151,3 @@ void TX_ToLowerCase(const nsAString& aSource, nsAString& aDest) copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), converter); } - -#endif diff --git a/mozilla/extensions/transformiix/source/base/txStringUtils.h b/mozilla/extensions/transformiix/source/base/txStringUtils.h index a33d91df216..6022ccadc1c 100644 --- a/mozilla/extensions/transformiix/source/base/txStringUtils.h +++ b/mozilla/extensions/transformiix/source/base/txStringUtils.h @@ -46,8 +46,14 @@ /** * Check equality between a string and an atom containing ASCII. */ -PRBool -TX_StringEqualsAtom(const nsASingleFragmentString& aString, nsIAtom* aAtom); +inline PRBool +TX_StringEqualsAtom(const nsASingleFragmentString& aString, nsIAtom* aAtom) +{ + const char* ASCIIAtom; + aAtom->GetUTF8String(&ASCIIAtom); + + return aString.EqualsASCII(ASCIIAtom); +} #ifndef TX_EXE diff --git a/mozilla/extensions/transformiix/source/xpath/AdditiveExpr.cpp b/mozilla/extensions/transformiix/source/xpath/AdditiveExpr.cpp index da9d18d6cc5..4b30360ea97 100644 --- a/mozilla/extensions/transformiix/source/xpath/AdditiveExpr.cpp +++ b/mozilla/extensions/transformiix/source/xpath/AdditiveExpr.cpp @@ -84,16 +84,10 @@ AdditiveExpr::evaluate(txIEvalContext* aContext, txAExprResult** aResult) return aContext->recycler()->getNumberResult(result, aResult); } //-- evaluate -/** - * Returns the String representation of this Expr. - * @param dest the String to use when creating the String - * representation. The String representation will be appended to - * any data in the destination String, to allow cascading calls to - * other #toString() methods for Expressions. - * @return the String representation of this Expr. -**/ -void AdditiveExpr::toString(nsAString& str) { - +#ifdef TX_TO_STRING +void +AdditiveExpr::toString(nsAString& str) +{ if ( leftExpr ) leftExpr->toString(str); else str.Append(NS_LITERAL_STRING("null")); @@ -108,5 +102,6 @@ void AdditiveExpr::toString(nsAString& str) { if ( rightExpr ) rightExpr->toString(str); else str.Append(NS_LITERAL_STRING("null")); -} //-- toString +} +#endif diff --git a/mozilla/extensions/transformiix/source/xpath/AttributeValueTemplate.cpp b/mozilla/extensions/transformiix/source/xpath/AttributeValueTemplate.cpp index 296ee5f0727..8234baf8ab2 100644 --- a/mozilla/extensions/transformiix/source/xpath/AttributeValueTemplate.cpp +++ b/mozilla/extensions/transformiix/source/xpath/AttributeValueTemplate.cpp @@ -100,15 +100,10 @@ AttributeValueTemplate::evaluate(txIEvalContext* aContext, return NS_OK; } //-- evaluate -/** -* Returns the String representation of this Expr. -* @param dest the String to use when creating the String -* representation. The String representation will be appended to -* any data in the destination String, to allow cascading calls to -* other #toString() methods for Expressions. -* @return the String representation of this Expr. -**/ -void AttributeValueTemplate::toString(nsAString& str) { +#ifdef TX_TO_STRING +void +AttributeValueTemplate::toString(nsAString& str) +{ txListIterator iter(&expressions); while (iter.hasNext()) { str.Append(PRUnichar('{')); @@ -116,5 +111,5 @@ void AttributeValueTemplate::toString(nsAString& str) { expr->toString(str); str.Append(PRUnichar('}')); } -} //-- toString - +} +#endif diff --git a/mozilla/extensions/transformiix/source/xpath/BooleanExpr.cpp b/mozilla/extensions/transformiix/source/xpath/BooleanExpr.cpp index 7c1debfd94a..94755e80d65 100644 --- a/mozilla/extensions/transformiix/source/xpath/BooleanExpr.cpp +++ b/mozilla/extensions/transformiix/source/xpath/BooleanExpr.cpp @@ -85,16 +85,10 @@ BooleanExpr::evaluate(txIEvalContext* aContext, txAExprResult** aResult) return NS_OK; } //-- evaluate -/** - * Returns the String representation of this Expr. - * @param dest the String to use when creating the String - * representation. The String representation will be appended to - * any data in the destination String, to allow cascading calls to - * other #toString() methods for Expressions. - * @return the String representation of this Expr. -**/ -void BooleanExpr::toString(nsAString& str) { - +#ifdef TX_TO_STRING +void +BooleanExpr::toString(nsAString& str) +{ if ( leftExpr ) leftExpr->toString(str); else str.Append(NS_LITERAL_STRING("null")); @@ -109,5 +103,5 @@ void BooleanExpr::toString(nsAString& str) { if ( rightExpr ) rightExpr->toString(str); else str.Append(NS_LITERAL_STRING("null")); -} //-- toString - +} +#endif diff --git a/mozilla/extensions/transformiix/source/xpath/BooleanFunctionCall.cpp b/mozilla/extensions/transformiix/source/xpath/BooleanFunctionCall.cpp index 10eaec99bb4..78d5cdd4e0b 100644 --- a/mozilla/extensions/transformiix/source/xpath/BooleanFunctionCall.cpp +++ b/mozilla/extensions/transformiix/source/xpath/BooleanFunctionCall.cpp @@ -142,7 +142,9 @@ BooleanFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult) return NS_ERROR_UNEXPECTED; } -nsresult BooleanFunctionCall::getNameAtom(nsIAtom** aAtom) +#ifdef TX_TO_STRING +nsresult +BooleanFunctionCall::getNameAtom(nsIAtom** aAtom) { switch (mType) { case TX_BOOLEAN: @@ -179,3 +181,4 @@ nsresult BooleanFunctionCall::getNameAtom(nsIAtom** aAtom) NS_ADDREF(*aAtom); return NS_OK; } +#endif diff --git a/mozilla/extensions/transformiix/source/xpath/Expr.h b/mozilla/extensions/transformiix/source/xpath/Expr.h index b8e3821f621..db01b42b183 100644 --- a/mozilla/extensions/transformiix/source/xpath/Expr.h +++ b/mozilla/extensions/transformiix/source/xpath/Expr.h @@ -49,6 +49,10 @@ #include "nsAutoPtr.h" #include "ExprResult.h" +#ifdef DEBUG +#define TX_TO_STRING +#endif + /* XPath class definitions. Much of this code was ported from XSL:P. @@ -84,6 +88,7 @@ public: virtual nsresult evaluate(txIEvalContext* aContext, txAExprResult** aResult) = 0; +#ifdef TX_TO_STRING /** * Returns the String representation of this Expr. * @param dest the String to use when creating the String @@ -93,12 +98,16 @@ public: * @return the String representation of this Expr. **/ virtual void toString(nsAString& str) = 0; - +#endif }; //-- Expr #define TX_DECL_EVALUATE \ nsresult evaluate(txIEvalContext* aContext, txAExprResult** aResult) +#ifndef TX_TO_STRING +#define TX_DECL_EXPR TX_DECL_EVALUATE +#define TX_DECL_FUNCTION TX_DECL_EVALUATE +#else #define TX_DECL_EXPR \ TX_DECL_EVALUATE; \ void toString(nsAString& aDest) @@ -106,6 +115,7 @@ public: #define TX_DECL_FUNCTION \ TX_DECL_EVALUATE; \ nsresult getNameAtom(nsIAtom** aAtom) +#endif /** * This class represents a FunctionCall as defined by the XPath 1.0 @@ -116,11 +126,6 @@ class FunctionCall : public Expr { public: virtual ~FunctionCall(); - /** - * Virtual methods from Expr - **/ - void toString(nsAString& aDest); - /** * Adds the given parameter to this FunctionCall's parameter list. * The ownership of the given Expr is passed over to the FunctionCall, @@ -145,6 +150,10 @@ public: PRInt32 aParamCountMax, txIEvalContext* aContext); +#ifdef TX_TO_STRING + void toString(nsAString& aDest); +#endif + protected: txList params; @@ -175,10 +184,12 @@ protected: nsresult evaluateToNodeSet(Expr* aExpr, txIEvalContext* aContext, txNodeSet** aResult); +#ifdef TX_TO_STRING /* * Returns the name of the function as an atom. */ virtual nsresult getNameAtom(nsIAtom** aAtom) = 0; +#endif }; //-- FunctionCall @@ -221,13 +232,23 @@ public: virtual PRBool matches(const txXPathNode& aNode, txIMatchContext* aContext) = 0; virtual double getDefaultPriority() = 0; + +#ifdef TX_TO_STRING virtual void toString(nsAString& aDest) = 0; +#endif }; -#define TX_DECL_NODE_TEST \ +#define TX_DECL_NODE_TEST_BASE \ PRBool matches(const txXPathNode& aNode, txIMatchContext* aContext); \ - double getDefaultPriority(); \ + double getDefaultPriority() + +#ifndef TX_TO_STRING +#define TX_DECL_NODE_TEST TX_DECL_NODE_TEST_BASE +#else +#define TX_DECL_NODE_TEST \ + TX_DECL_NODE_TEST_BASE; \ void toString(nsAString& aDest) +#endif /* * This class represents a NameTest as defined by the XPath spec @@ -319,6 +340,7 @@ public: **/ MBool isEmpty(); +#ifdef TX_TO_STRING /** * Returns the String representation of this PredicateList. * @param dest the String to use when creating the String @@ -328,6 +350,7 @@ public: * @return the String representation of this PredicateList. **/ virtual void toString(nsAString& dest); +#endif protected: //-- list of predicates @@ -635,21 +658,30 @@ private: * This class represents a RootExpr, which only matches the Document node **/ class RootExpr : public Expr { - public: - /** * Creates a new RootExpr - * @param aSerialize should this RootExpr be serialized */ - RootExpr(MBool aSerialize); + RootExpr() +#ifdef TX_TO_STRING + : mSerialize(PR_TRUE) +#endif + { + } TX_DECL_EXPR; +#ifdef TX_TO_STRING +public: + void setSerialize(PRBool aSerialize) + { + mSerialize = aSerialize; + } + private: // When a RootExpr is used in a PathExpr it shouldn't be serialized - MBool mSerialize; - + PRBool mSerialize; +#endif }; //-- RootExpr /** diff --git a/mozilla/extensions/transformiix/source/xpath/ExprParser.cpp b/mozilla/extensions/transformiix/source/xpath/ExprParser.cpp index 0a32d2ebdb8..f8280800156 100644 --- a/mozilla/extensions/transformiix/source/xpath/ExprParser.cpp +++ b/mozilla/extensions/transformiix/source/xpath/ExprParser.cpp @@ -792,7 +792,7 @@ txExprParser::createPathExpr(txExprLexer& lexer, txIParseContext* aContext, if (tok->mType == Token::PARENT_OP) { lexer.nextToken(); if (!isLocationStepToken(lexer.peek())) { - *aResult = new RootExpr(MB_TRUE); + *aResult = new RootExpr(); NS_ENSURE_TRUE(*aResult, NS_ERROR_OUT_OF_MEMORY); return NS_OK; } @@ -820,8 +820,12 @@ txExprParser::createPathExpr(txExprLexer& lexer, txIParseContext* aContext, } } else { - expr = new RootExpr(MB_FALSE); + expr = new RootExpr(); NS_ENSURE_TRUE(expr, NS_ERROR_OUT_OF_MEMORY); + +#ifdef TX_TO_STRING + NS_STATIC_CAST(RootExpr*, expr.get())->setSerialize(PR_FALSE); +#endif } // We have a PathExpr containing several steps diff --git a/mozilla/extensions/transformiix/source/xpath/FilterExpr.cpp b/mozilla/extensions/transformiix/source/xpath/FilterExpr.cpp index 4f8fca4e266..5e8c0191f0c 100644 --- a/mozilla/extensions/transformiix/source/xpath/FilterExpr.cpp +++ b/mozilla/extensions/transformiix/source/xpath/FilterExpr.cpp @@ -86,14 +86,13 @@ FilterExpr::evaluate(txIEvalContext* aContext, txAExprResult** aResult) return NS_OK; } //-- evaluate -/** - * Creates a String representation of this Expr - * @param str the destination String to append to - * @see Expr -**/ -void FilterExpr::toString(nsAString& str) { +#ifdef TX_TO_STRING +void +FilterExpr::toString(nsAString& str) +{ if ( expr ) expr->toString(str); else str.Append(NS_LITERAL_STRING("null")); PredicateList::toString(str); -} //-- toString +} +#endif diff --git a/mozilla/extensions/transformiix/source/xpath/FunctionCall.cpp b/mozilla/extensions/transformiix/source/xpath/FunctionCall.cpp index 6b4b18d5630..797e994dfe2 100644 --- a/mozilla/extensions/transformiix/source/xpath/FunctionCall.cpp +++ b/mozilla/extensions/transformiix/source/xpath/FunctionCall.cpp @@ -158,8 +158,11 @@ PRBool FunctionCall::requireParams(PRInt32 aParamCountMin, PRInt32 argc = params.getLength(); if (argc < aParamCountMin || (aParamCountMax > -1 && argc > aParamCountMax)) { - nsAutoString err(NS_LITERAL_STRING("invalid number of parameters for function: ")); + nsAutoString err(NS_LITERAL_STRING("invalid number of parameters for function")); +#ifdef TX_TO_STRING + err.Append(NS_LITERAL_STRING(": ")); toString(err); +#endif aContext->receiveError(err, NS_ERROR_XPATH_INVALID_ARG); return PR_FALSE; @@ -168,15 +171,9 @@ PRBool FunctionCall::requireParams(PRInt32 aParamCountMin, return PR_TRUE; } -/** - * Returns the String representation of this NodeExpr. - * @param dest the String to use when creating the String - * representation. The String representation will be appended to - * any data in the destination String, to allow cascading calls to - * other #toString() methods for Expressions. - * @return the String representation of this NodeExpr. -**/ -void FunctionCall::toString(nsAString& aDest) +#ifdef TX_TO_STRING +void +FunctionCall::toString(nsAString& aDest) { nsCOMPtr functionNameAtom; nsAutoString functionName; @@ -200,6 +197,7 @@ void FunctionCall::toString(nsAString& aDest) } aDest.Append(PRUnichar(')')); } +#endif /** * Implementation of txErrorFunctionCall @@ -216,6 +214,7 @@ txErrorFunctionCall::evaluate(txIEvalContext* aContext, return NS_ERROR_XPATH_BAD_EXTENSION_FUNCTION; } +#ifdef TX_TO_STRING nsresult txErrorFunctionCall::getNameAtom(nsIAtom** aAtom) { @@ -224,3 +223,4 @@ txErrorFunctionCall::getNameAtom(nsIAtom** aAtom) return NS_OK; } +#endif diff --git a/mozilla/extensions/transformiix/source/xpath/LocationStep.cpp b/mozilla/extensions/transformiix/source/xpath/LocationStep.cpp index 711d7dbfa36..b4781645552 100644 --- a/mozilla/extensions/transformiix/source/xpath/LocationStep.cpp +++ b/mozilla/extensions/transformiix/source/xpath/LocationStep.cpp @@ -276,12 +276,10 @@ void LocationStep::fromDescendantsRev(const txXPathNode& aNode, } while (walker.moveToPreviousSibling()); } -/** - * Creates a String representation of this Expr - * @param str the destination String to append to - * @see Expr -**/ -void LocationStep::toString(nsAString& str) { +#ifdef TX_TO_STRING +void +LocationStep::toString(nsAString& str) +{ switch (mAxisIdentifier) { case ANCESTOR_AXIS : str.Append(NS_LITERAL_STRING("ancestor::")); @@ -326,5 +324,5 @@ void LocationStep::toString(nsAString& str) { mNodeTest->toString(str); PredicateList::toString(str); -} // toString - +} +#endif diff --git a/mozilla/extensions/transformiix/source/xpath/MultiplicativeExpr.cpp b/mozilla/extensions/transformiix/source/xpath/MultiplicativeExpr.cpp index 974eee52ebe..215e3dacfc1 100644 --- a/mozilla/extensions/transformiix/source/xpath/MultiplicativeExpr.cpp +++ b/mozilla/extensions/transformiix/source/xpath/MultiplicativeExpr.cpp @@ -115,16 +115,10 @@ MultiplicativeExpr::evaluate(txIEvalContext* aContext, txAExprResult** aResult) return aContext->recycler()->getNumberResult(result, aResult); } //-- evaluate -/** - * Returns the String representation of this Expr. - * @param dest the String to use when creating the String - * representation. The String representation will be appended to - * any data in the destination String, to allow cascading calls to - * other #toString() methods for Expressions. - * @return the String representation of this Expr. -**/ -void MultiplicativeExpr::toString(nsAString& str) { - +#ifdef TX_TO_STRING +void +MultiplicativeExpr::toString(nsAString& str) +{ if ( leftExpr ) leftExpr->toString(str); else str.Append(NS_LITERAL_STRING("null")); @@ -142,5 +136,5 @@ void MultiplicativeExpr::toString(nsAString& str) { if ( rightExpr ) rightExpr->toString(str); else str.Append(NS_LITERAL_STRING("null")); -} //-- toString - +} +#endif diff --git a/mozilla/extensions/transformiix/source/xpath/NodeSetFunctionCall.cpp b/mozilla/extensions/transformiix/source/xpath/NodeSetFunctionCall.cpp index c39e01685ad..d7201a9643a 100644 --- a/mozilla/extensions/transformiix/source/xpath/NodeSetFunctionCall.cpp +++ b/mozilla/extensions/transformiix/source/xpath/NodeSetFunctionCall.cpp @@ -236,7 +236,9 @@ NodeSetFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult) return NS_ERROR_UNEXPECTED; } -nsresult NodeSetFunctionCall::getNameAtom(nsIAtom** aAtom) +#ifdef TX_TO_STRING +nsresult +NodeSetFunctionCall::getNameAtom(nsIAtom** aAtom) { switch (mType) { case COUNT: @@ -283,3 +285,4 @@ nsresult NodeSetFunctionCall::getNameAtom(nsIAtom** aAtom) NS_ADDREF(*aAtom); return NS_OK; } +#endif diff --git a/mozilla/extensions/transformiix/source/xpath/NumberFunctionCall.cpp b/mozilla/extensions/transformiix/source/xpath/NumberFunctionCall.cpp index 9e427a54635..2fdd011e40f 100644 --- a/mozilla/extensions/transformiix/source/xpath/NumberFunctionCall.cpp +++ b/mozilla/extensions/transformiix/source/xpath/NumberFunctionCall.cpp @@ -153,7 +153,9 @@ NumberFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult) return NS_ERROR_UNEXPECTED; } -nsresult NumberFunctionCall::getNameAtom(nsIAtom** aAtom) +#ifdef TX_TO_STRING +nsresult +NumberFunctionCall::getNameAtom(nsIAtom** aAtom) { switch (mType) { case NUMBER: @@ -190,3 +192,4 @@ nsresult NumberFunctionCall::getNameAtom(nsIAtom** aAtom) NS_ADDREF(*aAtom); return NS_OK; } +#endif diff --git a/mozilla/extensions/transformiix/source/xpath/PathExpr.cpp b/mozilla/extensions/transformiix/source/xpath/PathExpr.cpp index 33f90d761e3..a1fd07d2bec 100644 --- a/mozilla/extensions/transformiix/source/xpath/PathExpr.cpp +++ b/mozilla/extensions/transformiix/source/xpath/PathExpr.cpp @@ -218,15 +218,9 @@ PathExpr::evalDescendants(Expr* aStep, const txXPathNode& aNode, return NS_OK; } //-- evalDescendants -/** - * Returns the String representation of this Expr. - * @param dest the String to use when creating the String - * representation. The String representation will be appended to - * any data in the destination String, to allow cascading calls to - * other #toString() methods for Expressions. - * @return the String representation of this Expr. -**/ -void PathExpr::toString(nsAString& dest) +#ifdef TX_TO_STRING +void +PathExpr::toString(nsAString& dest) { txListIterator iter(&expressions); @@ -248,4 +242,5 @@ void PathExpr::toString(nsAString& dest) } pxi->expr->toString(dest); } -} //-- toString +} +#endif diff --git a/mozilla/extensions/transformiix/source/xpath/PredicateList.cpp b/mozilla/extensions/transformiix/source/xpath/PredicateList.cpp index e5fb3480b29..9aeff275b92 100644 --- a/mozilla/extensions/transformiix/source/xpath/PredicateList.cpp +++ b/mozilla/extensions/transformiix/source/xpath/PredicateList.cpp @@ -124,6 +124,7 @@ MBool PredicateList::isEmpty() return (MBool)(predicates.getLength() == 0); } // isEmpty +#ifdef TX_TO_STRING void PredicateList::toString(nsAString& dest) { txListIterator iter(&predicates); @@ -133,5 +134,5 @@ void PredicateList::toString(nsAString& dest) expr->toString(dest); dest.Append(PRUnichar(']')); } -} // toString - +} +#endif diff --git a/mozilla/extensions/transformiix/source/xpath/RelationalExpr.cpp b/mozilla/extensions/transformiix/source/xpath/RelationalExpr.cpp index 78e9ad7578b..b563c934c4d 100644 --- a/mozilla/extensions/transformiix/source/xpath/RelationalExpr.cpp +++ b/mozilla/extensions/transformiix/source/xpath/RelationalExpr.cpp @@ -205,6 +205,7 @@ RelationalExpr::evaluate(txIEvalContext* aContext, txAExprResult** aResult) return NS_OK; } +#ifdef TX_TO_STRING void RelationalExpr::toString(nsAString& str) { @@ -233,3 +234,4 @@ RelationalExpr::toString(nsAString& str) mRightExpr->toString(str); } +#endif diff --git a/mozilla/extensions/transformiix/source/xpath/RootExpr.cpp b/mozilla/extensions/transformiix/source/xpath/RootExpr.cpp index 85e353ff207..a62f000e214 100644 --- a/mozilla/extensions/transformiix/source/xpath/RootExpr.cpp +++ b/mozilla/extensions/transformiix/source/xpath/RootExpr.cpp @@ -40,14 +40,6 @@ #include "txNodeSet.h" #include "txIXPathContext.h" -/** - * Creates a new RootExpr - * @param aSerialize should this RootExpr be serialized - */ -RootExpr::RootExpr(MBool aSerialize) { - mSerialize = aSerialize; -} - /** * Evaluates this Expr based on the given context node and processor state * @param context the context node for evaluation of this Expr @@ -75,15 +67,11 @@ RootExpr::evaluate(txIEvalContext* aContext, txAExprResult** aResult) return aContext->recycler()->getNodeSet(*document, aResult); } //-- evaluate -/** - * Returns the String representation of this Expr. - * @param dest the String to use when creating the String - * representation. The String representation will be appended to - * any data in the destination String, to allow cascading calls to - * other #toString() methods for Expressions. - * @return the String representation of this Expr. -**/ -void RootExpr::toString(nsAString& dest) { +#ifdef TX_TO_STRING +void +RootExpr::toString(nsAString& dest) +{ if (mSerialize) dest.Append(PRUnichar('/')); -} //-- toString +} +#endif diff --git a/mozilla/extensions/transformiix/source/xpath/StringFunctionCall.cpp b/mozilla/extensions/transformiix/source/xpath/StringFunctionCall.cpp index 5201499616e..2fbb7622e1c 100644 --- a/mozilla/extensions/transformiix/source/xpath/StringFunctionCall.cpp +++ b/mozilla/extensions/transformiix/source/xpath/StringFunctionCall.cpp @@ -349,7 +349,9 @@ StringFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult) return NS_ERROR_UNEXPECTED; } -nsresult StringFunctionCall::getNameAtom(nsIAtom** aAtom) +#ifdef TX_TO_STRING +nsresult +StringFunctionCall::getNameAtom(nsIAtom** aAtom) { switch (mType) { case CONCAT: @@ -411,3 +413,4 @@ nsresult StringFunctionCall::getNameAtom(nsIAtom** aAtom) NS_ADDREF(*aAtom); return NS_OK; } +#endif diff --git a/mozilla/extensions/transformiix/source/xpath/UnaryExpr.cpp b/mozilla/extensions/transformiix/source/xpath/UnaryExpr.cpp index e9ea69e930e..563af4926ca 100644 --- a/mozilla/extensions/transformiix/source/xpath/UnaryExpr.cpp +++ b/mozilla/extensions/transformiix/source/xpath/UnaryExpr.cpp @@ -69,18 +69,13 @@ UnaryExpr::evaluate(txIEvalContext* aContext, txAExprResult** aResult) #endif } -/* - * Returns the String representation of this Expr. - * @param dest the String to use when creating the String - * representation. The String representation will be appended to - * any data in the destination String, to allow cascading calls to - * other #toString() methods for Expressions. - * @return the String representation of this Expr. - */ -void UnaryExpr::toString(nsAString& str) +#ifdef TX_TO_STRING +void +UnaryExpr::toString(nsAString& str) { if (!expr) return; str.Append(PRUnichar('-')); expr->toString(str); } +#endif diff --git a/mozilla/extensions/transformiix/source/xpath/UnionExpr.cpp b/mozilla/extensions/transformiix/source/xpath/UnionExpr.cpp index 9f536e02feb..2b044b8a891 100644 --- a/mozilla/extensions/transformiix/source/xpath/UnionExpr.cpp +++ b/mozilla/extensions/transformiix/source/xpath/UnionExpr.cpp @@ -125,15 +125,10 @@ UnionExpr::evaluate(txIEvalContext* aContext, txAExprResult** aResult) return NS_OK; } //-- evaluate -/** - * Returns the String representation of this Expr. - * @param dest the String to use when creating the String - * representation. The String representation will be appended to - * any data in the destination String, to allow cascading calls to - * other #toString() methods for Expressions. - * @return the String representation of this Expr. -**/ -void UnionExpr::toString(nsAString& dest) { +#ifdef TX_TO_STRING +void +UnionExpr::toString(nsAString& dest) +{ txListIterator iter(&expressions); short count = 0; @@ -144,5 +139,5 @@ void UnionExpr::toString(nsAString& dest) { ((Expr*)iter.next())->toString(dest); ++count; } -} //-- toString - +} +#endif diff --git a/mozilla/extensions/transformiix/source/xpath/VariableRefExpr.cpp b/mozilla/extensions/transformiix/source/xpath/VariableRefExpr.cpp index ddac5b49e86..85e4ad95563 100644 --- a/mozilla/extensions/transformiix/source/xpath/VariableRefExpr.cpp +++ b/mozilla/extensions/transformiix/source/xpath/VariableRefExpr.cpp @@ -82,15 +82,9 @@ VariableRefExpr::evaluate(txIEvalContext* aContext, txAExprResult** aResult) return NS_OK; } -/** - * Returns the String representation of this Expr. - * @param dest the String to use when creating the String - * representation. The String representation will be appended to - * any data in the destination String, to allow cascading calls to - * other #toString() methods for Expressions. - * @return the String representation of this Expr. -**/ -void VariableRefExpr::toString(nsAString& aDest) +#ifdef TX_TO_STRING +void +VariableRefExpr::toString(nsAString& aDest) { aDest.Append(PRUnichar('$')); if (mPrefix) { @@ -102,4 +96,5 @@ void VariableRefExpr::toString(nsAString& aDest) nsAutoString lname; mLocalName->ToString(lname); aDest.Append(lname); -} //-- toString +} +#endif diff --git a/mozilla/extensions/transformiix/source/xpath/nsXPathNSResolver.cpp b/mozilla/extensions/transformiix/source/xpath/nsXPathNSResolver.cpp index 77685bc68d2..3aa982008fd 100644 --- a/mozilla/extensions/transformiix/source/xpath/nsXPathNSResolver.cpp +++ b/mozilla/extensions/transformiix/source/xpath/nsXPathNSResolver.cpp @@ -62,7 +62,7 @@ NS_IMETHODIMP nsXPathNSResolver::LookupNamespaceURI(const nsAString & aPrefix, nsAString & aResult) { - if (aPrefix.Equals(NS_LITERAL_STRING("xml"))) { + if (aPrefix.EqualsLiteral("xml")) { aResult = NS_LITERAL_STRING("http://www.w3.org/XML/1998/namespace"); return NS_OK; diff --git a/mozilla/extensions/transformiix/source/xpath/txLiteralExpr.cpp b/mozilla/extensions/transformiix/source/xpath/txLiteralExpr.cpp index 7db3ddbb754..f85e33b7a0b 100644 --- a/mozilla/extensions/transformiix/source/xpath/txLiteralExpr.cpp +++ b/mozilla/extensions/transformiix/source/xpath/txLiteralExpr.cpp @@ -59,6 +59,7 @@ txLiteralExpr::evaluate(txIEvalContext* aContext, txAExprResult** aResult) return NS_OK; } +#ifdef TX_TO_STRING void txLiteralExpr::toString(nsAString& aStr) { @@ -84,3 +85,4 @@ txLiteralExpr::toString(nsAString& aStr) } } } +#endif diff --git a/mozilla/extensions/transformiix/source/xpath/txNameTest.cpp b/mozilla/extensions/transformiix/source/xpath/txNameTest.cpp index ed432125f02..ac5d0247132 100644 --- a/mozilla/extensions/transformiix/source/xpath/txNameTest.cpp +++ b/mozilla/extensions/transformiix/source/xpath/txNameTest.cpp @@ -90,12 +90,9 @@ double txNameTest::getDefaultPriority() return 0; } -/* - * Returns the String representation of this txNodeTest. - * @param aDest the String to use when creating the string representation. - * The string representation will be appended to the string. - */ -void txNameTest::toString(nsAString& aDest) +#ifdef TX_TO_STRING +void +txNameTest::toString(nsAString& aDest) { if (mPrefix) { nsAutoString prefix; @@ -107,3 +104,4 @@ void txNameTest::toString(nsAString& aDest) mLocalName->ToString(localName); aDest.Append(localName); } +#endif diff --git a/mozilla/extensions/transformiix/source/xpath/txNodeTypeTest.cpp b/mozilla/extensions/transformiix/source/xpath/txNodeTypeTest.cpp index 5f2755da5ce..48877ef446b 100644 --- a/mozilla/extensions/transformiix/source/xpath/txNodeTypeTest.cpp +++ b/mozilla/extensions/transformiix/source/xpath/txNodeTypeTest.cpp @@ -94,12 +94,9 @@ double txNodeTypeTest::getDefaultPriority() return mNodeName ? 0 : -0.5; } -/* - * Returns the String representation of this txNodeTest. - * @param aDest the String to use when creating the string representation. - * The string representation will be appended to the string. - */ -void txNodeTypeTest::toString(nsAString& aDest) +#ifdef TX_TO_STRING +void +txNodeTypeTest::toString(nsAString& aDest) { switch (mNodeType) { case COMMENT_TYPE: @@ -124,3 +121,4 @@ void txNodeTypeTest::toString(nsAString& aDest) break; } } +#endif diff --git a/mozilla/extensions/transformiix/source/xslt/functions/CurrentFunctionCall.cpp b/mozilla/extensions/transformiix/source/xslt/functions/CurrentFunctionCall.cpp index d2db52d26b5..ae6778a0bc6 100644 --- a/mozilla/extensions/transformiix/source/xslt/functions/CurrentFunctionCall.cpp +++ b/mozilla/extensions/transformiix/source/xslt/functions/CurrentFunctionCall.cpp @@ -38,9 +38,12 @@ CurrentFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult) es->getEvalContext()->getContextNode(), aResult); } -nsresult CurrentFunctionCall::getNameAtom(nsIAtom** aAtom) +#ifdef TX_TO_STRING +nsresult +CurrentFunctionCall::getNameAtom(nsIAtom** aAtom) { *aAtom = txXSLTAtoms::current; NS_ADDREF(*aAtom); return NS_OK; } +#endif diff --git a/mozilla/extensions/transformiix/source/xslt/functions/DocumentFunctionCall.cpp b/mozilla/extensions/transformiix/source/xslt/functions/DocumentFunctionCall.cpp index 488a67ae2f3..673214d84fb 100644 --- a/mozilla/extensions/transformiix/source/xslt/functions/DocumentFunctionCall.cpp +++ b/mozilla/extensions/transformiix/source/xslt/functions/DocumentFunctionCall.cpp @@ -177,9 +177,12 @@ DocumentFunctionCall::evaluate(txIEvalContext* aContext, return NS_OK; } -nsresult DocumentFunctionCall::getNameAtom(nsIAtom** aAtom) +#ifdef TX_TO_STRING +nsresult +DocumentFunctionCall::getNameAtom(nsIAtom** aAtom) { *aAtom = txXSLTAtoms::document; NS_ADDREF(*aAtom); return NS_OK; } +#endif diff --git a/mozilla/extensions/transformiix/source/xslt/functions/ElementAvailableFnCall.cpp b/mozilla/extensions/transformiix/source/xslt/functions/ElementAvailableFnCall.cpp index 8b8f372d181..b6d5b571efd 100644 --- a/mozilla/extensions/transformiix/source/xslt/functions/ElementAvailableFnCall.cpp +++ b/mozilla/extensions/transformiix/source/xslt/functions/ElementAvailableFnCall.cpp @@ -129,9 +129,12 @@ ElementAvailableFunctionCall::evaluate(txIEvalContext* aContext, return NS_OK; } -nsresult ElementAvailableFunctionCall::getNameAtom(nsIAtom** aAtom) +#ifdef TX_TO_STRING +nsresult +ElementAvailableFunctionCall::getNameAtom(nsIAtom** aAtom) { *aAtom = txXSLTAtoms::elementAvailable; NS_ADDREF(*aAtom); return NS_OK; } +#endif diff --git a/mozilla/extensions/transformiix/source/xslt/functions/FunctionAvailableFnCall.cpp b/mozilla/extensions/transformiix/source/xslt/functions/FunctionAvailableFnCall.cpp index 9c990f8184d..17b85d9bcf2 100644 --- a/mozilla/extensions/transformiix/source/xslt/functions/FunctionAvailableFnCall.cpp +++ b/mozilla/extensions/transformiix/source/xslt/functions/FunctionAvailableFnCall.cpp @@ -128,9 +128,12 @@ FunctionAvailableFunctionCall::evaluate(txIEvalContext* aContext, } -nsresult FunctionAvailableFunctionCall::getNameAtom(nsIAtom** aAtom) +#ifdef TX_TO_STRING +nsresult +FunctionAvailableFunctionCall::getNameAtom(nsIAtom** aAtom) { *aAtom = txXSLTAtoms::functionAvailable; NS_ADDREF(*aAtom); return NS_OK; } +#endif diff --git a/mozilla/extensions/transformiix/source/xslt/functions/GenerateIdFunctionCall.cpp b/mozilla/extensions/transformiix/source/xslt/functions/GenerateIdFunctionCall.cpp index 4b92a6a061c..d2dac47182f 100644 --- a/mozilla/extensions/transformiix/source/xslt/functions/GenerateIdFunctionCall.cpp +++ b/mozilla/extensions/transformiix/source/xslt/functions/GenerateIdFunctionCall.cpp @@ -105,9 +105,12 @@ GenerateIdFunctionCall::evaluate(txIEvalContext* aContext, return NS_OK; } -nsresult GenerateIdFunctionCall::getNameAtom(nsIAtom** aAtom) +#ifdef TX_TO_STRING +nsresult +GenerateIdFunctionCall::getNameAtom(nsIAtom** aAtom) { *aAtom = txXSLTAtoms::generateId; NS_ADDREF(*aAtom); return NS_OK; } +#endif diff --git a/mozilla/extensions/transformiix/source/xslt/functions/SystemPropertyFunctionCall.cpp b/mozilla/extensions/transformiix/source/xslt/functions/SystemPropertyFunctionCall.cpp index 6b759aa2627..2c40f9a4be2 100644 --- a/mozilla/extensions/transformiix/source/xslt/functions/SystemPropertyFunctionCall.cpp +++ b/mozilla/extensions/transformiix/source/xslt/functions/SystemPropertyFunctionCall.cpp @@ -69,9 +69,12 @@ SystemPropertyFunctionCall::evaluate(txIEvalContext* aContext, } -nsresult SystemPropertyFunctionCall::getNameAtom(nsIAtom** aAtom) +#ifdef TX_TO_STRING +nsresult +SystemPropertyFunctionCall::getNameAtom(nsIAtom** aAtom) { *aAtom = txXSLTAtoms::systemProperty; NS_ADDREF(*aAtom); return NS_OK; } +#endif diff --git a/mozilla/extensions/transformiix/source/xslt/functions/txFormatNumberFunctionCall.cpp b/mozilla/extensions/transformiix/source/xslt/functions/txFormatNumberFunctionCall.cpp index 912642b496d..690cc114f8f 100644 --- a/mozilla/extensions/transformiix/source/xslt/functions/txFormatNumberFunctionCall.cpp +++ b/mozilla/extensions/transformiix/source/xslt/functions/txFormatNumberFunctionCall.cpp @@ -48,7 +48,7 @@ #include "prdtoa.h" #define INVALID_PARAM_VALUE \ - NS_LITERAL_STRING("invalid parameter value for function: ") + NS_LITERAL_STRING("invalid parameter value for function") const PRUnichar txFormatNumberFunctionCall::FORMAT_QUOTE = '\''; @@ -101,8 +101,11 @@ txFormatNumberFunctionCall::evaluate(txIEvalContext* aContext, txDecimalFormat* format = mStylesheet->getDecimalFormat(formatName); if (!format) { - nsAutoString err(NS_LITERAL_STRING("unknown decimal format for: ")); + nsAutoString err(NS_LITERAL_STRING("unknown decimal format")); +#ifdef TX_TO_STRING + err.Append(NS_LITERAL_STRING(" for: ")); toString(err); +#endif aContext->receiveError(err, NS_ERROR_XPATH_INVALID_ARG); return NS_ERROR_XPATH_INVALID_ARG; } @@ -174,7 +177,10 @@ txFormatNumberFunctionCall::evaluate(txIEvalContext* aContext, multiplier = 100; else { nsAutoString err(INVALID_PARAM_VALUE); +#ifdef TX_TO_STRING + err.Append(NS_LITERAL_STRING(": ")); toString(err); +#endif aContext->receiveError(err, NS_ERROR_XPATH_INVALID_ARG); return NS_ERROR_XPATH_INVALID_ARG; @@ -185,7 +191,10 @@ txFormatNumberFunctionCall::evaluate(txIEvalContext* aContext, multiplier = 1000; else { nsAutoString err(INVALID_PARAM_VALUE); +#ifdef TX_TO_STRING + err.Append(NS_LITERAL_STRING(": ")); toString(err); +#endif aContext->receiveError(err, NS_ERROR_XPATH_INVALID_ARG); return NS_ERROR_XPATH_INVALID_ARG; @@ -270,7 +279,10 @@ txFormatNumberFunctionCall::evaluate(txIEvalContext* aContext, inQuote || groupSize == 0) { nsAutoString err(INVALID_PARAM_VALUE); +#ifdef TX_TO_STRING + err.Append(NS_LITERAL_STRING(": ")); toString(err); +#endif aContext->receiveError(err, NS_ERROR_XPATH_INVALID_ARG); return NS_ERROR_XPATH_INVALID_ARG; } @@ -395,12 +407,15 @@ txFormatNumberFunctionCall::evaluate(txIEvalContext* aContext, return aContext->recycler()->getStringResult(res, aResult); } //-- evaluate -nsresult txFormatNumberFunctionCall::getNameAtom(nsIAtom** aAtom) +#ifdef TX_TO_STRING +nsresult +txFormatNumberFunctionCall::getNameAtom(nsIAtom** aAtom) { *aAtom = txXSLTAtoms::formatNumber; NS_ADDREF(*aAtom); return NS_OK; } +#endif /* * txDecimalFormat diff --git a/mozilla/extensions/transformiix/source/xslt/functions/txKeyFunctionCall.cpp b/mozilla/extensions/transformiix/source/xslt/functions/txKeyFunctionCall.cpp index 6b94c3ae309..2a0b114535d 100644 --- a/mozilla/extensions/transformiix/source/xslt/functions/txKeyFunctionCall.cpp +++ b/mozilla/extensions/transformiix/source/xslt/functions/txKeyFunctionCall.cpp @@ -126,12 +126,15 @@ txKeyFunctionCall::evaluate(txIEvalContext* aContext, txAExprResult** aResult) return NS_OK; } -nsresult txKeyFunctionCall::getNameAtom(nsIAtom** aAtom) +#ifdef TX_TO_STRING +nsresult +txKeyFunctionCall::getNameAtom(nsIAtom** aAtom) { *aAtom = txXSLTAtoms::key; NS_ADDREF(*aAtom); return NS_OK; } +#endif /** * Hash functions diff --git a/mozilla/extensions/transformiix/source/xslt/txPatternParser.cpp b/mozilla/extensions/transformiix/source/xslt/txPatternParser.cpp index c0894aa83f6..b9a245720f1 100644 --- a/mozilla/extensions/transformiix/source/xslt/txPatternParser.cpp +++ b/mozilla/extensions/transformiix/source/xslt/txPatternParser.cpp @@ -147,7 +147,8 @@ nsresult txPatternParser::createLocPathPattern(txExprLexer& aLexer, isAbsolute = MB_TRUE; if (aLexer.peek()->mType == Token::END || aLexer.peek()->mType == Token::UNION_OP) { - aPattern = new txRootPattern(MB_TRUE); + aPattern = new txRootPattern(); + return aPattern ? NS_OK : NS_ERROR_OUT_OF_MEMORY; } break; @@ -189,12 +190,17 @@ nsresult txPatternParser::createLocPathPattern(txExprLexer& aLexer, } if (isAbsolute) { - txRootPattern* root = new txRootPattern(MB_FALSE); + txRootPattern* root = new txRootPattern(); if (!root) { delete stepPattern; delete pathPattern; return NS_ERROR_OUT_OF_MEMORY; } + +#ifdef TX_TO_STRING + root->setSerialize(PR_FALSE); +#endif + rv = pathPattern->addStep(root, isChild); if (NS_FAILED(rv)) { delete stepPattern; diff --git a/mozilla/extensions/transformiix/source/xslt/txStandaloneXSLTProcessor.cpp b/mozilla/extensions/transformiix/source/xslt/txStandaloneXSLTProcessor.cpp index 3992819901c..3a792bc70e4 100644 --- a/mozilla/extensions/transformiix/source/xslt/txStandaloneXSLTProcessor.cpp +++ b/mozilla/extensions/transformiix/source/xslt/txStandaloneXSLTProcessor.cpp @@ -250,14 +250,14 @@ void txStandaloneXSLTProcessor::getHrefFromStylesheetPI(Document& xmlDocument, if (node->getNodeType() == Node::PROCESSING_INSTRUCTION_NODE) { nsAutoString target; node->getNodeName(target); - if (target.Equals(NS_LITERAL_STRING("xml-stylesheet"))) { + if (target.EqualsLiteral("xml-stylesheet")) { nsAutoString data; node->getNodeValue(data); type.Truncate(); tmpHref.Truncate(); parseStylesheetPI(data, type, tmpHref); - if (type.Equals(NS_LITERAL_STRING("text/xsl")) || - type.Equals(NS_LITERAL_STRING("text/xml"))) { + if (type.EqualsLiteral("text/xsl") || + type.EqualsLiteral("text/xml")) { href = tmpHref; return; } @@ -334,11 +334,11 @@ void txStandaloneXSLTProcessor::parseStylesheetPI(const nsAFlatString& aData, // At this point attrName holds the name of the "attribute" and // the value is between start and iter. - if (attrName.Equals(NS_LITERAL_STRING("type"))) { + if (attrName.EqualsLiteral("type")) { aType = Substring(start, iter); ++found; } - else if (attrName.Equals(NS_LITERAL_STRING("href"))) { + else if (attrName.EqualsLiteral("href")) { aHref = Substring(start, iter); ++found; } diff --git a/mozilla/extensions/transformiix/source/xslt/txStylesheet.cpp b/mozilla/extensions/transformiix/source/xslt/txStylesheet.cpp index 2fecbb959d8..a1b5bbb5485 100644 --- a/mozilla/extensions/transformiix/source/xslt/txStylesheet.cpp +++ b/mozilla/extensions/transformiix/source/xslt/txStylesheet.cpp @@ -197,7 +197,9 @@ txStylesheet::findTemplate(const txXPathNode& aNode, txXPathNodeUtils::getNodeName(aNode, nodeName); if (matchTemplate) { nsAutoString matchAttr; +#ifdef TX_TO_STRING match->toString(matchAttr); +#endif PR_LOG(txLog::xslt, PR_LOG_DEBUG, ("MatchTemplate, Pattern %s, Mode %s, Node %s\n", NS_LossyConvertUCS2toASCII(matchAttr).get(), diff --git a/mozilla/extensions/transformiix/source/xslt/txStylesheetCompileHandlers.cpp b/mozilla/extensions/transformiix/source/xslt/txStylesheetCompileHandlers.cpp index ce28f4b624f..93a6471c026 100644 --- a/mozilla/extensions/transformiix/source/xslt/txStylesheetCompileHandlers.cpp +++ b/mozilla/extensions/transformiix/source/xslt/txStylesheetCompileHandlers.cpp @@ -480,7 +480,8 @@ txFnStartLREStylesheet(PRInt32 aNamespaceID, txExpandedName nullExpr; double prio = Double::NaN; - nsAutoPtr match(new txRootPattern(MB_TRUE)); + + nsAutoPtr match(new txRootPattern()); NS_ENSURE_TRUE(match, NS_ERROR_OUT_OF_MEMORY); nsAutoPtr templ(new txTemplateItem(match, nullExpr, diff --git a/mozilla/extensions/transformiix/source/xslt/txStylesheetCompiler.cpp b/mozilla/extensions/transformiix/source/xslt/txStylesheetCompiler.cpp index c69732243a5..ccd35eb2547 100644 --- a/mozilla/extensions/transformiix/source/xslt/txStylesheetCompiler.cpp +++ b/mozilla/extensions/transformiix/source/xslt/txStylesheetCompiler.cpp @@ -304,7 +304,7 @@ txStylesheetCompiler::startElementInternal(PRInt32 aNamespaceID, rv = ensureNewElementContext(); NS_ENSURE_SUCCESS(rv, rv); - if (attr->mValue.Equals(NS_LITERAL_STRING("1.0"))) { + if (attr->mValue.EqualsLiteral("1.0")) { mElementContext->mForwardsCompatibleParsing = MB_FALSE; } else { diff --git a/mozilla/extensions/transformiix/source/xslt/txXSLTPatterns.cpp b/mozilla/extensions/transformiix/source/xslt/txXSLTPatterns.cpp index cecef8c435c..60e24a39369 100644 --- a/mozilla/extensions/transformiix/source/xslt/txXSLTPatterns.cpp +++ b/mozilla/extensions/transformiix/source/xslt/txXSLTPatterns.cpp @@ -130,12 +130,9 @@ nsresult txUnionPattern::getSimplePatterns(txList& aList) return NS_OK; } -/* - * The String representation will be appended to any data in the - * destination String, to allow cascading calls to other - * toString() methods for mLocPathPatterns. - */ -void txUnionPattern::toString(nsAString& aDest) +#ifdef TX_TO_STRING +void +txUnionPattern::toString(nsAString& aDest) { #ifdef DEBUG aDest.Append(NS_LITERAL_STRING("txUnionPattern{")); @@ -150,7 +147,8 @@ void txUnionPattern::toString(nsAString& aDest) #ifdef DEBUG aDest.Append(PRUnichar('}')); #endif -} // toString +} +#endif /* @@ -257,7 +255,9 @@ double txLocPathPattern::getDefaultPriority() return ((Step*)mSteps.get(0))->pattern->getDefaultPriority(); } -void txLocPathPattern::toString(nsAString& aDest) +#ifdef TX_TO_STRING +void +txLocPathPattern::toString(nsAString& aDest) { txListIterator iter(&mSteps); #ifdef DEBUG @@ -278,7 +278,8 @@ void txLocPathPattern::toString(nsAString& aDest) #ifdef DEBUG aDest.Append(PRUnichar('}')); #endif -} // txLocPathPattern::toString +} +#endif /* * txRootPattern @@ -300,7 +301,9 @@ double txRootPattern::getDefaultPriority() return 0.5; } -void txRootPattern::toString(nsAString& aDest) +#ifdef TX_TO_STRING +void +txRootPattern::toString(nsAString& aDest) { #ifdef DEBUG aDest.Append(NS_LITERAL_STRING("txRootPattern{")); @@ -311,6 +314,7 @@ void txRootPattern::toString(nsAString& aDest) aDest.Append(PRUnichar('}')); #endif } +#endif /* * txIdPattern @@ -380,7 +384,9 @@ double txIdPattern::getDefaultPriority() return 0.5; } -void txIdPattern::toString(nsAString& aDest) +#ifdef TX_TO_STRING +void +txIdPattern::toString(nsAString& aDest) { #ifdef DEBUG aDest.Append(NS_LITERAL_STRING("txIdPattern{")); @@ -397,6 +403,7 @@ void txIdPattern::toString(nsAString& aDest) aDest.Append(PRUnichar('}')); #endif } +#endif /* * txKeyPattern @@ -430,7 +437,9 @@ double txKeyPattern::getDefaultPriority() return 0.5; } -void txKeyPattern::toString(nsAString& aDest) +#ifdef TX_TO_STRING +void +txKeyPattern::toString(nsAString& aDest) { #ifdef DEBUG aDest.Append(NS_LITERAL_STRING("txKeyPattern{")); @@ -451,6 +460,7 @@ void txKeyPattern::toString(nsAString& aDest) aDest.Append(PRUnichar('}')); #endif } +#endif /* * txStepPattern @@ -576,7 +586,9 @@ double txStepPattern::getDefaultPriority() return 0.5; } -void txStepPattern::toString(nsAString& aDest) +#ifdef TX_TO_STRING +void +txStepPattern::toString(nsAString& aDest) { #ifdef DEBUG aDest.Append(NS_LITERAL_STRING("txStepPattern{")); @@ -591,3 +603,4 @@ void txStepPattern::toString(nsAString& aDest) aDest.Append(PRUnichar('}')); #endif } +#endif diff --git a/mozilla/extensions/transformiix/source/xslt/txXSLTPatterns.h b/mozilla/extensions/transformiix/source/xslt/txXSLTPatterns.h index 652b9fbeb03..0a59a3de9ee 100644 --- a/mozilla/extensions/transformiix/source/xslt/txXSLTPatterns.h +++ b/mozilla/extensions/transformiix/source/xslt/txXSLTPatterns.h @@ -64,16 +64,6 @@ public: */ virtual double getDefaultPriority() = 0; - /* - * Returns the String representation of this Pattern. - * @param dest the String to use when creating the String - * representation. The String representation will be appended to - * any data in the destination String, to allow cascading calls to - * other #toString() methods for Patterns. - * @return the String representation of this Pattern. - */ - virtual void toString(nsAString& aDest) = 0; - /* * Adds the simple Patterns to the List. * For union patterns, add all sub patterns, @@ -83,12 +73,32 @@ public: * to this function. */ virtual nsresult getSimplePatterns(txList &aList); + +#ifdef TX_TO_STRING + /* + * Returns the String representation of this Pattern. + * @param dest the String to use when creating the String + * representation. The String representation will be appended to + * any data in the destination String, to allow cascading calls to + * other #toString() methods for Patterns. + * @return the String representation of this Pattern. + */ + virtual void toString(nsAString& aDest) = 0; +#endif }; -#define TX_DECL_PATTERN \ +#define TX_DECL_PATTERN_BASE \ MBool matches(const txXPathNode& aNode, txIMatchContext* aContext); \ - double getDefaultPriority(); \ + double getDefaultPriority() + +#ifndef TX_TO_STRING +#define TX_DECL_PATTERN TX_DECL_PATTERN_BASE +#else +#define TX_DECL_PATTERN \ + TX_DECL_PATTERN_BASE; \ void toString(nsAString& aDest) +#endif + #define TX_DECL_PATTERN2 \ TX_DECL_PATTERN; \ nsresult getSimplePatterns(txList &aList) @@ -147,16 +157,28 @@ private: class txRootPattern : public txPattern { public: - txRootPattern(MBool aSerialize) : mSerialize(aSerialize) + txRootPattern() +#ifdef TX_TO_STRING + : mSerialize(PR_TRUE) +#endif { } ~txRootPattern(); TX_DECL_PATTERN; + +#ifdef TX_TO_STRING +public: + void setSerialize(PRBool aSerialize) + { + mSerialize = aSerialize; + } + private: // Don't serialize txRootPattern if it's used in a txLocPathPattern - MBool mSerialize; + PRBool mSerialize; +#endif }; class txIdPattern : public txPattern