diff options
author | kenshi84 <kenshi84@protonmail.ch> | 2017-01-06 08:37:15 +0900 |
---|---|---|
committer | kenshi84 <kenshi84@protonmail.ch> | 2017-01-07 11:59:16 +0900 |
commit | 9d1d3a454e95098bebe1807f4d05f9378bfc0f81 (patch) | |
tree | e04a2fa845c6a4fbc95abe7cd7adca912e267e4a /external | |
parent | Merge pull request #1487 (diff) | |
download | monero-9d1d3a454e95098bebe1807f4d05f9378bfc0f81.tar.xz |
portable serializer: use signed char for size
Diffstat (limited to 'external')
-rw-r--r-- | external/boost/archive/portable_binary_archive.hpp | 5 | ||||
-rw-r--r-- | external/boost/archive/portable_binary_iarchive.hpp | 2 | ||||
-rw-r--r-- | external/boost/archive/portable_binary_oarchive.hpp | 4 |
3 files changed, 7 insertions, 4 deletions
diff --git a/external/boost/archive/portable_binary_archive.hpp b/external/boost/archive/portable_binary_archive.hpp index 560ef121b..e940c5b9e 100644 --- a/external/boost/archive/portable_binary_archive.hpp +++ b/external/boost/archive/portable_binary_archive.hpp @@ -14,6 +14,7 @@ #include <boost/config.hpp>
#include <boost/cstdint.hpp>
#include <boost/static_assert.hpp>
+#include <boost/archive/archive_exception.hpp>
#include <climits>
#if CHAR_BIT != 8
@@ -37,7 +38,9 @@ enum portable_binary_archive_flags { //#endif
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 * last = first + size - 1;
for(;first < last;++first, --last){
diff --git a/external/boost/archive/portable_binary_iarchive.hpp b/external/boost/archive/portable_binary_iarchive.hpp index 7149cca0f..3d60dddfc 100644 --- a/external/boost/archive/portable_binary_iarchive.hpp +++ b/external/boost/archive/portable_binary_iarchive.hpp @@ -234,7 +234,7 @@ namespace boost { namespace archive { inline void
portable_binary_iarchive::load_impl(boost::intmax_t & l, char maxsize){
- char size;
+ signed char size;
l = 0;
this->primitive_base_t::load(size);
diff --git a/external/boost/archive/portable_binary_oarchive.hpp b/external/boost/archive/portable_binary_oarchive.hpp index 8fd7090a1..271647cf7 100644 --- a/external/boost/archive/portable_binary_oarchive.hpp +++ b/external/boost/archive/portable_binary_oarchive.hpp @@ -225,7 +225,7 @@ portable_binary_oarchive::save_impl( const boost::intmax_t l,
const char maxsize
){
- char size = 0;
+ signed char size = 0;
if(l == 0){
this->primitive_base_t::save(size);
@@ -245,7 +245,7 @@ portable_binary_oarchive::save_impl( }while(ll != 0);
this->primitive_base_t::save(
- static_cast<char>(negative ? -size : size)
+ static_cast<signed char>(negative ? -size : size)
);
if(negative)
|