summaryrefslogtreecommitdiff
path: root/datatest.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2021-03-17 21:29:34 -0400
committerJeffrey Walton <noloader@gmail.com>2021-03-17 21:29:34 -0400
commit0b04d606e806dfe7eab5904c31deb53d955fd066 (patch)
tree13d4ee72e967a61708cd47a30ed54c87a7ab0880 /datatest.cpp
parenta742a069458790dbc050b63e92ffd41315e38199 (diff)
downloadcryptopp-git-0b04d606e806dfe7eab5904c31deb53d955fd066.tar.gz
Update datatest.cpp
Diffstat (limited to 'datatest.cpp')
-rw-r--r--datatest.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/datatest.cpp b/datatest.cpp
index 8509fb74..2590cb2b 100644
--- a/datatest.cpp
+++ b/datatest.cpp
@@ -147,18 +147,18 @@ void PutDecodedDatumInto(const TestData &data, const char *name, BufferedTransfo
while (!s1.empty())
{
- while (s1[0] == ' ')
- {
- s1 = s1.substr(1);
- if (s1.empty())
- goto end; // avoid invalid read if s1 is empty
- }
+ std::string::size_type pos = s1.find_first_not_of(" ");
+ if (pos != std::string::npos)
+ s1.erase(0, pos);
+
+ if (s1.empty())
+ goto end;
int repeat = 1;
if (s1[0] == 'r')
{
s1 = s1.erase(0, 1);
- repeat = ::atoi(s1.c_str());
+ repeat = std::atoi(s1.c_str());
s1 = s1.substr(s1.find(' ')+1);
}