Fix to_string_hex_array string reserve (#1619)

This commit is contained in:
Totoo 2023-12-02 23:42:09 +01:00 committed by GitHub
parent 7354ba8fd5
commit 4f440055cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -253,7 +253,7 @@ std::string to_string_hex(uint64_t value, int32_t length) {
std::string to_string_hex_array(uint8_t* array, int32_t length) { std::string to_string_hex_array(uint8_t* array, int32_t length) {
std::string str_return; std::string str_return;
str_return.reserve(length); str_return.reserve(length * 2);
for (uint8_t i = 0; i < length; i++) for (uint8_t i = 0; i < length; i++)
str_return += to_string_hex(array[i], 2); str_return += to_string_hex(array[i], 2);