1
0
mirror of https://github.com/nlohmann/json.git synced 2025-07-10 22:00:59 +03:00

minor changes to pull request #40

This commit is contained in:
Niels
2015-03-24 18:05:58 +01:00
parent 50e06a7bd1
commit 0707030bc5
3 changed files with 108 additions and 27 deletions

View File

@ -3118,7 +3118,7 @@ class basic_json
/// constructor with a given buffer
inline lexer(const string_t& s) noexcept
: m_buffer(s), m_stream(nullptr)
: m_stream(nullptr), m_buffer(s)
{
m_content = reinterpret_cast<const lexer_char_t*>(s.c_str());
m_start = m_cursor = m_content;
@ -3325,15 +3325,18 @@ class basic_json
}
/// append data from the stream to the internal buffer
void yyfill() noexcept
inline void yyfill() noexcept
{
if (not m_stream or not *m_stream) return;
if (not m_stream or not * m_stream)
{
return;
}
ssize_t offset_start = m_start - m_content;
ssize_t offset_marker = m_marker - m_start;
ssize_t offset_cursor = m_cursor - m_start;
const ssize_t offset_start = m_start - m_content;
const ssize_t offset_marker = m_marker - m_start;
const ssize_t offset_cursor = m_cursor - m_start;
m_buffer.erase(0, offset_start);
m_buffer.erase(0, static_cast<size_t>(offset_start));
std::string line;
std::getline(*m_stream, line);
m_buffer += line;
@ -3530,14 +3533,14 @@ class basic_json
{
public:
/// constructor for strings
inline parser(const string_t& s) : m_lexer(s)
inline parser(const string_t& s) : m_lexer(s)
{
// read first token
get_token();
}
/// a parser reading from an input stream
inline parser(std::istream& _is) : m_lexer(&_is)
inline parser(std::istream& _is) : m_lexer(&_is)
{
// read first token
get_token();