diff options
Diffstat (limited to 'src')
30 files changed, 61 insertions, 65 deletions
diff --git a/src/actorspritemanager.cpp b/src/actorspritemanager.cpp index f1454bfed..f4446cb85 100644 --- a/src/actorspritemanager.cpp +++ b/src/actorspritemanager.cpp @@ -1405,7 +1405,7 @@ void ActorSpriteManager::parseLevels(std::string levels) const { levels.append(", "); size_t f = 0; - const std::string brkEnd = "), "; + const std::string brkEnd("), "); size_t pos = levels.find(brkEnd, f); while (pos != std::string::npos) diff --git a/src/being/actorsprite.cpp b/src/being/actorsprite.cpp index 3feaa4d8b..6d783e6f1 100644 --- a/src/being/actorsprite.cpp +++ b/src/being/actorsprite.cpp @@ -360,9 +360,8 @@ static const char *cursorSize(const int size) void ActorSprite::initTargetCursor() { - static const std::string targetCursorFile = "%s/target-cursor-%s-%s.xml"; - - const std::string path = branding.getStringValue("guiPath"); + static const std::string targetCursorFile("%s/target-cursor-%s-%s.xml"); + const std::string path(branding.getStringValue("guiPath")); // Load target cursors for (int size = TC_SMALL; size < NUM_TC; size++) diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index e6332300b..f1c4c49e2 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -3526,8 +3526,8 @@ void LocalPlayer::afkRespond(ChatTab *const tab, const std::string &nick) if (mAfkTime == 0 || time < mAfkTime || time - mAfkTime > awayLimitTimer) { - const std::string msg = "*AFK*: " - + config.getStringValue("afkMessage"); + const std::string msg("*AFK*: " + + config.getStringValue("afkMessage")); if (!tab) { diff --git a/src/client.cpp b/src/client.cpp index 64dd6ed53..d4ec0fba5 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -2251,7 +2251,7 @@ void Client::initUpdatesDir() #endif const ResourceManager *const resman = ResourceManager::getInstance(); - const std::string updateDir = "/" + mUpdatesDir; + const std::string updateDir("/" + mUpdatesDir); // Verify that the updates directory exists. Create if necessary. if (!resman->isDirectory(updateDir)) diff --git a/src/commands.cpp b/src/commands.cpp index 680890b65..fc033cd83 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -1132,7 +1132,7 @@ impHandler(url) std::string url = args; if (!strStartWith(url, "http") && !strStartWith(url, "?")) url = "http://" + url; - std::string str = strprintf("[@@%s |%s@@]", url.c_str(), args.c_str()); + std::string str(strprintf("[@@%s |%s@@]", url.c_str(), args.c_str())); outStringNormal(tab, str, str); } } diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp index 587938798..29e65df1b 100644 --- a/src/graphicsmanager.cpp +++ b/src/graphicsmanager.cpp @@ -909,7 +909,7 @@ std::string GraphicsManager::errorToString(const GLenum error) { if (error) { - std::string errmsg = "Unknown error"; + std::string errmsg("Unknown error"); switch (error) { case GL_INVALID_ENUM: diff --git a/src/gui/logindialog.cpp b/src/gui/logindialog.cpp index c872b54a5..9af26b6ae 100644 --- a/src/gui/logindialog.cpp +++ b/src/gui/logindialog.cpp @@ -369,7 +369,7 @@ void LoginDialog::prepareUpdate() } else { - std::string str = ""; + std::string str; if (mUpdateHostDropDown) { str = mUpdateHostDropDown->getSelectedString(); diff --git a/src/gui/sdlfont.cpp b/src/gui/sdlfont.cpp index 07da298b2..5e859be53 100644 --- a/src/gui/sdlfont.cpp +++ b/src/gui/sdlfont.cpp @@ -370,7 +370,7 @@ SDLFont::SDLFont(std::string filename, if (!mFont) { logger->log("Error finding font " + filename); - std::string backFile = "fonts/dejavusans.ttf"; + std::string backFile("fonts/dejavusans.ttf"); mFont = openFont(fixDirSeparators(backFile).c_str(), size); if (!mFont) { diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp index 325d43502..fcebad81d 100644 --- a/src/gui/serverdialog.cpp +++ b/src/gui/serverdialog.cpp @@ -588,7 +588,7 @@ void ServerDialog::loadServers(const bool addNew) } const std::string lang = getLangShort(); - const std::string description2 = "description_" + lang; + const std::string description2("description_" + lang); for_each_xml_child_node(serverNode, rootNode) { @@ -707,13 +707,13 @@ void ServerDialog::loadCustomServers() for (int i = 0; i < MAX_SERVERLIST; ++i) { const std::string index = toString(i); - const std::string nameKey = "MostUsedServerDescName" + index; - const std::string descKey = "MostUsedServerDescription" + index; - const std::string hostKey = "MostUsedServerName" + index; - const std::string typeKey = "MostUsedServerType" + index; - const std::string portKey = "MostUsedServerPort" + index; + const std::string nameKey("MostUsedServerDescName" + index); + const std::string descKey("MostUsedServerDescription" + index); + const std::string hostKey("MostUsedServerName" + index); + const std::string typeKey("MostUsedServerType" + index); + const std::string portKey("MostUsedServerPort" + index); const std::string onlineListUrlKey - = "MostUsedServerOnlineList" + index; + ("MostUsedServerOnlineList" + index); ServerInfo server; server.name = config.getValue(nameKey, ""); @@ -771,13 +771,13 @@ void ServerDialog::saveCustomServers(const ServerInfo ¤tServer, continue; const std::string num = toString(savedServerCount); - const std::string nameKey = "MostUsedServerDescName" + num; - const std::string descKey = "MostUsedServerDescription" + num; - const std::string hostKey = "MostUsedServerName" + num; - const std::string typeKey = "MostUsedServerType" + num; - const std::string portKey = "MostUsedServerPort" + num; + const std::string nameKey("MostUsedServerDescName" + num); + const std::string descKey("MostUsedServerDescription" + num); + const std::string hostKey("MostUsedServerName" + num); + const std::string typeKey("MostUsedServerType" + num); + const std::string portKey("MostUsedServerPort" + num); const std::string onlineListUrlKey - = "MostUsedServerOnlineList" + num; + ("MostUsedServerOnlineList" + num); config.setValue(nameKey, toString(server.name)); config.setValue(descKey, toString(server.description)); diff --git a/src/gui/setup_input.cpp b/src/gui/setup_input.cpp index 0a395e6bb..3873c2dd3 100644 --- a/src/gui/setup_input.cpp +++ b/src/gui/setup_input.cpp @@ -285,7 +285,7 @@ void Setup_Input::action(const gcn::ActionEvent &event) else if (strStartWith(id, "tabs_")) { int k = 0; - std::string str = "tabs_"; + std::string str("tabs_"); while (pages[k]) { if (str + pages[k] == id) @@ -307,8 +307,8 @@ void Setup_Input::refreshAssignedKey(const int index) const SetupActionData &key = setupActionData[selectedData][index]; if (key.actionId == static_cast<int>(Input::KEY_NO_VALUE)) { - const std::string str = " \342\200\225\342\200\225\342\200\225" - "\342\200\225\342\200\225 "; + const std::string str(" \342\200\225\342\200\225\342\200\225" + "\342\200\225\342\200\225 "); mKeyListModel->setElementAt(index, str + gettext(key.name.c_str()) + str); } diff --git a/src/gui/setup_relations.cpp b/src/gui/setup_relations.cpp index 8a2641ea8..7e97800d5 100644 --- a/src/gui/setup_relations.cpp +++ b/src/gui/setup_relations.cpp @@ -238,9 +238,9 @@ public: } }; -static const std::string ACTION_DELETE = "delete"; -static const std::string ACTION_TABLE = "table"; -static const std::string ACTION_STRATEGY = "strategy"; +static const std::string ACTION_DELETE("delete"); +static const std::string ACTION_TABLE("table"); +static const std::string ACTION_STRATEGY("strategy"); Setup_Relations::Setup_Relations(const Widget2 *const widget) : SetupTab(widget), diff --git a/src/gui/shopwindow.cpp b/src/gui/shopwindow.cpp index e14dd9be9..feafdb51d 100644 --- a/src/gui/shopwindow.cpp +++ b/src/gui/shopwindow.cpp @@ -476,7 +476,7 @@ void ShopWindow::announce(ShopItems *const list, const int mode) if (!list) return; - std::string data = "\302\202"; + std::string data("\302\202"); if (mode == BUY) data.append("Buy "); else @@ -537,7 +537,7 @@ void ShopWindow::giveList(const std::string &nick, const int mode) if (!checkFloodCounter(mLastRequestTimeList)) return; - std::string data = "\302\202"; + std::string data("\302\202"); ShopItems *list; if (mode == BUY) diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp index 21901e0a4..8f65b6671 100644 --- a/src/gui/theme.cpp +++ b/src/gui/theme.cpp @@ -292,7 +292,7 @@ Skin *Theme::load(const std::string &filename, const std::string &filename2, } else { // first use correct density images - const std::string endStr = "_" + mScreenDensity + ".xml"; + const std::string endStr("_" + mScreenDensity + ".xml"); std::string name = filename; if (findCutLast(name, ".xml")) skin = readSkin(name + endStr, full); @@ -1254,8 +1254,8 @@ ThemeInfo *Theme::loadInfo(const std::string &themeName) ThemeInfo *info = new ThemeInfo(); - const std::string fontSize2 = "fontSize_" + mScreenDensity; - const std::string npcfontSize2 = "npcfontSize_" + mScreenDensity; + const std::string fontSize2("fontSize_" + mScreenDensity); + const std::string npcfontSize2("npcfontSize_" + mScreenDensity); for_each_xml_child_node(infoNode, rootNode) { if (xmlNameEqual(infoNode, "name")) diff --git a/src/gui/updaterwindow.cpp b/src/gui/updaterwindow.cpp index 1dc154b23..8b0dab6b3 100644 --- a/src/gui/updaterwindow.cpp +++ b/src/gui/updaterwindow.cpp @@ -50,10 +50,10 @@ #include "debug.h" -const std::string xmlUpdateFile = "resources.xml"; -const std::string txtUpdateFile = "resources2.txt"; +const std::string xmlUpdateFile("resources.xml"); +const std::string txtUpdateFile("resources2.txt"); const std::string updateServer2 - = "http://download.evolonline.org/manaplus/updates/"; + ("http://download.evolonline.org/manaplus/updates/"); /** * Load the given file into a vector of updateFiles. diff --git a/src/gui/userpalette.cpp b/src/gui/userpalette.cpp index 13bbdced4..75b0f5898 100644 --- a/src/gui/userpalette.cpp +++ b/src/gui/userpalette.cpp @@ -75,7 +75,7 @@ const std::string ColorTypeNames[] = std::string UserPalette::getConfigName(const std::string &typeName) { - std::string res = "Color" + typeName; + std::string res("Color" + typeName); size_t pos = 5; for (size_t i = 0; i < typeName.length(); i++) { diff --git a/src/gui/whoisonline.cpp b/src/gui/whoisonline.cpp index 7590db30b..4fd630a46 100644 --- a/src/gui/whoisonline.cpp +++ b/src/gui/whoisonline.cpp @@ -341,7 +341,7 @@ void WhoIsOnline::loadWebList() // Tokenize and add each line separately char *line = strtok(mMemoryBuffer, "\n"); - const std::string gmText = "(GM)"; + const std::string gmText("(GM)"); FOR_EACH (std::set<OnlinePlayer*>::iterator, itd, mOnlinePlayers) delete *itd; diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp index 804da2f18..aba79034f 100644 --- a/src/gui/widgets/chattab.cpp +++ b/src/gui/widgets/chattab.cpp @@ -142,7 +142,7 @@ void ChatTab::chatLog(std::string line, Own own, own = ACT_IS; } - std::string lineColor = "##C"; + std::string lineColor("##C"); switch (own) { case BY_GM: @@ -500,7 +500,7 @@ void ChatTab::loadFromLogFile(const std::string &name) std::list<std::string>::const_iterator i = list.begin(); while (i != list.end()) { - std::string line = "##9" + *i; + std::string line("##9" + *i); addRow(line); ++i; } diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp index 011f26b83..417133ec6 100644 --- a/src/gui/widgets/setupitem.cpp +++ b/src/gui/widgets/setupitem.cpp @@ -513,8 +513,8 @@ void SetupItemLabel::createControls() { if (mIsSeparator) { - const std::string str = " \342\200\225\342\200\225\342\200\225" - "\342\200\225\342\200\225 "; + const std::string str (" \342\200\225\342\200\225\342\200\225" + "\342\200\225\342\200\225 "); mLabel = new Label(this, std::string(str).append(mText).append(str)); } else diff --git a/src/gui/widgets/tradetab.cpp b/src/gui/widgets/tradetab.cpp index f266f1c8c..c0a4d4d33 100644 --- a/src/gui/widgets/tradetab.cpp +++ b/src/gui/widgets/tradetab.cpp @@ -40,7 +40,7 @@ TradeTab::~TradeTab() void TradeTab::handleInput(const std::string &msg) { - std::string str = "\302\202" + msg; + std::string str("\302\202" + msg); ChatTab::handleInput(str); } diff --git a/src/input/inputmanager.cpp b/src/input/inputmanager.cpp index 0f250dae6..d5e3b3957 100644 --- a/src/input/inputmanager.cpp +++ b/src/input/inputmanager.cpp @@ -174,7 +174,7 @@ void InputManager::store() const const KeyItem &key = kf.values[i2]; if (key.type != INPUT_UNKNOWN) { - std::string tmp = "k"; + std::string tmp("k"); switch (key.type) { case INPUT_MOUSE: diff --git a/src/logger.cpp b/src/logger.cpp index 13ed54fee..35da8973e 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -225,8 +225,8 @@ void Logger::error(const std::string &error_text) // (ConstStr255Param) msg, nullptr, nullptr); #elif defined(__linux__) || defined(_linux) std::cerr << "Error: " << error_text << std::endl; - const std::string msg = "xmessage \"Error happend. " - "Please see log file for more information.\""; + const std::string msg("xmessage \"Error happend. " + "Please see log file for more information.\""); if (system(msg.c_str()) == -1) std::cerr << "Error: " << error_text << std::endl; #else diff --git a/src/map.cpp b/src/map.cpp index 07d28b164..026774138 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -295,7 +295,7 @@ void Map::initializeAmbientLayers() for (int i = 0; hasProperty(std::string("background").append( toString(i)).append("image")); i ++) { - const std::string name = "background" + toString(i); + const std::string name("background" + toString(i)); Image *const img = resman->getImage(getProperty(name + "image")); if (img) diff --git a/src/net/ea/adminhandler.cpp b/src/net/ea/adminhandler.cpp index 36a08bc4c..d9c4e0d88 100644 --- a/src/net/ea/adminhandler.cpp +++ b/src/net/ea/adminhandler.cpp @@ -34,7 +34,7 @@ extern int serverVersion; namespace Ea { -const std::string GENERAL_CHANNEL = ""; +const std::string GENERAL_CHANNEL; void AdminHandler::kickName(const std::string &name) const { diff --git a/src/net/ea/buysellhandler.cpp b/src/net/ea/buysellhandler.cpp index f1eb536fd..601c3fbdf 100644 --- a/src/net/ea/buysellhandler.cpp +++ b/src/net/ea/buysellhandler.cpp @@ -57,7 +57,7 @@ void BuySellHandler::requestSellList(const std::string &nick) const if (nick.empty() != 0 || !shopWindow) return; - const std::string data = "!selllist " + toString(tick_time); + const std::string data("!selllist " + toString(tick_time)); shopWindow->setAcceptPlayer(nick); if (config.getBoolValue("hideShopMessages")) @@ -76,7 +76,7 @@ void BuySellHandler::requestBuyList(const std::string &nick) const if (nick.empty() || !shopWindow) return; - const std::string data = "!buylist " + toString(tick_time); + const std::string data("!buylist " + toString(tick_time)); shopWindow->setAcceptPlayer(nick); if (config.getBoolValue("hideShopMessages")) diff --git a/src/net/ea/chathandler.cpp b/src/net/ea/chathandler.cpp index d40f351c1..403848a88 100644 --- a/src/net/ea/chathandler.cpp +++ b/src/net/ea/chathandler.cpp @@ -339,7 +339,7 @@ void ChatHandler::processChat(Net::MessageIn &msg, const bool normalChat, if (channel.empty()) { - const std::string senseStr = "You sense the following: "; + const std::string senseStr("You sense the following: "); if (actorSpriteManager && !chatMsg.find(senseStr)) { actorSpriteManager->parseLevels( diff --git a/src/resources/colordb.cpp b/src/resources/colordb.cpp index a71e8c639..d947a6523 100644 --- a/src/resources/colordb.cpp +++ b/src/resources/colordb.cpp @@ -33,7 +33,7 @@ namespace { int mHairColorsSize = 0; bool mLoaded = false; - std::string mFail = "#ffffff"; + std::string mFail("#ffffff"); ColorDB::ColorLists mColorLists; } diff --git a/src/utils/cpu.cpp b/src/utils/cpu.cpp index 7f78341b5..e4615b4dd 100644 --- a/src/utils/cpu.cpp +++ b/src/utils/cpu.cpp @@ -90,7 +90,7 @@ void Cpu::detect() void Cpu::printFlags() { - std::string str = "CPU features:"; + std::string str("CPU features:"); if (mCpuFlags & FEATURE_MMX) str.append(" mmx"); if (mCpuFlags & FEATURE_SSE) diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp index 18a3fba12..9c5a53791 100644 --- a/src/utils/stringutils.cpp +++ b/src/utils/stringutils.cpp @@ -387,7 +387,7 @@ void replaceSpecialChars(std::string &text) } if (idx + 1 < f && text[f] == ';') { - std::string str = " "; + std::string str(" "); str[0] = static_cast<signed char>(atoi(text.substr( idx, f - idx).c_str())); text = text.substr(0, pos1) + str + text.substr(f + 1); diff --git a/src/utils/translation/poparser.cpp b/src/utils/translation/poparser.cpp index 55d4e01e2..b2034903d 100644 --- a/src/utils/translation/poparser.cpp +++ b/src/utils/translation/poparser.cpp @@ -133,7 +133,7 @@ bool PoParser::readMsgId() if (mReadingStr) return false; - const std::string msgId1 = "msgid \""; + const std::string msgId1("msgid \""); // check if in reading process if (mReadingId) @@ -175,7 +175,7 @@ bool PoParser::readMsgId() bool PoParser::readMsgStr() { - const std::string msgStr1 = "msgstr \""; + const std::string msgStr1("msgstr \""); // check if in reading process if (mReadingStr) diff --git a/src/utils/translation/translationmanager.cpp b/src/utils/translation/translationmanager.cpp index 0a5e7bca5..6036ddeab 100644 --- a/src/utils/translation/translationmanager.cpp +++ b/src/utils/translation/translationmanager.cpp @@ -109,14 +109,11 @@ bool TranslationManager::translateFile(const std::string &fileName, const size_t pos2 = str.find(">>", pos1 + 2); if (pos2 == std::string::npos) break; - const std::string key = str.substr(pos1 + 2, pos2 - pos1 - 2); - const std::string key2 = "<<" + str.substr( - pos1 + 2, pos2 - pos1 - 2) + ">>"; - const std::string val = dict->getStr(key); - -// logger->log("key:" + key); + const std::string key(str.substr(pos1 + 2, pos2 - pos1 - 2)); + const std::string key2("<<" + str.substr( + pos1 + 2, pos2 - pos1 - 2) + ">>"); + const std::string val(dict->getStr(key)); replaceAll(str, key2, val); - oldPos1 = pos1; } |