/W4: Fix compiler compatibility

Clang doesn't support function-style casts with types containing a space.
This commit is contained in:
Kawe Mazidjatari 2023-04-02 17:34:42 +02:00
parent 4e7693bae6
commit b0d2665550
6 changed files with 13 additions and 13 deletions

View File

@ -119,7 +119,7 @@ __int64 __fastcall Mod_GetQueuedPakHandle(char* a1, char* a2, __int64 a3)
while ((v10[-v4] & 0xC0) == 0x80); while ((v10[-v4] & 0xC0) == 0x80);
} }
v11 = &v10[-v4]; v11 = &v10[-v4];
if (v4 != signed int(((0xE5000000 >> (((unsigned __int8)*v11 >> 3) & 0x1E)) & 3))) if (v4 != (signed int)((0xE5000000 >> (((unsigned __int8)*v11 >> 3) & 0x1E)) & 3))
{ {
*v11 = 0; *v11 = 0;
v5 -= v4; v5 -= v4;

View File

@ -533,7 +533,7 @@ int CAI_Utility::GetNearestNodeToPos(const CAI_Network* pAINetwork, const Vector
v3 = pAINetwork->m_iNumScriptNodes; v3 = pAINetwork->m_iNumScriptNodes;
v4 = 0i64; v4 = 0i64;
v5 = 640000.0; v5 = 640000.0;
v6 = unsigned int(NO_NODE); v6 = (unsigned int)NO_NODE;
if (v3 >= 4) if (v3 >= 4)
{ {
v7 = pAINetwork->m_ScriptNode; v7 = pAINetwork->m_ScriptNode;

View File

@ -1741,7 +1741,7 @@ FORCEINLINE unsigned char RoundFloatToByte(float f)
#ifdef Assert #ifdef Assert
Assert(nResult >= 0 && nResult <= 255); Assert(nResult >= 0 && nResult <= 255);
#endif #endif
return unsigned char(nResult); return (unsigned char)nResult;
#endif #endif
} }

View File

@ -901,10 +901,10 @@ bool ConVar::SetColorFromString(const char* pszValue)
// Stuff all the values into each byte of our int. // Stuff all the values into each byte of our int.
unsigned char* pColorElement = (reinterpret_cast<unsigned char*>(&m_Value.m_nValue)); unsigned char* pColorElement = (reinterpret_cast<unsigned char*>(&m_Value.m_nValue));
pColorElement[0] = unsigned char(nRGBA[0]); pColorElement[0] = (unsigned char)nRGBA[0];
pColorElement[1] = unsigned char(nRGBA[1]); pColorElement[1] = (unsigned char)nRGBA[1];
pColorElement[2] = unsigned char(nRGBA[2]); pColorElement[2] = (unsigned char)nRGBA[2];
pColorElement[3] = unsigned char(nRGBA[3]); pColorElement[3] = (unsigned char)nRGBA[3];
// Copy that value into our float. // Copy that value into our float.
m_Value.m_fValue = static_cast<float>(m_Value.m_nValue); m_Value.m_fValue = static_cast<float>(m_Value.m_nValue);

View File

@ -203,7 +203,7 @@ CUtlBuffer::CUtlBuffer(int64 growSize, int64 initSize, int nFlags) :
m_Put = 0; m_Put = 0;
m_nTab = 0; m_nTab = 0;
m_nOffset = 0; m_nOffset = 0;
m_Flags = unsigned char(nFlags); m_Flags = (unsigned char)nFlags;
if ((initSize != 0) && !IsReadOnly()) if ((initSize != 0) && !IsReadOnly())
{ {
m_nMaxPut = -1; m_nMaxPut = -1;
@ -225,7 +225,7 @@ CUtlBuffer::CUtlBuffer(const void* pBuffer, int64 nSize, int nFlags) :
m_Put = 0; m_Put = 0;
m_nTab = 0; m_nTab = 0;
m_nOffset = 0; m_nOffset = 0;
m_Flags = unsigned char(nFlags); m_Flags = (unsigned char)nFlags;
if (IsReadOnly()) if (IsReadOnly())
{ {
m_nMaxPut = m_Put = nSize; m_nMaxPut = m_Put = nSize;
@ -399,7 +399,7 @@ void CUtlBuffer::SetExternalBuffer(void* pMemory, int64 nSize, int64 nInitialPut
m_nTab = 0; m_nTab = 0;
m_Error = 0; m_Error = 0;
m_nOffset = 0; m_nOffset = 0;
m_Flags = unsigned char(nFlags); m_Flags = (unsigned char)nFlags;
m_nMaxPut = -1; m_nMaxPut = -1;
AddNullTermination(m_Put); AddNullTermination(m_Put);
} }
@ -417,7 +417,7 @@ void CUtlBuffer::AssumeMemory(void* pMemory, int64 nSize, int64 nInitialPut, int
m_nTab = 0; m_nTab = 0;
m_Error = 0; m_Error = 0;
m_nOffset = 0; m_nOffset = 0;
m_Flags = unsigned char(nFlags); m_Flags = (unsigned char)nFlags;
m_nMaxPut = -1; m_nMaxPut = -1;
AddNullTermination(m_Put); AddNullTermination(m_Put);
} }

View File

@ -281,7 +281,7 @@ void CUtlString::ToUpper()
{ {
for ( int64 nLength = Length() - 1; nLength >= 0; nLength--) for ( int64 nLength = Length() - 1; nLength >= 0; nLength--)
{ {
m_Storage[nLength] = unsigned char(toupper( m_Storage[ nLength ] )); m_Storage[nLength] = (unsigned char)toupper( m_Storage[ nLength ] );
} }
} }
@ -289,7 +289,7 @@ void CUtlString::ToLower()
{ {
for( int64 nLength = Length() - 1; nLength >= 0; nLength-- ) for( int64 nLength = Length() - 1; nLength >= 0; nLength-- )
{ {
m_Storage[ nLength ] = unsigned char(tolower( m_Storage[ nLength ] )); m_Storage[ nLength ] = (unsigned char)tolower( m_Storage[ nLength ] );
} }
} }