summaryrefslogtreecommitdiff
path: root/datatest.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2017-05-10 16:20:12 -0400
committerJeffrey Walton <noloader@gmail.com>2017-05-10 16:20:12 -0400
commite456cd2275bba020e4ee3cc08381f3269df536b0 (patch)
tree8e29424ff46fe7cf18fa7b432ea00d5f76abccb0 /datatest.cpp
parentd236cf1277bf98007660ef8914449ff289827b4a (diff)
downloadcryptopp-git-e456cd2275bba020e4ee3cc08381f3269df536b0.tar.gz
Modify datatest parse to eat whitespace when line continuation is in effect
Previously the parsed string would look as follows. You would get this on a failed self test. Key: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 The new behavior eats the leading whitespace, so the key is reported as: Key: 0000000000000000000000000000000000000000000000000000000000000000
Diffstat (limited to 'datatest.cpp')
-rw-r--r--datatest.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/datatest.cpp b/datatest.cpp
index b0122f54..ac1bf76d 100644
--- a/datatest.cpp
+++ b/datatest.cpp
@@ -685,10 +685,21 @@ bool GetField(std::istream &is, std::string &name, std::string &value)
do
{
+ continueLine = false;
do
{
is.get(buffer, sizeof(buffer));
- value += buffer;
+
+ // Eat leading whispace on line continuation
+ if (continueLine == true)
+ {
+ size_t pos = 0;
+ while (buffer[pos] != '\0' && buffer[pos] != ' ')
+ pos++;
+ value += &buffer[pos];
+ }
+ else
+ value += buffer;
if (buffer[0] == ' ')
space = true;
}