summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-02-26 01:40:00 +0300
committerAndrei Karas <akaras@inbox.ru>2013-02-26 01:40:00 +0300
commitd4febba47388979b26cd4680cb8a6f20e548e399 (patch)
tree2d520db672ed39b755e668828d27f0dd9d18ed6e /src/utils
parent803b6afd00b0e3574b40b866f21a0d3d01f6dc4d (diff)
downloadplus-d4febba47388979b26cd4680cb8a6f20e548e399.tar.gz
plus-d4febba47388979b26cd4680cb8a6f20e548e399.tar.bz2
plus-d4febba47388979b26cd4680cb8a6f20e548e399.tar.xz
plus-d4febba47388979b26cd4680cb8a6f20e548e399.zip
Improve string usage in other files.
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/paths.cpp15
-rw-r--r--src/utils/process.cpp8
-rw-r--r--src/utils/stringutils.cpp12
3 files changed, 20 insertions, 15 deletions
diff --git a/src/utils/paths.cpp b/src/utils/paths.cpp
index f97ccafcb..f9c5cc5a8 100644
--- a/src/utils/paths.cpp
+++ b/src/utils/paths.cpp
@@ -149,9 +149,14 @@ std::string getDesktopDir()
char *xdg = getenv("XDG_CONFIG_HOME");
std::string file;
if (!xdg)
- file = std::string(PhysFs::getUserDir()) + "/.config/user-dirs.dirs";
+ {
+ file = std::string(PhysFs::getUserDir()).append(
+ "/.config/user-dirs.dirs");
+ }
else
- file = std::string(xdg) + "/user-dirs.dirs";
+ {
+ file = std::string(xdg).append("/user-dirs.dirs");
+ }
StringVect arr = ResourceManager::loadTextFileLocal(file);
FOR_EACH (StringVectCIter, it, arr)
@@ -165,13 +170,13 @@ std::string getDesktopDir()
replaceAll(str, "$HOME/", PhysFs::getUserDir());
str = getRealPath(str);
if (str.empty())
- str = std::string(PhysFs::getUserDir()) + "Desktop";
+ str = std::string(PhysFs::getUserDir()).append("Desktop");
return str;
}
}
- return std::string(PhysFs::getUserDir()) + "Desktop";
+ return std::string(PhysFs::getUserDir()).append("Desktop");
#else
- return std::string(PhysFs::getUserDir()) + "Desktop";
+ return std::string(PhysFs::getUserDir()).append("Desktop");
#endif
}
diff --git a/src/utils/process.cpp b/src/utils/process.cpp
index bba018195..b24949cfe 100644
--- a/src/utils/process.cpp
+++ b/src/utils/process.cpp
@@ -51,9 +51,9 @@ int execFileWait(std::string pathName, std::string name A_UNUSED,
memset(&piProcessInfo, 0, sizeof(piProcessInfo));
siStartupInfo.cb = sizeof(siStartupInfo);
DWORD ret = -1;
- std::string args(pathName + " " + arg1);
+ std::string args(std::string(pathName).append(" ").append(arg1));
if (!arg2.empty())
- args += " " + arg2;
+ args.append(" ").append(arg2);
if (CreateProcess(pathName.c_str(), (char*)args.c_str(), nullptr, nullptr,
false, CREATE_DEFAULT_ERROR_MODE, nullptr, nullptr, &siStartupInfo,
@@ -84,9 +84,9 @@ bool execFile(std::string pathName, std::string name A_UNUSED,
memset(&siStartupInfo, 0, sizeof(siStartupInfo));
memset(&piProcessInfo, 0, sizeof(piProcessInfo));
siStartupInfo.cb = sizeof(siStartupInfo);
- std::string args(pathName + " " + arg1);
+ std::string args(std::string(pathName).append(" ").append(arg1));
if (!arg2.empty())
- args += " " + arg2;
+ args.append(" ").append(arg2);
bool res = CreateProcess(pathName.c_str(), const_cast<char*>(
args.c_str()), nullptr, nullptr, false,
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp
index d4585a26d..3378ec132 100644
--- a/src/utils/stringutils.cpp
+++ b/src/utils/stringutils.cpp
@@ -494,8 +494,8 @@ std::string combineDye(std::string file, std::string dye)
return file;
const size_t pos = file.find_last_of("|");
if (pos != std::string::npos)
- return file.substr(0, pos) + "|" + dye;
- return file + "|" + dye;
+ return file.substr(0, pos).append("|").append(dye);
+ return file.append("|").append(dye);
}
std::string combineDye2(std::string file, std::string dye)
@@ -515,9 +515,9 @@ std::string combineDye2(std::string file, std::string dye)
it2 = list2.begin(), it1_end = list1.end(), it2_end = list2.end();
it1 != it1_end && it2 != it2_end; ++it1, ++it2)
{
- str += (*it1) + ":" + (*it2) + ";";
+ str.append(*it1).append(":").append(*it2).append(";");
}
- return file + "|" + str;
+ return file.append("|").append(str);
}
else
{
@@ -531,7 +531,7 @@ std::string packList(const std::list<std::string> &list)
std::string str("");
while (i != list.end())
{
- str = str + (*i) + "|";
+ str.append(*i).append("|");
++ i;
}
if (str.size() > 1)
@@ -551,7 +551,7 @@ std::string stringToHexPath(const std::string &str)
std::string hex = strprintf("%%%2x/", static_cast<int>(str[0]));
for (unsigned f = 1, sz = static_cast<unsigned>(str.size()); f < sz; f ++)
- hex += strprintf("%%%2x", static_cast<int>(str[f]));
+ hex.append(strprintf("%%%2x", static_cast<int>(str[f])));
return hex;
}