stringutil.cpp warnings fix

This commit is contained in:
MihailRis 2023-11-16 12:26:58 +03:00
parent 3527e9d8e7
commit d349b4b65a

View File

@ -37,22 +37,22 @@ wstring util::rfill(wstring s, uint length, wchar_t c) {
uint util::encode_utf8(uint32_t c, ubyte* bytes) {
if (c < 0x80) {
bytes[0] = c >> 0 & 0x7F | 0x00;
bytes[0] = ((c >> 0) & 0x7F) | 0x00;
return 1;
} else if (c < 0x0800) {
bytes[0] = c >> 6 & 0x1F | 0xC0;
bytes[1] = c >> 0 & 0x3F | 0x80;
bytes[0] = ((c >> 6) & 0x1F) | 0xC0;
bytes[1] = ((c >> 0) & 0x3F) | 0x80;
return 2;
} else if (c < 0x010000) {
bytes[0] = c >> 12 & 0x0F | 0xE0;
bytes[1] = c >> 6 & 0x3F | 0x80;
bytes[2] = c >> 0 & 0x3F | 0x80;
bytes[0] = ((c >> 12) & 0x0F) | 0xE0;
bytes[1] = ((c >> 6) & 0x3F) | 0x80;
bytes[2] = ((c >> 0) & 0x3F) | 0x80;
return 3;
} else {
bytes[0] = c >> 18 & 0x07 | 0xF0;
bytes[1] = c >> 12 & 0x3F | 0x80;
bytes[2] = c >> 6 & 0x3F | 0x80;
bytes[3] = c >> 0 & 0x3F | 0x80;
bytes[0] = ((c >> 18) & 0x07) | 0xF0;
bytes[1] = ((c >> 12) & 0x3F) | 0x80;
bytes[2] = ((c >> 6) & 0x3F) | 0x80;
bytes[3] = ((c >> 0) & 0x3F) | 0x80;
return 4;
}
}