From 24149e9e343dd5e507d2b4e879df55c692fbf9d1 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 7 Jun 2017 21:47:14 +0300 Subject: Remove static in anonimouse namespaces. --- src/being/playerrelations.cpp | 23 +++++---- src/gui/widgets/emotepage.cpp | 4 +- src/gui/widgets/tabs/tab.cpp | 2 +- src/guild.cpp | 57 ++++++++++------------ src/party.cpp | 47 +++++++++--------- src/resources/db/statdb.cpp | 6 +-- .../resourcemanager/resourcemanager_unittest.cc | 2 +- src/resources/sdlgfxblitfunc.cpp | 2 +- 8 files changed, 68 insertions(+), 75 deletions(-) diff --git a/src/being/playerrelations.cpp b/src/being/playerrelations.cpp index 2e4b4b68c..e45376137 100644 --- a/src/being/playerrelations.cpp +++ b/src/being/playerrelations.cpp @@ -44,18 +44,18 @@ typedef PlayerRelations::const_iterator PlayerRelationsCIter; typedef std::list PlayerRelationListeners; typedef PlayerRelationListeners::const_iterator PlayerRelationListenersCIter; -namespace -{ - static const char *const PLAYER_IGNORE_STRATEGY_NOP = "nop"; - static const char *const PLAYER_IGNORE_STRATEGY_EMOTE0 = "emote0"; - static const char *const DEFAULT_IGNORE_STRATEGY - = PLAYER_IGNORE_STRATEGY_EMOTE0; +static const char *const PLAYER_IGNORE_STRATEGY_NOP = "nop"; +static const char *const PLAYER_IGNORE_STRATEGY_EMOTE0 = "emote0"; +static const char *const DEFAULT_IGNORE_STRATEGY = + PLAYER_IGNORE_STRATEGY_EMOTE0; - static const char *const NAME = "name"; - static const char *const RELATION = "relation"; +static const char *const NAME = "name"; +static const char *const RELATION = "relation"; - static const unsigned int IGNORE_EMOTE_TIME = 100; +static const unsigned int IGNORE_EMOTE_TIME = 100; +namespace +{ class SortPlayersFunctor final { public: @@ -131,11 +131,10 @@ namespace return container; } }; - - static PlayerConfSerialiser player_conf_serialiser; // stateless singleton - } // namespace +static PlayerConfSerialiser player_conf_serialiser; // stateless singleton + const unsigned int PlayerRelation::RELATION_PERMISSIONS[RELATIONS_NR] = { /* NEUTRAL */ 0, // we always fall back to the defaults anyway diff --git a/src/gui/widgets/emotepage.cpp b/src/gui/widgets/emotepage.cpp index 459e386a4..88f4addd4 100644 --- a/src/gui/widgets/emotepage.cpp +++ b/src/gui/widgets/emotepage.cpp @@ -34,8 +34,8 @@ namespace { - static const unsigned int emoteWidth = 17; - static const unsigned int emoteHeight = 18; + const unsigned int emoteWidth = 17; + const unsigned int emoteHeight = 18; } // namespace EmotePage::EmotePage(const Widget2 *const widget) : diff --git a/src/gui/widgets/tabs/tab.cpp b/src/gui/widgets/tabs/tab.cpp index a4a2f583b..36c2a3f40 100644 --- a/src/gui/widgets/tabs/tab.cpp +++ b/src/gui/widgets/tabs/tab.cpp @@ -88,7 +88,7 @@ float Tab::mAlpha = 1.0; namespace { - static std::string const data[Tab::TAB_COUNT] = + std::string const data[Tab::TAB_COUNT] = { "tab.xml", "tab_highlighted.xml", diff --git a/src/guild.cpp b/src/guild.cpp index 87c06ec2f..575220cde 100644 --- a/src/guild.cpp +++ b/src/guild.cpp @@ -30,40 +30,37 @@ #include "debug.h" -namespace +static class SortGuildFunctor final { - static class SortGuildFunctor final - { - public: - A_DEFAULT_COPY(SortGuildFunctor) + public: + A_DEFAULT_COPY(SortGuildFunctor) - bool operator() (const GuildMember *const m1, - const GuildMember *const m2) const - { - if ((m1 == nullptr) || (m2 == nullptr)) - return false; - - if (m1->getOnline() != m2->getOnline()) - { - return static_cast(m1->getOnline()) > - static_cast(m2->getOnline()); - } - - if (m1->getPos() != m2->getPos()) - return m1->getPos() > m2->getPos(); - - if (m1->getName() != m2->getName()) - { - std::string s1 = m1->getName(); - std::string s2 = m2->getName(); - toLower(s1); - toLower(s2); - return s1 < s2; - } + bool operator() (const GuildMember *const m1, + const GuildMember *const m2) const + { + if ((m1 == nullptr) || (m2 == nullptr)) return false; + + if (m1->getOnline() != m2->getOnline()) + { + return static_cast(m1->getOnline()) > + static_cast(m2->getOnline()); } - } guildSorter; -} // namespace + + if (m1->getPos() != m2->getPos()) + return m1->getPos() > m2->getPos(); + + if (m1->getName() != m2->getName()) + { + std::string s1 = m1->getName(); + std::string s2 = m2->getName(); + toLower(s1); + toLower(s2); + return s1 < s2; + } + return false; + } +} guildSorter; GuildMember::GuildMember(Guild *const guild, const BeingId accountId, diff --git a/src/party.cpp b/src/party.cpp index 83c8bd12e..f28236e34 100644 --- a/src/party.cpp +++ b/src/party.cpp @@ -29,35 +29,32 @@ #include "debug.h" -namespace +static class SortPartyFunctor final { - static class SortPartyFunctor final - { - public: - A_DEFAULT_COPY(SortPartyFunctor) + public: + A_DEFAULT_COPY(SortPartyFunctor) - bool operator() (const PartyMember *const p1, - const PartyMember *const p2) const - { - if ((p1 == nullptr) || (p2 == nullptr)) - return false; - if (p1->getLeader()) - return true; - if (p2->getLeader()) - return false; - - if (p1->getName() != p2->getName()) - { - std::string s1 = p1->getName(); - std::string s2 = p2->getName(); - toLower(s1); - toLower(s2); - return s1 < s2; - } + bool operator() (const PartyMember *const p1, + const PartyMember *const p2) const + { + if ((p1 == nullptr) || (p2 == nullptr)) + return false; + if (p1->getLeader()) + return true; + if (p2->getLeader()) return false; + + if (p1->getName() != p2->getName()) + { + std::string s1 = p1->getName(); + std::string s2 = p2->getName(); + toLower(s1); + toLower(s2); + return s1 < s2; } - } partySorter; -} // namespace + return false; + } +} partySorter; PartyMember::PartyMember(Party *const party, const BeingId id, diff --git a/src/resources/db/statdb.cpp b/src/resources/db/statdb.cpp index 7911009a3..26734bdb3 100644 --- a/src/resources/db/statdb.cpp +++ b/src/resources/db/statdb.cpp @@ -35,9 +35,9 @@ namespace { bool mLoaded = false; - static std::vector mBasicStats; - static std::map > mStats; - static std::vector mPages; + std::vector mBasicStats; + std::map > mStats; + std::vector mPages; } // namespace void StatDb::addDefaultStats() diff --git a/src/resources/resourcemanager/resourcemanager_unittest.cc b/src/resources/resourcemanager/resourcemanager_unittest.cc index 801c8ae0d..231d5cfc0 100644 --- a/src/resources/resourcemanager/resourcemanager_unittest.cc +++ b/src/resources/resourcemanager/resourcemanager_unittest.cc @@ -48,7 +48,7 @@ namespace { - static int testResouceCounter = 0; + int testResouceCounter = 0; class TestResource : public Resource { diff --git a/src/resources/sdlgfxblitfunc.cpp b/src/resources/sdlgfxblitfunc.cpp index f419893a6..89fe0b21e 100644 --- a/src/resources/sdlgfxblitfunc.cpp +++ b/src/resources/sdlgfxblitfunc.cpp @@ -68,7 +68,7 @@ namespace SDL_PixelFormat *dst; }; - static unsigned int GFX_ALPHA_ADJUST_ARRAY[256] = + unsigned int GFX_ALPHA_ADJUST_ARRAY[256] = { 0, /* 0 */ 15, /* 1 */ -- cgit v1.2.3-60-g2f50