Ticket #5579: boost-serialization-1_46_1-patch-for-5567_and_5579.patch

File boost-serialization-1_46_1-patch-for-5567_and_5579.patch, 4.1 KB (added by Phil Hartmann <phil.hartmann82@…>, 11 years ago)

Patch file for 5579 & 5567

  • boost/archive/basic_binary_iarchive.hpp

     
    8585    void load_override(tracking_type & t, int /*version*/){
    8686        library_version_type lvt = this->get_library_version();
    8787        if(boost::archive::library_version_type(6) < lvt){
    88             int_least8_t x=0;
     88            bool x=0;
    8989            * this->This() >> x;
    9090            t = boost::archive::tracking_type(x);
    9191        }
    9292        else{
    93             bool x=0;
     93            int_least8_t x=0;
    9494            * this->This() >> x;
    9595            t = boost::archive::tracking_type(x);
    9696        }
     
    102102        }
    103103        else
    104104        if(boost::archive::library_version_type(6) < lvt){
    105             int_least16_t x=0;
     105            int x=0;
    106106            * this->This() >> x;
    107             t = boost::archive::class_id_type(x);
     107            t = boost::archive::class_id_type(x);           
    108108        }
    109109        else{
    110             int x=0;
     110            int_least16_t x=0;
    111111            * this->This() >> x;
    112112            t = boost::archive::class_id_type(x);
    113113        }
     
    183183            t = boost::serialization::item_version_type(x);
    184184        }
    185185        else{
    186             unsigned int x=0;
     186             unsigned int x=0;
    187187            * this->This() >> x;
    188188            t = boost::serialization::item_version_type(x);
    189189        }
  • libs/serialization/src/basic_iarchive.cpp

     
    9696    {
    9797        const basic_iserializer * m_bis;
    9898        const class_id_type m_class_id;
     99        const bool m_old_type_info;
     100
    99101        cobject_type(
    100102            std::size_t class_id,
    101             const basic_iserializer & bis
     103            const basic_iserializer & bis,
     104            bool old_type_info
    102105        ) :
    103106            m_bis(& bis),
    104             m_class_id(class_id)
     107            m_class_id(class_id),
     108            m_old_type_info(old_type_info)
    105109        {}
     110
     111
    106112        cobject_type(const cobject_type & rhs) :
    107113            m_bis(rhs.m_bis),
    108             m_class_id(rhs.m_class_id)
     114            m_class_id(rhs.m_class_id),
     115            m_old_type_info(rhs.m_old_type_info)
    109116        {}
     117
    110118        // the following cannot be defined because of the const
    111119        // member.  This will generate a link error if an attempt
    112120        // is made to assign.  This should never be necessary
    113121        cobject_type & operator=(const cobject_type & rhs);
     122       
    114123        bool operator<(const cobject_type &rhs) const
    115124        {
     125            // old versions with objects across DLL's depend on not mathcing
     126            // since class info will be stored out twice, we must not match in both cases
     127            if(m_old_type_info)
     128                return &m_bis->get_eti() < &rhs.m_bis->get_eti();
     129           
    116130            return *m_bis < *(rhs.m_bis);
    117131        }
    118132    };
     
    289303    }
    290304}
    291305
     306const bool boost_archive_ver_5_is_pre_140  = true;
     307
    292308inline class_id_type
    293309basic_iarchive_impl::register_type(
    294310    const basic_iserializer & bis
    295 ){
     311)
     312{
     313    // if we are serializing in an old archive (before version 5, or version 5 and the user specified that
     314    // archive revision 5 is actually 1_39 not 1_40 [ as this is ambigous ]
     315    bool old_cid_lookup = (m_archive_library_version < 5 || (5 == m_archive_library_version &&  boost_archive_ver_5_is_pre_140));
     316
    296317    class_id_type cid(cobject_info_set.size());
    297     cobject_type co(cid, bis);
    298     std::pair<cobject_info_set_type::const_iterator, bool>
    299         result = cobject_info_set.insert(co);
     318    cobject_type  co(cid, bis, old_cid_lookup);
    300319
     320    std::pair<cobject_info_set_type::const_iterator, bool> result = cobject_info_set.insert(co);
     321
    301322    if(result.second){
    302323        cobject_id_vector.push_back(cobject_id(bis));
    303324        BOOST_ASSERT(cobject_info_set.size() == cobject_id_vector.size());