Skip to content

Commit

Permalink
Merge pull request #1531
Browse files Browse the repository at this point in the history
9d1d3a4 portable serializer: use signed char for size (kenshi84)
  • Loading branch information
fluffypony committed Jan 9, 2017
2 parents 6cbfe0f + 9d1d3a4 commit 278562d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion external/boost/archive/portable_binary_archive.hpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/cstdint.hpp> #include <boost/cstdint.hpp>
#include <boost/static_assert.hpp> #include <boost/static_assert.hpp>
#include <boost/archive/archive_exception.hpp>


#include <climits> #include <climits>
#if CHAR_BIT != 8 #if CHAR_BIT != 8
Expand All @@ -37,7 +38,9 @@ enum portable_binary_archive_flags {
//#endif //#endif


inline void inline void
reverse_bytes(char size, char *address){ reverse_bytes(signed char size, char *address){
if (size <= 0)
throw archive_exception(archive_exception::other_exception);
char * first = address; char * first = address;
char * last = first + size - 1; char * last = first + size - 1;
for(;first < last;++first, --last){ for(;first < last;++first, --last){
Expand Down
2 changes: 1 addition & 1 deletion external/boost/archive/portable_binary_iarchive.hpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ namespace boost { namespace archive {


inline void inline void
portable_binary_iarchive::load_impl(boost::intmax_t & l, char maxsize){ portable_binary_iarchive::load_impl(boost::intmax_t & l, char maxsize){
char size; signed char size;
l = 0; l = 0;
this->primitive_base_t::load(size); this->primitive_base_t::load(size);


Expand Down
4 changes: 2 additions & 2 deletions external/boost/archive/portable_binary_oarchive.hpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ portable_binary_oarchive::save_impl(
const boost::intmax_t l, const boost::intmax_t l,
const char maxsize const char maxsize
){ ){
char size = 0; signed char size = 0;


if(l == 0){ if(l == 0){
this->primitive_base_t::save(size); this->primitive_base_t::save(size);
Expand All @@ -245,7 +245,7 @@ portable_binary_oarchive::save_impl(
}while(ll != 0); }while(ll != 0);


this->primitive_base_t::save( this->primitive_base_t::save(
static_cast<char>(negative ? -size : size) static_cast<signed char>(negative ? -size : size)
); );


if(negative) if(negative)
Expand Down

0 comments on commit 278562d

Please sign in to comment.