diff --git a/src/Font.cpp b/src/Font.cpp index 8ae5ded02a..731c0b651c 100644 --- a/src/Font.cpp +++ b/src/Font.cpp @@ -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] ) diff --git a/src/ModelTypes.h b/src/ModelTypes.h index 5d11063305..b279f29847 100644 --- a/src/ModelTypes.h +++ b/src/ModelTypes.h @@ -18,14 +18,14 @@ struct msTriangle struct msMesh { RString sName; - char nMaterialIndex; + std::int8_t nMaterialIndex; std::vector 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 Triangles; }; diff --git a/src/RageUtil.cpp b/src/RageUtil.cpp index 04c845db8f..cf525a8b71 100644 --- a/src/RageUtil.cpp +++ b/src/RageUtil.cpp @@ -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; } }