From 03ccac4d1f5bbf2f8895816503163466494ba241 Mon Sep 17 00:00:00 2001 From: Bob Polis Date: Mon, 12 Dec 2022 19:04:05 +0100 Subject: [PATCH] Fixed seeking for simultaneous in- and output --- src/memstreambuf.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/memstreambuf.cpp b/src/memstreambuf.cpp index 7e0a85f..d24c87b 100644 --- a/src/memstreambuf.cpp +++ b/src/memstreambuf.cpp @@ -72,7 +72,8 @@ std::streambuf::pos_type sc::io::memstreambuf::seekoff(std::streambuf::off_type break; } return gptr() - _mem; - } else if (which & std::ios::out) { // writing + } + if (which & std::ios::out) { // writing switch (dir) { // TODO case std::ios::beg: break; @@ -92,7 +93,8 @@ std::streambuf::pos_type sc::io::memstreambuf::seekpos(std::streambuf::pos_type if (pos < 0 || static_cast(pos) > _size) return EOF; setg(_mem, _mem + pos, _mem + _size); return pos; - } else if (which & std::ios::out) { + } + if (which & std::ios::out) { // TODO return pos; }