From 48de158d7c6637b0b0a7bb8ac1ba8b21f2060a2c Mon Sep 17 00:00:00 2001 From: WerWolv Date: Sat, 29 Jan 2022 02:52:14 +0100 Subject: [PATCH] pattern: Fixed broken removing of zero-characters from strings --- .../include/hex/pattern_language/pattern_data.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/libimhex/include/hex/pattern_language/pattern_data.hpp b/lib/libimhex/include/hex/pattern_language/pattern_data.hpp index 721442c5a..c61cebce9 100644 --- a/lib/libimhex/include/hex/pattern_language/pattern_data.hpp +++ b/lib/libimhex/include/hex/pattern_language/pattern_data.hpp @@ -687,9 +687,9 @@ namespace hex::pl { provider->read(this->getOffset(), buffer.data(), size); - std::erase_if(buffer, [](auto c) { + buffer.erase(std::remove_if(buffer.begin(), buffer.end(), [](auto c){ return c == 0x00; - }); + }), buffer.end()); this->createDefaultEntry(hex::format("\"{0}\" {1}", makeDisplayable(buffer.data(), this->getSize()), size > this->getSize() ? "(truncated)" : ""), buffer); } @@ -733,9 +733,9 @@ namespace hex::pl { for (auto &c : buffer) c = hex::changeEndianess(c, 2, this->getEndian()); - std::erase_if(buffer, [](auto c) { + buffer.erase(std::remove_if(buffer.begin(), buffer.end(), [](auto c){ return c == 0x00; - }); + }), buffer.end()); auto utf8String = std::wstring_convert, char16_t> {}.to_bytes(buffer);