[Libreoffice-commits] online.git: loolwsd/Connect.cpp loolwsd/IoUtil.cpp loolwsd/IoUtil.hpp loolwsd/LOOLKit.cpp loolwsd/LOOLTool.cpp loolwsd/MessageQueue.cpp loolwsd/MessageQueue.hpp loolwsd/TileCache.cpp
Miklos Vajna
vmiklos at collabora.co.uk
Wed Apr 27 12:59:09 UTC 2016
loolwsd/Connect.cpp | 2 +-
loolwsd/IoUtil.cpp | 12 ++++++------
loolwsd/IoUtil.hpp | 12 ++++++------
loolwsd/LOOLKit.cpp | 2 +-
loolwsd/LOOLTool.cpp | 2 +-
loolwsd/MessageQueue.cpp | 2 +-
loolwsd/MessageQueue.hpp | 2 +-
loolwsd/TileCache.cpp | 2 +-
8 files changed, 18 insertions(+), 18 deletions(-)
New commits:
commit 78308db763bf8886ec440298fe44377b5ea7f27b
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Wed Apr 27 14:58:33 2016 +0200
loolwsd: remaining 'unnecessary copy' fixes
Change-Id: I138e8473a002a15aae7752136950bb905a21fb1f
diff --git a/loolwsd/Connect.cpp b/loolwsd/Connect.cpp
index 8c10f27..e1255bf 100644
--- a/loolwsd/Connect.cpp
+++ b/loolwsd/Connect.cpp
@@ -211,7 +211,7 @@ protected:
}
break;
}
- else if (line.find("#") == 0)
+ else if (line.find('#') == 0)
{
// Also comments can be useful in input files for this program
}
diff --git a/loolwsd/IoUtil.cpp b/loolwsd/IoUtil.cpp
index 92b0254..5e58a23 100644
--- a/loolwsd/IoUtil.cpp
+++ b/loolwsd/IoUtil.cpp
@@ -39,10 +39,10 @@ namespace IoUtil
// Synchronously process WebSocket requests and dispatch to handler.
// Handler returns false to end.
-void SocketProcessor(std::shared_ptr<WebSocket> ws,
- std::function<bool(const std::vector<char>&)> handler,
- std::function<void()> closeFrame,
- std::function<bool()> stopPredicate)
+void SocketProcessor(const std::shared_ptr<WebSocket>& ws,
+ const std::function<bool(const std::vector<char>&)>& handler,
+ const std::function<void()>& closeFrame,
+ const std::function<bool()>& stopPredicate)
{
Log::info("SocketProcessor starting.");
@@ -182,7 +182,7 @@ void SocketProcessor(std::shared_ptr<WebSocket> ws,
Log::info("SocketProcessor finished.");
}
-void shutdownWebSocket(std::shared_ptr<Poco::Net::WebSocket> ws)
+void shutdownWebSocket(const std::shared_ptr<Poco::Net::WebSocket>& ws)
{
try
{
@@ -247,7 +247,7 @@ ssize_t readFIFO(int pipe, char* buffer, ssize_t size)
/// Returns 0 for timeout, <0 for error, and >0 on success.
/// On success, line will contain the read message.
int PipeReader::readLine(std::string& line,
- std::function<bool()> stopPredicate)
+ const std::function<bool()>& stopPredicate)
{
const char *endOfLine = static_cast<const char *>(std::memchr(_data.data(), '\n', _data.size()));
if (endOfLine != nullptr)
diff --git a/loolwsd/IoUtil.hpp b/loolwsd/IoUtil.hpp
index 2b49658..6f98136 100644
--- a/loolwsd/IoUtil.hpp
+++ b/loolwsd/IoUtil.hpp
@@ -23,13 +23,13 @@ namespace IoUtil
{
/// Synchronously process WebSocket requests and dispatch to handler.
//. Handler returns false to end.
- void SocketProcessor(std::shared_ptr<Poco::Net::WebSocket> ws,
- std::function<bool(const std::vector<char>&)> handler,
- std::function<void()> closeFrame,
- std::function<bool()> stopPredicate);
+ void SocketProcessor(const std::shared_ptr<Poco::Net::WebSocket>& ws,
+ const std::function<bool(const std::vector<char>&)>& handler,
+ const std::function<void()>& closeFrame,
+ const std::function<bool()>& stopPredicate);
/// Call WebSocket::shutdown() ignoring Poco::IOException.
- void shutdownWebSocket(std::shared_ptr<Poco::Net::WebSocket> ws);
+ void shutdownWebSocket(const std::shared_ptr<Poco::Net::WebSocket>& ws);
ssize_t writeFIFO(int pipe, const char* buffer, ssize_t size);
inline
@@ -55,7 +55,7 @@ namespace IoUtil
/// Returns 0 for timeout, <0 for error, and >0 on success.
/// On success, line will contain the read message.
int readLine(std::string& line,
- std::function<bool()> stopPredicate);
+ const std::function<bool()>& stopPredicate);
private:
const std::string _name;
diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp
index 7a95bcb..5af4248 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -839,7 +839,7 @@ private:
};
namespace {
- void symlinkPathToJail(const Path jailPath, const std::string &loTemplate,
+ void symlinkPathToJail(const Path& jailPath, const std::string &loTemplate,
const std::string &loSubPath)
{
Path symlinkSource(jailPath, Path(loTemplate.substr(1)));
diff --git a/loolwsd/LOOLTool.cpp b/loolwsd/LOOLTool.cpp
index 2e0acfc..7429ed2 100644
--- a/loolwsd/LOOLTool.cpp
+++ b/loolwsd/LOOLTool.cpp
@@ -92,7 +92,7 @@ public:
void run() override
{
- for (auto i : _files)
+ for (const auto& i : _files)
convertFile(i);
}
diff --git a/loolwsd/MessageQueue.cpp b/loolwsd/MessageQueue.cpp
index 2dd57db..e6ef3d6 100644
--- a/loolwsd/MessageQueue.cpp
+++ b/loolwsd/MessageQueue.cpp
@@ -37,7 +37,7 @@ void MessageQueue::clear()
clear_impl();
}
-void MessageQueue::remove_if(std::function<bool(const Payload&)> pred)
+void MessageQueue::remove_if(const std::function<bool(const Payload&)>& pred)
{
std::unique_lock<std::mutex> lock(_mutex);
std::remove_if(_queue.begin(), _queue.end(), pred);
diff --git a/loolwsd/MessageQueue.hpp b/loolwsd/MessageQueue.hpp
index 9e39a2a..8330f0f 100644
--- a/loolwsd/MessageQueue.hpp
+++ b/loolwsd/MessageQueue.hpp
@@ -46,7 +46,7 @@ public:
void clear();
/// Thread safe remove_if.
- void remove_if(std::function<bool(const Payload&)> pred);
+ void remove_if(const std::function<bool(const Payload&)>& pred);
private:
std::mutex _mutex;
diff --git a/loolwsd/TileCache.cpp b/loolwsd/TileCache.cpp
index 562eeed..c02eb7e 100644
--- a/loolwsd/TileCache.cpp
+++ b/loolwsd/TileCache.cpp
@@ -335,7 +335,7 @@ void TileCache::notifyAndRemoveSubscribers(int part, int width, int height, int
Log::debug("Sending tile message also to subscribers");
- for (auto i: tileBeingRendered->_subscribers)
+ for (const auto& i: tileBeingRendered->_subscribers)
{
auto subscriber = i.lock();
if (subscriber)
More information about the Libreoffice-commits
mailing list