|
Boost-Commit : |
From: troyer_at_[hidden]
Date: 2008-07-02 15:13:56
Author: troyer
Date: 2008-07-02 15:13:56 EDT (Wed, 02 Jul 2008)
New Revision: 46997
URL: http://svn.boost.org/trac/boost/changeset/46997
Log:
Backwards compatibility
Added:
trunk/boost/serialization/vector_134.hpp (contents, props changed)
Text files modified:
trunk/boost/serialization/vector.hpp | 10 ++++++++--
trunk/libs/serialization/src/basic_archive.cpp | 6 +++++-
2 files changed, 13 insertions(+), 3 deletions(-)
Modified: trunk/boost/serialization/vector.hpp
==============================================================================
--- trunk/boost/serialization/vector.hpp (original)
+++ trunk/boost/serialization/vector.hpp 2008-07-02 15:13:56 EDT (Wed, 02 Jul 2008)
@@ -29,6 +29,12 @@
#include <boost/serialization/detail/get_data.hpp>
#include <boost/mpl/bool.hpp>
+// default is being compatible with version 1.35 files, not 1.34.1 files
+#ifndef BOOST_SERIALIZATION_VECTOR_VERSION
+#define BOOST_SERIALIZATION_VECTOR_VERSION 4
+#endif
+
+
namespace boost {
namespace serialization {
@@ -77,7 +83,7 @@
){
const collection_size_type count(t.size());
ar << BOOST_SERIALIZATION_NVP(count);
- if(3 < ar.get_library_version()) {
+ if(BOOST_SERIALIZATION_VECTOR_VERSION < ar.get_library_version()) {
const unsigned int item_version = version<U>::value;
ar << BOOST_SERIALIZATION_NVP(item_version);
}
@@ -96,7 +102,7 @@
ar >> BOOST_SERIALIZATION_NVP(count);
t.resize(count);
unsigned int item_version=0;
- if(3 < ar.get_library_version())
+ if(BOOST_SERIALIZATION_VECTOR_VERSION < ar.get_library_version())
ar >> BOOST_SERIALIZATION_NVP(item_version);
if (!t.empty())
ar >> make_array(detail::get_data(t),t.size());
Added: trunk/boost/serialization/vector_134.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/serialization/vector_134.hpp 2008-07-02 15:13:56 EDT (Wed, 02 Jul 2008)
@@ -0,0 +1,20 @@
+#ifndef BOOST_SERIALIZATION_VECTOR_134_HPP
+#define BOOST_SERIALIZATION_VECTOR_134_HPP
+
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// vector_134.hpp: backwards compatibility with 1.34.1 files
+
+// (C) Copyright 2008 Matthias Troyer
+
+
+#ifdef BOOST_SERIALIZATION_VECTOR_VERSION
+#if BOOST_SERIALIZATION_VECTOR_VERSION != 3
+#error Boost.Serialization cannot be compatible with both 1.34.1. and 1.35 files. Please include boost/serialization/vector_134.hpp before vector.hpp to be compatible with 1.34.1 files
+#endif
+#else
+#define BOOST_SERIALIZATION_VECTOR_VERSION 3
+#endif
+
+#include <boost/serialization/vector.hpp>
+
+#endif // BOOST_SERIALIZATION_VECTOR_134_HPP
Modified: trunk/libs/serialization/src/basic_archive.cpp
==============================================================================
--- trunk/libs/serialization/src/basic_archive.cpp (original)
+++ trunk/libs/serialization/src/basic_archive.cpp 2008-07-02 15:13:56 EDT (Wed, 02 Jul 2008)
@@ -54,9 +54,13 @@
// 3 - numerous changes - can't guarentee compatibility with previous versions
// 4 - Boost 1.34
// added register_version to properly support versioning for collections
+// 5 - Boost 1.36
+// changed serialization of collections: adding version even for primitive
+// types caused backwards compatibility breaking change in 1.35
+
BOOST_ARCHIVE_DECL(unsigned char)
ARCHIVE_VERSION(){
- return 4;
+ return 5;
}
} // namespace archive
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk