From 36a305d55b320eee6f8d01b18ee21b393ce45d7c Mon Sep 17 00:00:00 2001 From: Jez Higgins Date: Sun, 10 Jan 2010 22:02:43 +0000 Subject: [PATCH] fixed more warnings --- .../XSLT/impl/handler/xslt_choose_handler.hpp | 2 +- .../impl/handler/xslt_for_each_handler.hpp | 10 ++++---- .../handler/xslt_foreign_element_handler.hpp | 14 +++++------ include/XSLT/impl/handler/xslt_if_handler.hpp | 8 +++---- .../impl/handler/xslt_include_handler.hpp | 7 +++--- .../handler/xslt_inline_element_handler.hpp | 2 +- .../handler/xslt_item_container_handler.hpp | 6 ++--- .../XSLT/impl/handler/xslt_key_handler.hpp | 18 +++++++------- .../impl/handler/xslt_message_handler.hpp | 6 ++--- .../handler/xslt_namespace_alias_handler.hpp | 16 ++++++------- .../XSLT/impl/handler/xslt_output_handler.hpp | 24 +++++++++---------- .../xslt_processing_instruction_handler.hpp | 8 +++---- include/XSLT/impl/xslt_functions.hpp | 8 +++---- include/XSLT/impl/xslt_output.hpp | 6 ++--- include/XSLT/impl/xslt_precedence.hpp | 2 +- 15 files changed, 69 insertions(+), 68 deletions(-) diff --git a/include/XSLT/impl/handler/xslt_choose_handler.hpp b/include/XSLT/impl/handler/xslt_choose_handler.hpp index bde0cc2b..b09e76da 100644 --- a/include/XSLT/impl/handler/xslt_choose_handler.hpp +++ b/include/XSLT/impl/handler/xslt_choose_handler.hpp @@ -23,7 +23,7 @@ public: const std::string& qName, const SAX::Attributes& atts) { - static const ValueRule rules[] = { { "test", true, 0. 0 }, + static const ValueRule rules[] = { { "test", true, 0, 0 }, { 0, false, 0, 0 } }; std::string test = gatherAttributes(qName, atts, rules)["test"]; diff --git a/include/XSLT/impl/handler/xslt_for_each_handler.hpp b/include/XSLT/impl/handler/xslt_for_each_handler.hpp index fded0d11..6d614ccb 100644 --- a/include/XSLT/impl/handler/xslt_for_each_handler.hpp +++ b/include/XSLT/impl/handler/xslt_for_each_handler.hpp @@ -20,13 +20,13 @@ public: } // ForEachHandler protected: - virtual ForEach* createContainer(const std::string& namespaceURI, - const std::string& localName, + virtual ForEach* createContainer(const std::string& /* namespaceURI */, + const std::string& /* localName */, const std::string& qName, const SAX::Attributes& atts) { - static const ValueRule rules[] = { { "select", true, 0 }, - { 0, false, 0} }; + static const ValueRule rules[] = { { "select", true, 0, 0 }, + { 0, false, 0, 0 } }; std::string select = gatherAttributes(qName, atts, rules)["select"]; return new ForEach(context().xpath_expression(select)); @@ -39,6 +39,7 @@ protected: { if((namespaceURI == StylesheetConstant::NamespaceURI()) && (localName == "sort")) + { if(!done_sort_) { context().push(0, @@ -51,6 +52,7 @@ protected: } else throw SAX::SAXException("xsl:sort must immediately follow xsl:for-each"); + } // if ... done_sort_ = true; return ItemContainerHandler::createChild(namespaceURI, localName, qName, atts); } // createChild diff --git a/include/XSLT/impl/handler/xslt_foreign_element_handler.hpp b/include/XSLT/impl/handler/xslt_foreign_element_handler.hpp index 8d58ce1b..183be5d7 100644 --- a/include/XSLT/impl/handler/xslt_foreign_element_handler.hpp +++ b/include/XSLT/impl/handler/xslt_foreign_element_handler.hpp @@ -15,17 +15,17 @@ public: { } // ForeignElementHandler - virtual void startElement(const std::string& namespaceURI, - const std::string& localName, - const std::string& qName, - const SAX::Attributes& atts) + virtual void startElement(const std::string& /* namespaceURI */, + const std::string& /* localName */, + const std::string& /* qName */, + const SAX::Attributes& /* atts */) { ++depth_; } // startElement - virtual void endElement(const std::string& namespaceURI, - const std::string& localName, - const std::string& qName) + virtual void endElement(const std::string& /* namespaceURI */, + const std::string& /* localName */, + const std::string& /* qName */) { if(--depth_ == 0) context_.pop(); diff --git a/include/XSLT/impl/handler/xslt_if_handler.hpp b/include/XSLT/impl/handler/xslt_if_handler.hpp index da8f2b80..194ef7d8 100644 --- a/include/XSLT/impl/handler/xslt_if_handler.hpp +++ b/include/XSLT/impl/handler/xslt_if_handler.hpp @@ -17,13 +17,13 @@ public: { } // IfHandler - virtual If* createContainer(const std::string& namespaceURI, - const std::string& localName, + virtual If* createContainer(const std::string& /* namespaceURI */, + const std::string& /* localName */, const std::string& qName, const SAX::Attributes& atts) { - static const ValueRule rules[] = { { "test", true, 0 }, - { 0, false, 0} }; + static const ValueRule rules[] = { { "test", true, 0, 0 }, + { 0, false, 0, 0 } }; std::string test = gatherAttributes(qName, atts, rules)["test"]; return new If(ItemContainerHandler::context().xpath_expression(test)); diff --git a/include/XSLT/impl/handler/xslt_include_handler.hpp b/include/XSLT/impl/handler/xslt_include_handler.hpp index f9044aba..023f302b 100644 --- a/include/XSLT/impl/handler/xslt_include_handler.hpp +++ b/include/XSLT/impl/handler/xslt_include_handler.hpp @@ -51,7 +51,6 @@ public: if(no_content_) throw SAX::SAXException("xsl:include must be empty"); - bool start_pass_through = false; if(namespaceURI == StylesheetConstant::NamespaceURI()) { if(localName == "import") @@ -121,8 +120,8 @@ public: private: std::string validate_href(const std::string& qName, const SAX::Attributes& atts) { - static const ValueRule rules[] = { { "href", true, 0 }, - { 0, false, 0 } }; + static const ValueRule rules[] = { { "href", true, 0, 0 }, + { 0, false, 0, 0 } }; std::string href = gatherAttributes(qName, atts, rules)["href"]; no_content_ = true; // std::cout << "Base : " << context_->currentBase() << ", href : " << href << "\n"; @@ -171,8 +170,8 @@ private: current_includes_.pop_back(); } // include_stylesheet - SAX::DefaultHandler* compiler_; CompilationContext* context_; + SAX::DefaultHandler* compiler_; bool no_content_; typedef std::vector HrefStack; diff --git a/include/XSLT/impl/handler/xslt_inline_element_handler.hpp b/include/XSLT/impl/handler/xslt_inline_element_handler.hpp index 049da692..b30f82d1 100644 --- a/include/XSLT/impl/handler/xslt_inline_element_handler.hpp +++ b/include/XSLT/impl/handler/xslt_inline_element_handler.hpp @@ -25,7 +25,7 @@ protected: const SAX::Attributes& atts) { std::vector inlineAtts; - for(unsigned int i = 0; i != atts.getLength(); ++i) + for(int i = 0; i != atts.getLength(); ++i) { if(atts.getQName(i).find("xmlns:") == 0) continue; diff --git a/include/XSLT/impl/handler/xslt_item_container_handler.hpp b/include/XSLT/impl/handler/xslt_item_container_handler.hpp index cd60b6b9..515f2cd1 100644 --- a/include/XSLT/impl/handler/xslt_item_container_handler.hpp +++ b/include/XSLT/impl/handler/xslt_item_container_handler.hpp @@ -55,9 +55,9 @@ public: throw SAX::SAXException(qName + " <- Sorry, don't know about that yet :)"); } // startElement - virtual void endElement(const std::string& namespaceURI, - const std::string& localName, - const std::string& qName) + virtual void endElement(const std::string& /* namespaceURI */, + const std::string& /* localName */, + const std::string& /* qName */) { context_.parentContainer().add_item(container_); context_.pop(); diff --git a/include/XSLT/impl/handler/xslt_key_handler.hpp b/include/XSLT/impl/handler/xslt_key_handler.hpp index a797f170..9c9756d0 100644 --- a/include/XSLT/impl/handler/xslt_key_handler.hpp +++ b/include/XSLT/impl/handler/xslt_key_handler.hpp @@ -18,18 +18,18 @@ public: { } // KeyHandler - virtual void startElement(const std::string& namespaceURI, - const std::string& localName, + virtual void startElement(const std::string& /* namespaceURI */, + const std::string& /* localName */, const std::string& qName, const SAX::Attributes& atts) { if(key_ != 0) throw SAX::SAXException(qName + " can not contain elements"); - static const ValueRule rules[] = { { "name", true, 0 }, - { "match", true, 0 }, - { "use", true, 0 }, - { 0, false, 0 } }; + static const ValueRule rules[] = { { "name", true, 0, 0 }, + { "match", true, 0, 0 }, + { "use", true, 0, 0 }, + { 0, false, 0, 0 } }; std::map attrs = gatherAttributes(qName, atts, rules); name_ = context_.processInternalQName(attrs["name"]).clarkName(); @@ -39,9 +39,9 @@ public: key_ = new Key(matches, use); } // startElement - virtual void endElement(const std::string& namespaceURI, - const std::string& localName, - const std::string& qName) + virtual void endElement(const std::string& /* namespaceURI */, + const std::string& /* localName */, + const std::string& /* qName */) { context_.stylesheet().add_key(name_, key_); context_.pop(); diff --git a/include/XSLT/impl/handler/xslt_message_handler.hpp b/include/XSLT/impl/handler/xslt_message_handler.hpp index 14cb53be..04c456bd 100644 --- a/include/XSLT/impl/handler/xslt_message_handler.hpp +++ b/include/XSLT/impl/handler/xslt_message_handler.hpp @@ -18,13 +18,13 @@ public: } // MessageHandler protected: - virtual Message* createContainer(const std::string& namespaceURI, - const std::string& localName, + virtual Message* createContainer(const std::string& /* namespaceURI */, + const std::string& /* localName */, const std::string& qName, const SAX::Attributes& atts) { static const ValueRule rules[] = { { "terminate", false, No, AllowedYesNo }, - { 0, false, 0} }; + { 0, false, 0, 0 } }; return new Message(gatherAttributes(qName, atts, rules)["terminate"] == Yes); } // createContainer }; // class MessageHandler diff --git a/include/XSLT/impl/handler/xslt_namespace_alias_handler.hpp b/include/XSLT/impl/handler/xslt_namespace_alias_handler.hpp index 069c60f2..aec447e1 100644 --- a/include/XSLT/impl/handler/xslt_namespace_alias_handler.hpp +++ b/include/XSLT/impl/handler/xslt_namespace_alias_handler.hpp @@ -17,16 +17,16 @@ public: { } // NamespaceAliasHandler - virtual void startElement(const std::string& namespaceURI, - const std::string& localName, + virtual void startElement(const std::string& /* namespaceURI */, + const std::string& /* localName */, const std::string& qName, const SAX::Attributes& atts) { if(!done_) { - static const ValueRule rules[] = { { "stylesheet-prefix", true, 0 }, - { "result-prefix", true, 0 }, - { 0, false, 0} }; + static const ValueRule rules[] = { { "stylesheet-prefix", true, 0, 0 }, + { "result-prefix", true, 0, 0 }, + { 0, false, 0, 0 } }; std::map attrs = gatherAttributes(qName, atts, rules); std::string stylesheet_prefix = attrs["stylesheet-prefix"]; @@ -52,9 +52,9 @@ public: throw SAX::SAXException(qName + " can not contain elements"); } // startElement - virtual void endElement(const std::string& namespaceURI, - const std::string& localName, - const std::string& qName) + virtual void endElement(const std::string& /* namespaceURI */, + const std::string& /* localName */, + const std::string& /* qName */) { context_.pop(); } // endElement diff --git a/include/XSLT/impl/handler/xslt_output_handler.hpp b/include/XSLT/impl/handler/xslt_output_handler.hpp index 04492791..e03880b9 100644 --- a/include/XSLT/impl/handler/xslt_output_handler.hpp +++ b/include/XSLT/impl/handler/xslt_output_handler.hpp @@ -16,8 +16,8 @@ public: { } // OutputHandler - virtual void startElement(const std::string& namespaceURI, - const std::string& localName, + virtual void startElement(const std::string& /* namespaceURI */, + const std::string& /* localName */, const std::string& qName, const SAX::Attributes& atts) { @@ -25,16 +25,16 @@ public: { static const char* AllowedMethods[] = { "xml", "html", "text", 0 }; static const ValueRule rules[] = { { "method", false, "xml", AllowedMethods }, - { "version", false, "1.0" }, - { "encoding", false, "UTF-8" }, + { "version", false, "1.0", 0 }, + { "encoding", false, "UTF-8", 0 }, { "omit-xml-declaration", false, No, AllowedYesNo }, { "standalone", false, "", AllowedYesNo }, - { "doctype-public", false, ""}, - { "doctype-system", false, ""}, - { "cdata-section-elements", false, ""}, + { "doctype-public", false, "", 0}, + { "doctype-system", false, "", 0}, + { "cdata-section-elements", false, "", 0}, { "indent", false, No, AllowedYesNo }, - { "media-type", false, "" }, - { 0, false, 0 } }; + { "media-type", false, "", 0 }, + { 0, false, 0, 0 } }; settings_ = gatherAttributes(qName, atts, rules); cdataElements_ = extractCDATAElements(settings_["cdata-section-elements"]); @@ -44,9 +44,9 @@ public: throw SAX::SAXException(qName + " can not contain elements"); } // startElement - virtual void endElement(const std::string& namespaceURI, - const std::string& localName, - const std::string& qName) + virtual void endElement(const std::string& /* namespaceURI */, + const std::string& /* localName */, + const std::string& /* qName */) { context_.stylesheet().output_settings(settings_, cdataElements_); context_.pop(); diff --git a/include/XSLT/impl/handler/xslt_processing_instruction_handler.hpp b/include/XSLT/impl/handler/xslt_processing_instruction_handler.hpp index 1b65c158..bcafddeb 100644 --- a/include/XSLT/impl/handler/xslt_processing_instruction_handler.hpp +++ b/include/XSLT/impl/handler/xslt_processing_instruction_handler.hpp @@ -17,13 +17,13 @@ public: { } // ProcessingInstructionHandler - virtual ProcessingInstruction* createContainer(const std::string& namespaceURI, - const std::string& localName, + virtual ProcessingInstruction* createContainer(const std::string& /* namespaceURI */, + const std::string& /* localName */, const std::string& qName, const SAX::Attributes& atts) { - static const ValueRule rules[] = { { "name", true, 0 }, - { 0, false, 0} }; + static const ValueRule rules[] = { { "name", true, 0, 0 }, + { 0, false, 0, 0} }; std::string name = gatherAttributes(qName, atts, rules)["name"]; return new ProcessingInstruction(ItemContainerHandler::context().xpath_attribute_value_template(name)); diff --git a/include/XSLT/impl/xslt_functions.hpp b/include/XSLT/impl/xslt_functions.hpp index 2aa5afb4..03a64467 100644 --- a/include/XSLT/impl/xslt_functions.hpp +++ b/include/XSLT/impl/xslt_functions.hpp @@ -139,8 +139,8 @@ public: Arabica::XPath::NodeSetXPathFunction(0, 0, args) { } protected: - virtual Arabica::XPath::NodeSet doEvaluate(const DOM::Node& context, - const Arabica::XPath::ExecutionContext& executionContext) const + virtual Arabica::XPath::NodeSet doEvaluate(const DOM::Node& /* context */, + const Arabica::XPath::ExecutionContext& executionContext) const { Arabica::XPath::NodeSet set; set.push_back(executionContext.currentNode()); @@ -156,8 +156,8 @@ public: Arabica::XPath::StringXPathFunction(1, 1, args) { } protected: - virtual std::string doEvaluate(const DOM::Node& context, - const Arabica::XPath::ExecutionContext& executionContext) const + virtual std::string doEvaluate(const DOM::Node& /* context */, + const Arabica::XPath::ExecutionContext& /* executionContext */) const { // This is a minimal, but I think conformant, implementation return ""; diff --git a/include/XSLT/impl/xslt_output.hpp b/include/XSLT/impl/xslt_output.hpp index 6bf573de..daab5110 100644 --- a/include/XSLT/impl/xslt_output.hpp +++ b/include/XSLT/impl/xslt_output.hpp @@ -364,16 +364,16 @@ private: int buffering_; bool pending_element_; - int pending_attribute_; bool pending_text_; + int pending_attribute_; + bool text_mode_; + Output* warning_sink_; CDATAElements cdataElements_; std::stack element_stack_; std::string target_; SAX::AttributesImpl > atts_; std::stringstream buffer_; - bool text_mode_; NamespaceStack namespaceStack_; - Output* warning_sink_; }; // class Output } // namespace XSLT diff --git a/include/XSLT/impl/xslt_precedence.hpp b/include/XSLT/impl/xslt_precedence.hpp index c490a5fa..c412ac5a 100644 --- a/include/XSLT/impl/xslt_precedence.hpp +++ b/include/XSLT/impl/xslt_precedence.hpp @@ -116,7 +116,7 @@ bool operator>(const Precedence& lhs, const Precedence& rhs) std::ostream& operator<<(std::ostream& os, const Precedence& prec) { os << '(' << prec.precedence_[0]; - for(int i = 1; i != prec.precedence_.size(); ++i) + for(size_t i = 1; i != prec.precedence_.size(); ++i) os << ',' << prec.precedence_[i]; os << ')'; return os;