summaryrefslogtreecommitdiff
path: root/datatest.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2017-05-12 03:05:24 -0400
committerJeffrey Walton <noloader@gmail.com>2017-05-12 03:05:24 -0400
commitd3986223a612791c8b9da6e29c6160f4a79644a4 (patch)
tree648186256bc8d641f1be73afcff5c465bd1bb571 /datatest.cpp
parentac6db2fa91744ed995bf0abcdc43e8e80491003d (diff)
downloadcryptopp-git-d3986223a612791c8b9da6e29c6160f4a79644a4.tar.gz
Add early continuation for parsing a continued line
Diffstat (limited to 'datatest.cpp')
-rw-r--r--datatest.cpp12
1 files changed, 9 insertions, 3 deletions
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"))