From a61ac4664d55cddb18d2d861e76629bd07676129 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 8 Feb 2016 22:44:39 +0300 Subject: Add some missing const. --- src/utils/copynpaste.cpp | 16 ++++++++-------- src/utils/copynpaste.h | 2 +- src/utils/stringutils.cpp | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) (limited to 'src/utils') 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; } } -- cgit v1.2.3-70-g09d2