diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-12-10 16:46:55 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-12-10 16:46:55 +0300 |
commit | 608dfae22e1b5145210314ca6c7268420dd639c8 (patch) | |
tree | 5f7317be7e895a1f8aede182ea69ef56d456c54f /src/gui | |
parent | 9eb389060d44672c311a36348036eab297859e7e (diff) | |
download | manaverse-608dfae22e1b5145210314ca6c7268420dd639c8.tar.gz manaverse-608dfae22e1b5145210314ca6c7268420dd639c8.tar.bz2 manaverse-608dfae22e1b5145210314ca6c7268420dd639c8.tar.xz manaverse-608dfae22e1b5145210314ca6c7268420dd639c8.zip |
Fix some issues found by automatic checks.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/models/modelistmodel.cpp | 8 | ||||
-rw-r--r-- | src/gui/widgets/browserbox.cpp | 10 | ||||
-rw-r--r-- | src/gui/widgets/tabs/setup_video.cpp | 4 | ||||
-rw-r--r-- | src/gui/widgets/textbox.cpp | 12 | ||||
-rw-r--r-- | src/gui/windows/chatwindow.cpp | 10 | ||||
-rw-r--r-- | src/gui/windows/npcdialog.cpp | 2 | ||||
-rw-r--r-- | src/gui/windows/registerdialog.cpp | 2 | ||||
-rw-r--r-- | src/gui/windows/shopwindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/windows/whoisonline.cpp | 2 |
9 files changed, 26 insertions, 26 deletions
diff --git a/src/gui/models/modelistmodel.cpp b/src/gui/models/modelistmodel.cpp index 5c63cf15e..673662a48 100644 --- a/src/gui/models/modelistmodel.cpp +++ b/src/gui/models/modelistmodel.cpp @@ -34,13 +34,13 @@ #ifndef ANDROID static bool modeSorter(const std::string &mode1, const std::string &mode2) { - const int width1 = atoi(mode1.substr(0, mode1.find("x")).c_str()); - const int height1 = atoi(mode1.substr(mode1.find("x") + 1).c_str()); + const int width1 = atoi(mode1.substr(0, mode1.find('x')).c_str()); + const int height1 = atoi(mode1.substr(mode1.find('x') + 1).c_str()); if (!width1 || !height1) return false; - const int width2 = atoi(mode2.substr(0, mode2.find("x")).c_str()); - const int height2 = atoi(mode2.substr(mode2.find("x") + 1).c_str()); + const int width2 = atoi(mode2.substr(0, mode2.find('x')).c_str()); + const int height2 = atoi(mode2.substr(mode2.find('x') + 1).c_str()); if (!width2 || !height2) return false; if (width1 != width2) diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index 20fc6c81c..0141eafbc 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -227,7 +227,7 @@ void BrowserBox::addRow(const std::string &row, const bool atTop) idx1 = tmp.find("###"); while (idx1 != std::string::npos) { - const size_t idx2 = tmp.find(";", idx1); + const size_t idx2 = tmp.find(';', idx1); if (idx2 == std::string::npos) break; @@ -242,7 +242,7 @@ void BrowserBox::addRow(const std::string &row, const bool atTop) idx1 = tmp.find("@@"); while (idx1 != std::string::npos) { - const size_t idx2 = tmp.find("|", idx1); + const size_t idx2 = tmp.find('|', idx1); const size_t idx3 = tmp.find("@@", idx2); if (idx2 == std::string::npos || idx3 == std::string::npos) @@ -290,7 +290,7 @@ void BrowserBox::addRow(const std::string &row, const bool atTop) } else { // item link - size_t idx = bLink.link.find(","); + size_t idx = bLink.link.find(','); if (idx != std::string::npos) { const int id = atoi(bLink.link.substr(0, idx).c_str()); @@ -359,7 +359,7 @@ void BrowserBox::addRow(const std::string &row, const bool atTop) idx1 = newRow.find("\\t"); while (idx1 != std::string::npos) { - const size_t idx2 = newRow.find(";", idx1); + const size_t idx2 = newRow.find(';', idx1); if (idx2 == std::string::npos) break; @@ -445,7 +445,7 @@ void BrowserBox::addRow(const std::string &row, const bool atTop) if (nextChar < sz && tempRow.at(nextChar) == ' ') { int nextSpacePos = CAST_U32( - tempRow.find(" ", (nextChar + 1))); + tempRow.find(' ', (nextChar + 1))); if (nextSpacePos <= 0) nextSpacePos = CAST_U32(sz) - 1U; diff --git a/src/gui/widgets/tabs/setup_video.cpp b/src/gui/widgets/tabs/setup_video.cpp index 85927cd0e..3da3ea7bf 100644 --- a/src/gui/widgets/tabs/setup_video.cpp +++ b/src/gui/widgets/tabs/setup_video.cpp @@ -377,8 +377,8 @@ void Setup_Video::action(const ActionEvent &event) return; } } - const int width = atoi(mode.substr(0, mode.find("x")).c_str()); - const int height = atoi(mode.substr(mode.find("x") + 1).c_str()); + const int width = atoi(mode.substr(0, mode.find('x')).c_str()); + const int height = atoi(mode.substr(mode.find('x') + 1).c_str()); if (!width || !height) return; diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp index 479349503..edf360b62 100644 --- a/src/gui/widgets/textbox.cpp +++ b/src/gui/widgets/textbox.cpp @@ -116,7 +116,7 @@ void TextBox::setTextWrapped(const std::string &text, const int minDimension) mMinWidth = minDimension; const size_t textSize = text.size(); - size_t spacePos = text.rfind(" ", textSize); + size_t spacePos = text.rfind(' ', textSize); if (spacePos != std::string::npos) { @@ -136,7 +136,7 @@ void TextBox::setTextWrapped(const std::string &text, const int minDimension) do { // Determine next piece of string to wrap - newlinePos = text.find("\n", lastNewlinePos); + newlinePos = text.find('\n', lastNewlinePos); if (newlinePos == std::string::npos) newlinePos = textSize; @@ -151,7 +151,7 @@ void TextBox::setTextWrapped(const std::string &text, const int minDimension) do { - spacePos = line.find(" ", lastSpacePos); + spacePos = line.find(' ', lastSpacePos); if (spacePos == std::string::npos) spacePos = sz; @@ -190,7 +190,7 @@ void TextBox::setTextWrapped(const std::string &text, const int minDimension) wrappedStream.clear(); wrappedStream.str(""); lastNewlinePos = 0; - newlinePos = text.find("\n", lastNewlinePos); + newlinePos = text.find('\n', lastNewlinePos); if (newlinePos == std::string::npos) newlinePos = textSize; line = text.substr(lastNewlinePos, newlinePos - @@ -208,7 +208,7 @@ void TextBox::setTextWrapped(const std::string &text, const int minDimension) } while (spacePos != sz); - if (text.find("\n", lastNewlinePos) != std::string::npos) + if (text.find('\n', lastNewlinePos) != std::string::npos) wrappedStream << "\n"; lastNewlinePos = newlinePos + 1; @@ -240,7 +240,7 @@ void TextBox::setText(const std::string& text) int length; do { - pos = text.find("\n", lastPos); + pos = text.find('\n', lastPos); if (pos != std::string::npos) length = CAST_S32(pos - lastPos); diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index d7392acc6..726774cdf 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -1107,7 +1107,7 @@ void ChatWindow::addWhisper(const std::string &restrict nick, if (tab->getRemoveNames()) { std::string msg = mes; - const size_t idx = mes.find(":"); + const size_t idx = mes.find(':'); if (idx != std::string::npos && idx > 0) { std::string nick2 = msg.substr(0, idx); @@ -1592,10 +1592,10 @@ bool ChatWindow::resortChatLog(std::string line, if (idx2 != std::string::npos) { std::string tmpNick = line.substr(0, idx2); - if (tmpNick.find("#") != std::string::npos || - tmpNick.find(":") != std::string::npos || - tmpNick.find("%") != std::string::npos || - tmpNick.find("@") != std::string::npos || + if (tmpNick.find('#') != std::string::npos || + tmpNick.find(':') != std::string::npos || + tmpNick.find('%') != std::string::npos || + tmpNick.find('@') != std::string::npos || tmpNick.size() < 5 || tmpNick[0] == '@' || tmpNick[0] == '/' || diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp index 38dbb8b92..84193a5d7 100644 --- a/src/gui/windows/npcdialog.cpp +++ b/src/gui/windows/npcdialog.cpp @@ -708,7 +708,7 @@ void NpcDialog::parseListItems(const std::string &itemString) { if (tmp.empty()) continue; - const size_t pos = tmp.find("|"); + const size_t pos = tmp.find('|'); if (pos == std::string::npos) { mItems.push_back(tmp); diff --git a/src/gui/windows/registerdialog.cpp b/src/gui/windows/registerdialog.cpp index b3cecc424..091e2c20e 100644 --- a/src/gui/windows/registerdialog.cpp +++ b/src/gui/windows/registerdialog.cpp @@ -224,7 +224,7 @@ void RegisterDialog::action(const ActionEvent &event) error = 2; } else if (mEmailField && - mEmailField->getText().find("@") == std::string::npos) + mEmailField->getText().find('@') == std::string::npos) { // TRANSLATORS: error message errorMsg = _("Incorrect email."); diff --git a/src/gui/windows/shopwindow.cpp b/src/gui/windows/shopwindow.cpp index 83d54730f..4dc8174cb 100644 --- a/src/gui/windows/shopwindow.cpp +++ b/src/gui/windows/shopwindow.cpp @@ -906,7 +906,7 @@ void ShopWindow::processRequest(const std::string &nick, std::string data, if (!inv) return; - const size_t idx = data.find(" "); + const size_t idx = data.find(' '); if (idx == std::string::npos) return; diff --git a/src/gui/windows/whoisonline.cpp b/src/gui/windows/whoisonline.cpp index d970cf8b9..eb4fff376 100644 --- a/src/gui/windows/whoisonline.cpp +++ b/src/gui/windows/whoisonline.cpp @@ -430,7 +430,7 @@ void WhoIsOnline::loadWebList() } trim(lineStr); - pos = lineStr.find("/", 0); + pos = lineStr.find('/', 0); if (pos != std::string::npos) lineStr = lineStr.substr(0, pos); |