From 2a267ff15abea98dd63e988999bdfb8f09a85893 Mon Sep 17 00:00:00 2001 From: Kurt Johnson Date: Wed, 2 Sep 2015 09:29:15 -0500 Subject: [PATCH] check return of fwrite to avoid warn_unused_result build failures --- include/rapidjson/filewritestream.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/rapidjson/filewritestream.h b/include/rapidjson/filewritestream.h index 31223b8..55da265 100644 --- a/include/rapidjson/filewritestream.h +++ b/include/rapidjson/filewritestream.h @@ -57,7 +57,11 @@ public: void Flush() { if (current_ != buffer_) { - fwrite(buffer_, 1, static_cast(current_ - buffer_), fp_); + size_t result = fwrite(buffer_, 1, static_cast(current_ - buffer_), fp_); + if (result < static_cast(current_ - buffer_)) { + // failure deliberately ignored at this time + // added to avoid warn_unused_result build errors + } current_ = buffer_; } }