Fixed a bug in the UTF-8 -> UTF-32 conversion when the input character type is signed
git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1577 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
parent
274014e786
commit
77078f53db
@ -45,18 +45,18 @@ In Utf<8>::Decode(In begin, In end, Uint32& output, Uint32 replacement)
|
||||
};
|
||||
|
||||
// Decode the character
|
||||
int trailingBytes = trailing[static_cast<int>(*begin)];
|
||||
int trailingBytes = trailing[static_cast<Uint8>(*begin)];
|
||||
if (begin + trailingBytes < end)
|
||||
{
|
||||
output = 0;
|
||||
switch (trailingBytes)
|
||||
{
|
||||
case 5 : output += *begin++; output <<= 6;
|
||||
case 4 : output += *begin++; output <<= 6;
|
||||
case 3 : output += *begin++; output <<= 6;
|
||||
case 2 : output += *begin++; output <<= 6;
|
||||
case 1 : output += *begin++; output <<= 6;
|
||||
case 0 : output += *begin++;
|
||||
case 5 : output += static_cast<Uint8>(*begin++); output <<= 6;
|
||||
case 4 : output += static_cast<Uint8>(*begin++); output <<= 6;
|
||||
case 3 : output += static_cast<Uint8>(*begin++); output <<= 6;
|
||||
case 2 : output += static_cast<Uint8>(*begin++); output <<= 6;
|
||||
case 1 : output += static_cast<Uint8>(*begin++); output <<= 6;
|
||||
case 0 : output += static_cast<Uint8>(*begin++);
|
||||
}
|
||||
output -= offsets[trailingBytes];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user