summaryrefslogtreecommitdiff
path: root/zen/zstring.cpp
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:24:35 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:24:35 +0200
commit460091fb0b2ff114cc741372f15bb43b702ea3b1 (patch)
tree0562c2eda4c66969c6e6d0910080db9f5b0def3e /zen/zstring.cpp
parent5.15 (diff)
downloadFreeFileSync-460091fb0b2ff114cc741372f15bb43b702ea3b1.tar.gz
FreeFileSync-460091fb0b2ff114cc741372f15bb43b702ea3b1.tar.bz2
FreeFileSync-460091fb0b2ff114cc741372f15bb43b702ea3b1.zip
5.16
Diffstat (limited to 'zen/zstring.cpp')
-rw-r--r--zen/zstring.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/zen/zstring.cpp b/zen/zstring.cpp
index 262df49e..085e6f72 100644
--- a/zen/zstring.cpp
+++ b/zen/zstring.cpp
@@ -78,10 +78,8 @@ private:
static std::string rawMemToString(const void* ptr, size_t size)
{
- std::string output(reinterpret_cast<const char*>(ptr), size);
- vector_remove_if(output, [](char& c) { return c == 0; }); //remove intermediate 0-termination
- if (output.size() > 100)
- output.resize(100);
+ std::string output(reinterpret_cast<const char*>(ptr), std::min<size_t>(size, 100));
+ std::replace(output.begin(), output.end(), '\0', ' '); //don't stop at 0-termination
return output;
}
bgstack15