diff --git a/include/boost/archive/basic_binary_iprimitive.hpp b/include/boost/archive/basic_binary_iprimitive.hpp index dede7123..f9f29c6b 100644 --- a/include/boost/archive/basic_binary_iprimitive.hpp +++ b/include/boost/archive/basic_binary_iprimitive.hpp @@ -137,28 +137,6 @@ basic_binary_iprimitive::load_binary( void *address, std::size_t count ){ -#if 0 - assert( - static_cast((std::numeric_limits::max)()) >= count - ); - //if(is.fail()) - // boost::throw_exception(archive_exception(archive_exception::stream_error)); - // note: an optimizer should eliminate the following for char files - std::size_t s = count / sizeof(BOOST_DEDUCED_TYPENAME IStream::char_type); - is.read( - static_cast(address), - s - ); - // note: an optimizer should eliminate the following for char files - s = count % sizeof(BOOST_DEDUCED_TYPENAME IStream::char_type); - if(0 < s){ - if(is.fail()) - boost::throw_exception(archive_exception(archive_exception::stream_error)); - BOOST_DEDUCED_TYPENAME IStream::char_type t; - is.read(& t, 1); - std::memcpy(address, &t, s); - } -#endif // note: an optimizer should eliminate the following for char files std::streamsize s = count / sizeof(Elem); std::streamsize scount = m_sb.sgetn( diff --git a/include/boost/archive/basic_text_iarchive.hpp b/include/boost/archive/basic_text_iarchive.hpp index fd19d872..a96bbd26 100644 --- a/include/boost/archive/basic_text_iarchive.hpp +++ b/include/boost/archive/basic_text_iarchive.hpp @@ -61,16 +61,6 @@ public: { this->detail_common_iarchive::load_override(t, 0); } -#if 0 - // Borland compilers has a problem with strong type. Try to fix this here - #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582)) - void load_override(version_type & t, int){ - unsigned int x; - * this->This() >> x; - t.t = version_type(x); - } - #endif -#endif // text file don't include the optional information void load_override(class_id_optional_type & /*t*/, int){} diff --git a/include/boost/archive/impl/basic_binary_iprimitive.ipp b/include/boost/archive/impl/basic_binary_iprimitive.ipp index c90d869d..3e2327e5 100644 --- a/include/boost/archive/impl/basic_binary_iprimitive.ipp +++ b/include/boost/archive/impl/basic_binary_iprimitive.ipp @@ -95,7 +95,8 @@ basic_binary_iprimitive::load(std::string & s) #endif s.resize(l); // note breaking a rule here - could be a problem on some platform - load_binary(&(*s.begin()), l); + if(0 < l) + load_binary(&(*s.begin()), l); } #ifndef BOOST_NO_CWCHAR diff --git a/include/boost/archive/impl/text_iarchive_impl.ipp b/include/boost/archive/impl/text_iarchive_impl.ipp index 4adc4e00..4c4996b7 100644 --- a/include/boost/archive/impl/text_iarchive_impl.ipp +++ b/include/boost/archive/impl/text_iarchive_impl.ipp @@ -53,7 +53,8 @@ text_iarchive_impl::load(std::string &s) if(NULL != s.data()) #endif s.resize(size); - is.read(&(*s.begin()), size); + if(0 < size) + is.read(&(*s.begin()), size); } #ifndef BOOST_NO_CWCHAR diff --git a/include/boost/serialization/utility.hpp b/include/boost/serialization/utility.hpp index 56773932..ab11e984 100644 --- a/include/boost/serialization/utility.hpp +++ b/include/boost/serialization/utility.hpp @@ -23,6 +23,7 @@ #include #include #include +#include namespace boost { namespace serialization { diff --git a/test/test_complex.cpp b/test/test_complex.cpp index a01867bd..603631d1 100644 --- a/test/test_complex.cpp +++ b/test/test_complex.cpp @@ -30,8 +30,12 @@ int test_main( int /* argc */, char* /* argv */[] ) BOOST_REQUIRE(NULL != testfile); // test array of objects - std::complex a(std::rand(),std::rand()); - std::complex b(std::rand(),std::rand()); + std::complex a(static_cast(std::rand()), + static_cast(std::rand())); + + std::complex b(static_cast(std::rand()), + static_cast(std::rand())); + { test_ostream os(testfile, TEST_STREAM_FLAGS); test_oarchive oa(os);