Guard against signedness of chars and wchars on different targets
This commit is contained in:
+9
-1
@@ -352,8 +352,16 @@ const glyph &Font::GetGlyph( wchar_t c ) const
|
||||
* with non-roman song titles, and looking at it, I'm gonna guess that
|
||||
* this is how ITG2 prevented crashing with them --infamouspat */
|
||||
//ASSERT(c >= 0 && c <= 0xFFFFFF);
|
||||
if (c < 0 || c > 0xFFFFFF)
|
||||
|
||||
// wchar_t can be signed or unsigned depending on the platform and the compiler.
|
||||
// We use WCHAR_MIN to determine a valid condition that won't emit a type-limits warning.
|
||||
#if WCHAR_MIN != 0
|
||||
if (c < 0 || c > 0xFFFFFF) {
|
||||
#else
|
||||
if (c > 0xFFFFFF) {
|
||||
#endif
|
||||
c = 1;
|
||||
}
|
||||
|
||||
// Fast path:
|
||||
if( c < (int) ARRAYLEN(m_iCharToGlyphCache) && m_iCharToGlyphCache[c] )
|
||||
|
||||
+2
-2
@@ -18,14 +18,14 @@ struct msTriangle
|
||||
struct msMesh
|
||||
{
|
||||
RString sName;
|
||||
char nMaterialIndex;
|
||||
std::int8_t nMaterialIndex;
|
||||
|
||||
std::vector<RageModelVertex> Vertices;
|
||||
|
||||
// OPTIMIZATION: If all verts in a mesh are transformed by the same bone,
|
||||
// then send the transform to the graphics card for the whole mesh instead
|
||||
// of transforming each vertex on the CPU;
|
||||
char m_iBoneIndex; // -1 = no bone
|
||||
std::int8_t m_iBoneIndex; // -1 = no bone
|
||||
|
||||
std::vector<msTriangle> Triangles;
|
||||
};
|
||||
|
||||
+8
-1
@@ -1831,8 +1831,15 @@ void UnicodeUpperLower( wchar_t *p, std::size_t iLen, const unsigned char pMappi
|
||||
wchar_t *pEnd = p + iLen;
|
||||
while( p != pEnd )
|
||||
{
|
||||
if( *p >= 0 && *p < 256 )
|
||||
// wchar_t can be signed or unsigned depending on the platform and the compiler.
|
||||
// We use WCHAR_MIN to determine a valid condition that won't emit a type-limits warning.
|
||||
#if WCHAR_MIN != 0
|
||||
if( *p >= 0 && *p < 256 ) {
|
||||
#else
|
||||
if( *p < 256 ) {
|
||||
#endif
|
||||
*p = pMapping[*p];
|
||||
}
|
||||
++p;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user