1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-20 15:40:32 +00:00

Do not use fall-through

This commit is contained in:
Andrei Kortunov 2018-08-09 11:01:23 +04:00
parent a19d55e035
commit 57e1462417

View File

@ -104,25 +104,17 @@ void TiXmlBase::ConvertUTF32ToUTF8( unsigned long input, char* output, int* leng
output += *length;
// Scary scary fall throughs.
switch (*length)
{
case 4:
--output;
*output = (char)((input | BYTE_MARK) & BYTE_MASK);
input >>= 6;
case 3:
--output;
*output = (char)((input | BYTE_MARK) & BYTE_MASK);
input >>= 6;
case 2:
--output;
*output = (char)((input | BYTE_MARK) & BYTE_MASK);
input >>= 6;
case 1:
--output;
*output = (char)(input | FIRST_BYTE_MARK[*length]);
}
int lengthLeft = *length;
while (lengthLeft > 1)
{
--output;
*output = (char)((input | BYTE_MARK) & BYTE_MASK);
input >>= 6;
--lengthLeft;
}
--output;
*output = (char)(input | FIRST_BYTE_MARK[*length]);
}