From b0d6ef00eebb7dcd03b051db63840c04243a784d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 8 Jun 2017 03:34:07 +0300 Subject: Add missing consts or string references. --- src/being/being.cpp | 2 +- src/fs/virtfs/tools.cpp | 2 +- src/gui/popups/popupmenu.cpp | 2 +- src/gui/widgets/itemcontainer.cpp | 4 ++-- src/gui/windows/helpwindow.cpp | 2 +- src/utils/langs.cpp | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/being/being.cpp b/src/being/being.cpp index a2cdf110f..9029b5ae1 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -5345,7 +5345,7 @@ void Being::setLanguageId(const int lang) restrict2 noexcept2 if (lang != mLanguageId) { delete2(mBadges[BadgeIndex::Lang]); - const std::string badge = LanguageDb::getIcon(lang); + const std::string &badge = LanguageDb::getIcon(lang); if (!badge.empty()) { mBadges[BadgeIndex::Lang] = AnimatedSprite::load(pathJoin( diff --git a/src/fs/virtfs/tools.cpp b/src/fs/virtfs/tools.cpp index 7850d056b..b0d6ce067 100644 --- a/src/fs/virtfs/tools.cpp +++ b/src/fs/virtfs/tools.cpp @@ -80,7 +80,7 @@ namespace VirtFs StringVect &list, const std::string &ext) { - const std::string path = dir; + const std::string &path = dir; StringVect tempList; VirtFs::getFilesWithDir(path, tempList); FOR_EACH (StringVectCIter, it, tempList) diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index b5a337b1c..8a4392143 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -905,7 +905,7 @@ void PopupMenu::showChatPopup(const int x, const int y, ChatTab *const tab) if (type == ChatTabType::WHISPER) { const WhisperTab *const wTab = static_cast(tab); - std::string name = wTab->getNick(); + const std::string &name = wTab->getNick(); const Being* const being = actorManager->findBeingByName( name, ActorType::Player); diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index 15e2df093..450379392 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -203,8 +203,8 @@ namespace const ItemDbTypeT t2 = info2.getType(); if (t1 == t2) { - const std::string name1 = info1.getName(); - const std::string name2 = info2.getName(); + const std::string &name1 = info1.getName(); + const std::string &name2 = info2.getName(); if (name1 == name2) { return pair1->mItem->getInvIndex() < diff --git a/src/gui/windows/helpwindow.cpp b/src/gui/windows/helpwindow.cpp index 3a2c542ad..85a14594d 100644 --- a/src/gui/windows/helpwindow.cpp +++ b/src/gui/windows/helpwindow.cpp @@ -110,7 +110,7 @@ void HelpWindow::handleLink(const std::string &link, { if (!strStartWith(link, "http://") && !strStartWith(link, "https://")) { - std::string helpFile = link; + const std::string &helpFile = link; loadHelp(helpFile); } else diff --git a/src/utils/langs.cpp b/src/utils/langs.cpp index 595a7ea09..b4672197a 100644 --- a/src/utils/langs.cpp +++ b/src/utils/langs.cpp @@ -69,7 +69,7 @@ LangVect getServerLang() LangVect langs; #ifndef DYECMD const int id = PlayerInfo::getServerLanguage(); - std::string lang = LanguageDb::getPo(id); + const std::string &lang = LanguageDb::getPo(id); if (lang.empty()) return langs; langs.push_back(lang); -- cgit v1.2.3-70-g09d2