1
0
mirror of synced 2024-11-28 09:30:51 +01:00

pattern: Fixed broken removing of zero-characters from strings

This commit is contained in:
WerWolv 2022-01-29 02:52:14 +01:00
parent e71091f4a8
commit 48de158d7c

View File

@ -687,9 +687,9 @@ namespace hex::pl {
provider->read(this->getOffset(), buffer.data(), size); 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; return c == 0x00;
}); }), buffer.end());
this->createDefaultEntry(hex::format("\"{0}\" {1}", makeDisplayable(buffer.data(), this->getSize()), size > this->getSize() ? "(truncated)" : ""), buffer); 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) for (auto &c : buffer)
c = hex::changeEndianess(c, 2, this->getEndian()); 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; return c == 0x00;
}); }), buffer.end());
auto utf8String = std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> {}.to_bytes(buffer); auto utf8String = std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> {}.to_bytes(buffer);