Index: basic_binary_iprimitive.hpp =================================================================== --- basic_binary_iprimitive.hpp (revision 5624) +++ basic_binary_iprimitive.hpp (working copy) @@ -143,6 +143,11 @@ void load_binary(void *address, std::size_t count); }; +#if defined(_MSC_VER) && (_MSC_VER >= 1400) //VC 8.0 + +# define BOOST_sgetn_safe( buf, count ) _Sgetn_s( buf, count, count ) +#else +# define BOOST_sgetn_safe( buf, count ) sgetn( buf, count ) +#endif template inline void @@ -157,6 +162,7 @@ ); std::streamsize s = static_cast(count / sizeof(Elem)); std::streamsize scount = m_sb.sgetn( + std::streamsize scount = m_sb.BOOST_sgetn_safe( static_cast(address), s ); @@ -173,7 +179,7 @@ // archive_exception(archive_exception::stream_error) // ); Elem t; - scount = m_sb.sgetn(& t, 1); + scount = m_sb.BOOST_sgetn_safe(& t, 1); if(scount != 1) boost::serialization::throw_exception( archive_exception(archive_exception::input_stream_error) @@ -181,6 +187,7 @@ std::memcpy(static_cast(address) + (count - s), &t, s); } } +#undef BOOST_sgetn_safe } // namespace archive } // namespace boost