From 11ba1270ab4c410aab926d86fcd4554c208c2ab8 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sat, 20 Jan 2024 07:58:56 -0800 Subject: [PATCH] Fix flush --- include/fmt/format-inl.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/fmt/format-inl.h b/include/fmt/format-inl.h index 1bd0ca51..654ccc3d 100644 --- a/include/fmt/format-inl.h +++ b/include/fmt/format-inl.h @@ -1503,7 +1503,7 @@ template class apple_file : public file_base { auto get_write_buffer() const -> span { if (!this->file_->_p || offset() == this->file_->_bf._size) { // Force buffer initialization by placing and removing a char in a buffer. - fputc(0, this->file_); + putc_unlocked(0, this->file_); --this->file_->_p; ++this->file_->_w; } @@ -1571,6 +1571,7 @@ class file_print_buffer : public buffer { static void grow(buffer& buf, size_t) { auto& self = static_cast(buf); self.set_buffer(); + self.clear(); } public: