From 608dfae22e1b5145210314ca6c7268420dd639c8 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 10 Dec 2016 16:46:55 +0300 Subject: Fix some issues found by automatic checks. --- src/gui/widgets/browserbox.cpp | 10 +++++----- src/gui/widgets/tabs/setup_video.cpp | 4 ++-- src/gui/widgets/textbox.cpp | 12 ++++++------ 3 files changed, 13 insertions(+), 13 deletions(-) (limited to 'src/gui/widgets') 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); -- cgit v1.2.3-60-g2f50