diff options
Diffstat (limited to 'cpp/demo/book/lifecycle/Parser.cpp')
-rw-r--r-- | cpp/demo/book/lifecycle/Parser.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/cpp/demo/book/lifecycle/Parser.cpp b/cpp/demo/book/lifecycle/Parser.cpp index b53950fa935..44ab2797d7f 100644 --- a/cpp/demo/book/lifecycle/Parser.cpp +++ b/cpp/demo/book/lifecycle/Parser.cpp @@ -294,8 +294,21 @@ Parser::destroy(const std::list<string>& names) } } +// +// With older flex version <= 2.5.35 YY_INPUT second +// paramenter is of type int&, in newer versions it +// changes to size_t& +// +void +Parser::getInput(char* buf, int& result, size_t maxSize) +{ + size_t r = static_cast<size_t>(result); + getInput(buf, r, maxSize); + result = static_cast<int>(r); +} + void -Parser::getInput(char* buf, int& result, int maxSize) +Parser::getInput(char* buf, size_t& result, size_t maxSize) { #ifdef HAVE_READLINE @@ -352,7 +365,7 @@ Parser::getInput(char* buf, int& result, int maxSize) } } - result = static_cast<int>(line.length()); + result = line.length(); if(result > maxSize) { error("input line too long"); |