mirror of
https://github.com/SFML/SFML.git
synced 2025-02-08 01:18:02 +08:00
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
|
// Decode the character
|
||||||
int trailingBytes = trailing[static_cast<int>(*begin)];
|
int trailingBytes = trailing[static_cast<Uint8>(*begin)];
|
||||||
if (begin + trailingBytes < end)
|
if (begin + trailingBytes < end)
|
||||||
{
|
{
|
||||||
output = 0;
|
output = 0;
|
||||||
switch (trailingBytes)
|
switch (trailingBytes)
|
||||||
{
|
{
|
||||||
case 5 : output += *begin++; output <<= 6;
|
case 5 : output += static_cast<Uint8>(*begin++); output <<= 6;
|
||||||
case 4 : output += *begin++; output <<= 6;
|
case 4 : output += static_cast<Uint8>(*begin++); output <<= 6;
|
||||||
case 3 : output += *begin++; output <<= 6;
|
case 3 : output += static_cast<Uint8>(*begin++); output <<= 6;
|
||||||
case 2 : output += *begin++; output <<= 6;
|
case 2 : output += static_cast<Uint8>(*begin++); output <<= 6;
|
||||||
case 1 : output += *begin++; output <<= 6;
|
case 1 : output += static_cast<Uint8>(*begin++); output <<= 6;
|
||||||
case 0 : output += *begin++;
|
case 0 : output += static_cast<Uint8>(*begin++);
|
||||||
}
|
}
|
||||||
output -= offsets[trailingBytes];
|
output -= offsets[trailingBytes];
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user