Fix compilation with GCC
This commit is contained in:
parent
2ecfe10584
commit
b8de1cbb68
|
@ -189,20 +189,20 @@ static inline void hexencode(char c, char out[2]) {
|
||||||
char nibble1 = (c >> 4) & 0xF;
|
char nibble1 = (c >> 4) & 0xF;
|
||||||
char nibble2 = c & 0xF;
|
char nibble2 = c & 0xF;
|
||||||
|
|
||||||
auto hexencode = [](char nibble) -> char {
|
auto hexencode = [](char nibble) {
|
||||||
return nibble < 10
|
return static_cast<char>(nibble < 10
|
||||||
? '0' + nibble
|
? '0' + nibble
|
||||||
: 'A' + nibble - 10;
|
: 'A' + nibble - 10);
|
||||||
};
|
};
|
||||||
out[0] = hexencode(nibble1);
|
out[0] = hexencode(nibble1);
|
||||||
out[1] = hexencode(nibble2);
|
out[1] = hexencode(nibble2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline char hexdecode(char nibble1, char nibble2) {
|
static inline char hexdecode(char nibble1, char nibble2) {
|
||||||
auto hexdecode = [](char nibble) -> char {
|
auto hexdecode = [](char nibble) {
|
||||||
if (nibble >= '0' && nibble <= '9') return nibble - '0';
|
if (nibble >= '0' && nibble <= '9') return static_cast<char>(nibble - '0');
|
||||||
if (nibble >= 'A' && nibble <= 'F') return nibble - 'A' + 10;
|
if (nibble >= 'A' && nibble <= 'F') return static_cast<char>(nibble - 'A' + 10);
|
||||||
if (nibble >= 'a' && nibble <= 'f') return nibble - 'a' + 10;
|
if (nibble >= 'a' && nibble <= 'f') return static_cast<char>(nibble - 'a' + 10);
|
||||||
throw std::invalid_argument("Invalid percent-encoded nibble received");
|
throw std::invalid_argument("Invalid percent-encoded nibble received");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue