|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r63085 - in trunk/boost: archive archive/impl serialization
From: ramey_at_[hidden]
Date: 2010-06-18 16:32:39
Author: ramey
Date: 2010-06-18 16:32:34 EDT (Fri, 18 Jun 2010)
New Revision: 63085
URL: http://svn.boost.org/trac/boost/changeset/63085
Log:
account for fact that on some platforms size of wchar_t > size of short int
Text files modified:
trunk/boost/archive/basic_archive.hpp | 10 ----------
trunk/boost/archive/basic_binary_oarchive.hpp | 2 +-
trunk/boost/archive/basic_text_iprimitive.hpp | 5 +++--
trunk/boost/archive/basic_text_oprimitive.hpp | 5 +++--
trunk/boost/archive/impl/text_iarchive_impl.ipp | 2 +-
trunk/boost/archive/impl/text_oarchive_impl.ipp | 2 +-
trunk/boost/archive/impl/xml_iarchive_impl.ipp | 4 ++--
trunk/boost/archive/impl/xml_oarchive_impl.ipp | 20 ++++++++++----------
trunk/boost/serialization/collection_size_type.hpp | 6 +++---
9 files changed, 24 insertions(+), 32 deletions(-)
Modified: trunk/boost/archive/basic_archive.hpp
==============================================================================
--- trunk/boost/archive/basic_archive.hpp (original)
+++ trunk/boost/archive/basic_archive.hpp 2010-06-18 16:32:34 EDT (Fri, 18 Jun 2010)
@@ -21,7 +21,6 @@
#include <boost/cstdint.hpp> // size_t
#include <boost/noncopyable.hpp>
#include <boost/integer_traits.hpp>
-#include <boost/serialization/strong_typedef.hpp>
#include <boost/archive/detail/auto_link_archive.hpp>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
@@ -257,7 +256,6 @@
}; \
/**/
-
BOOST_ARCHIVE_STRONG_TYPEDEF(class_id_type, class_id_reference_type)
BOOST_ARCHIVE_STRONG_TYPEDEF(class_id_type, class_id_optional_type)
BOOST_ARCHIVE_STRONG_TYPEDEF(object_id_type, object_reference_type)
@@ -267,14 +265,6 @@
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
-#if 0
-namespace boost {
-template<>
-class integer_traits<boost::archive::class_id_type> :
- public integer_traits<boost::archive::class_id_type::base_type>
-{};
-#endif
-
#include <boost/serialization/level.hpp>
// set implementation level to primitive for all types
Modified: trunk/boost/archive/basic_binary_oarchive.hpp
==============================================================================
--- trunk/boost/archive/basic_binary_oarchive.hpp (original)
+++ trunk/boost/archive/basic_binary_oarchive.hpp 2010-06-18 16:32:34 EDT (Fri, 18 Jun 2010)
@@ -87,7 +87,7 @@
// binary files don't include the optional information
void save_override(const class_id_optional_type & /* t */, int){}
- #if 0
+ #if 0 // enable this if we decide to support generation of previous versions
void save_override(const boost::archive::version_type & t, int version){
if(this->get_library_version() < boost::archive::library_version_type(7)){
* this->This() << static_cast<int_least16_t >(t);
Modified: trunk/boost/archive/basic_text_iprimitive.hpp
==============================================================================
--- trunk/boost/archive/basic_text_iprimitive.hpp (original)
+++ trunk/boost/archive/basic_text_iprimitive.hpp 2010-06-18 16:32:34 EDT (Fri, 18 Jun 2010)
@@ -44,9 +44,9 @@
#endif
#include <boost/limits.hpp>
-#include <boost/integer.hpp>
#include <boost/io/ios_state.hpp>
#include <boost/scoped_ptr.hpp>
+#include <boost/static_assert.hpp>
#include <boost/serialization/throw_exception.hpp>
#include <boost/archive/archive_exception.hpp>
@@ -117,7 +117,8 @@
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
void load(wchar_t & t)
{
- typename int_t<sizeof(wchar_t) * CHAR_BIT>::exact i;
+ BOOST_STATIC_ASSERT(sizeof(wchar_t) <= sizeof(int));
+ int i;
load(i);
t = i;
}
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-18 16:32:34 EDT (Fri, 18 Jun 2010)
@@ -31,6 +31,7 @@
#include <cstddef> // size_t
#include <boost/config.hpp>
+#include <boost/static_assert.hpp>
#include <boost/detail/workaround.hpp>
#if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1)
#include <boost/archive/dinkumware.hpp>
@@ -118,8 +119,8 @@
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
void save(const wchar_t t)
{
- typedef typename int_t<sizeof(wchar_t) * CHAR_BIT>::exact int_type;
- save(static_cast<int_type>(t));
+ BOOST_STATIC_ASSERT(sizeof(wchar_t) <= sizeof(int));
+ save(static_cast<int>(t));
}
#endif
void save(const float t)
Modified: trunk/boost/archive/impl/text_iarchive_impl.ipp
==============================================================================
--- trunk/boost/archive/impl/text_iarchive_impl.ipp (original)
+++ trunk/boost/archive/impl/text_iarchive_impl.ipp 2010-06-18 16:32:34 EDT (Fri, 18 Jun 2010)
@@ -71,7 +71,6 @@
ws[size] = L'\0';
}
#endif // BOOST_NO_INTRINSIC_WCHAR_T
-#endif // BOOST_NO_CWCHAR
#ifndef BOOST_NO_STD_WSTRING
template<class Archive>
@@ -91,6 +90,7 @@
}
#endif // BOOST_NO_STD_WSTRING
+#endif // BOOST_NO_CWCHAR
template<class Archive>
BOOST_ARCHIVE_DECL(void)
Modified: trunk/boost/archive/impl/text_oarchive_impl.ipp
==============================================================================
--- trunk/boost/archive/impl/text_oarchive_impl.ipp (original)
+++ trunk/boost/archive/impl/text_oarchive_impl.ipp 2010-06-18 16:32:34 EDT (Fri, 18 Jun 2010)
@@ -69,7 +69,6 @@
os.write((const char *)ws, l * sizeof(wchar_t)/sizeof(char));
}
#endif
-#endif // BOOST_NO_CWCHAR
#ifndef BOOST_NO_STD_WSTRING
template<class Archive>
@@ -82,6 +81,7 @@
os.write((const char *)(ws.data()), l * sizeof(wchar_t)/sizeof(char));
}
#endif
+#endif // BOOST_NO_CWCHAR
template<class Archive>
BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY())
Modified: trunk/boost/archive/impl/xml_iarchive_impl.ipp
==============================================================================
--- trunk/boost/archive/impl/xml_iarchive_impl.ipp (original)
+++ trunk/boost/archive/impl/xml_iarchive_impl.ipp 2010-06-18 16:32:34 EDT (Fri, 18 Jun 2010)
@@ -48,6 +48,7 @@
// wide char stuff used by char archives
+#ifndef BOOST_NO_CWCHAR
#ifndef BOOST_NO_STD_WSTRING
template<class Archive>
BOOST_ARCHIVE_DECL(void)
@@ -82,7 +83,6 @@
}
#endif // BOOST_NO_STD_WSTRING
-#ifndef BOOST_NO_CWCHAR
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
template<class Archive>
BOOST_ARCHIVE_DECL(void)
@@ -112,7 +112,7 @@
}
*ws = L'\0';
}
-#endif
+#endif // BOOST_NO_INTRINSIC_WCHAR_T
#endif // BOOST_NO_CWCHAR
Modified: trunk/boost/archive/impl/xml_oarchive_impl.ipp
==============================================================================
--- trunk/boost/archive/impl/xml_oarchive_impl.ipp (original)
+++ trunk/boost/archive/impl/xml_oarchive_impl.ipp 2010-06-18 16:32:34 EDT (Fri, 18 Jun 2010)
@@ -48,16 +48,6 @@
);
}
-#ifndef BOOST_NO_INTRINSIC_WCHAR_T
-template<class Archive>
-BOOST_ARCHIVE_DECL(void)
-xml_oarchive_impl<Archive>::save(const wchar_t * ws){
- save_iterator(os, ws, ws + std::wcslen(ws));
-}
-#endif
-
-#endif // BOOST_NO_CWCHAR
-
#ifndef BOOST_NO_STD_WSTRING
template<class Archive>
BOOST_ARCHIVE_DECL(void)
@@ -69,6 +59,16 @@
}
#endif
+#ifndef BOOST_NO_INTRINSIC_WCHAR_T
+template<class Archive>
+BOOST_ARCHIVE_DECL(void)
+xml_oarchive_impl<Archive>::save(const wchar_t * ws){
+ save_iterator(os, ws, ws + std::wcslen(ws));
+}
+#endif
+
+#endif // BOOST_NO_CWCHAR
+
template<class Archive>
BOOST_ARCHIVE_DECL(void)
xml_oarchive_impl<Archive>::save(const std::string & s){
Modified: trunk/boost/serialization/collection_size_type.hpp
==============================================================================
--- trunk/boost/serialization/collection_size_type.hpp (original)
+++ trunk/boost/serialization/collection_size_type.hpp 2010-06-18 16:32:34 EDT (Fri, 18 Jun 2010)
@@ -22,9 +22,9 @@
base_type t;
public:
collection_size_type(): t(0) {};
- explicit collection_size_type(const unsigned int & t_) : t(t_){
- assert(t_ <= boost::integer_traits<base_type>::const_max);
- }
+ explicit collection_size_type(const std::size_t & t_) :
+ t(t_)
+ {}
collection_size_type(const collection_size_type & t_) :
t(t_.t)
{}
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