diff options
author | xiphon <xiphon@protonmail.com> | 2020-02-12 20:53:29 +0000 |
---|---|---|
committer | xiphon <xiphon@protonmail.com> | 2020-02-12 21:16:07 +0000 |
commit | 0078ce7fac6a205341fee659b7f5adefa7f0b7aa (patch) | |
tree | 0c35cf990bc16642ed1f57b7ddd5d7ff88396656 /contrib/epee/src/wipeable_string.cpp | |
parent | Merge pull request #6145 (diff) | |
download | monero-0078ce7fac6a205341fee659b7f5adefa7f0b7aa.tar.xz |
wipeable_string: split - treat CR, LF and Tabs as separators
Diffstat (limited to 'contrib/epee/src/wipeable_string.cpp')
-rw-r--r-- | contrib/epee/src/wipeable_string.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/contrib/epee/src/wipeable_string.cpp b/contrib/epee/src/wipeable_string.cpp index 4209b71bf..4928db172 100644 --- a/contrib/epee/src/wipeable_string.cpp +++ b/contrib/epee/src/wipeable_string.cpp @@ -188,13 +188,14 @@ void wipeable_string::split(std::vector<wipeable_string> &fields) const while (len--) { const char c = *ptr++; - if (c != ' ') + const bool space_prev = space; + space = std::isspace(c); + if (!space) { - if (space) + if (space_prev) fields.push_back({}); fields.back().push_back(c); } - space = c == ' '; } } |