diff --git a/include/fmt/format-inl.h b/include/fmt/format-inl.h index 1bd0ca51c66a..654ccc3dbb70 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: