Ticket #9259: container_device.diff

File container_device.diff, 1.2 KB (added by Chris Foster <chris.foster@…>, 9 years ago)

Patch for container_device

  • .hpp

    old new  
    1313#include <boost/config.hpp>  // BOOST_NO_STDC_NAMESPACE.
    1414#include <boost/iostreams/categories.hpp>
    1515#include <boost/iostreams/detail/ios.hpp>  // failure.
     16#include <boost/iostreams/positioning.hpp> // stream_offset
    1617
    1718namespace boost { namespace iostreams { namespace example {
    1819
     
    113114            pos_ += result;
    114115        }
    115116        if (result < n) {
    116             container_.insert(container_.end(), s, s + n);
     117            container_.insert(container_.end(), s + result, s + n);
    117118            pos_ = container_.size();
    118119        }
    119120        return n;
     
    129130        } else if (way == BOOST_IOS::cur) {
    130131            next = pos_ + off;
    131132        } else if (way == BOOST_IOS::end) {
    132             next = container_.size() + off - 1;
     133            next = container_.size() + off;
    133134        } else {
    134135            throw BOOST_IOSTREAMS_FAILURE("bad seek direction");
    135136        }
    136137
    137138        // Check for errors
    138         if (next < 0 || next >= container_.size())
     139        if (next < 0 || next > container_.size())
    139140            throw BOOST_IOSTREAMS_FAILURE("bad seek offset");
    140141
    141142        pos_ = next;