summaryrefslogtreecommitdiff
path: root/src/utils/stringutils.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-10-16 00:27:51 +0300
committerAndrei Karas <akaras@inbox.ru>2012-10-16 00:27:51 +0300
commitc3434fa53d1c83bc65b640951364f842fe6c79f4 (patch)
tree51aa552c585518d7b2e2d67eba7c9500065dae05 /src/utils/stringutils.cpp
parent185a53c504a0d53e54a7425ea829b5c951661ea8 (diff)
downloadmanaverse-c3434fa53d1c83bc65b640951364f842fe6c79f4.tar.gz
manaverse-c3434fa53d1c83bc65b640951364f842fe6c79f4.tar.bz2
manaverse-c3434fa53d1c83bc65b640951364f842fe6c79f4.tar.xz
manaverse-c3434fa53d1c83bc65b640951364f842fe6c79f4.zip
Fix some signed/unsigned chars issues.
Diffstat (limited to 'src/utils/stringutils.cpp')
-rw-r--r--src/utils/stringutils.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp
index c201e9593..e28013320 100644
--- a/src/utils/stringutils.cpp
+++ b/src/utils/stringutils.cpp
@@ -87,7 +87,7 @@ const char *ipToString(const int address)
return asciiIP;
}
-std::string strprintf(char const *const format, ...)
+std::string strprintf(const char *const format, ...)
{
char buf[257];
va_list(args);
@@ -161,7 +161,7 @@ int compareStrI(const std::string &a, const std::string &b)
}
-bool isWordSeparator(const char chr)
+bool isWordSeparator(const signed char chr)
{
return (chr == ' ' || chr == ',' || chr == '.' || chr == '"');
}
@@ -229,13 +229,13 @@ const std::string encodeStr(unsigned int value, const unsigned int size)
do
{
- buf += static_cast<char>(value % base + start);
+ buf += static_cast<signed char>(value % base + start);
value /= base;
}
while (value);
while (buf.length() < size)
- buf += static_cast<char>(start);
+ buf += static_cast<signed char>(start);
return buf;
}
@@ -393,7 +393,7 @@ void replaceSpecialChars(std::string &text)
if (idx + 1 < f && text[f] == ';')
{
std::string str = " ";
- str[0] = static_cast<char>(atoi(text.substr(
+ str[0] = static_cast<signed char>(atoi(text.substr(
idx, f - idx).c_str()));
text = text.substr(0, pos1) + str + text.substr(f + 1);
pos1 += 1;
@@ -413,7 +413,8 @@ std::string normalize(const std::string &name)
return toLower(trim(normalized));
}
-std::set<int> splitToIntSet(const std::string &text, const char separator)
+std::set<int> splitToIntSet(const std::string &text,
+ const char separator)
{
std::set<int> tokens;
std::stringstream ss(text);
@@ -424,7 +425,8 @@ std::set<int> splitToIntSet(const std::string &text, const char separator)
return tokens;
}
-std::list<int> splitToIntList(const std::string &text, const char separator)
+std::list<int> splitToIntList(const std::string &text,
+ const char separator)
{
std::list<int> tokens;
std::stringstream ss(text);