From 16029e6b33a217d05d08976d7fb34ce488e88634 Mon Sep 17 00:00:00 2001 From: "Philipp A. Hartmann" Date: Sat, 1 Feb 2014 18:03:52 +0100 Subject: [PATCH] FileStream: avoid warning about missing initialisation FileStream::current_ is now explicitly initialized in the constructor. Avoids reading the garbage value in case of an empty file. --- include/rapidjson/filestream.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/rapidjson/filestream.h b/include/rapidjson/filestream.h index 57ab0ba..4cd4cc4 100644 --- a/include/rapidjson/filestream.h +++ b/include/rapidjson/filestream.h @@ -16,7 +16,7 @@ class FileStream { public: typedef char Ch; //!< Character type. Only support char. - FileStream(FILE* fp) : fp_(fp), count_(0) { Read(); } + FileStream(FILE* fp) : fp_(fp), current_('\0'), count_(0) { Read(); } char Peek() const { return current_; } char Take() { char c = current_; Read(); return c; } size_t Tell() const { return count_; }