From fea8db080353e408a38ad9b66b50b1c9dfaf96de Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Sat, 19 Dec 2020 17:12:05 +0300 Subject: Various fixes --- libxsd/xsd/cxx/parser/expat/elements.hxx | 6 ++++++ libxsd/xsd/cxx/parser/expat/elements.txx | 5 +++-- libxsd/xsd/cxx/parser/validating/xml-schema-pimpl.txx | 7 ++++++- libxsd/xsd/cxx/tree/containers.hxx | 2 +- libxsd/xsd/cxx/xml/dom/auto-ptr.hxx | 3 +++ 5 files changed, 19 insertions(+), 4 deletions(-) (limited to 'libxsd') diff --git a/libxsd/xsd/cxx/parser/expat/elements.hxx b/libxsd/xsd/cxx/parser/expat/elements.hxx index 5ed41f3..bd0b84c 100644 --- a/libxsd/xsd/cxx/parser/expat/elements.hxx +++ b/libxsd/xsd/cxx/parser/expat/elements.hxx @@ -86,6 +86,12 @@ namespace xsd return parser_; } + void + reset (XML_Parser parser) + { + *this = parser; + } + private: parser_auto_ptr (const parser_auto_ptr&); diff --git a/libxsd/xsd/cxx/parser/expat/elements.txx b/libxsd/xsd/cxx/parser/expat/elements.txx index a1b1beb..803c53c 100644 --- a/libxsd/xsd/cxx/parser/expat/elements.txx +++ b/libxsd/xsd/cxx/parser/expat/elements.txx @@ -312,7 +312,7 @@ namespace xsd if (XML_Parse (parser.get (), buf, - is.gcount (), + static_cast (is.gcount ()), is.eof ()) == XML_STATUS_ERROR) { r = false; @@ -337,7 +337,8 @@ namespace xsd // if (auto_xml_parser_.get () == 0) { - auto_xml_parser_ = XML_ParserCreateNS (0, XML_Char (' ')); + auto_xml_parser_.reset ( + XML_ParserCreateNS (0, XML_Char (' '))); if (auto_xml_parser_.get () == 0) throw std::bad_alloc (); diff --git a/libxsd/xsd/cxx/parser/validating/xml-schema-pimpl.txx b/libxsd/xsd/cxx/parser/validating/xml-schema-pimpl.txx index 5ef2455..7bf2523 100644 --- a/libxsd/xsd/cxx/parser/validating/xml-schema-pimpl.txx +++ b/libxsd/xsd/cxx/parser/validating/xml-schema-pimpl.txx @@ -5,6 +5,7 @@ #include #ifdef XSD_CXX11 +# include // std::isfinite # include // std::move #endif @@ -716,9 +717,13 @@ namespace xsd zc_istream is (str); is.imbue (std::locale::classic ()); - //@@ TODO: now we accept scientific notations and INF/NaN. + // Note that std::isfinite() returns false for INF/NaN. // +#ifdef XSD_CXX11 + if (!(is >> value_ && std::isfinite (value_) && is.exhausted ())) +#else if (!(is >> value_ && is.exhausted ())) +#endif throw invalid_value (bits::decimal (), str); } diff --git a/libxsd/xsd/cxx/tree/containers.hxx b/libxsd/xsd/cxx/tree/containers.hxx index f6a24ff..a7a4d10 100644 --- a/libxsd/xsd/cxx/tree/containers.hxx +++ b/libxsd/xsd/cxx/tree/containers.hxx @@ -1090,7 +1090,7 @@ namespace xsd } // Note that the container object of the two sequences being - // swapped should be the same. + // swapped should be the same. // void swap (sequence& x) diff --git a/libxsd/xsd/cxx/xml/dom/auto-ptr.hxx b/libxsd/xsd/cxx/xml/dom/auto-ptr.hxx index 97c9399..256f824 100644 --- a/libxsd/xsd/cxx/xml/dom/auto-ptr.hxx +++ b/libxsd/xsd/cxx/xml/dom/auto-ptr.hxx @@ -53,8 +53,11 @@ namespace xsd unique_ptr (unique_ptr&& p): base (std::move (p)) {} template unique_ptr (unique_ptr&& p): base (std::move (p)) {} + +#if !defined(__cplusplus) || __cplusplus < 201703L template unique_ptr (std::auto_ptr&& p): base (std::move (p)) {} +#endif unique_ptr& operator= (unique_ptr&& p) { -- cgit v1.1