Index: boost/archive/basic_binary_iarchive.hpp =================================================================== --- boost/archive/basic_binary_iarchive.hpp (revision 72264) +++ boost/archive/basic_binary_iarchive.hpp (working copy) @@ -85,12 +85,12 @@ void load_override(tracking_type & t, int /*version*/){ library_version_type lvt = this->get_library_version(); if(boost::archive::library_version_type(6) < lvt){ - int_least8_t x=0; + bool x=0; * this->This() >> x; t = boost::archive::tracking_type(x); } else{ - bool x=0; + int_least8_t x=0; * this->This() >> x; t = boost::archive::tracking_type(x); } @@ -102,12 +102,12 @@ } else if(boost::archive::library_version_type(6) < lvt){ - int_least16_t x=0; + int x=0; * this->This() >> x; - t = boost::archive::class_id_type(x); + t = boost::archive::class_id_type(x); } else{ - int x=0; + int_least16_t x=0; * this->This() >> x; t = boost::archive::class_id_type(x); } @@ -183,7 +183,7 @@ t = boost::serialization::item_version_type(x); } else{ - unsigned int x=0; + unsigned int x=0; * this->This() >> x; t = boost::serialization::item_version_type(x); } Index: libs/serialization/src/basic_iarchive.cpp =================================================================== --- libs/serialization/src/basic_iarchive.cpp (revision 72264) +++ libs/serialization/src/basic_iarchive.cpp (working copy) @@ -96,23 +96,37 @@ { const basic_iserializer * m_bis; const class_id_type m_class_id; + const bool m_old_type_info; + cobject_type( std::size_t class_id, - const basic_iserializer & bis + const basic_iserializer & bis, + bool old_type_info ) : m_bis(& bis), - m_class_id(class_id) + m_class_id(class_id), + m_old_type_info(old_type_info) {} + + cobject_type(const cobject_type & rhs) : m_bis(rhs.m_bis), - m_class_id(rhs.m_class_id) + m_class_id(rhs.m_class_id), + m_old_type_info(rhs.m_old_type_info) {} + // the following cannot be defined because of the const // member. This will generate a link error if an attempt // is made to assign. This should never be necessary cobject_type & operator=(const cobject_type & rhs); + bool operator<(const cobject_type &rhs) const { + // old versions with objects across DLL's depend on not mathcing + // since class info will be stored out twice, we must not match in both cases + if(m_old_type_info) + return &m_bis->get_eti() < &rhs.m_bis->get_eti(); + return *m_bis < *(rhs.m_bis); } }; @@ -289,15 +303,22 @@ } } +const bool boost_archive_ver_5_is_pre_140 = true; + inline class_id_type basic_iarchive_impl::register_type( const basic_iserializer & bis -){ +) +{ + // if we are serializing in an old archive (before version 5, or version 5 and the user specified that + // archive revision 5 is actually 1_39 not 1_40 [ as this is ambigous ] + bool old_cid_lookup = (m_archive_library_version < 5 || (5 == m_archive_library_version && boost_archive_ver_5_is_pre_140)); + class_id_type cid(cobject_info_set.size()); - cobject_type co(cid, bis); - std::pair - result = cobject_info_set.insert(co); + cobject_type co(cid, bis, old_cid_lookup); + std::pair result = cobject_info_set.insert(co); + if(result.second){ cobject_id_vector.push_back(cobject_id(bis)); BOOST_ASSERT(cobject_info_set.size() == cobject_id_vector.size());