From d3986223a612791c8b9da6e29c6160f4a79644a4 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Fri, 12 May 2017 03:05:24 -0400 Subject: Add early continuation for parsing a continued line --- datatest.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'datatest.cpp') diff --git a/datatest.cpp b/datatest.cpp index fbde5313..996fdb14 100644 --- a/datatest.cpp +++ b/datatest.cpp @@ -686,8 +686,11 @@ bool GetField(std::istream &is, std::string &name, std::string &value) while (continueLine && std::getline(is, line)) { - // Leading, trailing and position. The leading iterator moves right, and trailing iterator - // moves left. When finished, the sub-string in the middle is the value for the name. + // Early out for immediately continuing a line + if (!line.empty() && line[0] == '\\') { continue; } + + // Leading, trailing and temp position. The leading iterator moves right, and trailing + // iterator moves left.The sub-string in the middle is the value for the name. std::string::size_type l, t, p; const std::string whitespace = " \r\n\t\v\f"; @@ -698,7 +701,7 @@ bool GetField(std::istream &is, std::string &name, std::string &value) continueLine = false; if (t != std::string::npos && line[t] == '\\') { continueLine = true; - t = line.find_last_not_of(whitespace, t); + t = line.find_last_not_of(whitespace, t-1); } p = line.find('#', l); @@ -770,6 +773,9 @@ void TestDataFile(std::string filename, const NameValuePairs &overrideParameters if (!GetField(file, name, value)) break; + + // Can't assert value. Plaintext is sometimes empty. + // CRYPTOPP_ASSERT(!value.empty()); v[name] = value; if (name == "Test" && (s_thorough || v["SlowTest"] != "1")) -- cgit v1.2.1