diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2016-10-06 10:33:54 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2016-10-06 10:36:09 +0900 |
commit | d9ec475d945d3035377a0d89ed42e382d8988891 (patch) | |
tree | 34aff2cee4b209906243ab5499d61f3edee2982f /boost/archive | |
parent | 71d216b90256936a9638f325af9bc69d720e75de (diff) | |
download | boost-d9ec475d945d3035377a0d89ed42e382d8988891.tar.gz boost-d9ec475d945d3035377a0d89ed42e382d8988891.tar.bz2 boost-d9ec475d945d3035377a0d89ed42e382d8988891.zip |
Imported Upstream version 1.60.0
Change-Id: Ie709530d6d5841088ceaba025cbe175a4ef43050
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'boost/archive')
19 files changed, 96 insertions, 194 deletions
diff --git a/boost/archive/archive_exception.hpp b/boost/archive/archive_exception.hpp index 1159d27755..fabcdb5fa7 100644 --- a/boost/archive/archive_exception.hpp +++ b/boost/archive/archive_exception.hpp @@ -87,6 +87,7 @@ public: const char * e1 = NULL, const char * e2 = NULL ) BOOST_NOEXCEPT; + BOOST_ARCHIVE_DECL archive_exception(archive_exception const &) BOOST_NOEXCEPT ; virtual BOOST_ARCHIVE_DECL ~archive_exception() BOOST_NOEXCEPT_OR_NOTHROW ; virtual BOOST_ARCHIVE_DECL const char * what() const BOOST_NOEXCEPT_OR_NOTHROW ; }; diff --git a/boost/archive/basic_binary_oprimitive.hpp b/boost/archive/basic_binary_oprimitive.hpp index 077d705ef1..f2ea6aa3ea 100644 --- a/boost/archive/basic_binary_oprimitive.hpp +++ b/boost/archive/basic_binary_oprimitive.hpp @@ -149,9 +149,7 @@ basic_binary_oprimitive<Archive, Elem, Tr>::save_binary( const void *address, std::size_t count ){ - //BOOST_ASSERT( - // static_cast<std::size_t>((std::numeric_limits<std::streamsize>::max)()) >= count - //); + // BOOST_ASSERT(count <= std::size_t(boost::integer_traits<std::streamsize>::const_max)); // note: if the following assertions fail // a likely cause is that the output stream is set to "text" // mode where by cr characters recieve special treatment. @@ -161,9 +159,7 @@ basic_binary_oprimitive<Archive, Elem, Tr>::save_binary( // archive_exception(archive_exception::output_stream_error) // ); // figure number of elements to output - round up - count = ( count + sizeof(Elem) - 1) - / sizeof(Elem); - BOOST_ASSERT(count <= std::size_t(boost::integer_traits<std::streamsize>::const_max)); + count = ( count + sizeof(Elem) - 1) / sizeof(Elem); std::streamsize scount = m_sb.sputn( static_cast<const Elem *>(address), static_cast<std::streamsize>(count) diff --git a/boost/archive/detail/basic_iarchive.hpp b/boost/archive/detail/basic_iarchive.hpp index befd0c75f2..1f5a8bf63b 100644 --- a/boost/archive/detail/basic_iarchive.hpp +++ b/boost/archive/detail/basic_iarchive.hpp @@ -65,11 +65,7 @@ protected: public: // some msvc versions require that the following function be public // otherwise it should really protected. - // account for bogus gcc warning - #if defined(__GNUC__) - virtual - #endif - BOOST_ARCHIVE_DECL ~basic_iarchive(); + virtual BOOST_ARCHIVE_DECL ~basic_iarchive(); // note: NOT part of the public API. BOOST_ARCHIVE_DECL void next_object_pointer(void *t); BOOST_ARCHIVE_DECL void register_basic_serializer( diff --git a/boost/archive/detail/basic_iserializer.hpp b/boost/archive/detail/basic_iserializer.hpp index 240f0bc06e..0d66674c34 100644 --- a/boost/archive/detail/basic_iserializer.hpp +++ b/boost/archive/detail/basic_iserializer.hpp @@ -51,11 +51,7 @@ protected: explicit BOOST_ARCHIVE_DECL basic_iserializer( const boost::serialization::extended_type_info & type ); - // account for bogus gcc warning - #if defined(__GNUC__) - virtual - #endif - BOOST_ARCHIVE_DECL ~basic_iserializer(); + virtual BOOST_ARCHIVE_DECL ~basic_iserializer(); public: bool serialized_as_pointer() const { return m_bpis != NULL; diff --git a/boost/archive/detail/basic_oarchive.hpp b/boost/archive/detail/basic_oarchive.hpp index 702c5604bc..c379108d58 100644 --- a/boost/archive/detail/basic_oarchive.hpp +++ b/boost/archive/detail/basic_oarchive.hpp @@ -61,14 +61,8 @@ class BOOST_SYMBOL_VISIBLE basic_oarchive : protected: BOOST_ARCHIVE_DECL basic_oarchive(unsigned int flags = 0); BOOST_ARCHIVE_DECL boost::archive::detail::helper_collection & - get_helper_collection(){ - return *this; - } - // account for bogus gcc warning - #if defined(__GNUC__) - virtual - #endif - BOOST_ARCHIVE_DECL ~basic_oarchive(); + get_helper_collection(); + virtual BOOST_ARCHIVE_DECL ~basic_oarchive(); public: // note: NOT part of the public interface BOOST_ARCHIVE_DECL void register_basic_serializer( diff --git a/boost/archive/detail/basic_oserializer.hpp b/boost/archive/detail/basic_oserializer.hpp index 7a710ba6bc..94247e9005 100644 --- a/boost/archive/detail/basic_oserializer.hpp +++ b/boost/archive/detail/basic_oserializer.hpp @@ -52,11 +52,7 @@ protected: explicit BOOST_ARCHIVE_DECL basic_oserializer( const boost::serialization::extended_type_info & type_ ); - // account for bogus gcc warning - #if defined(__GNUC__) - virtual - #endif - BOOST_ARCHIVE_DECL ~basic_oserializer(); + virtual BOOST_ARCHIVE_DECL ~basic_oserializer(); public: bool serialized_as_pointer() const { return m_bpos != NULL; diff --git a/boost/archive/detail/basic_pointer_iserializer.hpp b/boost/archive/detail/basic_pointer_iserializer.hpp index 23b9f906dc..1fc4b14d6e 100644 --- a/boost/archive/detail/basic_pointer_iserializer.hpp +++ b/boost/archive/detail/basic_pointer_iserializer.hpp @@ -46,11 +46,7 @@ protected: explicit BOOST_ARCHIVE_DECL basic_pointer_iserializer( const boost::serialization::extended_type_info & type_ ); - // account for bogus gcc warning - #if defined(__GNUC__) - virtual - #endif - BOOST_ARCHIVE_DECL ~basic_pointer_iserializer(); + virtual BOOST_ARCHIVE_DECL ~basic_pointer_iserializer(); public: virtual void * heap_allocation() const = 0; virtual const basic_iserializer & get_basic_serializer() const = 0; diff --git a/boost/archive/detail/basic_pointer_oserializer.hpp b/boost/archive/detail/basic_pointer_oserializer.hpp index 868e2fa580..1a5d9549ea 100644 --- a/boost/archive/detail/basic_pointer_oserializer.hpp +++ b/boost/archive/detail/basic_pointer_oserializer.hpp @@ -47,11 +47,7 @@ protected: const boost::serialization::extended_type_info & type_ ); public: - // account for bogus gcc warning - #if defined(__GNUC__) - virtual - #endif - BOOST_ARCHIVE_DECL ~basic_pointer_oserializer(); + virtual BOOST_ARCHIVE_DECL ~basic_pointer_oserializer(); virtual const basic_oserializer & get_basic_serializer() const = 0; virtual void save_object_ptr( basic_oarchive & ar, diff --git a/boost/archive/detail/interface_oarchive.hpp b/boost/archive/detail/interface_oarchive.hpp index 187013b6cd..359463ed9d 100644 --- a/boost/archive/detail/interface_oarchive.hpp +++ b/boost/archive/detail/interface_oarchive.hpp @@ -29,7 +29,7 @@ namespace boost { namespace archive { namespace detail { -class BOOST_ARCHIVE_OR_WARCHIVE_DECL basic_pointer_oserializer; +class basic_pointer_oserializer; template<class Archive> class interface_oarchive @@ -75,7 +75,7 @@ public: template<class T> Archive & operator&(const T & t){ return * this ->This() << t; - }; + } }; } // namespace detail diff --git a/boost/archive/detail/iserializer.hpp b/boost/archive/detail/iserializer.hpp index d6d3f42f6e..6419e623c8 100644 --- a/boost/archive/detail/iserializer.hpp +++ b/boost/archive/detail/iserializer.hpp @@ -57,10 +57,16 @@ namespace std{ #include <boost/type_traits/is_polymorphic.hpp> #include <boost/serialization/assume_abstract.hpp> -#define DONT_USE_HAS_NEW_OPERATOR ( \ - BOOST_WORKAROUND(__IBMCPP__, < 1210) \ - || defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x590) \ -) + +#ifndef BOOST_MSVC + #define DONT_USE_HAS_NEW_OPERATOR ( \ + BOOST_WORKAROUND(__IBMCPP__, < 1210) \ + || defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x590) \ + ) +#else + #define DONT_USE_HAS_NEW_OPERATOR 0 +#endif + #if ! DONT_USE_HAS_NEW_OPERATOR #include <boost/type_traits/has_new_operator.hpp> #endif @@ -220,20 +226,25 @@ struct heap_allocation { static T * invoke_new() { return static_cast<T *>((T::operator new)(sizeof(T))); } + template<void D(void *, std::size_t)> + static void deleter(void * t, std::size_t s){ + D(t, s); + } + + template<void D(void *)> + static void deleter(void * t, std::size_t s){ + D(t); + } static void invoke_delete(T * t) { // if compilation fails here, the likely cause that the class // T has a class specific new operator but no class specific - // delete operator which matches the following signature. Fix - // your program to have this. Note that adding operator delete - // with only one parameter doesn't seem correct to me since - // the standard(3.7.4.2) says " - // "If a class T has a member deallocation function named - // 'operator delete' with exactly one parameter, then that function - // is a usual (non-placement) deallocation function" which I take - // to mean that it will call the destructor of type T which we don't - // want to do here. - // Note: reliance upon automatic conversion from T * to void * here - (T::operator delete)(t, sizeof(T)); + // delete operator which matches the following signature. + // note that this solution addresses the issue that two + // possible signatures. But it doesn't address the possibility + // that the class might have class specific new with NO + // class specific delete at all. Patches (compatible with + // C++03) welcome! + deleter<T::operator delete>(t, sizeof(T)); } }; struct doesnt_have_new_operator { diff --git a/boost/archive/detail/polymorphic_iarchive_route.hpp b/boost/archive/detail/polymorphic_iarchive_route.hpp index 2c57a3f51c..105685ebbd 100644 --- a/boost/archive/detail/polymorphic_iarchive_route.hpp +++ b/boost/archive/detail/polymorphic_iarchive_route.hpp @@ -39,8 +39,8 @@ namespace serialization { namespace archive { namespace detail{ -class BOOST_ARCHIVE_DECL basic_iserializer; -class BOOST_ARCHIVE_DECL basic_pointer_iserializer; +class basic_iserializer; +class basic_pointer_iserializer; #ifdef BOOST_MSVC # pragma warning(push) diff --git a/boost/archive/detail/polymorphic_oarchive_route.hpp b/boost/archive/detail/polymorphic_oarchive_route.hpp index ae750133a8..b23fd6bf39 100644 --- a/boost/archive/detail/polymorphic_oarchive_route.hpp +++ b/boost/archive/detail/polymorphic_oarchive_route.hpp @@ -39,8 +39,8 @@ namespace serialization { namespace archive { namespace detail{ -class BOOST_ARCHIVE_DECL basic_oserializer; -class BOOST_ARCHIVE_DECL basic_pointer_oserializer; +class basic_oserializer; +class basic_pointer_oserializer; #ifdef BOOST_MSVC # pragma warning(push) diff --git a/boost/archive/impl/xml_iarchive_impl.ipp b/boost/archive/impl/xml_iarchive_impl.ipp index 7639ecb3b1..bf94774987 100644 --- a/boost/archive/impl/xml_iarchive_impl.ipp +++ b/boost/archive/impl/xml_iarchive_impl.ipp @@ -18,10 +18,11 @@ namespace std{ #endif #ifndef BOOST_NO_CWCHAR -#include <cstdlib> // mbtowc +#include <cwchar> // mbstate_t and mbrtowc #if defined(BOOST_NO_STDC_NAMESPACE) namespace std{ - using ::mbtowc; + using ::mbstate_t; + using ::mbrtowc; } // namespace std #endif #endif // BOOST_NO_CWCHAR @@ -64,21 +65,22 @@ xml_iarchive_impl<Archive>::load(std::wstring &ws){ if(NULL != ws.data()) #endif ws.resize(0); + std::mbstate_t mbs; const char * start = s.data(); const char * end = start + s.size(); while(start < end){ wchar_t wc; - int resultx = std::mbtowc(&wc, start, end - start); - if(0 < resultx){ - start += resultx; - ws += wc; + std::size_t result = std::mbrtowc(&wc, start, end - start, &mbs); + if(result == static_cast<std::size_t>(-1)) + boost::serialization::throw_exception( + iterators::dataflow_exception( + iterators::dataflow_exception::invalid_conversion + ) + ); + if(result == static_cast<std::size_t>(-2)) continue; - } - boost::serialization::throw_exception( - iterators::dataflow_exception( - iterators::dataflow_exception::invalid_conversion - ) - ); + start += result; + ws += wc; } } #endif // BOOST_NO_STD_WSTRING @@ -91,24 +93,28 @@ xml_iarchive_impl<Archive>::load(wchar_t * ws){ bool result = gimpl->parse_string(is, s); if(! result) boost::serialization::throw_exception( - xml_archive_exception(xml_archive_exception::xml_archive_parsing_error) + xml_archive_exception( + xml_archive_exception::xml_archive_parsing_error + ) ); + std::mbstate_t mbs; const char * start = s.data(); const char * end = start + s.size(); while(start < end){ wchar_t wc; - int length = std::mbtowc(&wc, start, end - start); - if(0 < length){ - start += length; - *ws++ = wc; + std::size_t length = std::mbrtowc(&wc, start, end - start, &mbs); + if(static_cast<std::size_t>(-1) == length) + boost::serialization::throw_exception( + iterators::dataflow_exception( + iterators::dataflow_exception::invalid_conversion + ) + ); + if(static_cast<std::size_t>(-2) == length) continue; - } - boost::serialization::throw_exception( - iterators::dataflow_exception( - iterators::dataflow_exception::invalid_conversion - ) - ); + + start += length; + *ws++ = wc; } *ws = L'\0'; } diff --git a/boost/archive/iterators/head_iterator.hpp b/boost/archive/iterators/head_iterator.hpp deleted file mode 100644 index 6ad7d6b32b..0000000000 --- a/boost/archive/iterators/head_iterator.hpp +++ /dev/null @@ -1,80 +0,0 @@ -#ifndef BOOST_ARCHIVE_ITERATORS_HEAD_ITERATOR_HPP -#define BOOST_ARCHIVE_ITERATORS_HEAD_ITERATOR_HPP - -// MS compatible compilers support #pragma once -#if defined(_MSC_VER) -# pragma once -#endif - -/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 -// head_iterator.hpp - -// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . -// Use, modification and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org for updates, documentation, and revision history. - -#include <boost/iterator/iterator_adaptor.hpp> -#include <boost/iterator/iterator_traits.hpp> - -namespace boost { -namespace archive { -namespace iterators { - -template<class Predicate, class Base> -class head_iterator - : public boost::iterator_adaptor< - head_iterator<Predicate, Base>, - Base, - use_default, - single_pass_traversal_tag - > -{ -private: - friend class iterator_core_access; - typedef boost::iterator_adaptor< - head_iterator<Predicate, Base>, - Base, - use_default, - single_pass_traversal_tag - > super_t; - - typedef head_iterator<Predicate, Base> this_t; - typedef super_t::value_type value_type; - typedef super_t::reference reference_type; - - reference_type dereference_impl(){ - if(! m_end){ - while(! m_predicate(* this->base_reference())) - ++ this->base_reference(); - m_end = true; - } - return * this->base_reference(); - } - - reference_type dereference() const { - return const_cast<this_t *>(this)->dereference_impl(); - } - - void increment(){ - ++base_reference(); - } - Predicate m_predicate; - bool m_end; -public: - template<class T> - head_iterator(Predicate f, T start) : - super_t(Base(start)), - m_predicate(f), - m_end(false) - {} - -}; - -} // namespace iterators -} // namespace archive -} // namespace boost - -#endif // BOOST_ARCHIVE_ITERATORS_HEAD_ITERATOR_HPP diff --git a/boost/archive/iterators/mb_from_wchar.hpp b/boost/archive/iterators/mb_from_wchar.hpp index deb798f623..d76eb3e2d2 100644 --- a/boost/archive/iterators/mb_from_wchar.hpp +++ b/boost/archive/iterators/mb_from_wchar.hpp @@ -18,13 +18,14 @@ #include <boost/assert.hpp> #include <cstddef> // size_t -#include <cstdlib> // for wctomb() +#include <cwchar> // for mbstate_t and wcrtomb() #include <boost/config.hpp> #if defined(BOOST_NO_STDC_NAMESPACE) namespace std{ using ::size_t; - using ::wctomb; + using ::mbstate_t; + using ::wcrtomb; } // namespace std #endif @@ -82,13 +83,10 @@ class mb_from_wchar } void fill(){ + std::mbstate_t mbs; + std::wcrtomb(0, 0, &mbs); wchar_t value = * this->base_reference(); - #if (defined(__MINGW32__) && ((__MINGW32_MAJOR_VERSION > 3) \ - || ((__MINGW32_MAJOR_VERSION == 3) && (__MINGW32_MINOR_VERSION >= 8)))) - m_bend = std::wcrtomb(m_buffer, value,0); - #else - m_bend = std::wctomb(m_buffer, value); - #endif + m_bend = std::wcrtomb(m_buffer, value, &mbs); BOOST_ASSERT(-1 != m_bend); BOOST_ASSERT((std::size_t)m_bend <= sizeof(m_buffer)); BOOST_ASSERT(m_bend > 0); diff --git a/boost/archive/iterators/wchar_from_mb.hpp b/boost/archive/iterators/wchar_from_mb.hpp index ad1d4cbb7d..998a4686b2 100644 --- a/boost/archive/iterators/wchar_from_mb.hpp +++ b/boost/archive/iterators/wchar_from_mb.hpp @@ -19,13 +19,13 @@ #include <boost/assert.hpp> #include <cctype> #include <cstddef> // size_t -#include <cstdlib> // mblen +#include <cwchar> // mbstate_t and mbrtowc #include <boost/config.hpp> #if defined(BOOST_NO_STDC_NAMESPACE) namespace std{ - using ::mblen; - using ::mbtowc; + using ::mbstate_t; + using ::mbrtowc; } // namespace std #endif @@ -101,23 +101,17 @@ public: template<class Base> wchar_t wchar_from_mb<Base>::drain(){ - char buffer[9]; - char * bptr = buffer; - char val; - for(std::size_t i = 0; i++ < (unsigned)MB_CUR_MAX;){ - val = * this->base_reference(); - *bptr++ = val; - int result = std::mblen(buffer, i); - if(-1 != result) - break; - ++(this->base_reference()); - } + std::mbstate_t mbs; wchar_t retval; - int result = std::mbtowc(& retval, buffer, MB_CUR_MAX); - if(0 >= result) - boost::serialization::throw_exception(iterators::dataflow_exception( - iterators::dataflow_exception::invalid_conversion - )); + std::size_t result; + do { + char val = *this->base_reference(); + result = std::mbrtowc(&retval, &val, 1, &mbs); + if(result == static_cast<std::size_t>(-1)) + boost::serialization::throw_exception(iterators::dataflow_exception( + iterators::dataflow_exception::invalid_conversion + )); + } while (result == static_cast<std::size_t>(-2)); return retval; } diff --git a/boost/archive/polymorphic_iarchive.hpp b/boost/archive/polymorphic_iarchive.hpp index 7f19410dd8..d3c59a9f0f 100644 --- a/boost/archive/polymorphic_iarchive.hpp +++ b/boost/archive/polymorphic_iarchive.hpp @@ -43,8 +43,8 @@ namespace serialization { } // namespace serialization namespace archive { namespace detail { - class BOOST_ARCHIVE_DECL basic_iarchive; - class BOOST_ARCHIVE_DECL basic_iarchive; + class basic_iarchive; + class basic_iserializer; } class polymorphic_iarchive; diff --git a/boost/archive/polymorphic_oarchive.hpp b/boost/archive/polymorphic_oarchive.hpp index aa30b2ac3e..edac4edb1e 100644 --- a/boost/archive/polymorphic_oarchive.hpp +++ b/boost/archive/polymorphic_oarchive.hpp @@ -42,8 +42,8 @@ namespace serialization { } // namespace serialization namespace archive { namespace detail { - class BOOST_ARCHIVE_DECL basic_oarchive; - class BOOST_ARCHIVE_DECL basic_oserializer; + class basic_oarchive; + class basic_oserializer; } class polymorphic_oarchive; diff --git a/boost/archive/xml_archive_exception.hpp b/boost/archive/xml_archive_exception.hpp index b07f9a0c33..82c53ef5d3 100644 --- a/boost/archive/xml_archive_exception.hpp +++ b/boost/archive/xml_archive_exception.hpp @@ -45,6 +45,8 @@ public: const char * e1 = NULL, const char * e2 = NULL ); + BOOST_ARCHIVE_DECL xml_archive_exception(xml_archive_exception const &) ; + virtual BOOST_ARCHIVE_DECL ~xml_archive_exception() BOOST_NOEXCEPT_OR_NOTHROW ; }; }// namespace archive |