From 818bcfa0dbbc1ef48bc3fe1f0c14d12866c51ef2 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Sat, 19 Dec 2020 17:12:05 +0300 Subject: Various fixes --- libxsd/libxsd/cxx/parser/expat/elements.txx | 4 ++-- libxsd/libxsd/cxx/parser/validating/xml-schema-pimpl.txx | 7 ++++++- libxsd/libxsd/cxx/tree/containers.hxx | 2 +- libxsd/libxsd/cxx/xml/dom/auto-ptr.hxx | 3 +++ 4 files changed, 12 insertions(+), 4 deletions(-) (limited to 'libxsd/libxsd/cxx') diff --git a/libxsd/libxsd/cxx/parser/expat/elements.txx b/libxsd/libxsd/cxx/parser/expat/elements.txx index 8a068c4..910b3af 100644 --- a/libxsd/libxsd/cxx/parser/expat/elements.txx +++ b/libxsd/libxsd/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,7 @@ namespace xsd // if (auto_xml_parser_.get () == 0) { - auto_xml_parser_ = XML_ParserCreateNS (0, XML_Char (' ')); + auto_xml_parser_ = parser_auto_ptr (XML_ParserCreateNS (0, XML_Char (' '))); if (auto_xml_parser_.get () == 0) throw std::bad_alloc (); diff --git a/libxsd/libxsd/cxx/parser/validating/xml-schema-pimpl.txx b/libxsd/libxsd/cxx/parser/validating/xml-schema-pimpl.txx index 0140a8a..60286a7 100644 --- a/libxsd/libxsd/cxx/parser/validating/xml-schema-pimpl.txx +++ b/libxsd/libxsd/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/libxsd/cxx/tree/containers.hxx b/libxsd/libxsd/cxx/tree/containers.hxx index fd6cebf..07dff0d 100644 --- a/libxsd/libxsd/cxx/tree/containers.hxx +++ b/libxsd/libxsd/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/libxsd/cxx/xml/dom/auto-ptr.hxx b/libxsd/libxsd/cxx/xml/dom/auto-ptr.hxx index 4e19547..228391e 100644 --- a/libxsd/libxsd/cxx/xml/dom/auto-ptr.hxx +++ b/libxsd/libxsd/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