strutils::unescape(): minor change
Use static_cast<char> for clarity when adding an int to an std::string with std::string::operator+=().
This commit is contained in:
parent
e1c655c570
commit
e4c4db5cf9
@ -670,14 +670,14 @@ std::string unescape(const char* s)
|
|||||||
for (/* empty */; isxdigit(*s); s++) {
|
for (/* empty */; isxdigit(*s); s++) {
|
||||||
v = v * 16 + (isdigit(*s) ? *s - '0' : 10 + tolower(*s) - 'a');
|
v = v * 16 + (isdigit(*s) ? *s - '0' : 10 + tolower(*s) - 'a');
|
||||||
}
|
}
|
||||||
r += v;
|
r += static_cast<char>(v);
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
} else if (*s >= '0' && *s <= '7') {
|
} else if (*s >= '0' && *s <= '7') {
|
||||||
int v = *s++ - '0';
|
int v = *s++ - '0';
|
||||||
for (int i = 0; i < 2 && *s >= '0' && *s <= '7'; i++, s++)
|
for (int i = 0; i < 2 && *s >= '0' && *s <= '7'; i++, s++)
|
||||||
v = v * 8 + *s - '0';
|
v = v * 8 + *s - '0';
|
||||||
r += v;
|
r += static_cast<char>(v);
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user