diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-12-25 03:08:37 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-12-25 03:08:37 +0300 |
commit | 39029943851dfc318fabb95357e00b81d2735547 (patch) | |
tree | dfd195791587c51e6dca166dda8a016a1760d3bf | |
parent | 10f59701112130cf953a2af7ef4ae82d9d823fe6 (diff) | |
download | manaverse-39029943851dfc318fabb95357e00b81d2735547.tar.gz manaverse-39029943851dfc318fabb95357e00b81d2735547.tar.bz2 manaverse-39029943851dfc318fabb95357e00b81d2735547.tar.xz manaverse-39029943851dfc318fabb95357e00b81d2735547.zip |
Improve empty strings manipulation.
36 files changed, 76 insertions, 76 deletions
diff --git a/src/chatlogger.cpp b/src/chatlogger.cpp index 23a0e4aef..61e44a5bb 100644 --- a/src/chatlogger.cpp +++ b/src/chatlogger.cpp @@ -216,7 +216,7 @@ void ChatLogger::loadLast(std::string name, std::list<std::string> &list, void ChatLogger::clear() { - mLogDir = ""; - mServerName = ""; - mLogFileName = ""; + mLogDir.clear(); + mServerName.clear(); + mLogFileName.clear(); } diff --git a/src/client.cpp b/src/client.cpp index 2ec9c183c..7248aae43 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -1029,7 +1029,7 @@ int Client::gameExec() if (loginData.remember) loginData.username = serverConfig.getValue("username", ""); else - loginData.username = ""; + loginData.username.clear(); } else { @@ -1543,7 +1543,7 @@ int Client::gameExec() mCurrentDialog->addActionListener(&accountListener); mCurrentDialog = nullptr; // OkDialog deletes itself loginData.password = loginData.newPassword; - loginData.newPassword = ""; + loginData.newPassword.clear(); BLOCK_END("Client::gameExec STATE_CHANGEPASSWORD_SUCCESS") break; @@ -1716,7 +1716,7 @@ void Client::action(const gcn::ActionEvent &event) return; } if (eventId == "Setup") - tab = ""; + tab.clear(); else if (eventId == "Video") tab = "Video"; else if (eventId == "Themes") @@ -1965,7 +1965,7 @@ void Client::initConfiguration() const config.setValue("fpslimit", 60); std::string defaultUpdateHost = branding.getValue("defaultUpdateHost", ""); if (!checkPath(defaultUpdateHost)) - defaultUpdateHost = ""; + defaultUpdateHost.clear(); config.setValue("updatehost", defaultUpdateHost); config.setValue("customcursor", true); config.setValue("useScreenshotDirectorySuffix", true); @@ -2163,7 +2163,7 @@ void Client::accountLogin(LoginData *const data) const Net::getLoginHandler()->loginAccount(data); // Clear the password, avoids auto login when returning to login - data->password = ""; + data->password.clear(); // TODO This is not the best place to save the config, but at least better // than the login gui window diff --git a/src/commands.cpp b/src/commands.cpp index 31e3d3fe2..600b86f4b 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -307,7 +307,7 @@ impHandler(msg) else { recvnick = std::string(args); - msg = ""; + msg.clear(); } } @@ -1164,7 +1164,7 @@ void replaceVars(std::string &str) if (str.find("<PEOPLE>") != std::string::npos) { StringVect names; - std::string newStr = ""; + std::string newStr; actorSpriteManager->getPlayerNames(names, false); for (StringVectCIter it = names.begin(), it_end = names.end(); it != it_end; ++ it) @@ -1182,7 +1182,7 @@ void replaceVars(std::string &str) if (str.find("<PARTY>") != std::string::npos) { StringVect names; - std::string newStr = ""; + std::string newStr; const Party *party = nullptr; if (player_node->isInParty() && (party = player_node->getParty())) { diff --git a/src/configuration.cpp b/src/configuration.cpp index 9d09751e4..07a097de2 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -697,7 +697,7 @@ void Configuration::init(const std::string &filename, const bool useResManager) if (useResManager) { mConfigPath = "PhysFS://" + filename; - mDirectory = ""; + mDirectory.clear(); } else { diff --git a/src/game.cpp b/src/game.cpp index dbae184c6..dd0f1233b 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -634,7 +634,7 @@ void Game::slowLogic() Client::setFramerate(config.getIntValue("fpslimit")); mNextAdjustTime = cur_time + adjustDelay; if (Client::getState() != STATE_ERROR) - errorMessage = ""; + errorMessage.clear(); } else { diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp index 960554be1..cc9f76ce4 100644 --- a/src/gui/chatwindow.cpp +++ b/src/gui/chatwindow.cpp @@ -679,7 +679,7 @@ void ChatWindow::doPresent() const return; const ActorSprites &actors = actorSpriteManager->getAll(); - std::string response = ""; + std::string response; int playercount = 0; for (ActorSpritesConstIterator it = actors.begin(), it_end = actors.end(); diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp index ba78adcfd..07073fb71 100644 --- a/src/gui/itempopup.cpp +++ b/src/gui/itempopup.cpp @@ -260,6 +260,6 @@ void ItemPopup::mouseMoved(gcn::MouseEvent &event) // When the mouse moved on top of the popup, hide it setVisible(false); - mLastName = ""; + mLastName.clear(); mLastColor = 1; } diff --git a/src/gui/logindialog.cpp b/src/gui/logindialog.cpp index 00c5ab54d..41016b05c 100644 --- a/src/gui/logindialog.cpp +++ b/src/gui/logindialog.cpp @@ -268,8 +268,8 @@ void LoginDialog::action(const gcn::ActionEvent &event) } else { - mLoginData->updateHost = ""; - *mUpdateHost = ""; + mLoginData->updateHost.clear(); + (*mUpdateHost).clear(); } } else if (mUpdateHostDropDown) @@ -283,8 +283,8 @@ void LoginDialog::action(const gcn::ActionEvent &event) } else { - mLoginData->updateHost = ""; - *mUpdateHost = ""; + mLoginData->updateHost.clear(); + (*mUpdateHost).clear(); } } diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp index f552deb60..84ca51a18 100644 --- a/src/gui/npcdialog.cpp +++ b/src/gui/npcdialog.cpp @@ -235,7 +235,7 @@ void NpcDialog::addText(const std::string &text, const bool save) if (save || mLogInteraction) { if (mText.size() > 5000) - mText = ""; + mText.clear(); mNewText += text; mTextBox->addRow(text); diff --git a/src/gui/outfitwindow.cpp b/src/gui/outfitwindow.cpp index 383b85ca7..3e29adb5f 100644 --- a/src/gui/outfitwindow.cpp +++ b/src/gui/outfitwindow.cpp @@ -218,8 +218,8 @@ void OutfitWindow::save() serverConfig.setValue("OutfitUnequip" + toString(o), mItemsUnequip[o]); } - outfitStr = ""; - outfitColorsStr = ""; + outfitStr.clear(); + outfitColorsStr.clear(); } serverConfig.setValue("OutfitAwayIndex", mAwayOutfit); } diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index c6838079c..77c022ffe 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -663,7 +663,7 @@ void PopupMenu::showChangePos(const int x, const int y) mFloorItemId = 0; mItem = nullptr; mMapItem = nullptr; - mNick = ""; + mNick.clear(); mType = static_cast<int>(Being::UNKNOWN); mX = 0; mY = 0; @@ -1611,7 +1611,7 @@ void PopupMenu::handleLink(const std::string &link, mItemId = 0; mItemColor = 1; mMapItem = nullptr; - mNick = ""; + mNick.clear(); mType = static_cast<int>(Being::UNKNOWN); mX = 0; mY = 0; @@ -1629,7 +1629,7 @@ void PopupMenu::showPopup(Window *const parent, const int x, const int y, mWindow = parent; mX = x; mY = y; - mNick = ""; + mNick.clear(); mBrowserBox->clearRows(); const int cnt = item->getQuantity(); @@ -1760,7 +1760,7 @@ void PopupMenu::showItemPopup(const int x, const int y, Item *const item) mItemId = 0; mItemColor = 1; } - mNick = ""; + mNick.clear(); mBrowserBox->clearRows(); if (item) @@ -1813,7 +1813,7 @@ void PopupMenu::showDropPopup(const int x, const int y, Item *const item) mItem = item; mX = x; mY = y; - mNick = ""; + mNick.clear(); mBrowserBox->clearRows(); if (item) diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp index ec97b73c6..4ff77bdbd 100644 --- a/src/gui/serverdialog.cpp +++ b/src/gui/serverdialog.cpp @@ -373,7 +373,7 @@ void ServerDialog::connectToSelectedServer() if (!LoginDialog::savedPasswordKey.empty()) { if (mServerInfo->hostname != LoginDialog::savedPasswordKey) - LoginDialog::savedPassword = ""; + LoginDialog::savedPassword.clear(); } config.setValue("usePersistentIP", diff --git a/src/gui/setup_theme.cpp b/src/gui/setup_theme.cpp index 658877eed..277ddadae 100644 --- a/src/gui/setup_theme.cpp +++ b/src/gui/setup_theme.cpp @@ -312,7 +312,7 @@ void Setup_Theme::updateInfo() } else { - mThemeInfo = ""; + mThemeInfo.clear(); } replaceAll(mThemeInfo, "\\n", "\n"); mInfoButton->setEnabled(!mThemeInfo.empty()); @@ -324,7 +324,7 @@ void Setup_Theme::action(const gcn::ActionEvent &event) if (event.getId() == ACTION_THEME) { if (mThemeDropDown->getSelected() == 0) - mTheme = ""; + mTheme.clear(); else mTheme = mThemeDropDown->getSelectedString(); updateInfo(); @@ -337,7 +337,7 @@ void Setup_Theme::action(const gcn::ActionEvent &event) { const int id = mLangDropDown->getSelected(); if (id < 0 || id >= langs_count) - mLang = ""; + mLang.clear(); else mLang = LANG_NAME[id].value; } diff --git a/src/gui/shopwindow.cpp b/src/gui/shopwindow.cpp index 8be665d08..0d65c1524 100644 --- a/src/gui/shopwindow.cpp +++ b/src/gui/shopwindow.cpp @@ -200,12 +200,12 @@ void ShopWindow::action(const gcn::ActionEvent &event) } else if (event.getId() == "no") { - mTradeNick = ""; + mTradeNick.clear(); } else if (event.getId() == "ignore") { player_relations.ignoreTrade(mTradeNick); - mTradeNick = ""; + mTradeNick.clear(); } else if (event.getId() == "delete buy" && mBuyShopItemList && mBuyShopItemList->getSelected() >= 0) @@ -286,7 +286,7 @@ void ShopWindow::startTrade() } Net::getTradeHandler()->request(being); tradePartnerName = mTradeNick; - mTradeNick = ""; + mTradeNick.clear(); } void ShopWindow::valueChanged(const gcn::SelectionEvent &event A_UNUSED) diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp index aa60fedb1..219223240 100644 --- a/src/gui/skilldialog.cpp +++ b/src/gui/skilldialog.cpp @@ -407,7 +407,7 @@ void SkillDialog::loadSkills() SkillInfo *const skill = new SkillInfo; skill->id = 1; skill->data->name = _("basic"); - skill->data->description = ""; + skill->data->description.clear(); skill->data->dispName = _("basic, 1"); skill->data->shortName = "bas"; skill->data->setIcon(""); @@ -544,7 +544,7 @@ void SkillDialog::addSkill(const int id, const int level, const int range, skill->id = static_cast<short unsigned>(id); skill->data->name = "Unknown skill Id: " + toString(id); skill->data->dispName = "Unknown skill Id: " + toString(id); - skill->data->description = ""; + skill->data->description.clear(); skill->data->setIcon(""); skill->modifiable = modifiable; skill->visible = false; diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp index fd8114584..90899ea6f 100644 --- a/src/gui/socialwindow.cpp +++ b/src/gui/socialwindow.cpp @@ -1331,7 +1331,7 @@ SocialWindow::~SocialWindow() mPartyAcceptDialog->scheduleDelete(); mPartyAcceptDialog = nullptr; - mPartyInviter = ""; + mPartyInviter.clear(); } delete mCreatePopup; mCreatePopup = nullptr; @@ -1446,7 +1446,7 @@ void SocialWindow::action(const gcn::ActionEvent &event) Net::getPartyHandler()->inviteResponse(mPartyInviter, false); } - mPartyInviter = ""; + mPartyInviter.clear(); mPartyAcceptDialog = nullptr; } else if (event.getSource() == mGuildAcceptDialog) diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp index 8a4f3573c..8be991bd6 100644 --- a/src/gui/theme.cpp +++ b/src/gui/theme.cpp @@ -646,8 +646,8 @@ void Theme::prepareThemePath() { initDefaultThemePath(); - mThemePath = ""; - mThemeName = ""; + mThemePath.clear(); + mThemeName.clear(); // Try theme from settings if (tryThemePath(config.getStringValue("theme"))) diff --git a/src/gui/tradewindow.cpp b/src/gui/tradewindow.cpp index 4adb718c4..4bbfed638 100644 --- a/src/gui/tradewindow.cpp +++ b/src/gui/tradewindow.cpp @@ -398,7 +398,7 @@ void TradeWindow::close() void TradeWindow::clear() { mAutoAddItem = nullptr; - mAutoAddToNick = ""; + mAutoAddToNick.clear(); mAutoMoney = 0; mAutoAddAmount = 0; mGotMoney = 0; diff --git a/src/gui/updaterwindow.cpp b/src/gui/updaterwindow.cpp index 2abb8979c..e6dbfc05d 100644 --- a/src/gui/updaterwindow.cpp +++ b/src/gui/updaterwindow.cpp @@ -117,7 +117,7 @@ std::vector<updateFile> loadTxtFile(const std::string &fileName) thisFile.hash = hash; thisFile.type = "data"; thisFile.required = true; - thisFile.desc = ""; + thisFile.desc.clear(); if (!thisFile.name.empty() && checkPath(thisFile.name)) files.push_back(thisFile); diff --git a/src/gui/whoisonline.cpp b/src/gui/whoisonline.cpp index 4dd1df2b6..f0b0ab538 100644 --- a/src/gui/whoisonline.cpp +++ b/src/gui/whoisonline.cpp @@ -365,7 +365,7 @@ void WhoIsOnline::loadWebList() else { nick = lineStr; - lineStr = ""; + lineStr.clear(); } trim(nick); @@ -736,7 +736,7 @@ void WhoIsOnline::optionChanged(const std::string &name) void OnlinePlayer::setText(std::string color) { - mText = ""; + mText.clear(); if (mStatus != 255 && actorSpriteManager) { diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp index dcb280596..5a5027982 100644 --- a/src/gui/widgets/avatarlistbox.cpp +++ b/src/gui/widgets/avatarlistbox.cpp @@ -344,7 +344,7 @@ void AvatarListBox::mousePressed(gcn::MouseEvent &event) { std::string name; if (model->getAvatarAt(selected)->getLevel() == 0) - name = ""; + name.clear(); else name = model->getAvatarAt(selected)->getName(); @@ -357,7 +357,7 @@ void AvatarListBox::mousePressed(gcn::MouseEvent &event) { std::string name; if (model->getAvatarAt(selected)->getLevel() == 0) - name = ""; + name.clear(); else name = model->getAvatarAt(selected)->getName(); diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index 55bbcc89c..776b2eb29 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -695,7 +695,7 @@ std::string BrowserBox::getTextAtPos(const int x, const int y) const // textX = x - textX; textY = y - textY; - std::string str = ""; + std::string str; int lastY = 0; diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp index d2d66e681..2fc19a473 100644 --- a/src/gui/widgets/chattab.cpp +++ b/src/gui/widgets/chattab.cpp @@ -110,7 +110,7 @@ void ChatTab::chatLog(std::string line, Own own, CHATLOG tmp; tmp.own = own; - tmp.nick = ""; + tmp.nick.clear(); tmp.text = line; const size_t pos = line.find(" : "); @@ -173,7 +173,7 @@ void ChatTab::chatLog(std::string line, Own own, lineColor = "##S"; break; case BY_CHANNEL: - tmp.nick = ""; + tmp.nick.clear(); // TODO: Use a predefined color lineColor = "##2"; // Equiv. to BrowserBox::GREEN break; @@ -185,7 +185,7 @@ void ChatTab::chatLog(std::string line, Own own, lineColor = "##I"; break; case BY_LOGGER: - tmp.nick = ""; + tmp.nick.clear(); tmp.text = line; lineColor = "##L"; break; @@ -196,7 +196,7 @@ void ChatTab::chatLog(std::string line, Own own, if (tmp.nick == ": ") { - tmp.nick = ""; + tmp.nick.clear(); lineColor = "##S"; } diff --git a/src/gui/widgets/passwordfield.cpp b/src/gui/widgets/passwordfield.cpp index 512c12761..42bd8d0d0 100644 --- a/src/gui/widgets/passwordfield.cpp +++ b/src/gui/widgets/passwordfield.cpp @@ -39,7 +39,7 @@ void PasswordField::draw(gcn::Graphics *graphics) if (mPasswordChar) mText.assign(mText.length(), mPasswordChar); else - mText = ""; + mText.clear(); TextField::draw(graphics); mText = original; BLOCK_END("PasswordField::draw") diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 3ec5c6b71..890191bcc 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -369,7 +369,7 @@ void LocalPlayer::setAction(const Action &action, const int attackType) { debugMsg(strprintf(_("You were killed by %s"), mLastHitFrom.c_str())); - mLastHitFrom = ""; + mLastHitFrom.clear(); } setTarget(nullptr); } @@ -3821,8 +3821,8 @@ void LocalPlayer::cancelFollow() debugMsg(_("Follow canceled")); if (!mPlayerImitated.empty()) debugMsg(_("Imitation canceled")); - mPlayerFollowed = ""; - mPlayerImitated = ""; + mPlayerFollowed.clear(); + mPlayerImitated.clear(); } void LocalPlayer::imitateEmote(const Being *const being, @@ -4179,7 +4179,7 @@ void LocalPlayer::checkNewName(Being *const being) { debugMsg(_("You see ") + mWaitFor); sound.playGuiSound(SOUND_INFO); - mWaitFor = ""; + mWaitFor.clear(); } } diff --git a/src/main.cpp b/src/main.cpp index baa356386..1fe71fcfa 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -151,7 +151,7 @@ static void parseOptions(const int argc, char *const argv[], if (checkPath(optarg)) options.updateHost = optarg; else - options.updateHost = ""; + options.updateHost.clear(); break; case 'c': options.character = optarg; @@ -193,7 +193,7 @@ static void parseOptions(const int argc, char *const argv[], break; case 'T': options.testMode = true; - options.test = ""; + options.test.clear(); break; case 't': options.testMode = true; diff --git a/src/net/ea/loginhandler.cpp b/src/net/ea/loginhandler.cpp index 3f8c22502..2109678e2 100644 --- a/src/net/ea/loginhandler.cpp +++ b/src/net/ea/loginhandler.cpp @@ -171,7 +171,7 @@ void LoginHandler::processUpdateHost(Net::MessageIn &msg) if (!checkPath(mUpdateHost)) { - mUpdateHost = ""; + mUpdateHost.clear(); logger->log1("Warning: incorrect update server name"); } loginData.updateHost = mUpdateHost; @@ -233,7 +233,7 @@ void LoginHandler::processLoginError(Net::MessageIn &msg) break; case 1: errorMessage = _("Wrong password."); - LoginDialog::savedPassword = ""; + LoginDialog::savedPassword.clear(); break; case 2: errorMessage = _("Account expired."); diff --git a/src/net/eathena/beinghandler.cpp b/src/net/eathena/beinghandler.cpp index 857a0a8fb..b8b92ddde 100644 --- a/src/net/eathena/beinghandler.cpp +++ b/src/net/eathena/beinghandler.cpp @@ -285,7 +285,7 @@ void BeingHandler::processBeingChangeLook(Net::MessageIn &msg, bool look2) id2 = msg.readInt16(); else id2 = 1; - color = ""; + color.clear(); } if (dstBeing->getType() == Being::PLAYER) diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp index 9d9c82fce..803ae63a2 100644 --- a/src/net/tmwa/beinghandler.cpp +++ b/src/net/tmwa/beinghandler.cpp @@ -287,7 +287,7 @@ void BeingHandler::processBeingChangeLook(Net::MessageIn &msg, bool look2) id2 = msg.readInt16(); else id2 = 1; - color = ""; + color.clear(); } if (dstBeing->getType() == Being::PLAYER) diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp index c6a854c33..91e82d68b 100644 --- a/src/resources/itemdb.cpp +++ b/src/resources/itemdb.cpp @@ -226,7 +226,7 @@ void ItemDB::load() if (id <= -1 && id > -100) colors = "hair"; else - colors = ""; + colors.clear(); } std::string tags[3]; diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp index e7c20aa6f..f78674913 100644 --- a/src/resources/iteminfo.cpp +++ b/src/resources/iteminfo.cpp @@ -155,7 +155,7 @@ void ItemInfo::setColorsList(std::string name) if (name.empty()) { mColors = nullptr; - mColorList = ""; + mColorList.clear(); } else { diff --git a/src/spellmanager.cpp b/src/spellmanager.cpp index 746331851..4e710b64a 100644 --- a/src/spellmanager.cpp +++ b/src/spellmanager.cpp @@ -356,7 +356,7 @@ std::string SpellManager::autoComplete(std::string partName) std::vector<TextCommand*>::const_iterator i = mSpellsVector.begin(); const std::vector<TextCommand*>::const_iterator i_end = mSpellsVector.end(); - std::string newName = ""; + std::string newName; const TextCommand *newCommand = nullptr; while (i != i_end) diff --git a/src/test/testmain.cpp b/src/test/testmain.cpp index dec7b3248..a305ae239 100644 --- a/src/test/testmain.cpp +++ b/src/test/testmain.cpp @@ -34,7 +34,7 @@ #include "debug.h" -std::string fileName = ""; +std::string fileName; extern char *selfName; TestMain::TestMain() : diff --git a/src/units.cpp b/src/units.cpp index aa532ed36..bfe14276e 100644 --- a/src/units.cpp +++ b/src/units.cpp @@ -157,7 +157,7 @@ void Units::loadUnits() // Add one more level for saftey struct UnitLevel lev; - lev.symbol = ""; + lev.symbol.clear(); lev.count = INT_MAX; lev.round = 0; diff --git a/src/utils/translation/poparser.cpp b/src/utils/translation/poparser.cpp index b7c9a55ec..3a415b27b 100644 --- a/src/utils/translation/poparser.cpp +++ b/src/utils/translation/poparser.cpp @@ -64,8 +64,8 @@ PoDict *PoParser::load(const std::string &lang, const std::string &fileName, else openFile(fileName); - mMsgId = ""; - mMsgStr = ""; + mMsgId.clear(); + mMsgStr.clear(); // cycle by msgid+msgstr while (readLine()) @@ -98,8 +98,8 @@ PoDict *PoParser::load(const std::string &lang, const std::string &fileName, mDict->set(mMsgId, mMsgStr); } - mMsgId = ""; - mMsgStr = ""; + mMsgId.clear(); + mMsgStr.clear(); } return mDict; @@ -135,7 +135,7 @@ bool PoParser::readMsgId() { // reading text from: "text" mMsgId += mLine.substr(1, mLine.size() - 2); - mLine = ""; + mLine.clear(); return true; } // stop reading in other case @@ -151,7 +151,7 @@ bool PoParser::readMsgId() // reading text from: msgid "text" mMsgId += mLine.substr(msgId1.size(), mLine.size() - 1 - msgId1.size()); - mLine = ""; + mLine.clear(); return true; } // stop reading if we don't read msgid before @@ -176,7 +176,7 @@ bool PoParser::readMsgStr() { // reading text from: "text" mMsgStr += mLine.substr(1, mLine.size() - 2); - mLine = ""; + mLine.clear(); return true; } // stop reading in other case @@ -191,7 +191,7 @@ bool PoParser::readMsgStr() // reading text from: msgid "text" mMsgStr += mLine.substr(msgStr1.size(), mLine.size() - 1 - msgStr1.size()); - mLine = ""; + mLine.clear(); return true; } } diff --git a/src/utils/translation/translationmanager.cpp b/src/utils/translation/translationmanager.cpp index fe5d0951a..4d5767c8a 100644 --- a/src/utils/translation/translationmanager.cpp +++ b/src/utils/translation/translationmanager.cpp @@ -60,7 +60,7 @@ PoDict *TranslationManager::loadLang(LangVect lang, const std::string &subName, PoDict *const dict) { - std::string name = ""; + std::string name; PoParser parser; for (LangIter it = lang.begin(), it_end = lang.end(); it != it_end; ++ it) |