Opened 8 years ago

Last modified 8 years ago

#10561 new Bugs

Bugs in dual seekable mode

Reported by: jlodos@… Owned by: Jonathan Turkanis
Milestone: To Be Determined Component: iostreams
Version: Boost 1.56.0 Severity: Problem
Keywords: Cc:

Description

Currently there are no tests for dual seekable streams. So the first thing to do is to add some tests. See dual_seekable_test.cpp attached. These tests uncover the following bugs:

  1. The functions test_seekable_in_chars and test_seekable_in_chunks in test/detail/verification.hpp use seekp in several places where seekg should be used. This has no effect when there is a single head but does not work when the stream is dual seekable. A new verification function test_dual_seekable was added and tested. See attached verification.hpp.
  2. indirect_streambuf::seek_impl does not work for dual seeking. The problem is that both heads are modified for both input and output operations. Since the modification is the same (just resetting the pointers) everything works when there is a single head. This is a duplicate of https://svn.boost.org/trac/boost/ticket/7681. Solved in the attached indirect_streambuf.hpp
  3. The function shared_buffer() does not consider dual_seekable stream buffers as shared. Solved in the attached indirect_streambuf.hpp
  4. The function init_put_area() does not consider the existing input position. This is a duplicate of https://svn.boost.org/trac/boost/ticket/8572. Solved in the attached indirect_streambuf.hpp

With the attached versions of verification.hpp and indirect_streambuf.hpp all previously existing tests passed. I recommend adding the new tests in dual_seekable_test.cpp.

Attachments (3)

verification.hpp (11.9 KB ) - added by jlodos@… 8 years ago.
indirect_streambuf.hpp (15.6 KB ) - added by jlodos@… 8 years ago.
dual_seekable_test.cpp (5.3 KB ) - added by jlodos@… 8 years ago.

Download all attachments as: .zip

Change History (4)

by jlodos@…, 8 years ago

Attachment: verification.hpp added

by jlodos@…, 8 years ago

Attachment: indirect_streambuf.hpp added

by jlodos@…, 8 years ago

Attachment: dual_seekable_test.cpp added

comment:1 by jlodos@…, 8 years ago

Forgot this:

  1. Bug in the example file container_device.hpp. The function seek (line 138) checks for errors with next >= container_.size(). But container_.size() is a valid value indicating EOF. It should be next > container_.size().
Note: See TracTickets for help on using tickets.