diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-08-09 23:41:59 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-08-09 23:41:59 +0300 |
commit | a9d1aaa774b9e986b8ee3c6cb1e7baa1d9ba3ea5 (patch) | |
tree | 20a5024ce03d3b0abedd76378c534f4150af0ee9 /src/gui/widgets/chattab.cpp | |
parent | d0ccffd7db79f5dbff6f2cb4f8b77a8bb3435e57 (diff) | |
download | plus-a9d1aaa774b9e986b8ee3c6cb1e7baa1d9ba3ea5.tar.gz plus-a9d1aaa774b9e986b8ee3c6cb1e7baa1d9ba3ea5.tar.bz2 plus-a9d1aaa774b9e986b8ee3c6cb1e7baa1d9ba3ea5.tar.xz plus-a9d1aaa774b9e986b8ee3c6cb1e7baa1d9ba3ea5.zip |
improve size() methods usage.
Diffstat (limited to 'src/gui/widgets/chattab.cpp')
-rw-r--r-- | src/gui/widgets/chattab.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp index 03d1aaf78..37e94ef1b 100644 --- a/src/gui/widgets/chattab.cpp +++ b/src/gui/widgets/chattab.cpp @@ -346,7 +346,8 @@ void ChatTab::chatInput(const std::string &message) // Check for item link size_t start = msg.find('['); - while (start + 1 < msg.size() && start != std::string::npos + size_t sz = msg.size(); + while (start + 1 < sz && start != std::string::npos && msg[start + 1] != '@') { const size_t end = msg.find(']', start); @@ -360,9 +361,8 @@ void ChatTab::chatInput(const std::string &message) start = msg.find('[', start + 1); } - std::string temp(""); - if (start + 1 < msg.length() && end < msg.length() - && end > start + 1) + std::string temp; + if (start + 1 < sz && end < sz && end > start + 1) { temp = msg.substr(start + 1, end - start - 1); @@ -373,6 +373,7 @@ void ChatTab::chatInput(const std::string &message) msg.insert(start + 1, "|"); msg.insert(start + 1, toString(itemInfo.getId())); msg.insert(start + 1, "@@"); + sz = msg.size(); } } } |