commit f5bdcc1ebfe954bb64835f2a0efd94471da42207 Author: Jonathan Wakely Date: Thu Feb 23 02:18:58 2017 +0000 Replace boost::serialization::detail::get_data function. (#39) commit 947d17157304ceb93926ab961487e9c86fc7c2d2 Author: Jonathan Wakely Date: Thu Feb 23 02:19:45 2017 +0000 Add header for serialization::make_array (#40) commit b21d95676028e45a6743be9898306f13fe715282 Author: Andrey Semashev Date: Thu Feb 23 05:17:32 2017 +0300 Fix incorrect usage of auto_ptr to free an array (#38) The `auto_ptr` would use `delete p` to free an array allocated with `operator new[]`, which could result in heap corruption. Replaced it with `scoped_array`. commit 98c406a77f8506550276a8e81ad6ed0c961fca8f Author: Alain Miniussi Date: Thu Feb 23 11:26:49 2017 +0100 documentation typo Index: boost_1_64_0/boost/mpi/python/serialize.hpp =================================================================== --- boost_1_64_0.orig/boost/mpi/python/serialize.hpp +++ boost_1_64_0/boost/mpi/python/serialize.hpp @@ -26,7 +26,6 @@ #include #include -#include #include #include @@ -36,6 +35,9 @@ #include #include +#include + +#include #include @@ -441,7 +443,7 @@ load_impl(Archiver& ar, boost::python::o int len; ar >> len; - std::auto_ptr string(new char[len]); + boost::scoped_array string(new char[len]); ar >> boost::serialization::make_array(string.get(), len); boost::python::str py_string(string.get(), len); obj = boost::python::pickle::loads(py_string); Index: boost_1_64_0/boost/mpi/detail/mpi_datatype_primitive.hpp =================================================================== --- boost_1_64_0.orig/boost/mpi/detail/mpi_datatype_primitive.hpp +++ boost_1_64_0/boost/mpi/detail/mpi_datatype_primitive.hpp @@ -25,7 +25,6 @@ namespace std{ #include #include #include -#include #include #include #include @@ -80,18 +79,18 @@ public: BOOST_MPI_CHECK_RESULT(MPI_Type_create_struct, ( addresses.size(), - boost::serialization::detail::get_data(lengths), - boost::serialization::detail::get_data(addresses), - boost::serialization::detail::get_data(types), + get_data(lengths), + get_data(addresses), + get_data(types), &datatype_ )); #else BOOST_MPI_CHECK_RESULT(MPI_Type_struct, ( addresses.size(), - boost::serialization::detail::get_data(lengths), - boost::serialization::detail::get_data(addresses), - boost::serialization::detail::get_data(types), + get_data(lengths), + get_data(addresses), + get_data(types), &datatype_ )); #endif @@ -129,6 +128,12 @@ private: lengths.push_back(l); } + template + static T* get_data(std::vector& v) + { + return v.empty() ? 0 : &(v[0]); + } + std::vector addresses; std::vector types; std::vector lengths; Index: boost_1_64_0/boost/mpi/detail/packed_iprimitive.hpp =================================================================== --- boost_1_64_0.orig/boost/mpi/detail/packed_iprimitive.hpp +++ boost_1_64_0/boost/mpi/detail/packed_iprimitive.hpp @@ -16,7 +16,6 @@ #include #include #include -#include #include #include @@ -104,7 +103,12 @@ private: void load_impl(void * p, MPI_Datatype t, int l) { BOOST_MPI_CHECK_RESULT(MPI_Unpack, - (const_cast(boost::serialization::detail::get_data(buffer_)), buffer_.size(), &position, p, l, t, comm)); + (get_data(buffer_), buffer_.size(), &position, p, l, t, comm)); + } + + static buffer_type::value_type* get_data(buffer_type& b) + { + return b.empty() ? 0 : &(b[0]); } buffer_type & buffer_; Index: boost_1_64_0/boost/mpi/detail/packed_oprimitive.hpp =================================================================== --- boost_1_64_0.orig/boost/mpi/detail/packed_oprimitive.hpp +++ boost_1_64_0/boost/mpi/detail/packed_oprimitive.hpp @@ -15,7 +15,6 @@ #include #include -#include #include #include #include @@ -98,13 +97,18 @@ private: // pack the data into the buffer BOOST_MPI_CHECK_RESULT(MPI_Pack, - (const_cast(p), l, t, boost::serialization::detail::get_data(buffer_), buffer_.size(), &position, comm)); + (const_cast(p), l, t, get_data(buffer_), buffer_.size(), &position, comm)); // reduce the buffer size if needed BOOST_ASSERT(std::size_t(position) <= buffer_.size()); if (std::size_t(position) < buffer_.size()) buffer_.resize(position); } + static buffer_type::value_type* get_data(buffer_type& b) + { + return b.empty() ? 0 : &(b[0]); + } + buffer_type& buffer_; mutable std::size_t size_; MPI_Comm comm; Index: boost_1_64_0/boost/mpi/communicator.hpp =================================================================== --- boost_1_64_0.orig/boost/mpi/communicator.hpp +++ boost_1_64_0/boost/mpi/communicator.hpp @@ -850,7 +850,7 @@ class BOOST_MPI_DECL communicator optional as_graph_communicator() const; /** - * Determines whether this communicator has a Cartesian topology. + * Determines whether this communicator has a Graph topology. */ bool has_cartesian_topology() const;