Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r86487 - in trunk/libs/serialization: example src test
From: ramey_at_[hidden]
Date: 2013-10-27 16:50:26


Author: ramey
Date: 2013-10-27 16:50:26 EDT (Sun, 27 Oct 2013)
New Revision: 86487
URL: http://svn.boost.org/trac/boost/changeset/86487

Log:
correct rounding
fix memory leak for constructor failure in load_construct_data
fix another bug in loading pointers

Text files modified:
   trunk/libs/serialization/example/demo_dll_a.hpp | 8 ++++----
   trunk/libs/serialization/src/basic_iarchive.cpp | 12 +++++++-----
   trunk/libs/serialization/test/A.cpp | 8 ++++----
   trunk/libs/serialization/test/test_codecvt_null.cpp | 2 +-
   trunk/libs/serialization/test/test_complex.cpp | 4 ++--
   trunk/libs/serialization/test/test_iterators.cpp | 2 +-
   trunk/libs/serialization/test/test_map.cpp | 2 +-
   trunk/libs/serialization/test/test_set.cpp | 2 +-
   trunk/libs/serialization/test/test_simple_class.cpp | 8 ++++----
   trunk/libs/serialization/test/test_utf8_codecvt.cpp | 2 +-
   10 files changed, 26 insertions(+), 24 deletions(-)

Modified: trunk/libs/serialization/example/demo_dll_a.hpp
==============================================================================
--- trunk/libs/serialization/example/demo_dll_a.hpp Sun Oct 27 16:38:43 2013 (r86486)
+++ trunk/libs/serialization/example/demo_dll_a.hpp 2013-10-27 16:50:26 EDT (Sun, 27 Oct 2013) (r86487)
@@ -245,13 +245,13 @@
         return false;
     if(v != rhs.v)
         return false;
- if(w == 0 && std::fabs(rhs.w) > std::numeric_limits<float>::epsilon())
+ if(w == 0 && std::fabs(rhs.w) > 2 * std::numeric_limits<float>::round_error())
         return false;
- if(std::fabs(rhs.w/w - 1.0) > std::numeric_limits<float>::epsilon())
+ if(std::fabs(rhs.w/w - 1.0) > 2 * std::numeric_limits<float>::round_error())
         return false;
- if(x == 0 && std::fabs(rhs.x - x) > std::numeric_limits<float>::epsilon())
+ if(x == 0 && std::fabs(rhs.x - x) > 2 * std::numeric_limits<double>::round_error())
         return false;
- if(std::fabs(rhs.x/x - 1.0) > std::numeric_limits<float>::epsilon())
+ if(std::fabs(rhs.x/x - 1.0) > 2 * std::numeric_limits<double>::round_error())
         return false;
     if(0 != y.compare(rhs.y))
         return false;

Modified: trunk/libs/serialization/src/basic_iarchive.cpp
==============================================================================
--- trunk/libs/serialization/src/basic_iarchive.cpp Sun Oct 27 16:38:43 2013 (r86486)
+++ trunk/libs/serialization/src/basic_iarchive.cpp 2013-10-27 16:50:26 EDT (Sun, 27 Oct 2013) (r86487)
@@ -495,14 +495,16 @@
         // cyclic strucures
         object_id_vector.push_back(aobject(t, cid));
 
+ // remember that that the address of these elements could change
+ // when we make another call so don't use the address
         bpis_ptr->load_object_ptr(
- ar,
- object_id_vector[ui].address,
- co.file_version
+ ar,
+ t,
+ m_pending.version
         );
- t = object_id_vector[ui].address;
- object_id_vector[ui].loaded_as_pointer = true;
         BOOST_ASSERT(NULL != t);
+ object_id_vector[ui].address = t;
+ object_id_vector[ui].loaded_as_pointer = true;
     }
 
     return bpis_ptr;

Modified: trunk/libs/serialization/test/A.cpp
==============================================================================
--- trunk/libs/serialization/test/A.cpp Sun Oct 27 16:38:43 2013 (r86486)
+++ trunk/libs/serialization/test/A.cpp 2013-10-27 16:50:26 EDT (Sun, 27 Oct 2013) (r86487)
@@ -148,13 +148,13 @@
         return false;
     if(v != rhs.v)
         return false;
- if(w == 0 && std::fabs(rhs.w) > std::numeric_limits<float>::epsilon())
+ if(w == 0 && std::fabs(rhs.w) > 2 * std::numeric_limits<float>::round_error())
         return false;
- if(std::fabs(rhs.w/w - 1.0) > std::numeric_limits<float>::epsilon())
+ if(std::fabs(rhs.w/w - 1.0) > 2 * std::numeric_limits<float>::round_error())
         return false;
- if(x == 0 && std::fabs(rhs.x - x) > std::numeric_limits<float>::epsilon())
+ if(x == 0 && std::fabs(rhs.x - x) > 2 * std::numeric_limits<double>::round_error())
         return false;
- if(std::fabs(rhs.x/x - 1.0) > std::numeric_limits<float>::epsilon())
+ if(std::fabs(rhs.x/x - 1.0) > 2 * std::numeric_limits<double>::round_error())
         return false;
     if(0 != y.compare(rhs.y))
         return false;

Modified: trunk/libs/serialization/test/test_codecvt_null.cpp
==============================================================================
--- trunk/libs/serialization/test/test_codecvt_null.cpp Sun Oct 27 16:38:43 2013 (r86486)
+++ trunk/libs/serialization/test/test_codecvt_null.cpp 2013-10-27 16:50:26 EDT (Sun, 27 Oct 2013) (r86487)
@@ -10,7 +10,7 @@
 // which use wchar_t as 2 byte objects will emit warnings. These should be
 // ignored.
 
-#include <algorithm>
+#include <algorithm> // std::copy
 #include <fstream>
 #include <iostream>
 #include <iterator>

Modified: trunk/libs/serialization/test/test_complex.cpp
==============================================================================
--- trunk/libs/serialization/test/test_complex.cpp Sun Oct 27 16:38:43 2013 (r86486)
+++ trunk/libs/serialization/test/test_complex.cpp 2013-10-27 16:50:26 EDT (Sun, 27 Oct 2013) (r86487)
@@ -68,8 +68,8 @@
         ia >> boost::serialization::make_nvp("adoublecomplex", b1);
     }
 
- BOOST_CHECK(std::abs(a-a1) <= 2.*std::numeric_limits<float>::round_error());
- BOOST_CHECK(std::abs(b-b1) <= 2.*std::numeric_limits<double>::round_error());
+ BOOST_CHECK(std::abs(a-a1) <= (2 * std::numeric_limits<float>::round_error()));
+ BOOST_CHECK(std::abs(b-b1) <= (2 * std::numeric_limits<double>::round_error()));
 
     std::remove(testfile);
     return EXIT_SUCCESS;

Modified: trunk/libs/serialization/test/test_iterators.cpp
==============================================================================
--- trunk/libs/serialization/test/test_iterators.cpp Sun Oct 27 16:38:43 2013 (r86486)
+++ trunk/libs/serialization/test/test_iterators.cpp 2013-10-27 16:50:26 EDT (Sun, 27 Oct 2013) (r86487)
@@ -6,7 +6,7 @@
 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
-#include <algorithm>
+#include <algorithm> // std::copy
 #include <vector>
 #include <cstdlib> // for rand
 #include <functional>

Modified: trunk/libs/serialization/test/test_map.cpp
==============================================================================
--- trunk/libs/serialization/test/test_map.cpp Sun Oct 27 16:38:43 2013 (r86486)
+++ trunk/libs/serialization/test/test_map.cpp 2013-10-27 16:50:26 EDT (Sun, 27 Oct 2013) (r86487)
@@ -8,7 +8,7 @@
 
 // should pass compilation and execution
 
-#include <algorithm>
+#include <algorithm> // std::copy
 #include <vector>
 #include <fstream>
 #include <cstddef> // size_t, NULL

Modified: trunk/libs/serialization/test/test_set.cpp
==============================================================================
--- trunk/libs/serialization/test/test_set.cpp Sun Oct 27 16:38:43 2013 (r86486)
+++ trunk/libs/serialization/test/test_set.cpp 2013-10-27 16:50:26 EDT (Sun, 27 Oct 2013) (r86487)
@@ -12,7 +12,7 @@
 #include <cstdio> // remove
 #include <fstream>
 
-#include <algorithm>
+#include <algorithm> // std::copy
 #include <vector>
 
 #include <boost/config.hpp>

Modified: trunk/libs/serialization/test/test_simple_class.cpp
==============================================================================
--- trunk/libs/serialization/test/test_simple_class.cpp Sun Oct 27 16:38:43 2013 (r86486)
+++ trunk/libs/serialization/test/test_simple_class.cpp 2013-10-27 16:50:26 EDT (Sun, 27 Oct 2013) (r86487)
@@ -52,16 +52,16 @@
     BOOST_CHECK_EQUAL(l, rhs.l);
     BOOST_CHECK(!(
         w == 0
- && std::fabs(rhs.w) > std::numeric_limits<float>::epsilon()
+ && std::fabs(rhs.w) > std::numeric_limits<float>::round_error()
     ));
     BOOST_CHECK(!(
- std::fabs(rhs.w/w - 1.0) > std::numeric_limits<float>::epsilon()
+ std::fabs(rhs.w/w - 1.0) > 2.0 * std::numeric_limits<float>::round_error()
     ));
     BOOST_CHECK(!(
- x == 0 && std::fabs(rhs.x - x) > std::numeric_limits<float>::epsilon()
+ x == 0 && std::fabs(rhs.x - x) > 2.0 * std::numeric_limits<double>::round_error()
     ));
     BOOST_CHECK(!(
- std::fabs(rhs.x/x - 1.0) > std::numeric_limits<float>::epsilon()
+ std::fabs(rhs.x/x - 1.0) > 2.0 * std::numeric_limits<double>::round_error()
     ));
     BOOST_CHECK(!(0 != y.compare(rhs.y)));
     #ifndef BOOST_NO_STD_WSTRING

Modified: trunk/libs/serialization/test/test_utf8_codecvt.cpp
==============================================================================
--- trunk/libs/serialization/test/test_utf8_codecvt.cpp Sun Oct 27 16:38:43 2013 (r86486)
+++ trunk/libs/serialization/test/test_utf8_codecvt.cpp 2013-10-27 16:50:26 EDT (Sun, 27 Oct 2013) (r86487)
@@ -6,7 +6,7 @@
 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
-#include <algorithm>
+#include <algorithm> // std::copy
 #include <fstream>
 #include <iostream>
 #include <iterator>


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