From 4f83fc163afad8fc078afcb0eccfbda1f161b3b6 Mon Sep 17 00:00:00 2001 From: Robert Ramey Date: Mon, 28 Sep 2015 23:52:47 -0700 Subject: [PATCH] Miscellaneous fixes --- doc/serialization.html | 2 +- .../boost/archive/basic_binary_oprimitive.hpp | 8 +- .../boost/archive/iterators/head_iterator.hpp | 80 ------------------- .../serialization/collections_load_imp.hpp | 2 +- include/boost/serialization/deque.hpp | 2 + .../extended_type_info_typeid.hpp | 4 +- include/boost/serialization/singleton.hpp | 4 +- src/shared_ptr_helper.cpp | 63 --------------- 8 files changed, 11 insertions(+), 154 deletions(-) delete mode 100644 include/boost/archive/iterators/head_iterator.hpp delete mode 100644 src/shared_ptr_helper.cpp diff --git a/doc/serialization.html b/doc/serialization.html index 3378c288..82529309 100644 --- a/doc/serialization.html +++ b/doc/serialization.html @@ -792,7 +792,7 @@ class derived : public base { ar & boost::serialization::base_object<base>(*this); // method 2 : explicitly register base/derived relationship boost::serialization::void_cast_register<derived, base>( - static_cast<derived *>=NULL), + static_cast<derived *>(NULL), static_cast<base *>(NULL) ) } diff --git a/include/boost/archive/basic_binary_oprimitive.hpp b/include/boost/archive/basic_binary_oprimitive.hpp index 077d705e..f2ea6aa3 100644 --- a/include/boost/archive/basic_binary_oprimitive.hpp +++ b/include/boost/archive/basic_binary_oprimitive.hpp @@ -149,9 +149,7 @@ basic_binary_oprimitive::save_binary( const void *address, std::size_t count ){ - //BOOST_ASSERT( - // static_cast((std::numeric_limits::max)()) >= count - //); + // BOOST_ASSERT(count <= std::size_t(boost::integer_traits::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::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::const_max)); + count = ( count + sizeof(Elem) - 1) / sizeof(Elem); std::streamsize scount = m_sb.sputn( static_cast(address), static_cast(count) diff --git a/include/boost/archive/iterators/head_iterator.hpp b/include/boost/archive/iterators/head_iterator.hpp deleted file mode 100644 index 6ad7d6b3..00000000 --- a/include/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 -#include - -namespace boost { -namespace archive { -namespace iterators { - -template -class head_iterator - : public boost::iterator_adaptor< - head_iterator, - Base, - use_default, - single_pass_traversal_tag - > -{ -private: - friend class iterator_core_access; - typedef boost::iterator_adaptor< - head_iterator, - Base, - use_default, - single_pass_traversal_tag - > super_t; - - typedef head_iterator 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)->dereference_impl(); - } - - void increment(){ - ++base_reference(); - } - Predicate m_predicate; - bool m_end; -public: - template - 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/include/boost/serialization/collections_load_imp.hpp b/include/boost/serialization/collections_load_imp.hpp index 246b64ed..93d64d72 100644 --- a/include/boost/serialization/collections_load_imp.hpp +++ b/include/boost/serialization/collections_load_imp.hpp @@ -63,7 +63,7 @@ collection_load_impl( Archive & ar, T & t, collection_size_type count, - item_version_type item_version + item_version_type ){ t.resize(count); typename T::iterator hint; diff --git a/include/boost/serialization/deque.hpp b/include/boost/serialization/deque.hpp index f4b58c32..4d0a21f5 100644 --- a/include/boost/serialization/deque.hpp +++ b/include/boost/serialization/deque.hpp @@ -20,6 +20,8 @@ #include +#include + #include #include #include diff --git a/include/boost/serialization/extended_type_info_typeid.hpp b/include/boost/serialization/extended_type_info_typeid.hpp index d9e99e03..8ee591b3 100644 --- a/include/boost/serialization/extended_type_info_typeid.hpp +++ b/include/boost/serialization/extended_type_info_typeid.hpp @@ -84,7 +84,9 @@ class extended_type_info_typeid : { public: extended_type_info_typeid() : - typeid_system::extended_type_info_typeid_0(get_key()) + typeid_system::extended_type_info_typeid_0( + boost::serialization::guid< T >() + ) { type_register(typeid(T)); key_register(); diff --git a/include/boost/serialization/singleton.hpp b/include/boost/serialization/singleton.hpp index a397da57..db32395c 100644 --- a/include/boost/serialization/singleton.hpp +++ b/include/boost/serialization/singleton.hpp @@ -123,13 +123,13 @@ class singleton : public singleton_module private: BOOST_DLLEXPORT static T & instance; // include this to provoke instantiation at pre-execution time - static void use(T const &) {} + static void use(T const *) {} BOOST_DLLEXPORT static T & get_instance() { static detail::singleton_wrapper< T > t; // refer to instance, causing it to be instantiated (and // initialized at startup on working compilers) BOOST_ASSERT(! detail::singleton_wrapper< T >::m_is_destroyed); - use(instance); + use(& instance); return static_cast(t); } public: diff --git a/src/shared_ptr_helper.cpp b/src/shared_ptr_helper.cpp deleted file mode 100644 index 15102e2f..00000000 --- a/src/shared_ptr_helper.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 -// shared_ptr_helper.hpp: serialization for boost shared pointern - -// (C) Copyright 2004-2009 Robert Ramey, Martin Ecker and Takatoshi Kondo -// 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 -#include -#include -#include // NULL -#include - -#define BOOST_ARCHIVE_SOURCE -// include this to prevent linker errors when the -// same modules are marked export and import. -#define BOOST_SERIALIZATION_SOURCE - -#include -#include -#include -#include -#include - -namespace boost { -namespace serialization { - -/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 -// a common class for holding various types of shared pointers - -// #ifdef BOOST_SERIALIZATION_SHARED_PTR_132_HPP -BOOST_ARCHIVE_DECL(void) -shared_ptr_helper_base::append(const boost_132::shared_ptr & t){ - if(NULL == m_pointers_132) - m_pointers_132 = new std::list >; - m_pointers_132->push_back(t); -} -// #endif - -BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) -shared_ptr_helper_base::shared_ptr_helper_base() : - m_o_sp(NULL) - #ifdef BOOST_SERIALIZATION_SHARED_PTR_132_HPP - , m_pointers_132(NULL) - #endif -{} - -BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) -shared_ptr_helper_base::~shared_ptr_helper_base(){ - if(NULL != m_o_sp) - delete m_o_sp; - #ifdef BOOST_SERIALIZATION_SHARED_PTR_132_HPP - if(NULL != m_pointers_132) - delete m_pointers_132; - #endif -} - -} // namespace serialization -} // namespace boost -