summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-12-10 16:46:55 +0300
committerAndrei Karas <akaras@inbox.ru>2016-12-10 16:46:55 +0300
commit608dfae22e1b5145210314ca6c7268420dd639c8 (patch)
tree5f7317be7e895a1f8aede182ea69ef56d456c54f /src/utils
parent9eb389060d44672c311a36348036eab297859e7e (diff)
downloadplus-608dfae22e1b5145210314ca6c7268420dd639c8.tar.gz
plus-608dfae22e1b5145210314ca6c7268420dd639c8.tar.bz2
plus-608dfae22e1b5145210314ca6c7268420dd639c8.tar.xz
plus-608dfae22e1b5145210314ca6c7268420dd639c8.zip
Fix some issues found by automatic checks.
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/langs.cpp8
-rw-r--r--src/utils/paths.cpp4
-rw-r--r--src/utils/stringutils.cpp38
3 files changed, 25 insertions, 25 deletions
diff --git a/src/utils/langs.cpp b/src/utils/langs.cpp
index c8101930c..275c3449e 100644
--- a/src/utils/langs.cpp
+++ b/src/utils/langs.cpp
@@ -48,11 +48,11 @@ LangVect getLang()
return langs;
}
- size_t dot = lang.find(".");
+ size_t dot = lang.find('.');
if (dot != std::string::npos)
lang = lang.substr(0, dot);
langs.push_back(lang);
- dot = lang.find("_");
+ dot = lang.find('_');
if (dot != std::string::npos)
langs.push_back(lang.substr(0, dot));
return langs;
@@ -90,10 +90,10 @@ std::string getLangShort()
return "";
}
- size_t dot = lang.find(".");
+ size_t dot = lang.find('.');
if (dot != std::string::npos)
lang = lang.substr(0, dot);
- dot = lang.find("_");
+ dot = lang.find('_');
if (dot != std::string::npos)
return lang.substr(0, dot);
return lang;
diff --git a/src/utils/paths.cpp b/src/utils/paths.cpp
index 9023c4909..1a7f50b69 100644
--- a/src/utils/paths.cpp
+++ b/src/utils/paths.cpp
@@ -108,8 +108,8 @@ std::string &fixDirSeparators(std::string &str)
std::string removeLast(const std::string &str)
{
- size_t pos2 = str.rfind("/");
- const size_t pos3 = str.rfind("\\");
+ size_t pos2 = str.rfind('/');
+ const size_t pos3 = str.rfind('\\');
if (pos3 != std::string::npos)
{
if (pos2 == std::string::npos || pos3 > pos2)
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp
index d1d9b7200..7292a4f62 100644
--- a/src/utils/stringutils.cpp
+++ b/src/utils/stringutils.cpp
@@ -265,11 +265,11 @@ unsigned int decodeStr(const std::string &str)
std::string extractNameFromSprite(std::string str)
{
- const size_t pos1 = str.rfind(".");
+ const size_t pos1 = str.rfind('.');
if (pos1 != std::string::npos)
{
- size_t pos2 = str.rfind("/");
- const size_t pos3 = str.rfind("\\");
+ size_t pos2 = str.rfind('/');
+ const size_t pos3 = str.rfind('\\');
if (pos3 != std::string::npos)
{
if (pos2 == std::string::npos || pos3 > pos2)
@@ -287,12 +287,12 @@ std::string extractNameFromSprite(std::string str)
std::string removeSpriteIndex(std::string str)
{
- const size_t pos1 = str.rfind("[");
+ const size_t pos1 = str.rfind('[');
if (pos1 != std::string::npos)
{
- size_t pos2 = str.rfind("/");
- const size_t pos3 = str.rfind("\\");
+ size_t pos2 = str.rfind('/');
+ const size_t pos3 = str.rfind('\\');
if (pos3 != std::string::npos)
{
if (pos2 == std::string::npos || pos3 > pos2)
@@ -341,8 +341,8 @@ void getSafeUtf8String(std::string text, char *const buf)
std::string getFileName(const std::string &path)
{
- size_t pos1 = path.rfind("/");
- const size_t pos2 = path.rfind("\\");
+ size_t pos1 = path.rfind('/');
+ const size_t pos2 = path.rfind('\\');
if (pos1 == std::string::npos)
pos1 = pos2;
else if (pos2 != std::string::npos && pos2 > pos1)
@@ -355,8 +355,8 @@ std::string getFileName(const std::string &path)
std::string getFileDir(const std::string &path)
{
- size_t pos1 = path.rfind("/");
- const size_t pos2 = path.rfind("\\");
+ size_t pos1 = path.rfind('/');
+ const size_t pos2 = path.rfind('\\');
if (pos1 == std::string::npos)
pos1 = pos2;
else if (pos2 != std::string::npos && pos2 > pos1)
@@ -398,7 +398,7 @@ bool getBoolFromString(const std::string &text)
void replaceSpecialChars(std::string &text)
{
- size_t pos1 = text.find("&");
+ size_t pos1 = text.find('&');
while (pos1 != std::string::npos)
{
const size_t idx = pos1 + 1;
@@ -425,7 +425,7 @@ void replaceSpecialChars(std::string &text)
pos1 = f + 1;
}
- pos1 = text.find("&", pos1);
+ pos1 = text.find('&', pos1);
}
}
@@ -512,7 +512,7 @@ std::string combineDye(std::string file, const std::string &dye)
{
if (dye.empty())
return file;
- const size_t pos = file.find_last_of("|");
+ const size_t pos = file.find_last_of('|');
if (pos != std::string::npos)
return file.substr(0, pos).append("|").append(dye);
return file.append("|").append(dye);
@@ -523,7 +523,7 @@ std::string combineDye2(std::string file, const std::string &dye)
if (dye.empty())
return file;
- const size_t pos = file.find_last_of("|");
+ const size_t pos = file.find_last_of('|');
if (pos != std::string::npos)
{
const std::string dye1 = file.substr(pos + 1);
@@ -550,7 +550,7 @@ std::string combineDye3(std::string file, const std::string &dye)
if (dye.empty())
return file;
- const size_t pos = file.find_last_of("|");
+ const size_t pos = file.find_last_of('|');
if (pos != std::string::npos)
{
const std::string dye1 = file.substr(pos + 1);
@@ -866,9 +866,9 @@ void secureChatCommand(std::string &str)
bool parse2Int(const std::string &args, int &x, int &y)
{
bool isValid = false;
- size_t pos = args.find(" ");
+ size_t pos = args.find(' ');
if (pos == std::string::npos)
- pos = args.find(",");
+ pos = args.find(',');
if (pos != std::string::npos)
{
if (pos + 1 < args.length())
@@ -884,9 +884,9 @@ bool parse2Int(const std::string &args, int &x, int &y)
bool parse2Str(const std::string &args, std::string &str1, std::string &str2)
{
bool isValid = false;
- size_t pos = args.find(" ");
+ size_t pos = args.find(' ');
if (pos == std::string::npos)
- pos = args.find(",");
+ pos = args.find(',');
if (pos != std::string::npos)
{
if (pos + 1 < args.length())