mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
Merge pull request #6359
f9441c5
Fixed string_ref usage bug in epee::from_hex::vector (vtnerd)
This commit is contained in:
commit
06c81b6527
2 changed files with 6 additions and 3 deletions
|
@ -141,7 +141,7 @@ namespace epee
|
||||||
result.reserve(count / 2);
|
result.reserve(count / 2);
|
||||||
|
|
||||||
// the data to work with (std::string is always null-terminated)
|
// the data to work with (std::string is always null-terminated)
|
||||||
auto data = src.data();
|
auto data = src.begin();
|
||||||
|
|
||||||
// convert a single hex character to an unsigned integer
|
// convert a single hex character to an unsigned integer
|
||||||
auto char_to_int = [](const char *input) {
|
auto char_to_int = [](const char *input) {
|
||||||
|
@ -167,9 +167,9 @@ namespace epee
|
||||||
};
|
};
|
||||||
|
|
||||||
// keep going until we reach the end
|
// keep going until we reach the end
|
||||||
while (data[0] != '\0') {
|
while (data != src.end()) {
|
||||||
// skip unwanted characters
|
// skip unwanted characters
|
||||||
if (!include(data[0])) {
|
if (!include(*data)) {
|
||||||
++data;
|
++data;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -841,6 +841,9 @@ TEST(HexLocale, String)
|
||||||
// decoding it this way also, ignoring spaces and colons between the numbers
|
// decoding it this way also, ignoring spaces and colons between the numbers
|
||||||
hex.assign("00:ff 0f:f0");
|
hex.assign("00:ff 0f:f0");
|
||||||
EXPECT_EQ(source, epee::from_hex_locale::to_vector(hex));
|
EXPECT_EQ(source, epee::from_hex_locale::to_vector(hex));
|
||||||
|
|
||||||
|
hex.append("f0");
|
||||||
|
EXPECT_EQ(source, epee::from_hex_locale::to_vector(boost::string_ref{hex.data(), hex.size() - 2}));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(ToHex, Array)
|
TEST(ToHex, Array)
|
||||||
|
|
Loading…
Reference in a new issue