Opened 11 years ago

#5765 new Bugs

Container Device/Sink bug

Reported by: aris.basic@… Owned by: Jonathan Turkanis
Milestone: To Be Determined Component: iostreams
Version: Boost 1.47.0 Severity: Problem
Keywords: Cc:

Description

i think write should be like this, otherwise if one seeks back (after writing to overwrite replace some data, number of bytes seeked back will be duplicated on the next write. (original line changed/replaced is commented out in code)

    std::streamsize write(const char_type* s, std::streamsize n)
    {
        using namespace std;
        std::streamsize result = 0;
        if (pos_ != container_.size()) {
            std::streamsize amt =
                static_cast<std::streamsize>(container_.size() - pos_);
            result = (min)(n, amt);
            std::copy(s, s + result, container_.begin() + pos_);
            pos_ += result;
        }
        if (result < n) {
            container_.insert(container_.end(), s + result, s + n);
            //container_.insert(container_.end(), s, s + n);
            pos_ = container_.size();
        }
        return n;
    }

Change History (0)

Note: See TracTickets for help on using tickets.