Ticket #7240: boost_serialization_fix147.patch

File boost_serialization_fix147.patch, 1.7 KB (added by ggagniard@…, 10 years ago)

Proposed patch on boost 1.47 (should apply on 1.50 too)

  • boost/archive/basic_binary_iarchive.hpp

    diff -ur boost_1_47_0/boost/archive/basic_binary_iarchive.hpp boost_1_47_0.fixed/boost/archive/basic_binary_iarchive.hpp
    old new  
    9797    }
    9898    void load_override(class_id_type & t, int version){
    9999        library_version_type lvt = this->get_library_version();
     100        /*
     101         * library versions:
     102         *   boost 1.39 -> 5
     103         *   boost 1.43 -> 7
     104         *   boost 1.47 -> 9
     105         *
     106         *
     107         * 1) in boost 1.43 and inferior, class_id_type is always a 16bit value, with no check on the library version
     108         *   --> this means all archives with version v <= 7 are written with a 16bit class_id_type
     109         * 2) in boost 1.44 this load_override has disappeared (and thus boost 1.44 is not backward compatible at all !!)
     110         * 3) recent boosts reintroduced load_override with a test on the version :
     111         *     - v > 7 : this->detail_common_iarchive::load_override(t, version)
     112         *     - v > 6 : 16bit
     113         *     - other : 32bit
     114         *   --> which is obviously incorrect, see point 1
     115         *
     116         * the fix here decodes class_id_type on 16bit for all v <= 7, which seems to be the correct behaviour ...
     117         */
    100118        if(boost::archive::library_version_type(7) < lvt){
    101119            this->detail_common_iarchive::load_override(t, version);
    102120        }
    103         else
    104         if(boost::archive::library_version_type(6) < lvt){
    105             int_least16_t x=0;
    106             * this->This() >> x;
    107             t = boost::archive::class_id_type(x);
    108         }
    109121        else{
    110             int x=0;
     122            int_least16_t x=0;
    111123            * this->This() >> x;
    112124            t = boost::archive::class_id_type(x);
    113125        }