summaryrefslogtreecommitdiff
path: root/src/utils/stringutils.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-03-18 17:48:29 +0200
committerAndrei Karas <akaras@inbox.ru>2011-03-18 17:49:00 +0200
commitf98d003e354a1792117b7cbc771d1dd91475a156 (patch)
treedc2a297f7c4026394c9954ae4bfd4abd22ef9612 /src/utils/stringutils.cpp
parentbb0a6cb25b2985fd1f74c9d27d5a46f6863e2dee (diff)
downloadmv-f98d003e354a1792117b7cbc771d1dd91475a156.tar.gz
mv-f98d003e354a1792117b7cbc771d1dd91475a156.tar.bz2
mv-f98d003e354a1792117b7cbc771d1dd91475a156.tar.xz
mv-f98d003e354a1792117b7cbc771d1dd91475a156.zip
Fix most old style cast except manaserv and libxml2 defines.
Diffstat (limited to 'src/utils/stringutils.cpp')
-rw-r--r--src/utils/stringutils.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp
index 63924eb78..b5c2abd3e 100644
--- a/src/utils/stringutils.cpp
+++ b/src/utils/stringutils.cpp
@@ -74,10 +74,10 @@ const char *ipToString(int address)
static char asciiIP[18];
sprintf(asciiIP, "%i.%i.%i.%i",
- (unsigned char)(address),
- (unsigned char)(address >> 8),
- (unsigned char)(address >> 16),
- (unsigned char)(address >> 24));
+ static_cast<unsigned char>(address),
+ static_cast<unsigned char>(address >> 8),
+ static_cast<unsigned char>(address >> 16),
+ static_cast<unsigned char>(address >> 24));
return asciiIP;
}
@@ -209,7 +209,7 @@ const std::string encodeStr(unsigned int value, unsigned int size)
while (value);
while (buf.length() < size)
- buf += (char)start;
+ buf += static_cast<char>(start);
return buf;
}
@@ -325,7 +325,7 @@ bool getBoolFromString(const std::string &text)
else if (txt == "false" || txt == "no" || txt == "off" || txt == "0")
return false;
else
- return (bool) atoi(txt.c_str());
+ return static_cast<bool>(atoi(txt.c_str()));
}
void replaceSpecialChars(std::string &text)
@@ -347,7 +347,8 @@ void replaceSpecialChars(std::string &text)
if (idx + 1 < f && text[f] == ';')
{
std::string str = " ";
- str[0] = (char)atoi(text.substr(idx, f - idx).c_str());
+ str[0] = static_cast<char>(atoi(text.substr(
+ idx, f - idx).c_str()));
text = text.substr(0, pos1) + str + text.substr(f + 1);
pos1 += 1;
}