Merge branch 'laudrup-master' into develop

see #363
This commit is contained in:
Shane Grant
2016-11-28 11:47:53 -08:00
8 changed files with 20 additions and 22 deletions
+1 -1
View File
@@ -716,7 +716,7 @@ namespace cereal
//! Binding for non abstract types
void bind(std::false_type) const
{
instantiate_polymorphic_binding((T*) 0, 0, Tag{}, adl_tag{});
instantiate_polymorphic_binding(static_cast<T*>(nullptr), 0, Tag{}, adl_tag{});
}
//! Binding for abstract types
+6 -8
View File
@@ -50,10 +50,10 @@ namespace cereal
while (in_len--) {
char_array_3[i++] = *(bytes_to_encode++);
if (i == 3) {
char_array_4[0] = (unsigned char) ((char_array_3[0] & 0xfc) >> 2);
char_array_4[1] = (unsigned char) ( ( ( char_array_3[0] & 0x03 ) << 4 ) + ( ( char_array_3[1] & 0xf0 ) >> 4 ) );
char_array_4[2] = (unsigned char) ( ( ( char_array_3[1] & 0x0f ) << 2 ) + ( ( char_array_3[2] & 0xc0 ) >> 6 ) );
char_array_4[3] = (unsigned char) ( char_array_3[2] & 0x3f );
char_array_4[0] = static_cast<unsigned char>((char_array_3[0] & 0xfc) >> 2);
char_array_4[1] = static_cast<unsigned char>( ( ( char_array_3[0] & 0x03 ) << 4 ) + ( ( char_array_3[1] & 0xf0 ) >> 4 ) );
char_array_4[2] = static_cast<unsigned char>( ( ( char_array_3[1] & 0x0f ) << 2 ) + ( ( char_array_3[2] & 0xc0 ) >> 6 ) );
char_array_4[3] = static_cast<unsigned char>( char_array_3[2] & 0x3f );
for(i = 0; (i <4) ; i++)
ret += chars[char_array_4[i]];
@@ -76,11 +76,9 @@ namespace cereal
while((i++ < 3))
ret += '=';
}
return ret;
}
inline std::string decode(std::string const& encoded_string) {
@@ -95,7 +93,7 @@ namespace cereal
char_array_4[i++] = encoded_string[in_]; in_++;
if (i ==4) {
for (i = 0; i <4; i++)
char_array_4[i] = (unsigned char) chars.find( char_array_4[i] );
char_array_4[i] = static_cast<unsigned char>(chars.find( char_array_4[i] ));
char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4);
char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2);
@@ -112,7 +110,7 @@ namespace cereal
char_array_4[j] = 0;
for (j = 0; j <4; j++)
char_array_4[j] = (unsigned char) chars.find( char_array_4[j] );
char_array_4[j] = static_cast<unsigned char>(chars.find( char_array_4[j] ));
char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4);
char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2);
+2 -2
View File
@@ -651,9 +651,9 @@ int main()
iar( d1 );
assert( d1->x == 4 && d1->y == 3 );
iar( d2 );
assert( ((Derived*)d2.get())->x == 5 && ((Derived*)d2.get())->y == 4 );
assert( dynamic_cast<Derived*>(d2.get())->x == 5 && dynamic_cast<Derived*>(d2.get())->y == 4 );
iar( d3 );
assert( ((Derived*)d3.get())->x == 6 && ((Derived*)d3.get())->y == 5 );
assert( dynamic_cast<Derived*>(d3.get())->x == 6 && dynamic_cast<Derived*>(d3.get())->y == 5 );
}
{
+2 -2
View File
@@ -320,13 +320,13 @@ enum Bla
template <class Archive>
void save( Archive & ar, Bla const & b )
{
ar( (const int &)b );
ar( static_cast<const int &>(b) );
}
template <class Archive>
void load( Archive & ar, Bla & b )
{
ar( (int&)b );
ar( static_cast<int&>(b) );
}
CEREAL_SPECIALIZE_FOR_ALL_ARCHIVES( Bla, cereal::specialization::non_member_load_save )
+1 -1
View File
@@ -132,7 +132,7 @@ void test_pod()
BOOST_CHECK_EQUAL(i_int32 , o_int32);
BOOST_CHECK_EQUAL(i_uint64 , o_uint64);
BOOST_CHECK_EQUAL(i_int64 , o_int64);
BOOST_CHECK_CLOSE(i_float , o_float, (float)1e-5);
BOOST_CHECK_CLOSE(i_float , o_float, 1e-5F);
BOOST_CHECK_CLOSE(i_double , o_double, 1e-5);
BOOST_CHECK_CLOSE(i_long_double, o_long_double, 1e-5);
+6 -6
View File
@@ -322,13 +322,13 @@ void test_polymorphic()
#endif
BOOST_CHECK_EQUAL(i_shared.get(), i_locked.get());
BOOST_CHECK_EQUAL(*((PolyDerived*)i_shared.get()), *((PolyDerived*)o_shared.get()));
BOOST_CHECK_EQUAL(*((PolyDerived*)i_shared.get()), *((PolyDerived*)i_locked.get()));
BOOST_CHECK_EQUAL(*((PolyDerived*)i_locked.get()), *((PolyDerived*)o_locked.get()));
BOOST_CHECK_EQUAL(*((PolyDerived*)i_unique.get()), *((PolyDerived*)o_unique.get()));
BOOST_CHECK_EQUAL(*dynamic_cast<PolyDerived*>(i_shared.get()), *dynamic_cast<PolyDerived*>(o_shared.get()));
BOOST_CHECK_EQUAL(*dynamic_cast<PolyDerived*>(i_shared.get()), *dynamic_cast<PolyDerived*>(i_locked.get()));
BOOST_CHECK_EQUAL(*dynamic_cast<PolyDerived*>(i_locked.get()), *dynamic_cast<PolyDerived*>(o_locked.get()));
BOOST_CHECK_EQUAL(*dynamic_cast<PolyDerived*>(i_unique.get()), *dynamic_cast<PolyDerived*>(o_unique.get()));
BOOST_CHECK_EQUAL(*((PolyDerivedLA*)i_sharedLA.get()), *((PolyDerivedLA*)o_sharedLA.get()));
BOOST_CHECK_EQUAL(*((PolyDerivedLA*)i_sharedLA2.get()), *((PolyDerivedLA*)o_sharedLA.get()));
BOOST_CHECK_EQUAL(*dynamic_cast<PolyDerivedLA*>(i_sharedLA.get()), *dynamic_cast<PolyDerivedLA*>(o_sharedLA.get()));
BOOST_CHECK_EQUAL(*dynamic_cast<PolyDerivedLA*>(i_sharedLA2.get()), *dynamic_cast<PolyDerivedLA*>(o_sharedLA.get()));
BOOST_CHECK_EQUAL(i_sharedA.get(), i_lockedA.get());
BOOST_CHECK_EQUAL(*dynamic_cast<PolyDerivedD*>(i_sharedA.get()), *dynamic_cast<PolyDerivedD*>(o_sharedA.get()));
+1 -1
View File
@@ -72,7 +72,7 @@ inline void swapBytes( T & t )
BOOST_CHECK_EQUAL(i_int32 , o_int32); \
BOOST_CHECK_EQUAL(i_uint64 , o_uint64); \
BOOST_CHECK_EQUAL(i_int64 , o_int64); \
if( !std::isnan(i_float) && !std::isnan(o_float) ) BOOST_CHECK_CLOSE(i_float , o_float, (float)1e-5); \
if( !std::isnan(i_float) && !std::isnan(o_float) ) BOOST_CHECK_CLOSE(i_float , o_float, 1e-5F); \
if( !std::isnan(i_float) && !std::isnan(o_float) ) BOOST_CHECK_CLOSE(i_double , o_double, 1e-5);
// Last parameter exists to keep everything hidden in options
+1 -1
View File
@@ -441,7 +441,7 @@ void test_structs_specialized()
BOOST_CHECK(i_ispl.x == o_ispl.x);
BOOST_CHECK(i_isplv.x == o_isplv.x);
BOOST_CHECK_EQUAL(((SpecializedMSplitPolymorphic*)i_shared_ispl.get())->x, ((SpecializedMSplitPolymorphic*)o_shared_ispl.get())->x);
BOOST_CHECK_EQUAL(dynamic_cast<SpecializedMSplitPolymorphic*>(i_shared_ispl.get())->x, dynamic_cast<SpecializedMSplitPolymorphic*>(o_shared_ispl.get())->x);
BOOST_CHECK(i_isplm.x == o_isplm.x);
BOOST_CHECK(i_isplvm.x == o_isplvm.x);