Skip to content

Commit

Permalink
fix?
Browse files Browse the repository at this point in the history
  • Loading branch information
eseiler committed Jan 3, 2023
1 parent 5b823f8 commit f5de3d2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
4 changes: 3 additions & 1 deletion include/seqan3/io/stream/detail/fast_istreambuf_iterator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ class fast_istreambuf_iterator
stream_buf{reinterpret_cast<stream_buffer_exposer<char_t, traits_t> *>(&ibuf)}
{
assert(stream_buf != nullptr);
stream_buf->underflow(); // ensure the stream buffer has content on construction
if (!stream_buf->in_avail())
stream_buf->underflow(); // ensure the stream buffer has content on construction
assert(stream_buf.in_avail());
}
//!\}

Expand Down
20 changes: 6 additions & 14 deletions test/unit/io/sam_file/sam_file_format_test_template.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,31 +223,23 @@ TYPED_TEST_P(sam_file_read, read_in_all_data)

class null_filter_buf : public std::streambuf
{
static constexpr std::streamsize buffer_size{10};
std::streambuf * src;
std::array<char, 10> bufl{};
std::array<char, buffer_size> bufl{};

public:

null_filter_buf() = delete; //!< Defaulted.
null_filter_buf(null_filter_buf const &) = delete; //!< Defaulted.
null_filter_buf & operator=(null_filter_buf const &) = delete; //!< Defaulted.
null_filter_buf(null_filter_buf &&) = delete; //!< Defaulted.
null_filter_buf & operator=(null_filter_buf &&) = delete; //!< Defaulted.
~null_filter_buf() = default; //!< Defaulted.

int underflow()
{
std::streamsize number_of_characters_read = src->sgetn(bufl.data(), 10);
std::streamsize number_of_characters_read = src->sgetn(bufl.data(), buffer_size);

setg(bufl.data(), bufl.data(), bufl.data() + number_of_characters_read); // make read position available

return (number_of_characters_read == 10) ? *bufl.data() : traits_type::eof();
return (number_of_characters_read == buffer_size) ? *bufl.data() : traits_type::eof();
}

null_filter_buf(std::streambuf* buf) : src(buf)
null_filter_buf(std::streambuf * buf) : src(buf)
{
std::cout << "I'm getting consstructed and I'm filling my buffer" << std::endl;
underflow();
setg(bufl.data(), bufl.data(), bufl.data() + buffer_size);
}
};

Expand Down

0 comments on commit f5de3d2

Please sign in to comment.