From 90656bf081fde45eb6e1aab2cd50a3a2b8dd17c8 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 8 Jun 2017 03:51:32 +0300 Subject: Remove useless string initialisations. --- src/actions/chat.cpp | 2 +- src/configuration.cpp | 2 +- src/const/gui/chat.h | 2 +- src/const/resources/spriteaction.h | 2 +- src/gui/models/modelistmodel.cpp | 2 +- src/gui/windows/chatwindow.cpp | 2 +- src/gui/windows/logindialog.cpp | 4 ++-- src/net/download.cpp | 2 +- src/utils/stringutils_unittest.cc | 20 ++++++++++---------- 9 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/actions/chat.cpp b/src/actions/chat.cpp index 99d847c39..c0aea0179 100644 --- a/src/actions/chat.cpp +++ b/src/actions/chat.cpp @@ -667,7 +667,7 @@ impHandler(guildNotice) } const std::string str1 = args.substr(0, 60); - std::string str2(""); + std::string str2; if (args.size() > 60) str2 = args.substr(60); const Guild *const guild = localPlayer->getGuild(); diff --git a/src/configuration.cpp b/src/configuration.cpp index f820a6c49..9e0fd1412 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -494,7 +494,7 @@ int Configuration::resetIntValue(const std::string &key) std::string Configuration::getStringValue(const std::string &key) const { GETLOG(); - std::string defaultValue(""); + std::string defaultValue; const Options::const_iterator iter = mOptions.find(key); if (iter == mOptions.end()) { diff --git a/src/const/gui/chat.h b/src/const/gui/chat.h index 5b3eadb2a..a39516e13 100644 --- a/src/const/gui/chat.h +++ b/src/const/gui/chat.h @@ -25,7 +25,7 @@ #include -const std::string GENERAL_CHANNEL = ""; +const std::string GENERAL_CHANNEL; const std::string GM_CHANNEL = "#gm"; const std::string TRADE_CHANNEL = "#trade"; diff --git a/src/const/resources/spriteaction.h b/src/const/resources/spriteaction.h index 988eda378..da865d3df 100644 --- a/src/const/resources/spriteaction.h +++ b/src/const/resources/spriteaction.h @@ -68,7 +68,7 @@ namespace SpriteAction static const std::string DEADWATER("deadwater"); static const std::string DEADRIDE("deadride"); - static const std::string INVALID(""); + static const std::string INVALID; } // namespace SpriteAction #endif // CONST_RESOURCES_SPRITEACTION_H diff --git a/src/gui/models/modelistmodel.cpp b/src/gui/models/modelistmodel.cpp index 3c39921ad..d1253b9f1 100644 --- a/src/gui/models/modelistmodel.cpp +++ b/src/gui/models/modelistmodel.cpp @@ -90,7 +90,7 @@ void ModeListModel::addCustomMode(const std::string &mode) int ModeListModel::getIndexOf(const std::string &widthXHeightMode) { - std::string currentMode(""); + std::string currentMode; for (int i = 0; i < getNumberOfElements(); i++) { currentMode = getElementAt(i); diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index a9c686f3a..8ef8e9f75 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -1370,7 +1370,7 @@ std::string ChatWindow::addColors(std::string &msg) return msg; } - std::string newMsg(""); + std::string newMsg; const int cMap[] = {1, 4, 5, 2, 3, 6, 7, 9, 0, 8}; // rainbow diff --git a/src/gui/windows/logindialog.cpp b/src/gui/windows/logindialog.cpp index 746d37878..e99d1b68e 100644 --- a/src/gui/windows/logindialog.cpp +++ b/src/gui/windows/logindialog.cpp @@ -51,8 +51,8 @@ #include "debug.h" -std::string LoginDialog::savedPassword(""); -std::string LoginDialog::savedPasswordKey(""); +std::string LoginDialog::savedPassword; +std::string LoginDialog::savedPasswordKey; namespace { diff --git a/src/net/download.cpp b/src/net/download.cpp index 7dbb06e3c..5d9c434de 100644 --- a/src/net/download.cpp +++ b/src/net/download.cpp @@ -48,7 +48,7 @@ enum namespace Net { -std::string Download::mUploadResponse = ""; +std::string Download::mUploadResponse; Download::Download(void *const ptr, const std::string &url, diff --git a/src/utils/stringutils_unittest.cc b/src/utils/stringutils_unittest.cc index a6c187ac5..354232965 100644 --- a/src/utils/stringutils_unittest.cc +++ b/src/utils/stringutils_unittest.cc @@ -224,7 +224,7 @@ TEST_CASE("stringuntils parseNumber 1", "") TEST_CASE("stringuntils removeToken 1", "") { - std::string str = ""; + std::string str; REQUIRE(removeToken(str, " ").empty()); REQUIRE(str.empty()); @@ -292,8 +292,8 @@ TEST_CASE("stringuntils removeColors 1", "") TEST_CASE("stringuntils compareStrI 1", "") { - std::string str1 = ""; - std::string str2 = ""; + std::string str1; + std::string str2; REQUIRE(0 == compareStrI(str1, str2)); str1 = "test"; @@ -326,8 +326,8 @@ TEST_CASE("stringuntils isWordSeparator 1", "") TEST_CASE("stringuntils findSameSubstring", "") { - std::string str1 = ""; - std::string str2 = ""; + std::string str1; + std::string str2; REQUIRE(findSameSubstring("", "").empty()); @@ -346,8 +346,8 @@ TEST_CASE("stringuntils findSameSubstring", "") TEST_CASE("stringuntils findSameSubstringI", "") { - std::string str1 = ""; - std::string str2 = ""; + std::string str1; + std::string str2; REQUIRE(findSameSubstringI("", "").empty()); @@ -524,9 +524,9 @@ TEST_CASE("stringuntils getFileDir 1", "") TEST_CASE("stringuntils replaceAll 1", "") { - std::string str1 = ""; - std::string str2 = ""; - std::string str3 = ""; + std::string str1; + std::string str2; + std::string str3; REQUIRE(replaceAll(str1, str2, str3).empty()); -- cgit v1.2.3-70-g09d2