mirror of
https://github.com/mangosfour/server.git
synced 2025-12-24 01:37:02 +00:00
[9107] Fix most of the gcc warnings
* use UI64FMTD instead of "%u" for uint64 output * on most *NIX systems, I64FMT is "%016lX" and not "%016llX" * also fix typo: renamed GridMap::loadHeihgtData to GridMap::loadHeightData Note: there are still many warnings from the 3rd party libraries g3dlite and ACE. Those warnings won't be fixed with that commit. Also, a few warnings from MaNGOS are left, they'll be fixed later. Signed-off-by: XTZGZoReX <xtzgzorex@gmail.com>
This commit is contained in:
parent
e568293d2c
commit
ebb063beb9
14 changed files with 53 additions and 48 deletions
|
|
@ -55,16 +55,16 @@
|
|||
#include "Platform/Define.h"
|
||||
|
||||
#if COMPILER == COMPILER_MICROSOFT
|
||||
# pragma warning(disable:4996) // 'function': was declared deprecated
|
||||
# pragma warning(disable:4996) // 'function': was declared deprecated
|
||||
#ifndef __SHOW_STUPID_WARNINGS__
|
||||
# pragma warning(disable:4005) // 'identifier' : macro redefinition
|
||||
# pragma warning(disable:4018) // 'expression' : signed/unsigned mismatch
|
||||
# pragma warning(disable:4244) // 'argument' : conversion from 'type1' to 'type2', possible loss of data
|
||||
# pragma warning(disable:4267) // 'var' : conversion from 'size_t' to 'type', possible loss of data
|
||||
# pragma warning(disable:4305) // 'identifier' : truncation from 'type1' to 'type2'
|
||||
# pragma warning(disable:4311) // 'variable' : pointer truncation from 'type' to 'type'
|
||||
# pragma warning(disable:4355) // 'this' : used in base member initializer list
|
||||
# pragma warning(disable:4800) // 'type' : forcing value to bool 'true' or 'false' (performance warning)
|
||||
# pragma warning(disable:4005) // 'identifier' : macro redefinition
|
||||
# pragma warning(disable:4018) // 'expression' : signed/unsigned mismatch
|
||||
# pragma warning(disable:4244) // 'argument' : conversion from 'type1' to 'type2', possible loss of data
|
||||
# pragma warning(disable:4267) // 'var' : conversion from 'size_t' to 'type', possible loss of data
|
||||
# pragma warning(disable:4305) // 'identifier' : truncation from 'type1' to 'type2'
|
||||
# pragma warning(disable:4311) // 'variable' : pointer truncation from 'type' to 'type'
|
||||
# pragma warning(disable:4355) // 'this' : used in base member initializer list
|
||||
# pragma warning(disable:4800) // 'type' : forcing value to bool 'true' or 'false' (performance warning)
|
||||
#endif // __SHOW_STUPID_WARNINGS__
|
||||
#endif // __GNUC__
|
||||
|
||||
|
|
@ -116,20 +116,25 @@
|
|||
|
||||
#if COMPILER == COMPILER_MICROSOFT
|
||||
|
||||
#include <float.h>
|
||||
# include <float.h>
|
||||
|
||||
#define I32FMT "%08I32X"
|
||||
#define I64FMT "%016I64X"
|
||||
#define snprintf _snprintf
|
||||
#define vsnprintf _vsnprintf
|
||||
#define finite(X) _finite(X)
|
||||
# define I32FMT "%08I32X"
|
||||
# define I64FMT "%016I64X"
|
||||
# define snprintf _snprintf
|
||||
# define vsnprintf _vsnprintf
|
||||
# define finite(X) _finite(X)
|
||||
|
||||
#else
|
||||
|
||||
#define stricmp strcasecmp
|
||||
#define strnicmp strncasecmp
|
||||
#define I32FMT "%08X"
|
||||
#define I64FMT "%016llX"
|
||||
# define stricmp strcasecmp
|
||||
# define strnicmp strncasecmp
|
||||
|
||||
# define I32FMT "%08X"
|
||||
# if ACE_SIZEOF_LONG == 8
|
||||
# define I64FMT "%016lX"
|
||||
# else
|
||||
# define I64FMT "%016llX"
|
||||
# endif /* ACE_SIZEOF_LONG == 8 */
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -194,15 +199,15 @@ inline char * mangos_strdup(const char * source)
|
|||
|
||||
// we always use stdlibc++ std::max/std::min, undefine some not C++ standard defines (Win API and some pother platforms)
|
||||
#ifdef max
|
||||
#undef max
|
||||
# undef max
|
||||
#endif
|
||||
|
||||
#ifdef min
|
||||
#undef min
|
||||
# undef min
|
||||
#endif
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846
|
||||
# define M_PI 3.14159265358979323846
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -95,13 +95,13 @@ bool SqlQueryHolder::SetQuery(size_t index, const char *sql)
|
|||
{
|
||||
if(m_queries.size() <= index)
|
||||
{
|
||||
sLog.outError("Query index (%u) out of range (size: %u) for query: %s",index,(uint32)m_queries.size(),sql);
|
||||
sLog.outError("Query index (" SIZEFMTD ") out of range (size: " SIZEFMTD ") for query: %s",index,(uint32)m_queries.size(),sql);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(m_queries[index].first != NULL)
|
||||
{
|
||||
sLog.outError("Attempt assign query to holder index (%u) where other query stored (Old: [%s] New: [%s])",
|
||||
sLog.outError("Attempt assign query to holder index (" SIZEFMTD ") where other query stored (Old: [%s] New: [%s])",
|
||||
index,m_queries[index].first,sql);
|
||||
return false;
|
||||
}
|
||||
|
|
@ -115,7 +115,7 @@ bool SqlQueryHolder::SetPQuery(size_t index, const char *format, ...)
|
|||
{
|
||||
if(!format)
|
||||
{
|
||||
sLog.outError("Query (index: %u) is empty.",index);
|
||||
sLog.outError("Query (index: " SIZEFMTD ") is empty.",index);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -329,15 +329,15 @@ void Log::outTitle( const char * str)
|
|||
SetColor(true,WHITE);
|
||||
|
||||
// not expected utf8 and then send as-is
|
||||
printf( str );
|
||||
printf("%s", str);
|
||||
|
||||
if(m_colored)
|
||||
ResetColor(true);
|
||||
|
||||
printf( "\n" );
|
||||
printf("\n");
|
||||
if(logfile)
|
||||
{
|
||||
fprintf(logfile, str);
|
||||
fprintf(logfile, "%s", str);
|
||||
fprintf(logfile, "\n" );
|
||||
fflush(logfile);
|
||||
}
|
||||
|
|
@ -706,7 +706,7 @@ void Log::outWorldPacketDump( uint32 socket, uint32 opcode, char const* opcodeNa
|
|||
|
||||
outTimestamp(worldLogfile);
|
||||
|
||||
fprintf(worldLogfile,"\n%s:\nSOCKET: %u\nLENGTH: %u\nOPCODE: %s (0x%.4X)\nDATA:\n",
|
||||
fprintf(worldLogfile,"\n%s:\nSOCKET: %u\nLENGTH: " SIZEFMTD "\nOPCODE: %s (0x%.4X)\nDATA:\n",
|
||||
incoming ? "CLIENT" : "SERVER",
|
||||
socket, packet->size(), opcodeName, opcode);
|
||||
|
||||
|
|
@ -789,10 +789,10 @@ void outstring_log(const char * str, ...)
|
|||
char buf[256];
|
||||
va_list ap;
|
||||
va_start(ap, str);
|
||||
vsnprintf(buf,256, str, ap);
|
||||
vsnprintf(buf, 256, str, ap);
|
||||
va_end(ap);
|
||||
|
||||
sLog.outString(buf);
|
||||
sLog.outString("%s", buf);
|
||||
}
|
||||
|
||||
void detail_log(const char * str, ...)
|
||||
|
|
@ -806,7 +806,7 @@ void detail_log(const char * str, ...)
|
|||
vsnprintf(buf,256, str, ap);
|
||||
va_end(ap);
|
||||
|
||||
sLog.outDetail(buf);
|
||||
sLog.outDetail("%s", buf);
|
||||
}
|
||||
|
||||
void debug_log(const char * str, ...)
|
||||
|
|
@ -820,7 +820,7 @@ void debug_log(const char * str, ...)
|
|||
vsnprintf(buf,256, str, ap);
|
||||
va_end(ap);
|
||||
|
||||
sLog.outDebug(buf);
|
||||
sLog.outDebug("%s", buf);
|
||||
}
|
||||
|
||||
void error_log(const char * str, ...)
|
||||
|
|
@ -834,7 +834,7 @@ void error_log(const char * str, ...)
|
|||
vsnprintf(buf,256, str, ap);
|
||||
va_end(ap);
|
||||
|
||||
sLog.outError(buf);
|
||||
sLog.outError("%s", buf);
|
||||
}
|
||||
|
||||
void error_db_log(const char * str, ...)
|
||||
|
|
@ -848,5 +848,5 @@ void error_db_log(const char * str, ...)
|
|||
vsnprintf(buf,256, str, ap);
|
||||
va_end(ap);
|
||||
|
||||
sLog.outErrorDb(buf);
|
||||
sLog.outErrorDb("%s", buf);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "9106"
|
||||
#define REVISION_NR "9107"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue