Fix compile error on OS where char is signed.

This commit is contained in:
ArthurSonzogni 2020-03-25 02:01:31 +01:00
parent 508b2ef048
commit 6e22a10eb7

View File

@ -38,15 +38,14 @@ Event Event::Special(const std::string& input) {
void ParseUTF8(Receiver<char>& in, Sender<Event>& out, std::string& input) { void ParseUTF8(Receiver<char>& in, Sender<Event>& out, std::string& input) {
char c; char c;
char mask = 0b11000000; unsigned char head = static_cast<unsigned char>(input[0]);
for (int i = 0; i < 3; ++i) { for (int i = 0; i < 3; ++i, head <<= 1) {
if ((input[0] & mask) == mask) { if ((head & 0b11000000) != 0b11000000)
break;
if (!in->Receive(&c)) if (!in->Receive(&c))
return; return;
input += c; input += c;
} }
mask = mask >> 1 | 0b10000000;
}
out->Send(Event::Character(input)); out->Send(Event::Character(input));
} }