Fix build.
This commit is contained in:
parent
84844e257b
commit
c5d1a4d778
|
@ -373,34 +373,32 @@ auto DRW_Converter::decodeText(int c) -> std::string
|
||||||
|
|
||||||
auto DRW_Converter::encodeNum(int c) -> std::string
|
auto DRW_Converter::encodeNum(int c) -> std::string
|
||||||
{
|
{
|
||||||
unsigned char ret[5];
|
std::string ret;
|
||||||
|
|
||||||
if (c < 128)
|
if (c < 128)
|
||||||
{ // 0-7F US-ASCII 7 bits
|
{ // 0-7F US-ASCII 7 bits
|
||||||
ret[0] = static_cast<unsigned char>(c);
|
ret += static_cast<char>(c);
|
||||||
ret[1] = 0;
|
|
||||||
}
|
}
|
||||||
else if (c < 0x800)
|
else if (c < 0x800)
|
||||||
{ // 80-07FF 2 bytes
|
{ // 80-07FF 2 bytes
|
||||||
ret[0] = static_cast<unsigned char>(0xC0 | (c >> 6));
|
ret += static_cast<char>(0xC0 | (c >> 6));
|
||||||
ret[1] = 0x80 | (c & 0x3f);
|
ret += static_cast<char>(0x80 | (c & 0x3F));
|
||||||
ret[2] = 0;
|
|
||||||
}
|
}
|
||||||
else if (c < 0x10000)
|
else if (c < 0x10000)
|
||||||
{ // 800-FFFF 3 bytes
|
{ // 800-FFFF 3 bytes
|
||||||
ret[0] = static_cast<unsigned char>(0xe0 | (c >> 12));
|
ret += static_cast<char>(0xE0 | (c >> 12));
|
||||||
ret[1] = 0x80 | ((c >> 6) & 0x3f);
|
ret += static_cast<char>(0x80 | ((c >> 6) & 0x3F));
|
||||||
ret[2] = 0x80 | (c & 0x3f);
|
ret += static_cast<char>(0x80 | (c & 0x3F));
|
||||||
ret[3] = 0;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // 10000-10FFFF 4 bytes
|
{ // 10000-10FFFF 4 bytes
|
||||||
ret[0] = static_cast<unsigned char>(0xf0 | (c >> 18));
|
ret += static_cast<char>(0xF0 | (c >> 18));
|
||||||
ret[1] = 0x80 | ((c >> 12) & 0x3f);
|
ret += static_cast<char>(0x80 | ((c >> 12) & 0x3F));
|
||||||
ret[2] = 0x80 | ((c >> 6) & 0x3f);
|
ret += static_cast<char>(0x80 | ((c >> 6) & 0x3F));
|
||||||
ret[3] = 0x80 | (c & 0x3f);
|
ret += static_cast<char>(0x80 | (c & 0x3F));
|
||||||
ret[4] = 0;
|
|
||||||
}
|
}
|
||||||
return {reinterpret_cast<char *>(ret)};
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 's' is a string with at least 4 bytes length
|
/** 's' is a string with at least 4 bytes length
|
||||||
|
|
Loading…
Reference in New Issue
Block a user