diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-09-16 19:28:16 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-09-16 19:28:16 +0300 |
commit | cd24ed1c6c5aab358b4f18d262bd4c00c0ebfe96 (patch) | |
tree | fdda7e2c3d93b35771f6eb79c22dce9301082f19 /src/gui/widgets | |
parent | f8fc3380197c078a6dcff02351d835c3022411e1 (diff) | |
download | mv-cd24ed1c6c5aab358b4f18d262bd4c00c0ebfe96.tar.gz mv-cd24ed1c6c5aab358b4f18d262bd4c00c0ebfe96.tar.bz2 mv-cd24ed1c6c5aab358b4f18d262bd4c00c0ebfe96.tar.xz mv-cd24ed1c6c5aab358b4f18d262bd4c00c0ebfe96.zip |
Add const to variables with type size_t.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/browserbox.cpp | 6 | ||||
-rw-r--r-- | src/gui/widgets/chattab.cpp | 4 | ||||
-rw-r--r-- | src/gui/widgets/textbox.cpp | 3 | ||||
-rw-r--r-- | src/gui/widgets/whispertab.cpp | 8 |
4 files changed, 10 insertions, 11 deletions
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index c657d1e0e..18a9df3e2 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -121,8 +121,8 @@ void BrowserBox::addRow(const std::string &row, const bool atTop) const int sz = static_cast<int>(mTextRows.size()); while (idx1 != std::string::npos) { - size_t idx2 = tmp.find("|", idx1); - size_t idx3 = tmp.find("@@", idx2); + const size_t idx2 = tmp.find("|", idx1); + const size_t idx3 = tmp.find("@@", idx2); if (idx2 == std::string::npos || idx3 == std::string::npos) break; @@ -560,7 +560,7 @@ int BrowserBox::calcHeight() } } - size_t len = (end == std::string::npos) ? end : end - start; + const size_t len = (end == std::string::npos) ? end : end - start; if (start >= row.length()) break; diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp index a78d1f636..d71f7f640 100644 --- a/src/gui/widgets/chattab.cpp +++ b/src/gui/widgets/chattab.cpp @@ -114,7 +114,7 @@ void ChatTab::chatLog(std::string line, Own own, tmp.nick = ""; tmp.text = line; - size_t pos = line.find(" : "); + const size_t pos = line.find(" : "); if (pos != std::string::npos) { if (line.length() <= pos + 3) @@ -345,7 +345,7 @@ void ChatTab::chatInput(const std::string &message) while (start + 1 < msg.size() && start != std::string::npos && msg[start + 1] != '@') { - size_t end = msg.find(']', start); + const size_t end = msg.find(']', start); if (start + 1 != end && end != std::string::npos) { // Catch multiple embeds and ignore them diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp index 541308e5e..3254f9f28 100644 --- a/src/gui/widgets/textbox.cpp +++ b/src/gui/widgets/textbox.cpp @@ -52,13 +52,12 @@ void TextBox::setTextWrapped(const std::string &text, const int minDimension) mMinWidth = minDimension; std::stringstream wrappedStream; - size_t spacePos; size_t newlinePos; size_t lastNewlinePos = 0; int minWidth = 0; int xpos; - spacePos = text.rfind(" ", text.size()); + size_t spacePos = text.rfind(" ", text.size()); if (spacePos != std::string::npos) { diff --git a/src/gui/widgets/whispertab.cpp b/src/gui/widgets/whispertab.cpp index cc4db6a87..2126f3c7b 100644 --- a/src/gui/widgets/whispertab.cpp +++ b/src/gui/widgets/whispertab.cpp @@ -80,10 +80,10 @@ void WhisperTab::handleCommand(const std::string &msg) return; } - size_t pos = msg.find(' '); - std::string type(msg, 0, pos); - std::string args(msg, pos == std::string::npos - ? msg.size() : pos + 1); + const size_t pos = msg.find(' '); + const std::string type(msg, 0, pos); + const std::string args(msg, pos == std::string::npos + ? msg.size() : pos + 1); if (type == "me") { |