Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r68305 - in branches/release/libs/serialization: doc example src test
From: ramey_at_[hidden]
Date: 2011-01-19 13:31:04


Author: ramey
Date: 2011-01-19 13:31:02 EST (Wed, 19 Jan 2011)
New Revision: 68305
URL: http://svn.boost.org/trac/boost/changeset/68305

Log:
Merge from trunk to release
Properties modified:
   branches/release/libs/serialization/doc/ (props changed)
   branches/release/libs/serialization/example/ (props changed)
   branches/release/libs/serialization/src/ (props changed)
   branches/release/libs/serialization/test/test_diamond_complex.cpp (props changed)
Text files modified:
   branches/release/libs/serialization/doc/contents.html | 16 +---------------
   branches/release/libs/serialization/doc/exceptions.html | 2 +-
   branches/release/libs/serialization/doc/release.html | 8 ++++++++
   branches/release/libs/serialization/src/archive_exception.cpp | 4 ++--
   branches/release/libs/serialization/src/basic_archive.cpp | 2 +-
   branches/release/libs/serialization/src/basic_iarchive.cpp | 10 +++++-----
   branches/release/libs/serialization/src/basic_oarchive.cpp | 16 ++++++++--------
   branches/release/libs/serialization/src/basic_serializer_map.cpp | 2 +-
   branches/release/libs/serialization/src/extended_type_info.cpp | 16 ++++++++--------
   branches/release/libs/serialization/src/extended_type_info_no_rtti.cpp | 10 +++++-----
   branches/release/libs/serialization/src/extended_type_info_typeid.cpp | 8 ++++----
   branches/release/libs/serialization/src/shared_ptr_helper.cpp | 2 +-
   branches/release/libs/serialization/src/void_cast.cpp | 10 +++++-----
   branches/release/libs/serialization/src/xml_archive_exception.cpp | 4 ++--
   branches/release/libs/serialization/test/Jamfile.v2 | 1 +
   branches/release/libs/serialization/test/test_tools.hpp | 32 ++++++++++++++++++++++++++++----
   16 files changed, 81 insertions(+), 62 deletions(-)

Modified: branches/release/libs/serialization/doc/contents.html
==============================================================================
--- branches/release/libs/serialization/doc/contents.html (original)
+++ branches/release/libs/serialization/doc/contents.html 2011-01-19 13:31:02 EST (Wed, 19 Jan 2011)
@@ -84,21 +84,7 @@
 -->
 <p>
 <dl class="page-index">
- <dt><img style="display:none" src="plus.gif" id="release_notes"><a target="detail" href="release.html">Release Notes</a></dt>
- <dd><div id="release_notes_detail"><dl class="page-index">
- <dt><img style="display:none" src="dot.gif"><a target="detail" href="release.html#differences_1_43">Differences from version 1.43</a></dt>
- <dt><img style="display:none" src="dot.gif"><a target="detail" href="release.html#differences_1_42">Differences from version 1.42</a></dt>
- <dt><img style="display:none" src="dot.gif"><a target="detail" href="release.html#differences_1_41">Differences from version 1.41</a></dt>
- <dt><img style="display:none" src="dot.gif"><a target="detail" href="release.html#differences_1_40">Differences from version 1.40</a></dt>
- <dt><img style="display:none" src="dot.gif"><a target="detail" href="release.html#differences_1_39">Differences from version 1.39</a></dt>
- <dt><img style="display:none" src="dot.gif"><a target="detail" href="release.html#differences_1_37">Differences from version 1.37</a></dt>
- <dt><img style="display:none" src="dot.gif"><a target="detail" href="release.html#differences_1_35">Differences from version 1.35</a></dt>
- <dt><img style="display:none" src="dot.gif"><a target="detail" href="release.html#differences_1_34">Differences from version 1.34</a></dt>
- <dt><img style="display:none" src="dot.gif"><a target="detail" href="release.html#differences_1_33">Differences from version 1.33</a></dt>
- <dt><img style="display:none" src="dot.gif"><a target="detail" href="release.html#differences_1_32">Differences from version 1.32</a></dt>
-
- <dt><img style="display:none" src="dot.gif"><a target="detail" href="release.html#todo">Pending Issues</a></dt>
- </dl></div></dd>
+ <dt><img style="display:none" src="dot.gif" id="release_notes"><a target="detail" href="release.html">Release Notes</a></dt>
   <dt><img style="display:none" src="plus.gif" id="overview"><a target="detail" href="overview.html">Overview</a></dt>
   <dd><div id="overview_detail"><dl class="page-index">
     <dt><img style="display:none" src="dot.gif"><a target="detail" href="overview.html#Requirements">Requirements</a></dt>

Modified: branches/release/libs/serialization/doc/exceptions.html
==============================================================================
--- branches/release/libs/serialization/doc/exceptions.html (original)
+++ branches/release/libs/serialization/doc/exceptions.html 2011-01-19 13:31:02 EST (Wed, 19 Jan 2011)
@@ -118,7 +118,7 @@
 exception is thrown.
 
 <h3><a name="unsupported_version"><code style="white-space: normal">unsupported_version</code></a></h3>
-This system assigns a version number of 3 to all archives created. Note that this is in
+This system records the current library version number to all archives created. Note that this is in
 no way related to version number of classes used by application programs. This refers
 to the version of the serialization system used to create the archive. Future versions
 of this serialization system will be able to identify archives created under previous

Modified: branches/release/libs/serialization/doc/release.html
==============================================================================
--- branches/release/libs/serialization/doc/release.html (original)
+++ branches/release/libs/serialization/doc/release.html 2011-01-19 13:31:02 EST (Wed, 19 Jan 2011)
@@ -29,6 +29,7 @@
 </table>
 <hr>
 <dl class="index">
+ <dt>Differences from version 1.45</dt>
     <dt>Differences from version 1.43</dt>
     <dt>Differences from version 1.42</dt>
     <dt>Differences from version 1.41</dt>
@@ -44,6 +45,13 @@
 As of this writing, there are no known bugs. However, due to compiler/library
 quirks and or bugs, some tests fail with some combinations of compilers and
 libraries.
+<h2><a name="differences_1_45"></a>Differences from Boost 1.45</h2>
+Since the release of version 1.42, it has been discovered that binary
+archives created by versions 1.42-1.44 cannot always be read by the
+recent binary archive code. Work has proceeded in detecting the source
+of these anomolies and those which have been reported with test cases
+have been fixed. As of this writing, it is not known whether all
+binary archives created with these versions can be loaded.
 <h2><a name="differences_1_43"></a>Differences from Boost 1.43</h2>
 <ul>
     <li>fixed bug in the serialization of virtual base classes. Due

Modified: branches/release/libs/serialization/src/archive_exception.cpp
==============================================================================
--- branches/release/libs/serialization/src/archive_exception.cpp (original)
+++ branches/release/libs/serialization/src/archive_exception.cpp 2011-01-19 13:31:02 EST (Wed, 19 Jan 2011)
@@ -13,7 +13,7 @@
 #endif
 
 #include <exception>
-#include <cassert>
+#include <boost/assert.hpp>
 #include <string>
 
 #define BOOST_ARCHIVE_SOURCE
@@ -93,7 +93,7 @@
         m_msg = "output stream error";
         break;
     default:
- assert(false);
+ BOOST_ASSERT(false);
         break;
     }
 }

Modified: branches/release/libs/serialization/src/basic_archive.cpp
==============================================================================
--- branches/release/libs/serialization/src/basic_archive.cpp (original)
+++ branches/release/libs/serialization/src/basic_archive.cpp 2011-01-19 13:31:02 EST (Wed, 19 Jan 2011)
@@ -73,7 +73,7 @@
 
 BOOST_ARCHIVE_DECL(library_version_type)
 BOOST_ARCHIVE_VERSION(){
- return library_version_type(8);
+ return library_version_type(9);
 }
 
 } // namespace archive

Modified: branches/release/libs/serialization/src/basic_iarchive.cpp
==============================================================================
--- branches/release/libs/serialization/src/basic_iarchive.cpp (original)
+++ branches/release/libs/serialization/src/basic_iarchive.cpp 2011-01-19 13:31:02 EST (Wed, 19 Jan 2011)
@@ -10,7 +10,7 @@
 
 #include <boost/config.hpp> // msvc 6.0 needs this to suppress warnings
 
-#include <cassert>
+#include <boost/assert.hpp>
 #include <set>
 #include <list>
 #include <vector>
@@ -300,7 +300,7 @@
 
     if(result.second){
         cobject_id_vector.push_back(cobject_id(bis));
- assert(cobject_info_set.size() == cobject_id_vector.size());
+ BOOST_ASSERT(cobject_info_set.size() == cobject_id_vector.size());
     }
     cid = result.first->m_class_id;
     // borland complains without this minor hack
@@ -433,11 +433,11 @@
                 );
             bpis_ptr = (*finder)(*eti);
         }
- assert(NULL != bpis_ptr);
+ BOOST_ASSERT(NULL != bpis_ptr);
         class_id_type new_cid = register_type(bpis_ptr->get_basic_serializer());
         int i = cid;
         cobject_id_vector[i].bpis_ptr = bpis_ptr;
- assert(new_cid == cid);
+ BOOST_ASSERT(new_cid == cid);
     }
     int i = cid;
     cobject_id & co = cobject_id_vector[i];
@@ -484,7 +484,7 @@
         );
         t = object_id_vector[ui].address;
         object_id_vector[ui].loaded_as_pointer = true;
- assert(NULL != t);
+ BOOST_ASSERT(NULL != t);
     }
 
     return bpis_ptr;

Modified: branches/release/libs/serialization/src/basic_oarchive.cpp
==============================================================================
--- branches/release/libs/serialization/src/basic_oarchive.cpp (original)
+++ branches/release/libs/serialization/src/basic_oarchive.cpp 2011-01-19 13:31:02 EST (Wed, 19 Jan 2011)
@@ -10,7 +10,7 @@
 
 #include <boost/config.hpp> // msvc 6.0 needs this for warning suppression
 
-#include <cassert>
+#include <boost/assert.hpp>
 #include <set>
 #include <cstddef> // NULL
 
@@ -59,8 +59,8 @@
 
         bool operator<(const aobject &rhs) const
         {
- assert(NULL != address);
- assert(NULL != rhs.address);
+ BOOST_ASSERT(NULL != address);
+ BOOST_ASSERT(NULL != rhs.address);
             if( address < rhs.address )
                 return true;
             if( address > rhs.address )
@@ -178,28 +178,28 @@
         public basic_oserializer
     {
         bool class_info() const {
- assert(false);
+ BOOST_ASSERT(false);
             return false;
         }
         // returns true if objects should be tracked
         bool tracking(const unsigned int) const {
- assert(false);
+ BOOST_ASSERT(false);
             return false;
         }
         // returns class version
         version_type version() const {
- assert(false);
+ BOOST_ASSERT(false);
             return version_type(0);
         }
         // returns true if this class is polymorphic
         bool is_polymorphic() const{
- assert(false);
+ BOOST_ASSERT(false);
             return false;
         }
         void save_object_data(
             basic_oarchive & /*ar*/, const void * /*x*/
         ) const {
- assert(false);
+ BOOST_ASSERT(false);
         }
     public:
         bosarg(const serialization::extended_type_info & eti) :

Modified: branches/release/libs/serialization/src/basic_serializer_map.cpp
==============================================================================
--- branches/release/libs/serialization/src/basic_serializer_map.cpp (original)
+++ branches/release/libs/serialization/src/basic_serializer_map.cpp 2011-01-19 13:31:02 EST (Wed, 19 Jan 2011)
@@ -99,7 +99,7 @@
     map_type::const_iterator it;
     it = m_map.find(& bs);
     if(it == m_map.end()){
- assert(false);
+ BOOST_ASSERT(false);
         return 0;
     }
     return *it;

Modified: branches/release/libs/serialization/src/extended_type_info.cpp
==============================================================================
--- branches/release/libs/serialization/src/extended_type_info.cpp (original)
+++ branches/release/libs/serialization/src/extended_type_info.cpp 2011-01-19 13:31:02 EST (Wed, 19 Jan 2011)
@@ -15,7 +15,7 @@
 #include <algorithm>
 #include <set>
 #include <utility>
-#include <cassert>
+#include <boost/assert.hpp>
 #include <cstddef> // NULL
 
 #include <boost/config.hpp> // msvc needs this to suppress warning
@@ -52,9 +52,9 @@
         if(lhs == rhs)
             return false;
         const char * l = lhs->get_key();
- assert(NULL != l);
+ BOOST_ASSERT(NULL != l);
         const char * r = rhs->get_key();
- assert(NULL != r);
+ BOOST_ASSERT(NULL != r);
         // performance shortcut
         // shortcut to exploit string pooling
         if(l == r)
@@ -77,23 +77,23 @@
 {
     virtual bool
     is_less_than(const extended_type_info & /*rhs*/) const {
- assert(false);
+ BOOST_ASSERT(false);
         return false;
     };
     virtual bool
     is_equal(const extended_type_info & /*rhs*/) const {
- assert(false);
+ BOOST_ASSERT(false);
         return false;
     };
     virtual const char * get_debug_info() const {
         return get_key();
     }
     virtual void * construct(unsigned int /*count*/, ...) const{
- assert(false);
+ BOOST_ASSERT(false);
         return NULL;
     }
     virtual void destroy(void const * const /*p*/) const {
- assert(false);
+ BOOST_ASSERT(false);
     }
 public:
     extended_type_info_arg(const char * key) :
@@ -137,7 +137,7 @@
 
 BOOST_SERIALIZATION_DECL(const extended_type_info *)
 extended_type_info::find(const char *key) {
- assert(NULL != key);
+ BOOST_ASSERT(NULL != key);
     const detail::ktmap & k = singleton<detail::ktmap>::get_const_instance();
     const detail::extended_type_info_arg eti_key(key);
     const detail::ktmap::const_iterator it = k.find(& eti_key);

Modified: branches/release/libs/serialization/src/extended_type_info_no_rtti.cpp
==============================================================================
--- branches/release/libs/serialization/src/extended_type_info_no_rtti.cpp (original)
+++ branches/release/libs/serialization/src/extended_type_info_no_rtti.cpp 2011-01-19 13:31:02 EST (Wed, 19 Jan 2011)
@@ -11,7 +11,7 @@
 
 #include <cstring>
 #include <cstddef> // NULL
-#include <cassert>
+#include <boost/assert.hpp>
 
 #include <boost/config.hpp>
 #if defined(BOOST_NO_STDC_NAMESPACE)
@@ -52,8 +52,8 @@
     // through a pointer to the to most derived class. OR make sure
     // that the BOOST_CLASS_EXPORT is included in every file
     // which does this.
- assert(NULL != l);
- assert(NULL != r);
+ BOOST_ASSERT(NULL != l);
+ BOOST_ASSERT(NULL != r);
     return std::strcmp(l, r) < 0;
 }
 
@@ -66,11 +66,11 @@
         return true;
     // null keys don't match with anything
     const char * l = get_key();
- assert(NULL != l);
+ BOOST_ASSERT(NULL != l);
     if(NULL == l)
         return false;
     const char * r = rhs.get_key();
- assert(NULL != r);
+ BOOST_ASSERT(NULL != r);
     if(NULL == r)
         return false;
     return 0 == std::strcmp(l, r);

Modified: branches/release/libs/serialization/src/extended_type_info_typeid.cpp
==============================================================================
--- branches/release/libs/serialization/src/extended_type_info_typeid.cpp (original)
+++ branches/release/libs/serialization/src/extended_type_info_typeid.cpp 2011-01-19 13:31:02 EST (Wed, 19 Jan 2011)
@@ -11,7 +11,7 @@
 
 #include <algorithm>
 #include <set>
-#include <cassert>
+#include <boost/assert.hpp>
 #include <typeinfo>
 #include <cstddef> // NULL
 
@@ -96,7 +96,7 @@
             tkmap & x = singleton<tkmap>::get_mutable_instance();
             tkmap::iterator start = x.lower_bound(this);
             tkmap::iterator end = x.upper_bound(this);
- assert(start != end);
+ BOOST_ASSERT(start != end);
 
             // remove entry in map which corresponds to this type
             do{
@@ -120,11 +120,11 @@
     public extended_type_info_typeid_0
 {
     virtual void * construct(unsigned int /*count*/, ...) const{
- assert(false);
+ BOOST_ASSERT(false);
         return NULL;
     }
     virtual void destroy(void const * const /*p*/) const {
- assert(false);
+ BOOST_ASSERT(false);
     }
 public:
     extended_type_info_typeid_arg(const std::type_info & ti) :

Modified: branches/release/libs/serialization/src/shared_ptr_helper.cpp
==============================================================================
--- branches/release/libs/serialization/src/shared_ptr_helper.cpp (original)
+++ branches/release/libs/serialization/src/shared_ptr_helper.cpp 2011-01-19 13:31:02 EST (Wed, 19 Jan 2011)
@@ -103,7 +103,7 @@
     if(i == m_pointers->end()){
         std::pair<collection_type::iterator, bool> result;
         result = m_pointers->insert(sp);
- assert(result.second);
+ BOOST_ASSERT(result.second);
     }
 }
 

Modified: branches/release/libs/serialization/src/void_cast.cpp
==============================================================================
--- branches/release/libs/serialization/src/void_cast.cpp (original)
+++ branches/release/libs/serialization/src/void_cast.cpp 2011-01-19 13:31:02 EST (Wed, 19 Jan 2011)
@@ -13,7 +13,7 @@
 # pragma warning (disable : 4786) // too long name, harmless warning
 #endif
 
-#include <cassert>
+#include <boost/assert.hpp>
 #include <cstddef> // NULL
 #ifdef BOOST_SERIALIZATION_LOG
 #include <iostream>
@@ -23,7 +23,7 @@
 #include <set>
 #include <functional>
 #include <algorithm>
-#include <cassert>
+#include <boost/assert.hpp>
 
 // BOOST
 #define BOOST_SERIALIZATION_SOURCE
@@ -185,16 +185,16 @@
 {
     virtual void const *
     upcast(void const * const /*t*/) const {
- assert(false);
+ BOOST_ASSERT(false);
         return NULL;
     }
     virtual void const *
     downcast( void const * const /*t*/) const {
- assert(false);
+ BOOST_ASSERT(false);
         return NULL;
     }
     virtual bool has_virtual_base() const {
- assert(false);
+ BOOST_ASSERT(false);
         return false;
     }
 public:

Modified: branches/release/libs/serialization/src/xml_archive_exception.cpp
==============================================================================
--- branches/release/libs/serialization/src/xml_archive_exception.cpp (original)
+++ branches/release/libs/serialization/src/xml_archive_exception.cpp 2011-01-19 13:31:02 EST (Wed, 19 Jan 2011)
@@ -14,7 +14,7 @@
 
 
 #include <exception>
-#include <cassert>
+#include <boost/assert.hpp>
 #include <string>
 
 #define BOOST_ARCHIVE_SOURCE
@@ -47,7 +47,7 @@
             m_msg = "Invalid XML tag name";
             break;
         default:
- assert(false);
+ BOOST_ASSERT(false);
             break;
         }
     }

Modified: branches/release/libs/serialization/test/Jamfile.v2
==============================================================================
--- branches/release/libs/serialization/test/Jamfile.v2 (original)
+++ branches/release/libs/serialization/test/Jamfile.v2 2011-01-19 13:31:02 EST (Wed, 19 Jan 2011)
@@ -8,6 +8,7 @@
 
 project libs/serialization/test
     : id serialization_test
+ : requirements <source>/boost/filesystem
     ;
 
 # import rules from the boost serialization test

Modified: branches/release/libs/serialization/test/test_tools.hpp
==============================================================================
--- branches/release/libs/serialization/test/test_tools.hpp (original)
+++ branches/release/libs/serialization/test/test_tools.hpp 2011-01-19 13:31:02 EST (Wed, 19 Jan 2011)
@@ -1,6 +1,9 @@
 #ifndef BOOST_SERIALIZATION_TEST_TOOLS_HPP
 #define BOOST_SERIALIZATION_TEST_TOOLS_HPP
 
+#define BOOST_FILESYSTEM_VERSION 3
+#include <boost/filesystem.hpp>
+
 // MS compatible compilers support #pragma once
 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
 # pragma once
@@ -16,7 +19,6 @@
 
 // See http://www.boost.org for updates, documentation, and revision history.
 
-#include <cstdio> // remove, tmpnam
 #include <cstddef> // size_t
 #ifndef BOOST_NO_EXCEPTION_STD_NAMESPACE
     #include <exception>
@@ -87,7 +89,11 @@
             char old_dir[256];
             _getcwd(old_dir, sizeof(old_dir) - 1);
             chdir(dir);
- std::tmpnam(ibuffer + i);
+ // (C) Copyright 2010 Dean Michael Berris. <mikhailberis_at_[hidden]>
+ // Instead of using std::tmpnam, we use Boost.Filesystem's unique_path
+ boost::filesystem::path tmp_path =
+ boost::filesystem::unique_path("%%%%%");
+ std::strcat(ibuffer, tmp_path.string().c_str());
             chdir(old_dir);
         }
         else{
@@ -118,15 +124,33 @@
  
 namespace boost {
 namespace archive {
- using ::tempnam;
+ using ::tmpnam;
 } // archive
 } // boost
 
 #else // defined(__hpux)
 
+// (C) Copyright 2010 Dean Michael Berris.
+// Instead of using the potentially dangrous tempnam function that's part
+// of the C standard library, on Unix/Linux we use the more portable and
+// "safe" unique_path function provided in the Boost.Filesystem library.
+
+#include <boost/archive/tmpdir.hpp>
+
 namespace boost {
 namespace archive {
- using std::tmpnam;
+ char const * tmpnam(char * buffer) {
+ static char name[512] = {0};
+ if (name[0] == 0) {
+ boost::filesystem::path tempdir(tmpdir());
+ boost::filesystem::path tempfilename =
+ boost::filesystem::unique_path("serialization-%%%%");
+ boost::filesystem::path temp = tempdir / tempfilename;
+ std::strcat(name, temp.string().c_str());
+ }
+ if (buffer != 0) std::strcpy(buffer, name);
+ return name;
+ }
 } // archive
 } // boost
 


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