Boost logo

Boost Users :

Subject: [Boost-users] boost serialisation, PORTABLE_BINARY_ARCHIVE fix required
From: avib369 . (avibahra_at_[hidden])
Date: 2013-06-20 11:22:58


Currently portable binary archive is broken on AIX platforms.
The reason is because the default 'char' type is unsigned on this platform.
Whereas for most other platforms it is signed,

By going through the portable binary and replacing 'char' with 'signed
char'
 this long standing bug is fixed.
I have tested the fix on Linux(opensuse103,opensuse113, HPUX,
AIX(power6,power7)

This is a fairly safe and quick fix, can I please ask the authors of this
library
to add this fix, for the next version of boost.

Here are the changes I made: (flagged under ' // changed ' comment
//--------------------------------------------------------
portable_binary_iarchive.hpp

   void load(signed char & t){ // changed
        this->primitive_base_t::load(t);
    }

//-------------------------------------------------------------
portable_binary_iarchive.cpp

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

    if(0 == size){
        return;
    }

    bool negative = (size < 0);
    ......

// -----------------------------------------------------------------
portable_binary_oarchive.hpp

  void save(const signed char & t){ // changed
        this->primitive_base_t::save(t);
    }

// -----------------------------------------------------------
portable_binary_oarchive.cpp

void
portable_binary_oarchive::save_impl(
    const boost::intmax_t l,
    const char maxsize
){
    signed char size = 0; // changed

    if(l == 0){
        this->primitive_base_t::save(size);
        return;
    }

 ..........

// ------------------------------

Ta,
   Avi



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net