summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-02-08 22:44:39 +0300
committerAndrei Karas <akaras@inbox.ru>2016-02-08 22:44:39 +0300
commita61ac4664d55cddb18d2d861e76629bd07676129 (patch)
tree59f5ba3ff7e65bbe94651db9ad2cf68b847d8f96 /src/utils
parentbb3a85b045a6135f7228023a7ba55fb1c9e6bd90 (diff)
downloadmv-a61ac4664d55cddb18d2d861e76629bd07676129.tar.gz
mv-a61ac4664d55cddb18d2d861e76629bd07676129.tar.bz2
mv-a61ac4664d55cddb18d2d861e76629bd07676129.tar.xz
mv-a61ac4664d55cddb18d2d861e76629bd07676129.zip
Add some missing const.
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/copynpaste.cpp16
-rw-r--r--src/utils/copynpaste.h2
-rw-r--r--src/utils/stringutils.cpp4
3 files changed, 11 insertions, 11 deletions
diff --git a/src/utils/copynpaste.cpp b/src/utils/copynpaste.cpp
index 8a413c1f7..8bce3a4c0 100644
--- a/src/utils/copynpaste.cpp
+++ b/src/utils/copynpaste.cpp
@@ -59,7 +59,7 @@ bool retrieveBuffer(std::string& text, size_t& pos)
return false;
}
-bool sendBuffer(std::string& text)
+bool sendBuffer(const std::string &restrict text)
{
return !SDL_SetClipboardText(text.c_str());
}
@@ -120,7 +120,7 @@ bool retrieveBuffer(std::string& text, size_t& pos)
return ret;
}
-bool sendBuffer(std::string& text)
+bool sendBuffer(const std::string &restrict text)
{
const int wCharsLen = MultiByteToWideChar(CP_UTF8,
0, text.c_str(), -1, nullptr, 0);
@@ -293,7 +293,7 @@ bool retrieveBuffer(std::string& text, size_t& pos)
}
}
-bool sendBuffer(std::string& text)
+bool sendBuffer(const std::string &restrict text)
{
return false;
}
@@ -402,17 +402,17 @@ bool retrieveBuffer(std::string& text, size_t& pos)
return false;
}
-static bool runxsel(std::string& text, const char *p1,
+static bool runxsel(const std::string &text, const char *p1,
const char *p2 = nullptr);
-bool sendBuffer(std::string& text)
+bool sendBuffer(const std::string &restrict text)
{
runxsel(text, "-i");
runxsel(text, "-b", "-i");
return true;
}
-static bool runxsel(std::string& text, const char *p1, const char *p2)
+static bool runxsel(const std::string &text, const char *p1, const char *p2)
{
pid_t pid;
int fd[2];
@@ -484,7 +484,7 @@ bool retrieveBuffer(std::string& text, size_t& pos)
return true;
}
-bool sendBuffer(std::string& text)
+bool sendBuffer(const std::string &restrict text)
{
naclPostMessage("clipboard-copy", text);
return true;
@@ -495,7 +495,7 @@ bool retrieveBuffer(std::string&, size_t&)
return false;
}
-bool sendBuffer(std::string& text A_UNUSED)
+bool sendBuffer(const std::string &restrict text A_UNUSED)
{
return false;
}
diff --git a/src/utils/copynpaste.h b/src/utils/copynpaste.h
index 4d30f61d0..f536eca1c 100644
--- a/src/utils/copynpaste.h
+++ b/src/utils/copynpaste.h
@@ -37,6 +37,6 @@
*/
bool retrieveBuffer(std::string& text, size_t& pos) A_WARN_UNUSED;
-bool sendBuffer(std::string& text);
+bool sendBuffer(const std::string &restrict text);
#endif // UTILS_COPYNPASTE_H
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp
index 041003988..9cc21f23a 100644
--- a/src/utils/stringutils.cpp
+++ b/src/utils/stringutils.cpp
@@ -876,8 +876,8 @@ bool parse2Str(const std::string &args, std::string &str1, std::string &str2)
{
if (pos + 1 < args.length())
{
- str1 = args.substr(0, pos).c_str();
- str2 = args.substr(pos + 1, args.length()).c_str();
+ str1 = args.substr(0, pos);
+ str2 = args.substr(pos + 1, args.length());
isValid = true;
}
}