diff options
author | ylavic <ylavic.dev@gmail.com> | 2018-12-06 02:48:47 +0300 |
---|---|---|
committer | ylavic <ylavic.dev@gmail.com> | 2018-12-06 10:38:21 +0300 |
commit | 38d25d7458526c3dbf15b4935e5c9d736ef4209f (patch) | |
tree | ab2bdef9901eb8b3844e2426904c84463794e300 /include | |
parent | 30d92a6399b6077006d976b1dc05ee13305bf1c4 (diff) |
Fix FileReadStream::Peek4().
Until Read() reaches EOF, Peek4() must not take off by one in
bufferLast_ into account; otherwise a buffer of size exactly 4 always
returns NULL.
Diffstat (limited to 'include')
-rw-r--r-- | include/rapidjson/filereadstream.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/rapidjson/filereadstream.h b/include/rapidjson/filereadstream.h index f1bfb7d0..6b343707 100644 --- a/include/rapidjson/filereadstream.h +++ b/include/rapidjson/filereadstream.h @@ -59,7 +59,7 @@ public: // For encoding detection only. const Ch* Peek4() const { - return (current_ + 4 <= bufferLast_) ? current_ : 0; + return (current_ + 4 - !eof_ <= bufferLast_) ? current_ : 0; } private: |