mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +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
|
|
@ -896,7 +896,7 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
|
||||||
<< (m_isDeadByDefault ? 1 : 0) << "," //is_dead
|
<< (m_isDeadByDefault ? 1 : 0) << "," //is_dead
|
||||||
<< GetDefaultMovementType() << ")"; //default movement generator type
|
<< GetDefaultMovementType() << ")"; //default movement generator type
|
||||||
|
|
||||||
WorldDatabase.PExecuteLog( ss.str( ).c_str( ) );
|
WorldDatabase.PExecuteLog("%s", ss.str().c_str());
|
||||||
|
|
||||||
WorldDatabase.CommitTransaction();
|
WorldDatabase.CommitTransaction();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -558,7 +558,7 @@ void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
|
||||||
|
|
||||||
WorldDatabase.BeginTransaction();
|
WorldDatabase.BeginTransaction();
|
||||||
WorldDatabase.PExecuteLog("DELETE FROM gameobject WHERE guid = '%u'", m_DBTableGuid);
|
WorldDatabase.PExecuteLog("DELETE FROM gameobject WHERE guid = '%u'", m_DBTableGuid);
|
||||||
WorldDatabase.PExecuteLog( ss.str( ).c_str( ) );
|
WorldDatabase.PExecuteLog("%s", ss.str().c_str());
|
||||||
WorldDatabase.CommitTransaction();
|
WorldDatabase.CommitTransaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1212,7 +1212,7 @@ bool GridMap::loadData(char *filename)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// loadup height data
|
// loadup height data
|
||||||
if (header.heightMapOffset && !loadHeihgtData(in, header.heightMapOffset, header.heightMapSize))
|
if (header.heightMapOffset && !loadHeightData(in, header.heightMapOffset, header.heightMapSize))
|
||||||
{
|
{
|
||||||
sLog.outError("Error loading map height data\n");
|
sLog.outError("Error loading map height data\n");
|
||||||
fclose(in);
|
fclose(in);
|
||||||
|
|
@ -1265,7 +1265,7 @@ bool GridMap::loadAreaData(FILE *in, uint32 offset, uint32 size)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GridMap::loadHeihgtData(FILE *in, uint32 offset, uint32 size)
|
bool GridMap::loadHeightData(FILE *in, uint32 offset, uint32 size)
|
||||||
{
|
{
|
||||||
map_heightHeader header;
|
map_heightHeader header;
|
||||||
fseek(in, offset, SEEK_SET);
|
fseek(in, offset, SEEK_SET);
|
||||||
|
|
|
||||||
|
|
@ -176,7 +176,7 @@ class GridMap
|
||||||
float *m_liquid_map;
|
float *m_liquid_map;
|
||||||
|
|
||||||
bool loadAreaData(FILE *in, uint32 offset, uint32 size);
|
bool loadAreaData(FILE *in, uint32 offset, uint32 size);
|
||||||
bool loadHeihgtData(FILE *in, uint32 offset, uint32 size);
|
bool loadHeightData(FILE *in, uint32 offset, uint32 size);
|
||||||
bool loadLiquidData(FILE *in, uint32 offset, uint32 size);
|
bool loadLiquidData(FILE *in, uint32 offset, uint32 size);
|
||||||
|
|
||||||
// Get height functions and pointers
|
// Get height functions and pointers
|
||||||
|
|
|
||||||
|
|
@ -845,7 +845,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data)
|
||||||
else if(missingKey)
|
else if(missingKey)
|
||||||
GetPlayer()->SendTransferAborted(at->target_mapId, TRANSFER_ABORT_DIFFICULTY, isRegularTargetMap ? DUNGEON_DIFFICULTY_NORMAL : DUNGEON_DIFFICULTY_HEROIC);
|
GetPlayer()->SendTransferAborted(at->target_mapId, TRANSFER_ABORT_DIFFICULTY, isRegularTargetMap ? DUNGEON_DIFFICULTY_NORMAL : DUNGEON_DIFFICULTY_HEROIC);
|
||||||
else if(missingQuest)
|
else if(missingQuest)
|
||||||
SendAreaTriggerMessage(at->requiredFailedText.c_str());
|
SendAreaTriggerMessage("%s", at->requiredFailedText.c_str());
|
||||||
else if(missingLevel)
|
else if(missingLevel)
|
||||||
SendAreaTriggerMessage(GetMangosString(LANG_LEVEL_MINREQUIRED), missingLevel);
|
SendAreaTriggerMessage(GetMangosString(LANG_LEVEL_MINREQUIRED), missingLevel);
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -4524,7 +4524,7 @@ void ObjectMgr::LoadPageTexts()
|
||||||
ss << *itr << " ";
|
ss << *itr << " ";
|
||||||
ss << "create(s) a circular reference, which can cause the server to freeze. Changing Next_Page of page "
|
ss << "create(s) a circular reference, which can cause the server to freeze. Changing Next_Page of page "
|
||||||
<< pageItr->Page_ID <<" to 0";
|
<< pageItr->Page_ID <<" to 0";
|
||||||
sLog.outErrorDb(ss.str().c_str());
|
sLog.outErrorDb("%s", ss.str().c_str());
|
||||||
const_cast<PageText*>(pageItr)->Next_Page = 0;
|
const_cast<PageText*>(pageItr)->Next_Page = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16594,7 +16594,7 @@ void Player::SavePositionInDB(uint32 mapid, float x,float y,float z,float o,uint
|
||||||
<< "',position_z='"<<z<<"',orientation='"<<o<<"',map='"<<mapid
|
<< "',position_z='"<<z<<"',orientation='"<<o<<"',map='"<<mapid
|
||||||
<< "',zone='"<<zone<<"',trans_x='0',trans_y='0',trans_z='0',"
|
<< "',zone='"<<zone<<"',trans_x='0',trans_y='0',trans_z='0',"
|
||||||
<< "transguid='0',taxi_path='' WHERE guid='"<< GUID_LOPART(guid) <<"'";
|
<< "transguid='0',taxi_path='' WHERE guid='"<< GUID_LOPART(guid) <<"'";
|
||||||
sLog.outDebug(ss.str().c_str());
|
sLog.outDebug("%s", ss.str().c_str());
|
||||||
CharacterDatabase.Execute(ss.str().c_str());
|
CharacterDatabase.Execute(ss.str().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -605,7 +605,7 @@ void PoolManager::LoadFromDB()
|
||||||
ss << *itr << " ";
|
ss << *itr << " ";
|
||||||
ss << "create(s) a circular reference, which can cause the server to freeze.\nRemoving the last link between mother pool "
|
ss << "create(s) a circular reference, which can cause the server to freeze.\nRemoving the last link between mother pool "
|
||||||
<< poolItr->first << " and child pool " << poolItr->second;
|
<< poolItr->first << " and child pool " << poolItr->second;
|
||||||
sLog.outErrorDb(ss.str().c_str());
|
sLog.outErrorDb("%s", ss.str().c_str());
|
||||||
mPoolPoolGroups[poolItr->second].RemoveOneRelation(poolItr->first);
|
mPoolPoolGroups[poolItr->second].RemoveOneRelation(poolItr->first);
|
||||||
mPoolSearchMap.erase(poolItr);
|
mPoolSearchMap.erase(poolItr);
|
||||||
--count;
|
--count;
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,7 @@ void WorldSession::LogUnexpectedOpcode(WorldPacket* packet, const char *reason)
|
||||||
/// Logging helper for unexpected opcodes
|
/// Logging helper for unexpected opcodes
|
||||||
void WorldSession::LogUnprocessedTail(WorldPacket *packet)
|
void WorldSession::LogUnprocessedTail(WorldPacket *packet)
|
||||||
{
|
{
|
||||||
sLog.outError( "SESSION: opcode %s (0x%.4X) have unprocessed tail data (read stop at %u from %u)",
|
sLog.outError( "SESSION: opcode %s (0x%.4X) have unprocessed tail data (read stop at " SIZEFMTD " from " SIZEFMTD ")",
|
||||||
LookupOpcodeName(packet->GetOpcode()),
|
LookupOpcodeName(packet->GetOpcode()),
|
||||||
packet->GetOpcode(),
|
packet->GetOpcode(),
|
||||||
packet->rpos(),packet->wpos());
|
packet->rpos(),packet->wpos());
|
||||||
|
|
|
||||||
|
|
@ -45,9 +45,9 @@ void utf8print(const char* str)
|
||||||
|
|
||||||
char temp_buf[6000];
|
char temp_buf[6000];
|
||||||
CharToOemBuffW(&wtemp_buf[0],&temp_buf[0],wtemp_len+1);
|
CharToOemBuffW(&wtemp_buf[0],&temp_buf[0],wtemp_len+1);
|
||||||
printf(temp_buf);
|
printf("%s", temp_buf);
|
||||||
#else
|
#else
|
||||||
printf(str);
|
printf("%s", str);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,16 +55,16 @@
|
||||||
#include "Platform/Define.h"
|
#include "Platform/Define.h"
|
||||||
|
|
||||||
#if COMPILER == COMPILER_MICROSOFT
|
#if COMPILER == COMPILER_MICROSOFT
|
||||||
# pragma warning(disable:4996) // 'function': was declared deprecated
|
# pragma warning(disable:4996) // 'function': was declared deprecated
|
||||||
#ifndef __SHOW_STUPID_WARNINGS__
|
#ifndef __SHOW_STUPID_WARNINGS__
|
||||||
# pragma warning(disable:4005) // 'identifier' : macro redefinition
|
# pragma warning(disable:4005) // 'identifier' : macro redefinition
|
||||||
# pragma warning(disable:4018) // 'expression' : signed/unsigned mismatch
|
# 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: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: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:4305) // 'identifier' : truncation from 'type1' to 'type2'
|
||||||
# pragma warning(disable:4311) // 'variable' : pointer truncation from 'type' to 'type'
|
# 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: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:4800) // 'type' : forcing value to bool 'true' or 'false' (performance warning)
|
||||||
#endif // __SHOW_STUPID_WARNINGS__
|
#endif // __SHOW_STUPID_WARNINGS__
|
||||||
#endif // __GNUC__
|
#endif // __GNUC__
|
||||||
|
|
||||||
|
|
@ -116,20 +116,25 @@
|
||||||
|
|
||||||
#if COMPILER == COMPILER_MICROSOFT
|
#if COMPILER == COMPILER_MICROSOFT
|
||||||
|
|
||||||
#include <float.h>
|
# include <float.h>
|
||||||
|
|
||||||
#define I32FMT "%08I32X"
|
# define I32FMT "%08I32X"
|
||||||
#define I64FMT "%016I64X"
|
# define I64FMT "%016I64X"
|
||||||
#define snprintf _snprintf
|
# define snprintf _snprintf
|
||||||
#define vsnprintf _vsnprintf
|
# define vsnprintf _vsnprintf
|
||||||
#define finite(X) _finite(X)
|
# define finite(X) _finite(X)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define stricmp strcasecmp
|
# define stricmp strcasecmp
|
||||||
#define strnicmp strncasecmp
|
# define strnicmp strncasecmp
|
||||||
#define I32FMT "%08X"
|
|
||||||
#define I64FMT "%016llX"
|
# define I32FMT "%08X"
|
||||||
|
# if ACE_SIZEOF_LONG == 8
|
||||||
|
# define I64FMT "%016lX"
|
||||||
|
# else
|
||||||
|
# define I64FMT "%016llX"
|
||||||
|
# endif /* ACE_SIZEOF_LONG == 8 */
|
||||||
|
|
||||||
#endif
|
#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)
|
// we always use stdlibc++ std::max/std::min, undefine some not C++ standard defines (Win API and some pother platforms)
|
||||||
#ifdef max
|
#ifdef max
|
||||||
#undef max
|
# undef max
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef min
|
#ifdef min
|
||||||
#undef min
|
# undef min
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef M_PI
|
#ifndef M_PI
|
||||||
#define M_PI 3.14159265358979323846
|
# define M_PI 3.14159265358979323846
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -95,13 +95,13 @@ bool SqlQueryHolder::SetQuery(size_t index, const char *sql)
|
||||||
{
|
{
|
||||||
if(m_queries.size() <= index)
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_queries[index].first != NULL)
|
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);
|
index,m_queries[index].first,sql);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -115,7 +115,7 @@ bool SqlQueryHolder::SetPQuery(size_t index, const char *format, ...)
|
||||||
{
|
{
|
||||||
if(!format)
|
if(!format)
|
||||||
{
|
{
|
||||||
sLog.outError("Query (index: %u) is empty.",index);
|
sLog.outError("Query (index: " SIZEFMTD ") is empty.",index);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -329,15 +329,15 @@ void Log::outTitle( const char * str)
|
||||||
SetColor(true,WHITE);
|
SetColor(true,WHITE);
|
||||||
|
|
||||||
// not expected utf8 and then send as-is
|
// not expected utf8 and then send as-is
|
||||||
printf( str );
|
printf("%s", str);
|
||||||
|
|
||||||
if(m_colored)
|
if(m_colored)
|
||||||
ResetColor(true);
|
ResetColor(true);
|
||||||
|
|
||||||
printf( "\n" );
|
printf("\n");
|
||||||
if(logfile)
|
if(logfile)
|
||||||
{
|
{
|
||||||
fprintf(logfile, str);
|
fprintf(logfile, "%s", str);
|
||||||
fprintf(logfile, "\n" );
|
fprintf(logfile, "\n" );
|
||||||
fflush(logfile);
|
fflush(logfile);
|
||||||
}
|
}
|
||||||
|
|
@ -706,7 +706,7 @@ void Log::outWorldPacketDump( uint32 socket, uint32 opcode, char const* opcodeNa
|
||||||
|
|
||||||
outTimestamp(worldLogfile);
|
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",
|
incoming ? "CLIENT" : "SERVER",
|
||||||
socket, packet->size(), opcodeName, opcode);
|
socket, packet->size(), opcodeName, opcode);
|
||||||
|
|
||||||
|
|
@ -789,10 +789,10 @@ void outstring_log(const char * str, ...)
|
||||||
char buf[256];
|
char buf[256];
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, str);
|
va_start(ap, str);
|
||||||
vsnprintf(buf,256, str, ap);
|
vsnprintf(buf, 256, str, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
sLog.outString(buf);
|
sLog.outString("%s", buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void detail_log(const char * str, ...)
|
void detail_log(const char * str, ...)
|
||||||
|
|
@ -806,7 +806,7 @@ void detail_log(const char * str, ...)
|
||||||
vsnprintf(buf,256, str, ap);
|
vsnprintf(buf,256, str, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
sLog.outDetail(buf);
|
sLog.outDetail("%s", buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void debug_log(const char * str, ...)
|
void debug_log(const char * str, ...)
|
||||||
|
|
@ -820,7 +820,7 @@ void debug_log(const char * str, ...)
|
||||||
vsnprintf(buf,256, str, ap);
|
vsnprintf(buf,256, str, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
sLog.outDebug(buf);
|
sLog.outDebug("%s", buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void error_log(const char * str, ...)
|
void error_log(const char * str, ...)
|
||||||
|
|
@ -834,7 +834,7 @@ void error_log(const char * str, ...)
|
||||||
vsnprintf(buf,256, str, ap);
|
vsnprintf(buf,256, str, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
sLog.outError(buf);
|
sLog.outError("%s", buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void error_db_log(const char * str, ...)
|
void error_db_log(const char * str, ...)
|
||||||
|
|
@ -848,5 +848,5 @@ void error_db_log(const char * str, ...)
|
||||||
vsnprintf(buf,256, str, ap);
|
vsnprintf(buf,256, str, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
sLog.outErrorDb(buf);
|
sLog.outErrorDb("%s", buf);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "9106"
|
#define REVISION_NR "9107"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue