Skip to content

Commit

Permalink
Fix various warnnigs messages.
Browse files Browse the repository at this point in the history
(based on commit cf77ece)

Signed-off-by: Xfurry <xfurry@scriptdev2.com>
  • Loading branch information
Cyberium authored and xfurry committed Oct 30, 2015
1 parent 9653b9a commit 4b015bc
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 19 deletions.
3 changes: 3 additions & 0 deletions cmake/compiler/clang/settings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ if(WARNINGS)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNING_FLAGS} -Woverloaded-virtual")
message(STATUS "Clang: All warnings enabled")
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused*result")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-result")
endif()

if(DEBUG)
Expand Down
4 changes: 4 additions & 0 deletions cmake/compiler/gcc/settings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ if(PLATFORM EQUAL X86)
set(SSE_FLAGS "-msse2 -mfpmath=sse")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SSE_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SSE_FLAGS}")
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused*result")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-result")
endif()

add_definitions(-DHAVE_SSE2)
message(STATUS "GCC: SFMT enabled, SSE2 flags forced")

Expand Down
8 changes: 4 additions & 4 deletions src/game/CalendarHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recv_data*/)
sCalendarMgr.GetPlayerInvitesList(guid, invites);

data << uint32(invites.size());
DEBUG_FILTER_LOG(LOG_FILTER_CALENDAR, "Sending > %u invites", invites.size());
DEBUG_FILTER_LOG(LOG_FILTER_CALENDAR, "Sending > %u invites", uint32(invites.size()));

for (CalendarInvitesList::const_iterator itr = invites.begin(); itr != invites.end(); ++itr)
{
Expand All @@ -66,7 +66,7 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recv_data*/)
sCalendarMgr.GetPlayerEventsList(guid, events);

data << uint32(events.size());
DEBUG_FILTER_LOG(LOG_FILTER_CALENDAR, "Sending > %u events", events.size());
DEBUG_FILTER_LOG(LOG_FILTER_CALENDAR, "Sending > %u events", uint32(events.size()));

for (CalendarEventsList::const_iterator itr = events.begin(); itr != events.end(); ++itr)
{
Expand Down Expand Up @@ -368,7 +368,7 @@ void WorldSession::HandleCalendarUpdateEvent(WorldPacket& recv_data)
CharacterDatabase.PExecute("UPDATE calendar_events SET "
"type=%hu, flags=%u, dungeonId=%d, eventTime=%u, title='%s', description='%s'"
"WHERE eventid=" UI64FMTD,
type, flags, dungeonId, event->EventTime, title.c_str(), description.c_str(), eventId);
type, flags, dungeonId, uint32(event->EventTime), title.c_str(), description.c_str(), eventId);
}
else
sCalendarMgr.SendCalendarCommandResult(_player, CALENDAR_ERROR_EVENT_INVALID);
Expand Down Expand Up @@ -510,7 +510,7 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recv_data)
invite.LastUpdateTime = time(NULL);

sCalendarMgr.SendCalendarEventInvite(&invite);
DEBUG_FILTER_LOG(LOG_FILTER_CALENDAR, "PREINVITE> sender[%s], Invitee[%u]", playerGuid.GetString().c_str(), inviteeGuid.GetString().c_str());
DEBUG_FILTER_LOG(LOG_FILTER_CALENDAR, "PREINVITE> sender[%s], Invitee[%s]", playerGuid.GetString().c_str(), inviteeGuid.GetString().c_str());
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/game/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20193,7 +20193,7 @@ void Player::SendTransferAbortedByLockStatus(MapEntry const* mapEntry, AreaLockS
case AREA_LOCKSTATUS_QUEST_NOT_COMPLETED:
if (mapEntry->MapID == 269) // Exception for Black Morass
{
GetSession()->SendAreaTriggerMessage(GetSession()->GetMangosString(LANG_TELEREQ_QUEST_BLACK_MORASS));
GetSession()->SendAreaTriggerMessage("%s", GetSession()->GetMangosString(LANG_TELEREQ_QUEST_BLACK_MORASS));
break;
}
else if (mapEntry->IsContinent()) // do not report anything for quest areatrigge
Expand Down
2 changes: 1 addition & 1 deletion src/scriptdev2/base/escort_ai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void npc_escortAI::GetAIInformation(ChatHandler& reader)
m_creature->GetMotionMaster()->GetWaypointPathInformation(oss);
}

reader.PSendSysMessage(oss.str().c_str());
reader.PSendSysMessage("%s", oss.str().c_str());
}

bool npc_escortAI::IsVisible(Unit* pWho) const
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ struct npc_anubisath_sentinelAI : public ScriptedAI
if (m_lAssistList.size() == MAX_BUDDY)
reader.PSendSysMessage("Anubisath Sentinel - proper group found");
else
reader.PSendSysMessage("Anubisath Sentinel - not correct number of mobs for group found. Number found %u, should be %u", m_lAssistList.size(), MAX_BUDDY);
reader.PSendSysMessage("Anubisath Sentinel - not correct number of mobs for group found. Number found %u, should be %u", uint32(m_lAssistList.size()), MAX_BUDDY);
}

void JustReachedHome() override
Expand Down
76 changes: 65 additions & 11 deletions src/shared/ByteBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,79 @@
*/

#include "ByteBuffer.h"
#include "Log.h"

void BitStream::Clear()
void ByteBufferException::PrintPosError() const
{
_data.clear();
_rpos = _wpos = 0;
char const* traceStr;

#ifdef HAVE_ACE_STACK_TRACE_H
ACE_Stack_Trace trace;
traceStr = trace.c_str();
#else
traceStr = NULL;
#endif

sLog.outError(
"Attempted to %s in ByteBuffer (pos: " SIZEFMTD " size: " SIZEFMTD ") "
"value with size: " SIZEFMTD "%s%s",
(add ? "put" : "get"), pos, size, esize,
traceStr ? "\n" : "", traceStr ? traceStr : "");
}

uint8 BitStream::GetBit(uint32 bit)
{
MANGOS_ASSERT(_data.size() > bit);
return _data[bit];
if (!sLog.HasLogLevelOrHigher(LOG_LVL_DEBUG)) // optimize disabled debug output
return;

std::ostringstream ss;
ss << "STORAGE_SIZE: " << size() << "\n";

if (sLog.IsIncludeTime())
ss << " ";

for (size_t i = 0; i < size(); ++i)
ss << uint32(read<uint8>(i)) << " - ";

sLog.outDebug("%s", ss.str().c_str());
}

uint8 BitStream::ReadBit()
void ByteBuffer::textlike() const
{
MANGOS_ASSERT(_data.size() < _rpos);
uint8 b = _data[_rpos];
++_rpos;
return b;
if (!sLog.HasLogLevelOrHigher(LOG_LVL_DEBUG)) // optimize disabled debug output
return;

std::ostringstream ss;
ss << "STORAGE_SIZE: " << size() << "\n";

if (sLog.IsIncludeTime())
ss << " ";

for (size_t i = 0; i < size(); ++i)
ss << read<uint8>(i);

sLog.outDebug("%s", ss.str().c_str());
}

void ByteBuffer::hexlike() const
{
if (!sLog.HasLogLevelOrHigher(LOG_LVL_DEBUG)) // optimize disabled debug output
return;

std::ostringstream ss;
ss << "STORAGE_SIZE: " << size() << "\n";

if (sLog.IsIncludeTime())
ss << " ";

size_t j = 1, k = 1;

for (size_t i = 0; i < size(); ++i)
{
if ((i == (j * 8)) && ((i != (k * 16))))
{
ss << "| ";
++j;
}

void BitStream::WriteBit(uint32 bit)
Expand Down Expand Up @@ -72,6 +126,6 @@ void BitStream::Print()
for (uint32 i = 0; i < GetLength(); ++i)
ss << uint32(GetBit(i)) << " ";

sLog.outDebug(ss.str().c_str());
sLog.outDebug("%s", ss.str().c_str());
}

2 changes: 1 addition & 1 deletion src/shared/Database/SQLStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ void SQLStorage::prepareToLoad(uint32 maxRecordId, uint32 recordCount, uint32 re

// Set index array
m_Index = new char* [maxRecordId];
memset(m_Index, NULL, maxRecordId * sizeof(char*));
memset(m_Index, 0, maxRecordId * sizeof(char*));

SQLStorageBase::prepareToLoad(maxRecordId, recordCount, recordSize);
}
Expand Down

0 comments on commit 4b015bc

Please sign in to comment.