diff --git a/Engine/source/platform/types.h b/Engine/source/platform/types.h index 6f44d1e96..256337214 100644 --- a/Engine/source/platform/types.h +++ b/Engine/source/platform/types.h @@ -54,7 +54,17 @@ struct EmptyType {}; ///< "Null" type used by templates ////////////////////////////////////////////////////////////////////////////////////////////////////////// typedef char UTF8; ///< Compiler independent 8 bit Unicode encoded character + +#if defined(_MSC_VER) && defined(__clang__) +// Clang's MSVC compatibility mode doesn't currently support /Zc:wchar_t-, +// which we rely on to avoid type conversion errors when calling system +// APIs when wchar_t is defined as unsigned short. So, just define UTF16 +// as wchar_t instead since it's always a 2 byte unsigned on windows anyway. +typedef wchar_t UTF16; +#else typedef unsigned short UTF16; ///< Compiler independent 16 bit Unicode encoded character +#endif + typedef unsigned int UTF32; ///< Compiler independent 32 bit Unicode encoded character typedef const char* StringTableEntry; diff --git a/Engine/source/windowManager/win32/winDispatch.cpp b/Engine/source/windowManager/win32/winDispatch.cpp index 400e918df..908c4fbde 100644 --- a/Engine/source/windowManager/win32/winDispatch.cpp +++ b/Engine/source/windowManager/win32/winDispatch.cpp @@ -137,14 +137,14 @@ static void _keyboardEvent(Win32Window* window,UINT message, WPARAM wParam, WPAR && window->getKeyboardTranslation() && !window->shouldNotTranslate( torqueMods, newVirtKey ) ) { - U16 chars[ 64 ]; + wchar_t chars[ 64 ]; dMemset( chars, 0, sizeof( chars ) ); S32 res = ToUnicode( keyCode, scanCode, keyboardState, chars, sizeof( chars ) / sizeof( chars[ 0 ] ), 0 ); // This should only happen on Window 9x/ME systems if( res == 0 ) - res = ToAscii( keyCode, scanCode, keyboardState, chars, 0 ); + res = ToAscii( keyCode, scanCode, keyboardState, (LPWORD)chars, 0 ); if( res >= 1 ) {