File indexing completed on 2025-01-18 09:28:28
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #include <string>
0011 #include <boost/assert.hpp>
0012 #include <algorithm>
0013 #include <cstring>
0014
0015 #include <boost/config.hpp>
0016 #if defined(BOOST_NO_STDC_NAMESPACE)
0017 namespace std{
0018 using ::memcpy;
0019 using ::strlen;
0020 using ::size_t;
0021 }
0022 #endif
0023
0024 #include <boost/detail/workaround.hpp>
0025 #include <boost/predef/other/endian.h>
0026
0027 #include <boost/archive/basic_binary_iarchive.hpp>
0028
0029 namespace boost {
0030 namespace archive {
0031
0032
0033
0034 template<class Archive>
0035 BOOST_ARCHIVE_OR_WARCHIVE_DECL void
0036 basic_binary_iarchive<Archive>::load_override(class_name_type & t){
0037 std::string cn;
0038 cn.reserve(BOOST_SERIALIZATION_MAX_KEY_SIZE);
0039 load_override(cn);
0040 if(cn.size() > (BOOST_SERIALIZATION_MAX_KEY_SIZE - 1))
0041 boost::serialization::throw_exception(
0042 archive_exception(archive_exception::invalid_class_name)
0043 );
0044 std::memcpy(t, cn.data(), cn.size());
0045
0046 t.t[cn.size()] = '\0';
0047 }
0048
0049 template<class Archive>
0050 BOOST_ARCHIVE_OR_WARCHIVE_DECL void
0051 basic_binary_iarchive<Archive>::init() {
0052
0053 std::string file_signature;
0054
0055 #if 0
0056 BOOST_TRY {
0057 std::size_t l;
0058 this->This()->load(l);
0059 if(l == std::strlen(BOOST_ARCHIVE_SIGNATURE())) {
0060
0061 #if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101))
0062 if(NULL != file_signature.data())
0063 #endif
0064 file_signature.resize(l);
0065
0066 if(0 < l)
0067 this->This()->load_binary(&(*file_signature.begin()), l);
0068 }
0069 }
0070 BOOST_CATCH(archive_exception const &) {
0071
0072 file_signature = "";
0073 }
0074 BOOST_CATCH_END
0075 #else
0076
0077 * this->This() >> file_signature;
0078 #endif
0079
0080 if(file_signature != BOOST_ARCHIVE_SIGNATURE())
0081 boost::serialization::throw_exception(
0082 archive_exception(archive_exception::invalid_signature)
0083 );
0084
0085
0086
0087 boost::serialization::library_version_type input_library_version;
0088
0089 {
0090 int v = 0;
0091 v = this->This()->m_sb.sbumpc();
0092 #if BOOST_ENDIAN_LITTLE_BYTE
0093 if(v < 6){
0094 ;
0095 }
0096 else
0097 if(v < 7){
0098
0099 this->This()->m_sb.sbumpc();
0100 }
0101 else
0102 if(v < 8){
0103 int x1;
0104
0105 x1 = this->This()->m_sb.sgetc();
0106
0107 if(0 == x1)
0108 this->This()->m_sb.sbumpc();
0109 }
0110 else{
0111
0112 this->This()->m_sb.sbumpc();
0113 }
0114 #elif BOOST_ENDIAN_BIG_BYTE
0115 if(v == 0)
0116 v = this->This()->m_sb.sbumpc();
0117 #endif
0118 input_library_version = static_cast<boost::serialization::library_version_type>(v);
0119 }
0120
0121 #if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3205))
0122 this->set_library_version(input_library_version);
0123 #else
0124 detail::basic_iarchive::set_library_version(input_library_version);
0125 #endif
0126
0127 if(BOOST_ARCHIVE_VERSION() < input_library_version)
0128 boost::serialization::throw_exception(
0129 archive_exception(archive_exception::unsupported_version)
0130 );
0131 }
0132
0133 }
0134 }