diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index 06949e94a..10f491b64 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -896,7 +896,7 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) << (m_isDeadByDefault ? 1 : 0) << "," //is_dead << GetDefaultMovementType() << ")"; //default movement generator type - WorldDatabase.PExecuteLog( ss.str( ).c_str( ) ); + WorldDatabase.PExecuteLog("%s", ss.str().c_str()); WorldDatabase.CommitTransaction(); } diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index fa5ada1aa..fcee11090 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -558,7 +558,7 @@ void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) WorldDatabase.BeginTransaction(); 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(); } diff --git a/src/game/Map.cpp b/src/game/Map.cpp index 8f7161308..a190cc95c 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -1212,7 +1212,7 @@ bool GridMap::loadData(char *filename) return false; } // 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"); fclose(in); @@ -1265,7 +1265,7 @@ bool GridMap::loadAreaData(FILE *in, uint32 offset, uint32 size) return true; } -bool GridMap::loadHeihgtData(FILE *in, uint32 offset, uint32 size) +bool GridMap::loadHeightData(FILE *in, uint32 offset, uint32 size) { map_heightHeader header; fseek(in, offset, SEEK_SET); diff --git a/src/game/Map.h b/src/game/Map.h index dd206d6ee..43509147f 100644 --- a/src/game/Map.h +++ b/src/game/Map.h @@ -176,7 +176,7 @@ class GridMap float *m_liquid_map; 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); // Get height functions and pointers diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index 1094865fa..421e03158 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -845,7 +845,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data) else if(missingKey) GetPlayer()->SendTransferAborted(at->target_mapId, TRANSFER_ABORT_DIFFICULTY, isRegularTargetMap ? DUNGEON_DIFFICULTY_NORMAL : DUNGEON_DIFFICULTY_HEROIC); else if(missingQuest) - SendAreaTriggerMessage(at->requiredFailedText.c_str()); + SendAreaTriggerMessage("%s", at->requiredFailedText.c_str()); else if(missingLevel) SendAreaTriggerMessage(GetMangosString(LANG_LEVEL_MINREQUIRED), missingLevel); return; diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 476de5f6b..4888b120d 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -4524,7 +4524,7 @@ void ObjectMgr::LoadPageTexts() ss << *itr << " "; ss << "create(s) a circular reference, which can cause the server to freeze. Changing Next_Page of page " << pageItr->Page_ID <<" to 0"; - sLog.outErrorDb(ss.str().c_str()); + sLog.outErrorDb("%s", ss.str().c_str()); const_cast(pageItr)->Next_Page = 0; break; } diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 8f5b70a64..eb335a4ec 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -16594,7 +16594,7 @@ void Player::SavePositionInDB(uint32 mapid, float x,float y,float z,float o,uint << "',position_z='"<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); mPoolSearchMap.erase(poolItr); --count; diff --git a/src/game/WorldSession.cpp b/src/game/WorldSession.cpp index a9d0e1cb2..946cdaaa4 100644 --- a/src/game/WorldSession.cpp +++ b/src/game/WorldSession.cpp @@ -149,7 +149,7 @@ void WorldSession::LogUnexpectedOpcode(WorldPacket* packet, const char *reason) /// Logging helper for unexpected opcodes 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()), packet->GetOpcode(), packet->rpos(),packet->wpos()); diff --git a/src/mangosd/CliRunnable.cpp b/src/mangosd/CliRunnable.cpp index a97fd7fb6..f6d00fdbf 100644 --- a/src/mangosd/CliRunnable.cpp +++ b/src/mangosd/CliRunnable.cpp @@ -45,9 +45,9 @@ void utf8print(const char* str) char temp_buf[6000]; CharToOemBuffW(&wtemp_buf[0],&temp_buf[0],wtemp_len+1); - printf(temp_buf); + printf("%s", temp_buf); #else - printf(str); + printf("%s", str); #endif } diff --git a/src/shared/Common.h b/src/shared/Common.h index c3f16b73d..9cbe595e5 100644 --- a/src/shared/Common.h +++ b/src/shared/Common.h @@ -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 +# include -#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 diff --git a/src/shared/Database/SqlOperations.cpp b/src/shared/Database/SqlOperations.cpp index bcea9078d..000334d2d 100644 --- a/src/shared/Database/SqlOperations.cpp +++ b/src/shared/Database/SqlOperations.cpp @@ -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; } diff --git a/src/shared/Log.cpp b/src/shared/Log.cpp index 429b089e7..fdb49469a 100644 --- a/src/shared/Log.cpp +++ b/src/shared/Log.cpp @@ -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); } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 6968d2405..f39d14e5b 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9106" + #define REVISION_NR "9107" #endif // __REVISION_NR_H__