From 4f9a746cf6924158f9f5d2e8bf2059c32ae60041 Mon Sep 17 00:00:00 2001 From: "peterv%netscape.com" Date: Mon, 2 Jul 2001 09:24:58 +0000 Subject: [PATCH] Warning fixes, part of bug 88623 (Clean up Transformiix code). r=sicking, sr=jst. --- content/base/src/nsSyncLoadService.cpp | 2 +- .../transformiix/source/base/Double.cpp | 3 +- .../transformiix/source/net/URIUtils.cpp | 41 +---------------- .../transformiix/source/xml/XMLDOMUtils.cpp | 3 +- .../source/xml/parser/nsSyncLoader.cpp | 2 +- .../source/xml/util/DOMHelper.cpp | 5 +- .../source/xpath/BooleanFunctionCall.cpp | 5 +- .../transformiix/source/xpath/ExprParser.cpp | 6 +-- .../source/xpath/ExtensionFunctionCall.cpp | 4 +- .../source/xpath/NumberFunctionCall.cpp | 3 +- .../transformiix/source/xpath/PathExpr.cpp | 6 +-- .../source/xpath/StringFunctionCall.cpp | 7 ++- .../transformiix/source/xslt/Numbering.cpp | 46 +------------------ 13 files changed, 21 insertions(+), 112 deletions(-) diff --git a/content/base/src/nsSyncLoadService.cpp b/content/base/src/nsSyncLoadService.cpp index c9408065a2fb..62f1dbc6e68d 100644 --- a/content/base/src/nsSyncLoadService.cpp +++ b/content/base/src/nsSyncLoadService.cpp @@ -246,7 +246,7 @@ nsSyncLoader::LoadDocument(nsIURI* documentURI, nsIDOMDocument **_retval) JSContext* cx; if (NS_SUCCEEDED(rv) && cc) { rv = cc->GetJSContext(&cx); - if (NS_FAILED(rv)) NS_ERROR_FAILURE; + if (NS_FAILED(rv)) return NS_ERROR_FAILURE; } else { NS_WITH_SERVICE(nsIAppShellService, appshellSvc, kAppShellServiceCID, &rv); diff --git a/extensions/transformiix/source/base/Double.cpp b/extensions/transformiix/source/base/Double.cpp index 3c2741397d76..3874e972b977 100644 --- a/extensions/transformiix/source/base/Double.cpp +++ b/extensions/transformiix/source/base/Double.cpp @@ -27,7 +27,7 @@ * Eric Du, duxy@leyou.com.cn * -- added fix for FreeBSD * - * $Id: Double.cpp,v 1.5 2001/06/26 14:07:45 peterv%netscape.com Exp $ + * $Id: Double.cpp,v 1.6 2001/07/02 09:24:01 peterv%netscape.com Exp $ */ #include "primitives.h" @@ -147,7 +147,6 @@ MBool Double::isNaN() { double Double::toDouble(const String& src) { double dbl = 0.0; - double fraction = 1.0; double multiplier = 10.0; PRInt32 idx = 0; diff --git a/extensions/transformiix/source/net/URIUtils.cpp b/extensions/transformiix/source/net/URIUtils.cpp index a8499353191e..c6b0b63f5eb0 100644 --- a/extensions/transformiix/source/net/URIUtils.cpp +++ b/extensions/transformiix/source/net/URIUtils.cpp @@ -45,7 +45,7 @@ * URIUtils * A set of utilities for handling URIs * @author Keith Visco - * @version $Revision: 1.15 $ $Date: 2001/06/26 14:10:10 $ + * @version $Revision: 1.16 $ $Date: 2001/07/02 09:24:52 $ **/ #ifdef TX_EXE @@ -253,8 +253,6 @@ istream* URIUtils::openStream(ParsedURI* uri) { return inStream; } //-- openStream -/* */ - URIUtils::ParsedURI* URIUtils::parseURI(const String& uri) { ParsedURI* uriTokens = new ParsedURI; @@ -349,41 +347,4 @@ URIUtils::ParsedURI* URIUtils::parseURI(const String& uri) { return uriTokens; } //-- parseURI -/** - * -** -void URIUtils::test(const String& str) { - cout << "parsing: " << str << endl; - ParsedURI* uri = parseURI(str); - cout << "protocol : " << uri->protocol << endl; - cout << "host : " << uri->host << endl; - cout << "port : " << uri->port << endl; - cout << "path : " << uri->path << endl; - cout << "malformed: " << uri->isMalformed << endl; - delete uri; -} //-- test - -/** - * The test class for the URIUtils -** -void main(int argc, char** argv) { - URIUtils::test("file:///c|\\test"); - URIUtils::test("http://my.domain.com"); - URIUtils::test("my.domain.com"); - URIUtils::test("http://my.domain.com:80"); - URIUtils::test("http://my.domain.com:88/foo.html"); - - String url("http://my.domain.com:88/foo.html"); - String docBase; - URIUtils::getDocumentBase(url, docBase); - cout << "url : " << url <Keith Visco - * @version $Revision: 1.17 $ $Date: 2001/06/26 14:10:15 $ + * @version $Revision: 1.18 $ $Date: 2001/07/02 09:24:58 $ **/ #include "XMLDOMUtils.h" @@ -143,7 +143,6 @@ void XMLDOMUtils::getNodeValue(Node* node, String* target) { if (!node) return; int nodeType = node->getNodeType(); - Element* element = 0; switch ( nodeType ) { case Node::ATTRIBUTE_NODE : diff --git a/extensions/transformiix/source/xml/parser/nsSyncLoader.cpp b/extensions/transformiix/source/xml/parser/nsSyncLoader.cpp index c9408065a2fb..62f1dbc6e68d 100644 --- a/extensions/transformiix/source/xml/parser/nsSyncLoader.cpp +++ b/extensions/transformiix/source/xml/parser/nsSyncLoader.cpp @@ -246,7 +246,7 @@ nsSyncLoader::LoadDocument(nsIURI* documentURI, nsIDOMDocument **_retval) JSContext* cx; if (NS_SUCCEEDED(rv) && cc) { rv = cc->GetJSContext(&cx); - if (NS_FAILED(rv)) NS_ERROR_FAILURE; + if (NS_FAILED(rv)) return NS_ERROR_FAILURE; } else { NS_WITH_SERVICE(nsIAppShellService, appshellSvc, kAppShellServiceCID, &rv); diff --git a/extensions/transformiix/source/xml/util/DOMHelper.cpp b/extensions/transformiix/source/xml/util/DOMHelper.cpp index 1f5711e9039c..acd6acaa9c0a 100644 --- a/extensions/transformiix/source/xml/util/DOMHelper.cpp +++ b/extensions/transformiix/source/xml/util/DOMHelper.cpp @@ -161,8 +161,6 @@ void DOMHelper::addParentReference(Node* child, Node* parent) { void DOMHelper::continueIndexing(Node* node) { if (!node) return; - TxObjectWrapper* wrapper = 0; - //-- get indexing information Document* doc = 0; if (node->getNodeType() == Node::DOCUMENT_NODE) @@ -252,7 +250,8 @@ int DOMHelper::getChildNumber(Node* node) { case Node::ATTRIBUTE_NODE: break; default: - while (tmp = tmp->getPreviousSibling()) ++c; + while ((tmp = tmp->getPreviousSibling())) + ++c; break; } diff --git a/extensions/transformiix/source/xpath/BooleanFunctionCall.cpp b/extensions/transformiix/source/xpath/BooleanFunctionCall.cpp index 2f5e5a1c07dd..7c7c5006b429 100644 --- a/extensions/transformiix/source/xpath/BooleanFunctionCall.cpp +++ b/extensions/transformiix/source/xpath/BooleanFunctionCall.cpp @@ -24,7 +24,7 @@ * Marina Mechtcheriakova, mmarina@mindspring.com * -- added lang() implementation * - * $Id: BooleanFunctionCall.cpp,v 1.7 2001/04/08 14:35:34 peterv%netscape.com Exp $ + * $Id: BooleanFunctionCall.cpp,v 1.8 2001/07/02 09:23:49 peterv%netscape.com Exp $ */ #include "FunctionLib.h" @@ -33,7 +33,7 @@ /** * Creates a default BooleanFunctionCall, which always evaluates to False * @author Keith Visco - * @version $Revision: 1.7 $ $Date: 2001/04/08 14:35:34 $ + * @version $Revision: 1.8 $ $Date: 2001/07/02 09:23:49 $ **/ BooleanFunctionCall::BooleanFunctionCall() : FunctionCall(XPathNames::FALSE_FN) { this->type = TX_FALSE; @@ -75,7 +75,6 @@ ExprResult* BooleanFunctionCall::evaluate(Node* context, ContextState* cs) { MBool result = MB_FALSE; ListIterator* iter = params.iterator(); - int argc = params.getLength(); Expr* param = 0; String err; diff --git a/extensions/transformiix/source/xpath/ExprParser.cpp b/extensions/transformiix/source/xpath/ExprParser.cpp index ec2c01acaf46..6fb45b1e9912 100644 --- a/extensions/transformiix/source/xpath/ExprParser.cpp +++ b/extensions/transformiix/source/xpath/ExprParser.cpp @@ -30,7 +30,7 @@ * -- fixed bug in ::parsePredicates, * made sure we continue looking for more predicates. * - * $Id: ExprParser.cpp,v 1.14 2001/06/30 13:54:29 sicking%bigfoot.com Exp $ + * $Id: ExprParser.cpp,v 1.15 2001/07/02 09:24:06 peterv%netscape.com Exp $ */ /** @@ -38,7 +38,7 @@ * This class is used to parse XSL Expressions * @author Keith Visco * @see ExprLexer - * @version $Revision: 1.14 $ $Date: 2001/06/30 13:54:29 $ + * @version $Revision: 1.15 $ $Date: 2001/07/02 09:24:06 $ **/ #include "ExprParser.h" @@ -797,8 +797,6 @@ MBool ExprParser::isNodeTypeToken(Token* token) { **/ MBool ExprParser::parsePredicates(PredicateList* predicateList, ExprLexer& lexer) { - String* errorMsg = 0; - while (lexer.peek()->type == Token::L_BRACKET) { //-- eat Token lexer.nextToken(); diff --git a/extensions/transformiix/source/xpath/ExtensionFunctionCall.cpp b/extensions/transformiix/source/xpath/ExtensionFunctionCall.cpp index b3054a2ad29f..5449f82336bf 100644 --- a/extensions/transformiix/source/xpath/ExtensionFunctionCall.cpp +++ b/extensions/transformiix/source/xpath/ExtensionFunctionCall.cpp @@ -19,7 +19,7 @@ * Keith Visco, kvisco@ziplink.net * -- original author. * - * $Id: ExtensionFunctionCall.cpp,v 1.1 2000/04/19 10:35:59 kvisco%ziplink.net Exp $ + * $Id: ExtensionFunctionCall.cpp,v 1.2 2001/07/02 09:24:10 peterv%netscape.com Exp $ */ #include "FunctionLib.h" @@ -67,8 +67,6 @@ ExprResult* ExtensionFunctionCall::evaluate(Node* context, ContextState* cs) { //copy parameters ListIterator* iter = params.iterator(); - Expr* param = 0; - while (iter->hasNext()) { fnCall->addParam( new ExprWrapper( (Expr*) iter->next() ) ); } diff --git a/extensions/transformiix/source/xpath/NumberFunctionCall.cpp b/extensions/transformiix/source/xpath/NumberFunctionCall.cpp index c5a74c258d29..021f6690cd67 100644 --- a/extensions/transformiix/source/xpath/NumberFunctionCall.cpp +++ b/extensions/transformiix/source/xpath/NumberFunctionCall.cpp @@ -25,7 +25,7 @@ * Nisheeth Ranjan, nisheeth@netscape.com * -- implemented rint function, which was not available on Windows. * - * $Id: NumberFunctionCall.cpp,v 1.12 2001/04/08 14:33:21 peterv%netscape.com Exp $ + * $Id: NumberFunctionCall.cpp,v 1.13 2001/07/02 09:24:20 peterv%netscape.com Exp $ */ /* @@ -94,7 +94,6 @@ static double rint(double r) ExprResult* NumberFunctionCall::evaluate(Node* context, ContextState* cs) { NumberResult* result = 0; ListIterator* iter = params.iterator(); - int argc = params.getLength(); Expr* param = 0; String err; diff --git a/extensions/transformiix/source/xpath/PathExpr.cpp b/extensions/transformiix/source/xpath/PathExpr.cpp index bb42b70e60d2..2b8f4de8a607 100644 --- a/extensions/transformiix/source/xpath/PathExpr.cpp +++ b/extensions/transformiix/source/xpath/PathExpr.cpp @@ -29,7 +29,7 @@ * - foo//bar would not match properly if there was more than * one node in the NodeSet (nodes) on the final iteration * - * $Id: PathExpr.cpp,v 1.7 2001/06/30 13:54:33 sicking%bigfoot.com Exp $ + * $Id: PathExpr.cpp,v 1.8 2001/07/02 09:24:32 peterv%netscape.com Exp $ */ #include "Expr.h" @@ -242,7 +242,7 @@ MBool PathExpr::matches(Node* node, Node* context, ContextState* cs) case ANCESTOR_OP: { Node* ancestor = node; - while (ancestor = cs->getParentNode(ancestor)) { + while ((ancestor = cs->getParentNode(ancestor))) { if (pxi->expr->matches(node, ancestor, cs)) return MB_TRUE; } @@ -286,7 +286,7 @@ MBool PathExpr::matches(Node* node, Node* context, ContextState* cs) case ANCESTOR_OP: { Node* parent = tnode; - while (parent = cs->getParentNode(parent)) { + while ((parent = cs->getParentNode(parent))) { if (pxi->expr->matches(tnode, parent, cs)) tmpNodes.add(parent); } diff --git a/extensions/transformiix/source/xpath/StringFunctionCall.cpp b/extensions/transformiix/source/xpath/StringFunctionCall.cpp index c59475d010a7..27a1c660d3a4 100644 --- a/extensions/transformiix/source/xpath/StringFunctionCall.cpp +++ b/extensions/transformiix/source/xpath/StringFunctionCall.cpp @@ -21,14 +21,14 @@ * Keith Visco, kvisco@ziplink.net * -- original author. * - * $Id: StringFunctionCall.cpp,v 1.10 2001/06/26 14:09:23 peterv%netscape.com Exp $ + * $Id: StringFunctionCall.cpp,v 1.11 2001/07/02 09:24:39 peterv%netscape.com Exp $ */ /** * StringFunctionCall * A representation of the XPath String funtions * @author Keith Visco - * @version $Revision: 1.10 $ $Date: 2001/06/26 14:09:23 $ + * @version $Revision: 1.11 $ $Date: 2001/07/02 09:24:39 $ **/ #include "FunctionLib.h" @@ -123,7 +123,7 @@ ExprResult* StringFunctionCall::evaluate(Node* context, ContextState* cs) { // Leading & Trailing Whitespace resultStr.trim(); MBool hasSpace = MB_FALSE; - PRInt32 lastchar=-1, dest=0; + PRInt32 dest=0; String normed(resultStr.length()); UNICODE_CHAR current; for (PRInt32 src=0; srcKeith Visco - * @version $Revision: 1.2 $ $Date: 2001/04/08 14:40:02 $ + * @version $Revision: 1.3 $ $Date: 2001/07/02 09:24:26 $ **/ #include "Numbering.h" @@ -152,45 +152,3 @@ NodeSet* Numbering::getAncestorsOrSelf } return nodeSet; } //-- fromAncestorsOrSelf - -/** - * Retrieves all nodes that come before the given element - * at any level in the document that match the count pattern of - * this XSLNumber starting from the closest element that matches - * the from pattern - * @param element the element to find the nearest ancestor of - * @return a List of all matching nodes -** -NodeSet* Numbering::getAnyPreviousNodes - ( PatternExpr* patternExpr, Node* context, ProcessorState* ps) -{ - - NodeSet* nodes = new NodeSet(); - - Node* current = context; - - while (current) { - - // Check from MatchExpr - if ((from != null) && from.matches(element,element,ps)) - return nodes; - - // Check count MatchExpr - if (matchExpr.matches(element, element, ps)) - nodes.add(element); - - Node sibling = element; - while ( (sibling = sibling.getPreviousSibling()) != null) { - if (sibling.getNodeType() == Node.ELEMENT_NODE) break; - } - if (sibling == null) { - Node parent = element.getParentNode(); - if (parent.getNodeType() != Node.ELEMENT_NODE) break; - element = (Element)parent; - } - else element = (Element)sibling; - } - return nodes; -} //-- getAnyPreviousNodes - -/* */