mirror of https://github.com/OpenTTD/OpenTTD
Fix: FormatArrayAsHex returns gibberish instead of a hex array
parent
b70df6eeda
commit
e53caf8f01
|
@ -168,14 +168,14 @@ char *CDECL str_fmt(const char *str, ...)
|
||||||
*/
|
*/
|
||||||
std::string FormatArrayAsHex(span<const byte> data)
|
std::string FormatArrayAsHex(span<const byte> data)
|
||||||
{
|
{
|
||||||
std::ostringstream ss;
|
std::string str;
|
||||||
ss << std::uppercase << std::setfill('0') << std::setw(2) << std::hex;
|
str.reserve(data.size() * 2 + 1);
|
||||||
|
|
||||||
for (auto b : data) {
|
for (auto b : data) {
|
||||||
ss << b;
|
fmt::format_to(std::back_inserter(str), "{:02X}", b);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ss.str();
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue