diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2020-12-19 17:12:05 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2021-02-25 13:45:49 +0300 |
commit | fea8db080353e408a38ad9b66b50b1c9dfaf96de (patch) | |
tree | 19c060eb9d6b66104f3bff3e5ea940dd7441c74d /libxsd | |
parent | 5e527213a2430bb3018e5eebd909aef294edf9b5 (diff) |
Various fixes
Diffstat (limited to 'libxsd')
-rw-r--r-- | libxsd/xsd/cxx/parser/expat/elements.hxx | 6 | ||||
-rw-r--r-- | libxsd/xsd/cxx/parser/expat/elements.txx | 5 | ||||
-rw-r--r-- | libxsd/xsd/cxx/parser/validating/xml-schema-pimpl.txx | 7 | ||||
-rw-r--r-- | libxsd/xsd/cxx/tree/containers.hxx | 2 | ||||
-rw-r--r-- | libxsd/xsd/cxx/xml/dom/auto-ptr.hxx | 3 |
5 files changed, 19 insertions, 4 deletions
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<int> (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 <locale> #ifdef XSD_CXX11 +# include <cmath> // std::isfinite # include <utility> // std::move #endif @@ -716,9 +717,13 @@ namespace xsd zc_istream<C> 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<C> (bits::decimal<C> (), 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 <class T1> unique_ptr (unique_ptr<T1>&& p): base (std::move (p)) {} + +#if !defined(__cplusplus) || __cplusplus < 201703L template <class T1> unique_ptr (std::auto_ptr<T1>&& p): base (std::move (p)) {} +#endif unique_ptr& operator= (unique_ptr&& p) { |