From 4d4bb0001abb4c61afd8cad4a66f10577502cc16 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Wed, 18 Feb 2009 19:15:53 +0300 Subject: [PATCH] [7296] Fixed some GCC warnings. --- src/game/Formulas.h | 2 +- src/game/Level2.cpp | 8 ++------ src/shared/Util.cpp | 6 ++++-- src/shared/revision_nr.h | 2 +- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/game/Formulas.h b/src/game/Formulas.h index decad556f..9250d86be 100644 --- a/src/game/Formulas.h +++ b/src/game/Formulas.h @@ -32,7 +32,7 @@ namespace MaNGOS } namespace XP { - typedef enum XPColorChar { RED, ORANGE, YELLOW, GREEN, GRAY }; + enum XPColorChar { RED, ORANGE, YELLOW, GREEN, GRAY }; inline uint32 GetGrayLevel(uint32 pl_level) { diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index 24d30cc92..ebb9816df 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -1882,18 +1882,14 @@ bool ChatHandler::HandlePInfoCommand(const char* args) return false; } - char* FactionName; for(FactionStateList::const_iterator itr = target->m_factions.begin(); itr != target->m_factions.end(); ++itr) { FactionEntry const *factionEntry = sFactionStore.LookupEntry(itr->second.ID); - if (factionEntry) - FactionName = factionEntry->name[m_session->GetSessionDbcLocale()]; - else - FactionName = "#Not found#"; + char const* factionName = factionEntry ? factionEntry->name[m_session->GetSessionDbcLocale()] : "#Not found#"; ReputationRank rank = target->GetReputationRank(factionEntry); std::string rankName = GetMangosString(ReputationRankStrIndex[rank]); std::ostringstream ss; - ss << itr->second.ID << ": |cffffffff|Hfaction:" << itr->second.ID << "|h[" << FactionName << "]|h|r " << rankName << "|h|r (" << target->GetReputation(factionEntry) << ")"; + ss << itr->second.ID << ": |cffffffff|Hfaction:" << itr->second.ID << "|h[" << factionName << "]|h|r " << rankName << "|h|r (" << target->GetReputation(factionEntry) << ")"; if(itr->second.Flags & FACTION_FLAG_VISIBLE) ss << GetMangosString(LANG_FACTION_VISIBLE); diff --git a/src/shared/Util.cpp b/src/shared/Util.cpp index b670c85ee..519c612af 100644 --- a/src/shared/Util.cpp +++ b/src/shared/Util.cpp @@ -252,8 +252,9 @@ bool Utf8toWStr(char const* utf8str, size_t csize, wchar_t* wstr, size_t& wsize) size_t len = utf8::distance(utf8str,utf8str+csize); if(len > wsize) { + if(wsize > 0) + wstr[0] = L'\0'; wsize = 0; - wstr = L""; return false; } @@ -263,8 +264,9 @@ bool Utf8toWStr(char const* utf8str, size_t csize, wchar_t* wstr, size_t& wsize) } catch(std::exception) { + if(wsize > 0) + wstr[0] = L'\0'; wsize = 0; - wstr = L""; return false; } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index caca4e064..6e70795b5 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 "7295" + #define REVISION_NR "7296" #endif // __REVISION_NR_H__ -- 2.11.4.GIT