mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Fix many verbose compiler warnings
Many compiler warnings regarding implicit conversions.
This commit is contained in:
parent
e886208d64
commit
371e15db41
@ -62,7 +62,7 @@ typedef ull uint64;
|
||||
#endif
|
||||
|
||||
// Non-standard boolean types. They are used when the decompiler cannot use
|
||||
// the standard "bool" type because of the size mistmatch but the possible
|
||||
// the standard "bool" type because of the size mismatch but the possible
|
||||
// values are only 0 and 1. See also 'BOOL' type below.
|
||||
typedef int8 _BOOL1;
|
||||
typedef int16 _BOOL2;
|
||||
@ -111,6 +111,12 @@ typedef int bool; // we want to use bool in our C programs
|
||||
#define WORDn(x, n) (*((_WORD*)&(x)+n))
|
||||
#define DWORDn(x, n) (*((_DWORD*)&(x)+n))
|
||||
|
||||
// Undefine Windows macro's
|
||||
#undef LOBYTE
|
||||
#undef LOWORD
|
||||
#undef HIBYTE
|
||||
#undef HIWORD
|
||||
|
||||
#define LOBYTE(x) BYTEn(x,LOW_IND(x,_BYTE))
|
||||
#define LOWORD(x) WORDn(x,LOW_IND(x,_WORD))
|
||||
#define LODWORD(x) DWORDn(x,LOW_IND(x,_DWORD))
|
||||
|
@ -1,13 +1,13 @@
|
||||
#pragma once
|
||||
#ifndef NDEBUG
|
||||
# define Assert(condition, message) \
|
||||
do { \
|
||||
if (! (condition)) { \
|
||||
std::cerr << "Assertion '" #condition "' failed in " << __FILE__ \
|
||||
<< " line " << __LINE__ << ": " << message << std::endl; \
|
||||
assert(condition); \
|
||||
} \
|
||||
} while (false)
|
||||
#else
|
||||
# define Assert(condition, message) do { } while (false)
|
||||
#endif
|
||||
//#ifndef NDEBUG
|
||||
//# define Assert(condition, message) \
|
||||
// do { \
|
||||
// if (! (condition)) { \
|
||||
// std::cerr << "Assertion '" #condition "' failed in " << __FILE__ \
|
||||
// << " line " << __LINE__ << ": " << message << std::endl; \
|
||||
// assert(condition); \
|
||||
// } \
|
||||
// } while (false)
|
||||
//#else
|
||||
# define Assert(condition, ...) assert(condition)
|
||||
//#endif
|
||||
|
@ -127,7 +127,7 @@ void CRConClient::Disconnect(void)
|
||||
void CRConClient::Send(const string& svMessage) const
|
||||
{
|
||||
ostringstream ssSendBuf;
|
||||
const u_long nLen = htonl(svMessage.size());
|
||||
const u_long nLen = htonl(static_cast<u_long>(svMessage.size()));
|
||||
|
||||
ssSendBuf.write(reinterpret_cast<const char*>(&nLen), sizeof(u_long));
|
||||
ssSendBuf.write(svMessage.data(), svMessage.size());
|
||||
|
@ -44,7 +44,8 @@ void Host_Status_PrintClient(CClient* client, bool bShowAddress, void (*print) (
|
||||
|
||||
if (nci != NULL)
|
||||
{
|
||||
print("# %i \"%s\" %llu %s %i %i %s %d", client->GetHandle(), client->GetServerName(), client->GetNucleusID(), COM_FormatSeconds(nci->GetTimeConnected()),
|
||||
print("# %i \"%s\" %llu %s %i %i %s %d",
|
||||
client->GetHandle(), client->GetServerName(), client->GetNucleusID(), COM_FormatSeconds(static_cast<int>(nci->GetTimeConnected())),
|
||||
static_cast<int>(1000.0f * nci->GetAvgLatency(FLOW_OUTGOING)), static_cast<int>(100.0f * nci->GetAvgLoss(FLOW_INCOMING)), state, nci->GetDataRate());
|
||||
|
||||
if (bShowAddress)
|
||||
|
@ -95,7 +95,7 @@ void CNetworkStringTableContainer::WriteUpdateMessage(CNetworkStringTableContain
|
||||
#ifndef CLIENT_DLL
|
||||
if (sv_stats->GetBool())
|
||||
{
|
||||
uint8_t nCPUPercentage = g_pServer[MAX_PLAYERS].GetCPUUsage() * 100.0f;
|
||||
uint8_t nCPUPercentage = static_cast<uint8_t>(g_pServer[MAX_PLAYERS].GetCPUUsage() * 100.0f);
|
||||
if (s_OldCPUPercentage != nCPUPercentage)
|
||||
{
|
||||
s_OldCPUPercentage = nCPUPercentage;
|
||||
|
@ -151,7 +151,7 @@ void CRConServer::RunFrame(void)
|
||||
void CRConServer::Send(const std::string& svMessage) const
|
||||
{
|
||||
std::ostringstream ssSendBuf;
|
||||
const u_long nLen = htonl(svMessage.size());
|
||||
const u_long nLen = htonl(static_cast<u_long>(svMessage.size()));
|
||||
|
||||
ssSendBuf.write(reinterpret_cast<const char*>(&nLen), sizeof(u_long));
|
||||
ssSendBuf.write(svMessage.data(), svMessage.size());
|
||||
@ -176,7 +176,7 @@ void CRConServer::Send(const std::string& svMessage) const
|
||||
void CRConServer::Send(const SocketHandle_t hSocket, const std::string& svMessage) const
|
||||
{
|
||||
std::ostringstream ssSendBuf;
|
||||
const u_long nLen = htonl(svMessage.size());
|
||||
const u_long nLen = htonl(static_cast<u_long>(svMessage.size()));
|
||||
|
||||
ssSendBuf.write(reinterpret_cast<const char*>(&nLen), sizeof(u_long));
|
||||
ssSendBuf.write(svMessage.data(), svMessage.size());
|
||||
|
@ -81,7 +81,7 @@ void CAI_Utility::DrawAIScriptNetwork(const CAI_Network* pNetwork) const
|
||||
|
||||
if (bDrawNearest) // Render links to the nearest node.
|
||||
{
|
||||
int nNearest = GetNearestNodeToPos(pNetwork, &pScriptNode->m_vOrigin);
|
||||
int64_t nNearest = GetNearestNodeToPos(pNetwork, &pScriptNode->m_vOrigin);
|
||||
if (nNearest != NO_NODE) // NO_NODE = -1
|
||||
{
|
||||
auto p = uLinkSet.insert(PackNodeLink(i, nNearest).m128i_i64[1]);
|
||||
|
@ -347,10 +347,10 @@ void CCrashHandler::FormatFPU(const CHAR* pszRegister, M128A* pxContent)
|
||||
{
|
||||
DWORD nVec[4] =
|
||||
{
|
||||
pxContent->Low & UINT_MAX,
|
||||
pxContent->Low >> 32,
|
||||
pxContent->High & UINT_MAX,
|
||||
pxContent->High >> 32,
|
||||
static_cast<DWORD>(pxContent->Low & UINT_MAX),
|
||||
static_cast<DWORD>(pxContent->Low >> 32),
|
||||
static_cast<DWORD>(pxContent->High & UINT_MAX),
|
||||
static_cast<DWORD>(pxContent->High >> 32),
|
||||
};
|
||||
|
||||
m_svBuffer.append(fmt::format("\t{:s} = [ [{:.8g}, {:.8g}, {:.8g}, {:.8g}]", pszRegister,
|
||||
|
@ -7,7 +7,6 @@
|
||||
//====================================================================//
|
||||
#ifndef DBG_H
|
||||
#define DBG_H
|
||||
#define Assert assert
|
||||
#define AssertDbg assert
|
||||
#define Verify( _exp ) ( _exp )
|
||||
#include "tier0/dbgflag.h"
|
||||
|
@ -98,7 +98,7 @@ void CTextOverlay::DrawNotify(void)
|
||||
|
||||
if (i == 0 && f < 0.2f)
|
||||
{
|
||||
y -= m_nFontHeight * (1.0f - f / 0.2f);
|
||||
y -= m_nFontHeight * (static_cast<float>(1.0f - f / 0.2f));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -27,13 +27,13 @@ int _Host_Map_f_CompletionFunc(char const* cmdname, char const* partial, char co
|
||||
substring = (char*)partial + strlen(cmdname);
|
||||
}
|
||||
|
||||
const size_t mapcount = g_vAllMaps.size();
|
||||
const size_t longest = COMMAND_COMPLETION_ITEM_LENGTH;
|
||||
const size_t count = MIN(mapcount, COMMAND_COMPLETION_MAXITEMS);
|
||||
const int mapcount = (int)g_vAllMaps.size();
|
||||
const int longest = COMMAND_COMPLETION_ITEM_LENGTH;
|
||||
const int count = MIN(mapcount, COMMAND_COMPLETION_MAXITEMS);
|
||||
|
||||
if (count > 0)
|
||||
{
|
||||
for (size_t i = 0; i < count; i++)
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
strncpy(commands[i], g_vAllMaps[i].c_str(), longest);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user