Skip to content

Commit

Permalink
Merge branch 'laudrup-master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
AzothAmmo committed Nov 28, 2016
2 parents 29829c1 + e63f08f commit d21b0c0
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 22 deletions.
2 changes: 1 addition & 1 deletion include/cereal/details/polymorphic_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 6 additions & 8 deletions include/cereal/external/base64.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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]];
Expand All @@ -76,11 +76,9 @@ namespace cereal

while((i++ < 3))
ret += '=';

}

return ret;

}

inline std::string decode(std::string const& encoded_string) {
Expand All @@ -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);
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions sandbox/sandbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}

{
Expand Down
4 changes: 2 additions & 2 deletions sandbox/sandbox_json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down
2 changes: 1 addition & 1 deletion unittests/pod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
12 changes: 6 additions & 6 deletions unittests/polymorphic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
Expand Down
2 changes: 1 addition & 1 deletion unittests/portable_binary_archive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion unittests/structs_specialized.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit d21b0c0

Please sign in to comment.