void
portable_binary_iarchive::load_impl(boost::intmax_t & l, char maxsize) {
    char size;
    l = 0;
    this->primitive_base_t::load(size);

    if(0 == size) {
        return;
    }

    bool negative = (size < 0);
    if(negative)
        size = -size;

    if(size > maxsize)
        boost::serialization::throw_exception(
            portable_binary_iarchive_exception()
        );

    char * cptr = reinterpret_cast<char *>(& l);
#ifdef BOOST_BIG_ENDIAN
    cptr += (sizeof(boost::intmax_t) - size);
#endif
    this->primitive_base_t::load_binary(cptr, size);

#ifdef BOOST_BIG_ENDIAN
    if(m_flags & endian_little)
#else
    if(m_flags & endian_big)
#endif
        reverse_bytes(size, cptr);

    if(negative)
        l = -l;
}
예제 #2
0
 void load(boost::serialization::collection_size_type& t) {
     boost::int64_t l = 0;
     load_impl(l, sizeof(boost::int64_t));
     if (l > static_cast<boost::int64_t>((std::numeric_limits<unsigned int>::max)())) {
         BOOST_THROW_EXCEPTION(portable_binary_iarchive_exception());
     }
     t = boost::serialization::collection_size_type(static_cast<unsigned int>(l)); //-V106
 }