summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-07-01 12:10:38 +0300
committerAndrei Karas <akaras@inbox.ru>2013-07-01 12:10:38 +0300
commit4d580a22e13f003e8835adba54c78bab1a2a3f5a (patch)
tree57db5121bc27ebf1082542d76cef2ec7c3d2e28d /src/utils
parent827dbd86772860f3b4dfa268c1e606ddbee82c0d (diff)
downloadmanaverse-4d580a22e13f003e8835adba54c78bab1a2a3f5a.tar.gz
manaverse-4d580a22e13f003e8835adba54c78bab1a2a3f5a.tar.bz2
manaverse-4d580a22e13f003e8835adba54c78bab1a2a3f5a.tar.xz
manaverse-4d580a22e13f003e8835adba54c78bab1a2a3f5a.zip
improve size() usage in copynpaste.
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/copynpaste.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/utils/copynpaste.cpp b/src/utils/copynpaste.cpp
index db14dd3c7..8af847a21 100644
--- a/src/utils/copynpaste.cpp
+++ b/src/utils/copynpaste.cpp
@@ -365,8 +365,9 @@ bool retrieveBuffer(std::string& text, size_t& pos)
if (data)
{
// check cursor position
- if (pos > text.size())
- pos = text.size();
+ const size_t sz = text.size();
+ if (pos > sz)
+ pos = sz;
text.insert(pos, data);
pos += strlen(data);