From 8231a83db8f3603d2155760829e9c4591706405e Mon Sep 17 00:00:00 2001 From: dimxy Date: Tue, 9 Apr 2019 13:28:02 +0500 Subject: [PATCH] corr eof state SplitStr --- src/util.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/util.cpp b/src/util.cpp index 7d0b9cc3d..fe28acf75 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -399,20 +399,18 @@ void SplitStr(const std::string& strVal, std::vector &outVals) { stringstream ss(strVal); - while (true) { + while (!ss.eof()) { int c; std::string str; while (std::isspace(ss.peek())) ss.ignore(); - while (!ss.eof() && !std::isspace(c = ss.get()) && c != ',') + while ((c = ss.get()) != EOF && !std::isspace(c = ss.get()) && c != ',') str += c; if (!str.empty()) outVals.push_back(str); - else - break; } }