diff --git a/include/boost/iostreams/detail/streambuf/direct_streambuf.hpp b/include/boost/iostreams/detail/streambuf/direct_streambuf.hpp index e4bfeda..853c9a6 100755 --- a/include/boost/iostreams/detail/streambuf/direct_streambuf.hpp +++ b/include/boost/iostreams/detail/streambuf/direct_streambuf.hpp @@ -53,6 +53,7 @@ public: // stream_facade needs access. void close(); bool auto_close() const { return auto_close_; } void set_auto_close(bool close) { auto_close_ = close; } + bool strict_sync() { return true; } // Declared in linked_streambuf. T* component() { return storage_.get_ptr(); } diff --git a/include/boost/iostreams/detail/streambuf/indirect_streambuf.hpp b/include/boost/iostreams/detail/streambuf/indirect_streambuf.hpp index 3298993..c787766 100755 --- a/include/boost/iostreams/detail/streambuf/indirect_streambuf.hpp +++ b/include/boost/iostreams/detail/streambuf/indirect_streambuf.hpp @@ -63,6 +63,7 @@ public: void close(); bool auto_close() const; void set_auto_close(bool close); + bool strict_sync(); // Declared in linked_streambuf. T* component() { return &*obj(); } @@ -356,10 +357,20 @@ int indirect_streambuf::sync() { try { // sync() is no-throw. sync_impl(); - return obj().flush(next_) ? 0 : -1; + obj().flush(next_); + return 0; } catch (std::exception&) { return -1; } } +template +bool indirect_streambuf::strict_sync() +{ + try { // sync() is no-throw. + sync_impl(); + return obj().flush(next_); + } catch (std::exception&) { return false; } +} + template inline typename indirect_streambuf::pos_type indirect_streambuf::seekoff