Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r62451 - in trunk/boost: archive archive/impl serialization
From: ramey_at_[hidden]
Date: 2010-06-05 13:12:26


Author: ramey
Date: 2010-06-05 13:12:25 EDT (Sat, 05 Jun 2010)
New Revision: 62451
URL: http://svn.boost.org/trac/boost/changeset/62451

Log:
correct version type conversions
Text files modified:
   trunk/boost/archive/basic_archive.hpp | 4 ++--
   trunk/boost/archive/basic_binary_iarchive.hpp | 15 ++++++++-------
   trunk/boost/archive/basic_text_oprimitive.hpp | 18 +++---------------
   trunk/boost/archive/impl/basic_text_iarchive.ipp | 2 +-
   trunk/boost/archive/text_wiarchive.hpp | 2 +-
   trunk/boost/archive/xml_wiarchive.hpp | 2 +-
   trunk/boost/serialization/item_version_type.hpp | 4 ++--
   7 files changed, 18 insertions(+), 29 deletions(-)

Modified: trunk/boost/archive/basic_archive.hpp
==============================================================================
--- trunk/boost/archive/basic_archive.hpp (original)
+++ trunk/boost/archive/basic_archive.hpp 2010-06-05 13:12:25 EDT (Sat, 05 Jun 2010)
@@ -76,8 +76,8 @@
     typedef uint_least8_t base_type;
     base_type t;
     version_type(){};
- explicit version_type(const version_type & t_) : t(t_.t){}
- version_type(const unsigned int & t_) : t(t_){
+ version_type(const version_type & t_) : t(t_.t){}
+ explicit version_type(const unsigned int & t_) : t(t_){
         assert(t_ <= boost::integer_traits<base_type>::const_max);
     }
     version_type & operator=(const version_type & rhs){

Modified: trunk/boost/archive/basic_binary_iarchive.hpp
==============================================================================
--- trunk/boost/archive/basic_binary_iarchive.hpp (original)
+++ trunk/boost/archive/basic_binary_iarchive.hpp 2010-06-05 13:12:25 EDT (Sat, 05 Jun 2010)
@@ -92,26 +92,27 @@
             t = boost::serialization::item_version_type(x);
         }
     }
- void load_override(serialization::collection_size_type & t, int version){
+
+ void load_override(version_type & t, int version){
         if(boost::archive::library_version_type(6) < this->get_library_version()){
             this->detail_common_iarchive::load_override(t, version);
         }
         else{
             unsigned int x=0;
             * this->This() >> x;
- t = serialization::collection_size_type(x);
- }
+ t = boost::archive::version_type(x);
+ }
     }
 
- void load_override(version_type & t, int version){
- if(boost::archive::library_version_type(6) < this->get_library_version()){
+ void load_override(serialization::collection_size_type & t, int version){
+ if(boost::archive::library_version_type(5) < this->get_library_version()){
             this->detail_common_iarchive::load_override(t, version);
         }
         else{
             unsigned int x=0;
             * this->This() >> x;
- t = boost::archive::version_type(x);
- }
+ t = serialization::collection_size_type(x);
+ }
     }
 
     BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)

Modified: trunk/boost/archive/basic_text_oprimitive.hpp
==============================================================================
--- trunk/boost/archive/basic_text_oprimitive.hpp (original)
+++ trunk/boost/archive/basic_text_oprimitive.hpp 2010-06-05 13:12:25 EDT (Sat, 05 Jun 2010)
@@ -104,27 +104,15 @@
     }
     void save(const signed char t)
     {
- if(os.fail())
- boost::serialization::throw_exception(
- archive_exception(archive_exception::stream_error)
- );
- os << static_cast<short int>(t);
+ save(static_cast<short int>(t));
     }
     void save(const unsigned char t)
     {
- if(os.fail())
- boost::serialization::throw_exception(
- archive_exception(archive_exception::stream_error)
- );
- os << static_cast<short unsigned int>(t);
+ save(static_cast<short unsigned int>(t));
     }
     void save(const char t)
     {
- if(os.fail())
- boost::serialization::throw_exception(
- archive_exception(archive_exception::stream_error)
- );
- os << static_cast<short int>(t);
+ save(static_cast<short int>(t));
     }
     #ifndef BOOST_NO_INTRINSIC_WCHAR_T
     void save(const wchar_t t)

Modified: trunk/boost/archive/impl/basic_text_iarchive.ipp
==============================================================================
--- trunk/boost/archive/impl/basic_text_iarchive.ipp (original)
+++ trunk/boost/archive/impl/basic_text_iarchive.ipp 2010-06-05 13:12:25 EDT (Sat, 05 Jun 2010)
@@ -33,7 +33,7 @@
 basic_text_iarchive<Archive>::load_override(version_type & t, int){
     unsigned int v;
     load_override(v, 0);
- t = v;
+ t = version_type(v);
 }
 
 template<class Archive>

Modified: trunk/boost/archive/text_wiarchive.hpp
==============================================================================
--- trunk/boost/archive/text_wiarchive.hpp (original)
+++ trunk/boost/archive/text_wiarchive.hpp 2010-06-05 13:12:25 EDT (Sat, 05 Jun 2010)
@@ -60,7 +60,7 @@
     void load(boost::serialization::item_version_type & t){
         unsigned int x;
         basic_text_iprimitive<std::wistream>::load(x);
- t = x;
+ t = boost::serialization::item_version_type(x);
     }
     BOOST_WARCHIVE_DECL(void)
     load(char * t);

Modified: trunk/boost/archive/xml_wiarchive.hpp
==============================================================================
--- trunk/boost/archive/xml_wiarchive.hpp (original)
+++ trunk/boost/archive/xml_wiarchive.hpp 2010-06-05 13:12:25 EDT (Sat, 05 Jun 2010)
@@ -72,7 +72,7 @@
     void load(boost::serialization::item_version_type & t){
         unsigned int x;
         basic_text_iprimitive<std::wistream>::load(x);
- t = x;
+ t = boost::serialization::item_version_type(x);
     }
     BOOST_WARCHIVE_DECL(void)
     load(char * t);

Modified: trunk/boost/serialization/item_version_type.hpp
==============================================================================
--- trunk/boost/serialization/item_version_type.hpp (original)
+++ trunk/boost/serialization/item_version_type.hpp 2010-06-05 13:12:25 EDT (Sat, 05 Jun 2010)
@@ -27,8 +27,8 @@
     typedef uint_least8_t base_type;
     base_type t;
     item_version_type(){};
- explicit item_version_type(const item_version_type & t_) : t(t_.t){}
- item_version_type(const unsigned int & t_) : t(t_){
+ item_version_type(const item_version_type & t_) : t(t_.t){}
+ explicit item_version_type(const unsigned int & t_) : t(t_){
         assert(t_ <= boost::integer_traits<base_type>::const_max);
     }
     item_version_type & operator=(const item_version_type & rhs){


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