[Libreoffice-commits] online.git: common/Crypto.cpp common/FileUtil.cpp common/JsonUtil.hpp common/Log.cpp common/LOOLWebSocket.hpp common/MessageQueue.cpp common/Seccomp.cpp common/Session.cpp common/SigUtil.cpp common/Util.cpp common/Util.hpp kit/ChildSession.cpp kit/Delta.hpp kit/ForKit.cpp kit/Kit.cpp kit/KitHelper.hpp net/clientnb.cpp net/DelaySocket.cpp net/FakeSocket.cpp net/ServerSocket.hpp net/Socket.cpp net/Socket.hpp net/Ssl.cpp net/WebSocketHandler.hpp test/countloolkits.hpp test/DeltaTests.cpp test/fakesockettest.cpp test/helpers.hpp test/lokassert.hpp test/TileCacheTests.cpp test/UnitAdmin.cpp test/UnitClient.cpp test/UnitConvert.cpp test/UnitCopyPaste.cpp test/UnitHTTP.cpp test/UnitSession.cpp test/UnitTyping.cpp test/UnitUNOCommand.cpp tools/Config.cpp tools/Connect.cpp tools/KitClient.cpp tools/map.cpp tools/Replay.hpp tools/Tool.cpp tools/WebSocketDump.cpp wsd/Admin.cpp wsd/AdminModel.cpp wsd/ClientSession.cpp wsd/DocumentBroker.cpp wsd/FileServer.cpp wsd/LOOLWSD.cpp wsd/LOOLWSD .hpp wsd/ProxyProtocol.cpp wsd/ProxyProtocol.hpp wsd/RequestDetails.hpp wsd/SenderQueue.hpp wsd/ServerURL.hpp wsd/Storage.cpp wsd/TileCache.cpp wsd/TileDesc.hpp
Ashod Nakashian (via logerrit)
logerrit at kemper.freedesktop.org
Mon Jun 1 23:31:45 UTC 2020
common/Crypto.cpp | 8 ++--
common/FileUtil.cpp | 4 +-
common/JsonUtil.hpp | 4 +-
common/LOOLWebSocket.hpp | 6 +--
common/Log.cpp | 4 +-
common/MessageQueue.cpp | 17 +++++---
common/Seccomp.cpp | 12 +++---
common/Session.cpp | 4 +-
common/SigUtil.cpp | 2 -
common/Util.cpp | 6 +--
common/Util.hpp | 4 +-
kit/ChildSession.cpp | 6 +--
kit/Delta.hpp | 6 +--
kit/ForKit.cpp | 10 ++---
kit/Kit.cpp | 38 ++++++++++----------
kit/KitHelper.hpp | 4 +-
net/DelaySocket.cpp | 28 +++++++-------
net/FakeSocket.cpp | 24 ++++++------
net/ServerSocket.hpp | 2 -
net/Socket.cpp | 36 +++++++++----------
net/Socket.hpp | 36 +++++++++----------
net/Ssl.cpp | 6 +--
net/WebSocketHandler.hpp | 48 ++++++++++++-------------
net/clientnb.cpp | 10 ++---
test/DeltaTests.cpp | 12 +++---
test/TileCacheTests.cpp | 16 ++++----
test/UnitAdmin.cpp | 2 -
test/UnitClient.cpp | 2 -
test/UnitConvert.cpp | 2 -
test/UnitCopyPaste.cpp | 18 ++++-----
test/UnitHTTP.cpp | 7 ++-
test/UnitSession.cpp | 2 -
test/UnitTyping.cpp | 10 ++---
test/UnitUNOCommand.cpp | 2 -
test/countloolkits.hpp | 2 -
test/fakesockettest.cpp | 2 -
test/helpers.hpp | 8 ++--
test/lokassert.hpp | 2 -
tools/Config.cpp | 10 ++---
tools/Connect.cpp | 2 -
tools/KitClient.cpp | 2 -
tools/Replay.hpp | 4 +-
tools/Tool.cpp | 6 +--
tools/WebSocketDump.cpp | 10 ++---
tools/map.cpp | 2 -
wsd/Admin.cpp | 10 ++---
wsd/AdminModel.cpp | 22 +++++------
wsd/ClientSession.cpp | 12 +++---
wsd/DocumentBroker.cpp | 38 ++++++++++----------
wsd/FileServer.cpp | 15 +++----
wsd/LOOLWSD.cpp | 89 +++++++++++++++++++++++------------------------
wsd/LOOLWSD.hpp | 4 +-
wsd/ProxyProtocol.cpp | 6 +--
wsd/ProxyProtocol.hpp | 8 ++--
wsd/RequestDetails.hpp | 2 -
wsd/SenderQueue.hpp | 6 +--
wsd/ServerURL.hpp | 8 ++--
wsd/Storage.cpp | 26 ++++++-------
wsd/TileCache.cpp | 10 ++---
wsd/TileDesc.hpp | 4 +-
60 files changed, 356 insertions(+), 352 deletions(-)
New commits:
commit 224ef08c7f6c9cf2a88fbf156225f04cac2eabeb
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sun May 24 09:10:18 2020 -0400
Commit: Ashod Nakashian <ashnakash at gmail.com>
CommitDate: Tue Jun 2 01:31:26 2020 +0200
wsd: single-char string literals -> char
More readable and typically more efficient.
Change-Id: I9bd5bfc91f4ac255bb8ae0987708fb8b56b398f8
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95285
Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
diff --git a/common/Crypto.cpp b/common/Crypto.cpp
index 7c1d00052..5faf1988a 100644
--- a/common/Crypto.cpp
+++ b/common/Crypto.cpp
@@ -43,24 +43,24 @@ struct SupportKeyImpl
if (firstColon != std::string::npos)
{
std::string expiry(key.substr(0, firstColon));
- LOG_INF("Support key with expiry '" << expiry << "'");
+ LOG_INF("Support key with expiry '" << expiry << '\'');
try {
int timeZoneDifferential = 0;
Poco::DateTimeParser::parse(expiry, _expiry, timeZoneDifferential);
- size_t lastColon = key.rfind(":");
+ size_t lastColon = key.rfind(':');
if (lastColon != std::string::npos)
{
_signature = key.substr(lastColon + 1,
key.length() - lastColon);
_data = key.substr(0, lastColon);
- LOG_INF("Support key signature '" << _signature << "' data '" << _data << "'");
+ LOG_INF("Support key signature '" << _signature << "' data '" << _data << '\'');
_invalid = false;
}
} catch (SyntaxException &e) {
- LOG_ERR("Invalid support key expiry '" << expiry << "'");
+ LOG_ERR("Invalid support key expiry '" << expiry << '\'');
}
}
}
diff --git a/common/FileUtil.cpp b/common/FileUtil.cpp
index 054a9461d..793fc1e25 100644
--- a/common/FileUtil.cpp
+++ b/common/FileUtil.cpp
@@ -223,7 +223,7 @@ namespace FileUtil
catch (const std::exception&e)
{
// Already removed or we don't care about failures.
- LOG_DBG("Exception removing " << path << " " << recursive << " : " << e.what());
+ LOG_DBG("Exception removing " << path << ' ' << recursive << " : " << e.what());
}
#endif
}
@@ -273,7 +273,7 @@ namespace FileUtil
if (lastSlash != std::string::npos)
{
const std::string dirPath = path.substr(0, lastSlash + 1) + '.';
- LOG_INF("Registering filesystem for space checks: [" << dirPath << "]");
+ LOG_INF("Registering filesystem for space checks: [" << dirPath << ']');
std::lock_guard<std::mutex> lock(fsmutex);
diff --git a/common/JsonUtil.hpp b/common/JsonUtil.hpp
index d85f01500..8f4e9d926 100644
--- a/common/JsonUtil.hpp
+++ b/common/JsonUtil.hpp
@@ -119,7 +119,7 @@ bool findJSONValue(Poco::JSON::Object::Ptr &object, const std::string& key, T& v
// We found something with some differences--warn and return.
LOG_WRN("Incorrect JSON property [" << userInput << "]. Did you mean [" << key <<
- "] ? (Levenshtein distance: " << levDist << ")");
+ "] ? (Levenshtein distance: " << levDist << ')');
// Fail without exact match.
return false;
@@ -129,7 +129,7 @@ bool findJSONValue(Poco::JSON::Object::Ptr &object, const std::string& key, T& v
if (bRemove)
object->remove(userInput);
- LOG_TRC("Found JSON property [" << userInput << "] => [" << value << "]");
+ LOG_TRC("Found JSON property [" << userInput << "] => [" << value << ']');
return true;
}
diff --git a/common/LOOLWebSocket.hpp b/common/LOOLWebSocket.hpp
index 627b89a5e..ddaf0e7ff 100644
--- a/common/LOOLWebSocket.hpp
+++ b/common/LOOLWebSocket.hpp
@@ -60,7 +60,7 @@ public:
const int n = Poco::Net::WebSocket::receiveFrame(buffer, length, flags);
if (n <= 0)
- LOG_TRC("Got nothing (" << n << ")");
+ LOG_TRC("Got nothing (" << n << ')');
else
LOG_TRC("Got frame: " << getAbbreviatedFrameDump(buffer, n, flags));
@@ -176,14 +176,14 @@ public:
result << Poco::format("%#x", flags);
break;
}
- result << " " << std::setw(3) << length << " bytes";
+ result << ' ' << std::setw(3) << length << " bytes";
if (length > 0 &&
((flags & Poco::Net::WebSocket::FRAME_OP_BITMASK) == Poco::Net::WebSocket::FRAME_OP_TEXT ||
(flags & Poco::Net::WebSocket::FRAME_OP_BITMASK) == Poco::Net::WebSocket::FRAME_OP_BINARY ||
(flags & Poco::Net::WebSocket::FRAME_OP_BITMASK) == Poco::Net::WebSocket::FRAME_OP_PING ||
(flags & Poco::Net::WebSocket::FRAME_OP_BITMASK) == Poco::Net::WebSocket::FRAME_OP_PONG))
- result << ": '" << LOOLProtocol::getAbbreviatedMessage(message, length) << "'";
+ result << ": '" << LOOLProtocol::getAbbreviatedMessage(message, length) << '\'';
return result.str();
}
};
diff --git a/common/Log.cpp b/common/Log.cpp
index 6cb376c9e..feabf0216 100644
--- a/common/Log.cpp
+++ b/common/Log.cpp
@@ -312,13 +312,13 @@ namespace Log
oss.str("");
oss.clear();
- oss << "Initializing " << name << ".";
+ oss << "Initializing " << name << '.';
// TODO: replace with std::put_time when we move to gcc 5+.
char buf[32];
if (strftime(buf, sizeof(buf), "%a %F %T%z", std::localtime(&t)) > 0)
{
- oss << " Local time: " << buf << ".";
+ oss << " Local time: " << buf << '.';
}
oss << " Log level is [" << logger.getLevel() << "].";
diff --git a/common/MessageQueue.cpp b/common/MessageQueue.cpp
index 3e5cb08d2..b171ce553 100644
--- a/common/MessageQueue.cpp
+++ b/common/MessageQueue.cpp
@@ -42,7 +42,7 @@ void TileQueue::put_impl(const Payload& value)
{
if (s.find("ver=" + tokens[i]) != std::string::npos)
{
- LOG_TRC("Matched " << tokens[i] << ", Removing [" << s << "]");
+ LOG_TRC("Matched " << tokens[i] << ", Removing [" << s << ']');
return true;
}
}
@@ -243,8 +243,10 @@ std::string TileQueue::removeCallbackDuplicate(const std::string& callbackMsg)
// just remove it
if (msgX <= queuedX && queuedX + queuedW <= msgX + msgW && msgY <= queuedY && queuedY + queuedH <= msgY + msgH)
{
- LOG_TRC("Removing smaller invalidation: " << std::string(it.data(), it.size()) << " -> " <<
- tokens[0] << " " << tokens[1] << " " << tokens[2] << " " << msgX << " " << msgY << " " << msgW << " " << msgH << " " << msgPart);
+ LOG_TRC("Removing smaller invalidation: "
+ << std::string(it.data(), it.size()) << " -> " << tokens[0] << ' '
+ << tokens[1] << ' ' << tokens[2] << ' ' << msgX << ' ' << msgY << ' '
+ << msgW << ' ' << msgH << ' ' << msgPart);
// remove from the queue
getQueue().erase(getQueue().begin() + i);
@@ -268,9 +270,12 @@ std::string TileQueue::removeCallbackDuplicate(const std::string& callbackMsg)
continue;
}
- LOG_TRC("Merging invalidations: " << std::string(it.data(), it.size()) << " and " <<
- tokens[0] << " " << tokens[1] << " " << tokens[2] << " " << msgX << " " << msgY << " " << msgW << " " << msgH << " " << msgPart << " -> " <<
- tokens[0] << " " << tokens[1] << " " << tokens[2] << " " << joinX << " " << joinY << " " << joinW << " " << joinH << " " << msgPart);
+ LOG_TRC("Merging invalidations: "
+ << std::string(it.data(), it.size()) << " and " << tokens[0] << ' '
+ << tokens[1] << ' ' << tokens[2] << ' ' << msgX << ' ' << msgY << ' '
+ << msgW << ' ' << msgH << ' ' << msgPart << " -> " << tokens[0] << ' '
+ << tokens[1] << ' ' << tokens[2] << ' ' << joinX << ' ' << joinY << ' '
+ << joinW << ' ' << joinH << ' ' << msgPart);
msgX = joinX;
msgY = joinY;
diff --git a/common/Seccomp.cpp b/common/Seccomp.cpp
index e868ee01e..1b05f290c 100644
--- a/common/Seccomp.cpp
+++ b/common/Seccomp.cpp
@@ -261,7 +261,7 @@ void setRLimit(rlim_t confLim, int resource, const std::string &resourceText, co
rlim_t lim = confLim;
if (lim <= 0)
lim = RLIM_INFINITY;
- const std::string limTextWithUnit((lim == RLIM_INFINITY) ? "unlimited" : std::to_string(lim) + " " + unitText);
+ const std::string limTextWithUnit((lim == RLIM_INFINITY) ? "unlimited" : std::to_string(lim) + ' ' + unitText);
if (resource != RLIMIT_FSIZE && resource != RLIMIT_NOFILE)
{
/* FIXME Currently the RLIMIT_FSIZE handling is non-ideal, and can
@@ -272,17 +272,17 @@ void setRLimit(rlim_t confLim, int resource, const std::string &resourceText, co
*/
rlimit rlim = { lim, lim };
if (setrlimit(resource, &rlim) != 0)
- LOG_SYS("Failed to set " << resourceText << " to " << limTextWithUnit << ".");
+ LOG_SYS("Failed to set " << resourceText << " to " << limTextWithUnit << '.');
if (getrlimit(resource, &rlim) == 0)
{
- const std::string setLimTextWithUnit((rlim.rlim_max == RLIM_INFINITY) ? "unlimited" : std::to_string(rlim.rlim_max) + " " + unitText);
- LOG_INF(resourceText << " is " << setLimTextWithUnit << " after setting it to " << limTextWithUnit << ".");
+ const std::string setLimTextWithUnit((rlim.rlim_max == RLIM_INFINITY) ? "unlimited" : std::to_string(rlim.rlim_max) + ' ' + unitText);
+ LOG_INF(resourceText << " is " << setLimTextWithUnit << " after setting it to " << limTextWithUnit << '.');
}
else
- LOG_SYS("Failed to get " << resourceText << ".");
+ LOG_SYS("Failed to get " << resourceText << '.');
}
else
- LOG_INF("Ignored setting " << resourceText << " to " << limTextWithUnit << ".");
+ LOG_INF("Ignored setting " << resourceText << " to " << limTextWithUnit << '.');
}
bool handleSetrlimitCommand(const StringVector& tokens)
diff --git a/common/Session.cpp b/common/Session.cpp
index 58d7c0b6b..0b3499a05 100644
--- a/common/Session.cpp
+++ b/common/Session.cpp
@@ -250,7 +250,7 @@ void Session::handleMessage(const std::vector<char> &data)
LOG_ERR("Session::handleInput: Exception while handling [" <<
getAbbreviatedMessage(data) <<
"] in " << getName() << ": " << exc.displayText() <<
- (exc.nested() ? " (" + exc.nested()->displayText() + ")" : ""));
+ (exc.nested() ? " (" + exc.nested()->displayText() + ')' : ""));
}
catch (const std::exception& exc)
{
@@ -288,7 +288,7 @@ void Session::dumpState(std::ostream& os)
<< "\n\t\tuserId: " << _userId
<< "\n\t\tuserName: " << _userName
<< "\n\t\tlang: " << _lang
- << "\n";
+ << '\n';
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/common/SigUtil.cpp b/common/SigUtil.cpp
index cd4c779dc..5a587f30d 100644
--- a/common/SigUtil.cpp
+++ b/common/SigUtil.cpp
@@ -308,7 +308,7 @@ namespace SigUtil
stream << "\nERROR: Fatal signal! Attach debugger with:\n"
<< "sudo gdb --pid=" << getpid() << "\n or \n"
<< "sudo gdb --q --n --ex 'thread apply all backtrace full' --batch --pid="
- << getpid() << "\n";
+ << getpid() << '\n';
std::string streamStr = stream.str();
assert (sizeof (FatalGdbString) > strlen(streamStr.c_str()) + 1);
strncpy(FatalGdbString, streamStr.c_str(), sizeof(FatalGdbString)-1);
diff --git a/common/Util.cpp b/common/Util.cpp
index 881836c34..b51295ebd 100644
--- a/common/Util.cpp
+++ b/common/Util.cpp
@@ -384,7 +384,7 @@ namespace Util
default: assert(false);
}
- unit += "B";
+ unit += 'B';
std::stringstream ss;
ss << std::fixed << std::setprecision(1) << val << ' ' << unit;
return ss.str();
@@ -572,7 +572,7 @@ namespace Util
{
// Copy the current name.
const std::string knownAs
- = ThreadName[0] ? "known as [" + std::string(ThreadName) + "]" : "unnamed";
+ = ThreadName[0] ? "known as [" + std::string(ThreadName) + ']' : "unnamed";
// Set the new name.
strncpy(ThreadName, s.c_str(), sizeof(ThreadName) - 1);
@@ -864,7 +864,7 @@ namespace Util
<< time_modified
<< std::setw(6)
<< (time - lastModified_s).count() / 1000
- << "Z";
+ << 'Z';
return oss.str();
}
diff --git a/common/Util.hpp b/common/Util.hpp
index 0f19828ba..46a88fec0 100644
--- a/common/Util.hpp
+++ b/common/Util.hpp
@@ -203,7 +203,7 @@ namespace Util
for (unsigned int i = 0; i < width; i++)
{
if (i && (i % 8) == 0)
- os << " ";
+ os << ' ';
if ((offset + i) < buffer.size())
sprintf (scratch, "%.2x ", (unsigned char)buffer[offset+i]);
else
@@ -254,7 +254,7 @@ namespace Util
}
lastLine.swap(line);
- os << "\n";
+ os << '\n';
}
os.flush();
}
diff --git a/kit/ChildSession.cpp b/kit/ChildSession.cpp
index ba8bdf8ee..9b62f1c06 100644
--- a/kit/ChildSession.cpp
+++ b/kit/ChildSession.cpp
@@ -656,7 +656,7 @@ bool ChildSession::loadDocument(const char * /*buffer*/, int /*length*/, const S
}
// Respond by the document status
- LOG_DBG("Sending status after loading view " << _viewId << ".");
+ LOG_DBG("Sending status after loading view " << _viewId << '.');
const std::string status = LOKitHelper::documentStatus(getLOKitDocument()->get());
if (status.empty() || !sendTextFrame("status: " + status))
{
@@ -699,7 +699,7 @@ bool ChildSession::sendFontRendering(const char* /*buffer*/, int /*length*/, con
return false;
}
- const std::string response = "renderfont: " + tokens.cat(std::string(" "), 1) + "\n";
+ const std::string response = "renderfont: " + tokens.cat(std::string(" "), 1) + '\n';
std::vector<char> output;
output.resize(response.size());
@@ -1614,7 +1614,7 @@ bool ChildSession::renderWindow(const char* /*buffer*/, int /*length*/, const St
if (!paintRectangle.empty())
response += " rectangle=" + paintRectangle;
- response += "\n";
+ response += '\n';
std::vector<char> output;
output.reserve(response.size() + pixmapDataSize);
diff --git a/kit/Delta.hpp b/kit/Delta.hpp
index 9e3876643..6358c1f42 100644
--- a/kit/Delta.hpp
+++ b/kit/Delta.hpp
@@ -102,13 +102,13 @@ class DeltaGenerator {
// TODO: should we split and compress alpha separately ?
if (prev.getWidth() != cur.getWidth() || prev.getHeight() != cur.getHeight())
{
- LOG_ERR("mis-sized delta: " << prev.getWidth() << "x" << prev.getHeight() << " vs "
- << cur.getWidth() << "x" << cur.getHeight());
+ LOG_ERR("mis-sized delta: " << prev.getWidth() << 'x' << prev.getHeight() << " vs "
+ << cur.getWidth() << 'x' << cur.getHeight());
return false;
}
output.push_back('D');
- LOG_TRC("building delta of a " << cur.getWidth() << "x" << cur.getHeight() << " bitmap");
+ LOG_TRC("building delta of a " << cur.getWidth() << 'x' << cur.getHeight() << " bitmap");
// row move/copy src/dest is a byte.
assert (prev.getHeight() <= 256);
diff --git a/kit/ForKit.cpp b/kit/ForKit.cpp
index c820305ff..c5bd274dc 100644
--- a/kit/ForKit.cpp
+++ b/kit/ForKit.cpp
@@ -136,7 +136,7 @@ protected:
}
else
{
- LOG_ERR("Bad or unknown token [" << tokens[0] << "]");
+ LOG_ERR("Bad or unknown token [" << tokens[0] << ']');
}
}
@@ -167,12 +167,12 @@ static bool haveCapability(cap_value_t capability)
{
if (cap_name)
{
- LOG_SFL("cap_get_flag failed for " << cap_name << ".");
+ LOG_SFL("cap_get_flag failed for " << cap_name << '.');
cap_free(cap_name);
}
else
{
- LOG_SFL("cap_get_flag failed for capability " << capability << ".");
+ LOG_SFL("cap_get_flag failed for capability " << capability << '.');
}
return false;
}
@@ -263,7 +263,7 @@ static void cleanupChildren()
if (WSHandler)
{
std::stringstream stream;
- stream << "segfaultcount " << segFaultCount << "\n";
+ stream << "segfaultcount " << segFaultCount << '\n';
int ret = WSHandler->sendMessage(stream.str());
if (ret == -1)
{
@@ -297,7 +297,7 @@ static int createLibreOfficeKit(const std::string& childRoot,
// Used to label the spare kit instances
static size_t spareKitId = 0;
++spareKitId;
- LOG_DBG("Forking a loolkit process with jailId: " << jailId << " as spare loolkit #" << spareKitId << ".");
+ LOG_DBG("Forking a loolkit process with jailId: " << jailId << " as spare loolkit #" << spareKitId << '.');
const pid_t pid = fork();
if (!pid)
diff --git a/kit/Kit.cpp b/kit/Kit.cpp
index db95047f9..db18fd858 100644
--- a/kit/Kit.cpp
+++ b/kit/Kit.cpp
@@ -224,7 +224,7 @@ namespace
{
++linkOrCopyFileCount;
if (linkOrCopyVerboseLogging)
- LOG_INF("Linking file \"" << fpath << "\" to \"" << newPath.toString() << "\"");
+ LOG_INF("Linking file \"" << fpath << "\" to \"" << newPath.toString() << '"');
if (link(fpath, newPath.toString().c_str()) == -1)
{
@@ -328,10 +328,10 @@ namespace
}
break;
case FTW_DNR:
- LOG_ERR("nftw: Cannot read directory '" << fpath << "'");
+ LOG_ERR("nftw: Cannot read directory '" << fpath << '\'');
return FTW_STOP;
case FTW_NS:
- LOG_ERR("nftw: stat failed for '" << fpath << "'");
+ LOG_ERR("nftw: stat failed for '" << fpath << '\'');
return FTW_STOP;
default:
LOG_FTL("nftw: unexpected typeflag: '" << typeflag);
@@ -368,7 +368,7 @@ namespace
if (nftw(source.c_str(), linkOrCopyFunction, 10, FTW_ACTIONRETVAL|FTW_PHYS) == -1)
{
- LOG_SYS("linkOrCopy: nftw() failed for '" << source << "'");
+ LOG_SYS("linkOrCopy: nftw() failed for '" << source << '\'');
}
if (linkOrCopyVerboseLogging)
@@ -920,7 +920,7 @@ public:
{
LOG_INF("setDocumentPassword: passwordProtected=" << _isDocPasswordProtected <<
" passwordProvided=" << _haveDocPassword <<
- " password='" << _docPassword << "'");
+ " password='" << _docPassword << '\'');
if (_isDocPasswordProtected && _haveDocPassword)
{
@@ -1010,7 +1010,7 @@ public:
const size_t pixmapHeight = tilesByY * tileCombined.getHeight();
if (pixmapWidth > 4096 || pixmapHeight > 4096)
- LOG_WRN("Unusual extremely large tile combine of size " << pixmapWidth << "x" << pixmapHeight);
+ LOG_WRN("Unusual extremely large tile combine of size " << pixmapWidth << 'x' << pixmapHeight);
const size_t pixmapSize = 4 * pixmapWidth * pixmapHeight;
RenderBuffer pixmap(pixmapWidth, pixmapHeight);
@@ -1044,7 +1044,7 @@ public:
// Render the whole area
const double area = pixmapWidth * pixmapHeight;
auto start = std::chrono::system_clock::now();
- LOG_TRC("Calling paintPartTile(" << (void*)pixmap.data() << ")");
+ LOG_TRC("Calling paintPartTile(" << (void*)pixmap.data() << ')');
_loKitDocument->paintPartTile(pixmap.data(),
tileCombined.getPart(),
pixmapWidth, pixmapHeight,
@@ -1092,7 +1092,7 @@ public:
if (hash != 0 && oldWireId == wireId)
{
// The tile content is identical to what the client already has, so skip it
- LOG_TRC("Match for tile #" << tileIndex << " at (" << positionX << "," <<
+ LOG_TRC("Match for tile #" << tileIndex << " at (" << positionX << ',' <<
positionY << ") oldhash==hash (" << hash << "), wireId: " << wireId << " skipping");
tileIndex++;
continue;
@@ -1117,7 +1117,7 @@ public:
pushRendered(duplicateTiles, tiles[tileIndex], wireId, 0);
duplicateHashes.push_back(hash);
skipCompress = true;
- LOG_TRC("Rendering duplicate tile #" << tileIndex << " at (" << positionX << "," <<
+ LOG_TRC("Rendering duplicate tile #" << tileIndex << " at (" << positionX << ',' <<
positionY << ") oldhash==hash (" << hash << "), wireId: " << wireId << " skipping");
break;
}
@@ -1160,7 +1160,7 @@ public:
});
}
- LOG_TRC("Encoded tile #" << tileIndex << " at (" << positionX << "," << positionY << ") with oldWireId=" <<
+ LOG_TRC("Encoded tile #" << tileIndex << " at (" << positionX << ',' << positionY << ") with oldWireId=" <<
tiles[tileIndex].getOldWireId() << ", hash=" << hash << " wireId: " << wireId << " in " << imgSize << " bytes.");
tileIndex++;
}
@@ -1236,7 +1236,7 @@ public:
catch (const Exception& exc)
{
LOG_ERR("Document::sendFrame: Exception: " << exc.displayText() <<
- (exc.nested() ? "( " + exc.nested()->displayText() + ")" : ""));
+ (exc.nested() ? "( " + exc.nested()->displayText() + ')' : ""));
}
return false;
@@ -1544,7 +1544,7 @@ private:
oss << "viewinfo: [";
for (const auto& viewId : viewIds)
{
- oss << "{\"id\":" << viewId << ",";
+ oss << "{\"id\":" << viewId << ',';
int color = 0;
const auto itView = viewInfoMap.find(viewId);
if (itView == viewInfoMap.end())
@@ -1572,7 +1572,7 @@ private:
}
oss.seekp(-1, std::ios_base::cur); // Remove last comma.
- oss << "]";
+ oss << ']';
// Broadcast updated viewinfo to all clients.
notifyAll(oss.str());
@@ -1655,7 +1655,7 @@ private:
catch(const Exception& exc)
{
LOG_ERR("Poco Exception: " << exc.displayText() <<
- (exc.nested() ? " (" + exc.nested()->displayText() + ")" : ""));
+ (exc.nested() ? " (" + exc.nested()->displayText() + ')' : ""));
}
return viewColors;
@@ -2350,7 +2350,7 @@ protected:
}
else
{
- LOG_ERR("Bad or unknown token [" << tokens[0] << "]");
+ LOG_ERR("Bad or unknown token [" << tokens[0] << ']');
}
}
@@ -2504,7 +2504,7 @@ void lokit_main(
try
{
#if !MOBILEAPP
- jailPath = Path::forDirectory(childRoot + "/" + jailId);
+ jailPath = Path::forDirectory(childRoot + '/' + jailId);
LOG_INF("Jail path: " << jailPath.toString());
File(jailPath).createDirectories();
chmod(jailPath.toString().c_str(), S_IXUSR | S_IWUSR | S_IRUSR);
@@ -2512,7 +2512,7 @@ void lokit_main(
if (!ChildSession::NoCapsForKit)
{
userdir_url = "file:///user";
- instdir_path = "/" + loSubPath + "/program";
+ instdir_path = '/' + loSubPath + "/program";
// Create a symlink inside the jailPath so that the absolute pathname loTemplate, when
// interpreted inside a chroot at jailPath, points to loSubPath (relative to the chroot).
@@ -2610,7 +2610,7 @@ void lokit_main(
{
LOG_ERR("Security warning - using template " << loTemplate << " as install subpath - skipping chroot jail setup");
userdir_url = "file:///" + jailPath.toString() + "/user";
- instdir_path = "/" + loTemplate + "/program";
+ instdir_path = '/' + loTemplate + "/program";
}
// hard-random tmpdir inside the jail / root
@@ -2776,7 +2776,7 @@ void lokit_main(
catch (const Exception& exc)
{
LOG_ERR("Poco Exception: " << exc.displayText() <<
- (exc.nested() ? " (" + exc.nested()->displayText() + ")" : ""));
+ (exc.nested() ? " (" + exc.nested()->displayText() + ')' : ""));
}
catch (const std::exception& exc)
{
diff --git a/kit/KitHelper.hpp b/kit/KitHelper.hpp
index 37fce3fa0..2c8db05ba 100644
--- a/kit/KitHelper.hpp
+++ b/kit/KitHelper.hpp
@@ -102,7 +102,7 @@ namespace LOKitHelper
for (int i = 0; i < parts; ++i)
{
- oss << "\n";
+ oss << '\n';
ptrValue = loKitDocument->pClass->getPartName(loKitDocument, i);
oss << ptrValue;
std::free(ptrValue);
@@ -112,7 +112,7 @@ namespace LOKitHelper
{
for (int i = 0; i < parts; ++i)
{
- oss << "\n";
+ oss << '\n';
ptrValue = loKitDocument->pClass->getPartHash(loKitDocument, i);
oss << ptrValue;
std::free(ptrValue);
diff --git a/net/DelaySocket.cpp b/net/DelaySocket.cpp
index fe9478bca..f2ece3279 100644
--- a/net/DelaySocket.cpp
+++ b/net/DelaySocket.cpp
@@ -11,7 +11,7 @@
#include <net/DelaySocket.hpp>
-#define DELAY_LOG(X) std::cerr << X << "\n";
+#define DELAY_LOG(X) std::cerr << X << '\n';
class Delayer;
@@ -63,7 +63,7 @@ public:
void dumpState(std::ostream& os) override
{
os << "\tfd: " << getFD()
- << "\n\tqueue: " << _chunks.size() << "\n";
+ << "\n\tqueue: " << _chunks.size() << '\n';
auto now = std::chrono::steady_clock::now();
for (auto &chunk : _chunks)
{
@@ -85,7 +85,7 @@ public:
int64_t remainingMicroS = std::chrono::duration_cast<std::chrono::microseconds>(
(*_chunks.begin())->getSendTime() - now).count();
if (remainingMicroS < timeoutMaxMicroS)
- DELAY_LOG("#" << getFD() << " reset timeout max to " << remainingMicroS
+ DELAY_LOG('#' << getFD() << " reset timeout max to " << remainingMicroS
<< "us from " << timeoutMaxMicroS << "us\n");
timeoutMaxMicroS = std::min(timeoutMaxMicroS, remainingMicroS);
}
@@ -122,7 +122,7 @@ public:
shutdown();
break;
}
- DELAY_LOG("#" << getFD() << " changed to state " << newState << "\n");
+ DELAY_LOG('#' << getFD() << " changed to state " << newState << '\n');
_state = newState;
}
@@ -144,8 +144,8 @@ public:
changeState(EofFlushWrites);
else if (len >= 0)
{
- DELAY_LOG("#" << getFD() << " read " << len
- << " to queue: " << _chunks.size() << "\n");
+ DELAY_LOG('#' << getFD() << " read " << len
+ << " to queue: " << _chunks.size() << '\n');
chunk->getData().insert(chunk->getData().end(), &buf[0], &buf[len]);
if (_dest)
_dest->_chunks.push_back(chunk);
@@ -154,7 +154,7 @@ public:
}
else if (errno != EAGAIN && errno != EWOULDBLOCK)
{
- DELAY_LOG("#" << getFD() << " error : " << Util::symbolicErrno(errno) << ": " << strerror(errno) << "\n");
+ DELAY_LOG('#' << getFD() << " error : " << Util::symbolicErrno(errno) << ": " << strerror(errno) << '\n');
changeState(Closed); // FIXME - propagate the error ?
}
}
@@ -172,7 +172,7 @@ public:
{
if (chunk->getData().size() == 0)
{ // delayed error or close
- DELAY_LOG("#" << getFD() << " handling delayed close\n");
+ DELAY_LOG('#' << getFD() << " handling delayed close\n");
changeState(Closed);
}
else
@@ -186,23 +186,23 @@ public:
{
if (errno == EAGAIN || errno == EWOULDBLOCK)
{
- DELAY_LOG("#" << getFD() << " full - waiting for write\n");
+ DELAY_LOG('#' << getFD() << " full - waiting for write\n");
}
else
{
- DELAY_LOG("#" << getFD() << " failed onwards write "
+ DELAY_LOG('#' << getFD() << " failed onwards write "
<< len << "bytes of "
<< chunk->getData().size()
<< " queue: " << _chunks.size() << " error: "
- << Util::symbolicErrno(errno) << ": " << strerror(errno) << "\n");
+ << Util::symbolicErrno(errno) << ": " << strerror(errno) << '\n');
changeState(Closed);
}
}
else
{
- DELAY_LOG("#" << getFD() << " written onwards " << len << "bytes of "
+ DELAY_LOG('#' << getFD() << " written onwards " << len << "bytes of "
<< chunk->getData().size()
- << " queue: " << _chunks.size() << "\n");
+ << " queue: " << _chunks.size() << '\n');
if (len > 0)
chunk->getData().erase(chunk->getData().begin(), chunk->getData().begin() + len);
@@ -215,7 +215,7 @@ public:
if (events & (POLLERR | POLLHUP | POLLNVAL))
{
- DELAY_LOG("#" << getFD() << " error events: " << events << "\n");
+ DELAY_LOG('#' << getFD() << " error events: " << events << '\n');
changeState(Closed);
}
diff --git a/net/FakeSocket.cpp b/net/FakeSocket.cpp
index 0cdd54795..13b73922c 100644
--- a/net/FakeSocket.cpp
+++ b/net/FakeSocket.cpp
@@ -83,7 +83,7 @@ static std::string flush()
{
static bool alwaysStderr = std::getenv("FAKESOCKET_LOG_ALWAYS_STDERR") != nullptr;
if (alwaysStderr)
- std::cerr << std::this_thread::get_id() << ":" << loggingBuffer.str() << std::endl;
+ std::cerr << std::this_thread::get_id() << ':' << loggingBuffer.str() << std::endl;
else if (loggingCallback != nullptr)
loggingCallback(loggingBuffer.str());
loggingBuffer.str("");
@@ -146,7 +146,7 @@ int fakeSocketPipe2(int pipefd[2])
pair.fd[1] = pair.fd[0] + 1;
pipefd[1] = pair.fd[1];
- FAKESOCKET_LOG("FakeSocket Pipe created (#" << pipefd[0] << ",#" << pipefd[1] << ")" << flush());
+ FAKESOCKET_LOG("FakeSocket Pipe created (#" << pipefd[0] << ",#" << pipefd[1] << ')' << flush());
return 0;
}
@@ -161,37 +161,37 @@ static std::string pollBits(int bits)
if (bits & POLLERR)
{
if (result != "")
- result += "+";
+ result += '+';
result += "ERR";
}
if (bits & POLLHUP)
{
if (result != "")
- result += "+";
+ result += '+';
result += "HUP";
}
if (bits & POLLIN)
{
if (result != "")
- result += "+";
+ result += '+';
result += "IN";
}
if (bits & POLLNVAL)
{
if (result != "")
- result += "+";
+ result += '+';
result += "NVAL";
}
if (bits & POLLOUT)
{
if (result != "")
- result += "+";
+ result += '+';
result += "OUT";
}
if (bits & POLLPRI)
{
if (result != "")
- result += "+";
+ result += '+';
result += "PRI";
}
@@ -253,8 +253,8 @@ int fakeSocketPoll(struct pollfd *pollfds, int nfds, int timeout)
for (int i = 0; i < nfds; i++)
{
if (i > 0)
- FAKESOCKET_LOG(",");
- FAKESOCKET_LOG("#" << pollfds[i].fd << ":" << pollBits(pollfds[i].events));
+ FAKESOCKET_LOG(',');
+ FAKESOCKET_LOG('#' << pollfds[i].fd << ':' << pollBits(pollfds[i].events));
}
FAKESOCKET_LOG(", timeout:" << timeout << flush());
@@ -294,8 +294,8 @@ int fakeSocketPoll(struct pollfd *pollfds, int nfds, int timeout)
for (int i = 0; i < nfds; i++)
{
if (i > 0)
- FAKESOCKET_LOG(",");
- FAKESOCKET_LOG("#" << pollfds[i].fd << ":" << pollBits(pollfds[i].revents));
+ FAKESOCKET_LOG(',');
+ FAKESOCKET_LOG('#' << pollfds[i].fd << ':' << pollBits(pollfds[i].revents));
}
FAKESOCKET_LOG(": " << result << flush());
diff --git a/net/ServerSocket.hpp b/net/ServerSocket.hpp
index 87cd51347..557f7004e 100644
--- a/net/ServerSocket.hpp
+++ b/net/ServerSocket.hpp
@@ -82,7 +82,7 @@ public:
if (!clientSocket)
{
const std::string msg = "Failed to accept. (errno: ";
- throw std::runtime_error(msg + std::strerror(errno) + ")");
+ throw std::runtime_error(msg + std::strerror(errno) + ')');
}
LOG_DBG("Accepted client #" << clientSocket->getFD());
diff --git a/net/Socket.cpp b/net/Socket.cpp
index 0703f9c0a..e388d412a 100644
--- a/net/Socket.cpp
+++ b/net/Socket.cpp
@@ -504,7 +504,7 @@ void SocketPoll::insertNewFakeSocket(
void ServerSocket::dumpState(std::ostream& os)
{
- os << "\t" << getFD() << "\t<accept>\n";
+ os << '\t' << getFD() << "\t<accept>\n";
}
void SocketDisposition::execute()
@@ -529,7 +529,7 @@ void WebSocketHandler::dumpState(std::ostream& os)
<< std::setw(5) << _pingTimeUs/1000. << "ms ";
if (_wsPayload.size() > 0)
Util::dumpHex(os, "\t\tws queued payload:\n", "\t\t", _wsPayload);
- os << "\n";
+ os << '\n';
if (_msgHandler)
_msgHandler->dumpState(os);
}
@@ -538,10 +538,10 @@ void StreamSocket::dumpState(std::ostream& os)
{
int64_t timeoutMaxMicroS = SocketPoll::DefaultPollTimeoutMicroS;
int events = getPollEvents(std::chrono::steady_clock::now(), timeoutMaxMicroS);
- os << "\t" << getFD() << "\t" << events << "\t"
- << _inBuffer.size() << "\t" << _outBuffer.size() << "\t"
- << " r: " << _bytesRecvd << "\t w: " << _bytesSent << "\t"
- << clientAddress() << "\t";
+ os << '\t' << getFD() << '\t' << events << '\t'
+ << _inBuffer.size() << '\t' << _outBuffer.size() << '\t'
+ << " r: " << _bytesRecvd << "\t w: " << _bytesSent << '\t'
+ << clientAddress() << '\t';
_socketHandler->dumpState(os);
if (_inBuffer.size() > 0)
Util::dumpHex(os, "\t\tinBuffer:\n", "\t\t", _inBuffer);
@@ -564,9 +564,9 @@ void SocketPoll::dumpState(std::ostream& os)
{
// FIXME: NOT thread-safe! _pollSockets is modified from the polling thread!
os << " Poll [" << _pollSockets.size() << "] - wakeup r: "
- << _wakeup[0] << " w: " << _wakeup[1] << "\n";
+ << _wakeup[0] << " w: " << _wakeup[1] << '\n';
if (_newCallbacks.size() > 0)
- os << "\tcallbacks: " << _newCallbacks.size() << "\n";
+ os << "\tcallbacks: " << _newCallbacks.size() << '\n';
os << "\tfd\tevents\trsize\twsize\n";
for (auto &i : _pollSockets)
i->dumpState(os);
@@ -688,7 +688,7 @@ int Socket::getPid() const
socklen_t credSize = sizeof(struct ucred);
if (getsockopt(_fd, SOL_SOCKET, SO_PEERCRED, &creds, &credSize) < 0)
{
- LOG_TRC("Failed to get pid via peer creds on " << _fd << " " << strerror(errno));
+ LOG_TRC("Failed to get pid via peer creds on " << _fd << ' ' << strerror(errno));
return -1;
}
return creds.pid;
@@ -721,7 +721,7 @@ std::shared_ptr<Socket> LocalServerSocket::accept()
socklen_t credSize = sizeof(struct ucred);
if (getsockopt(getFD(), SOL_SOCKET, SO_PEERCRED, &creds, &credSize) < 0)
{
- LOG_ERR("Failed to get peer creds on " << getFD() << " " << strerror(errno));
+ LOG_ERR("Failed to get peer creds on " << getFD() << ' ' << strerror(errno));
::close(rc);
return std::shared_ptr<Socket>(nullptr);
}
@@ -740,7 +740,7 @@ std::shared_ptr<Socket> LocalServerSocket::accept()
_socket->setClientAddress(addr);
LOG_DBG("Accepted socket is UDS - address " << addr <<
- " and uid/gid " << creds.uid << "/" << creds.gid);
+ " and uid/gid " << creds.uid << '/' << creds.gid);
return _socket;
}
catch (const std::exception& ex)
@@ -788,7 +788,7 @@ bool StreamSocket::parseHeader(const char *clientName,
Poco::Net::HTTPRequest &request,
MessageMap *map)
{
- LOG_TRC("#" << getFD() << " handling incoming " << _inBuffer.size() << " bytes.");
+ LOG_TRC('#' << getFD() << " handling incoming " << _inBuffer.size() << " bytes.");
assert(!map || (map->_headerSize == 0 && map->_messageSize == 0));
@@ -798,7 +798,7 @@ bool StreamSocket::parseHeader(const char *clientName,
marker.begin(), marker.end());
if (itBody == _inBuffer.end())
{
- LOG_TRC("#" << getFD() << " doesn't have enough data yet.");
+ LOG_TRC('#' << getFD() << " doesn't have enough data yet.");
return false;
}
@@ -817,7 +817,7 @@ bool StreamSocket::parseHeader(const char *clientName,
Log::StreamLogger logger = Log::info();
if (logger.enabled())
{
- logger << "#" << getFD() << ": " << clientName << " HTTP Request: "
+ logger << '#' << getFD() << ": " << clientName << " HTTP Request: "
<< request.getMethod() << ' '
<< request.getURI() << ' '
<< request.getVersion();
@@ -846,7 +846,7 @@ bool StreamSocket::parseHeader(const char *clientName,
bool getExpectContinue = !expect.empty() && Poco::icompare(expect, "100-continue") == 0;
if (getExpectContinue && !_sentHTTPContinue)
{
- LOG_TRC("#" << getFD() << " got Expect: 100-continue, sending Continue");
+ LOG_TRC('#' << getFD() << " got Expect: 100-continue, sending Continue");
// FIXME: should validate authentication headers early too.
send("HTTP/1.1 100 Continue\r\n\r\n",
sizeof("HTTP/1.1 100 Continue\r\n\r\n") - 1);
@@ -1033,7 +1033,7 @@ namespace HttpHelper
struct stat st;
if (stat(path.c_str(), &st) != 0)
{
- LOG_WRN("#" << socket->getFD() << ": Failed to stat [" << path << "]. File will not be sent.");
+ LOG_WRN('#' << socket->getFD() << ": Failed to stat [" << path << "]. File will not be sent.");
throw Poco::FileNotFoundException("Failed to stat [" + path + "]. File will not be sent.");
}
@@ -1064,7 +1064,7 @@ namespace HttpHelper
if (!deflate || true)
{
response.setContentLength(st.st_size);
- LOG_TRC("#" << socket->getFD() << ": Sending " <<
+ LOG_TRC('#' << socket->getFD() << ": Sending " <<
(headerOnly ? "header for " : "") << " file [" << path << "].");
socket->send(response);
@@ -1074,7 +1074,7 @@ namespace HttpHelper
else
{
response.set("Content-Encoding", "deflate");
- LOG_TRC("#" << socket->getFD() << ": Sending " <<
+ LOG_TRC('#' << socket->getFD() << ": Sending " <<
(headerOnly ? "header for " : "") << " file [" << path << "].");
socket->send(response);
diff --git a/net/Socket.hpp b/net/Socket.hpp
index 967e7b8c6..7e011bb9d 100644
--- a/net/Socket.hpp
+++ b/net/Socket.hpp
@@ -116,7 +116,7 @@ public:
virtual ~Socket()
{
- LOG_TRC("#" << getFD() << " Socket dtor.");
+ LOG_TRC('#' << getFD() << " Socket dtor.");
// Doesn't block on sockets; no error handling needed.
#if !MOBILEAPP
@@ -146,7 +146,7 @@ public:
/// TODO: Support separate read/write shutdown.
virtual void shutdown()
{
- LOG_TRC("#" << _fd << ": socket shutdown RDWR.");
+ LOG_TRC('#' << _fd << ": socket shutdown RDWR.");
#if !MOBILEAPP
::shutdown(_fd, SHUT_RDWR);
#else
@@ -193,7 +193,7 @@ public:
_sendBufferSize = getSocketBufferSize();
if (rc != 0 || _sendBufferSize < 0 )
{
- LOG_ERR("#" << _fd << ": Error getting socket buffer size " << errno);
+ LOG_ERR('#' << _fd << ": Error getting socket buffer size " << errno);
_sendBufferSize = DefaultSendBufferSize;
return false;
}
@@ -201,12 +201,12 @@ public:
{
if (_sendBufferSize > MaximumSendBufferSize * 2)
{
- LOG_TRC("#" << _fd << ": Clamped send buffer size to " <<
+ LOG_TRC('#' << _fd << ": Clamped send buffer size to " <<
MaximumSendBufferSize << " from " << _sendBufferSize);
_sendBufferSize = MaximumSendBufferSize;
}
else
- LOG_TRC("#" << _fd << ": Set socket buffer size to " << _sendBufferSize);
+ LOG_TRC('#' << _fd << ": Set socket buffer size to " << _sendBufferSize);
return true;
}
}
@@ -284,7 +284,7 @@ public:
{
if (id != _owner)
{
- LOG_DBG("#" << _fd << " Thread affinity set to " << Log::to_string(id) <<
+ LOG_DBG('#' << _fd << " Thread affinity set to " << Log::to_string(id) <<
" (was " << Log::to_string(_owner) << ").");
_owner = id;
}
@@ -303,7 +303,7 @@ public:
// uninitialized owner means detached and can be invoked by any thread.
const bool sameThread = (_owner == std::thread::id() || std::this_thread::get_id() == _owner);
if (!sameThread)
- LOG_ERR("#" << _fd << " Invoked from foreign thread. Expected: " <<
+ LOG_ERR('#' << _fd << " Invoked from foreign thread. Expected: " <<
Log::to_string(_owner) << " but called from " <<
std::this_thread::get_id() << " (" << Util::getThreadId() << ").");
@@ -325,7 +325,7 @@ protected:
setNoDelay();
_sendBufferSize = DefaultSendBufferSize;
_owner = std::this_thread::get_id();
- LOG_DBG("#" << _fd << " Thread affinity set to " << Log::to_string(_owner) << ".");
+ LOG_DBG('#' << _fd << " Thread affinity set to " << Log::to_string(_owner) << '.');
#if !MOBILEAPP
#if ENABLE_DEBUG
@@ -333,8 +333,8 @@ protected:
{
const int oldSize = getSocketBufferSize();
setSocketBufferSize(0);
- LOG_TRC("#" << _fd << ": Buffer size: " << getSendBufferSize() <<
- " (was " << oldSize << ")");
+ LOG_TRC('#' << _fd << ": Buffer size: " << getSendBufferSize() <<
+ " (was " << oldSize << ')');
}
#endif
#endif
@@ -493,7 +493,7 @@ public:
/// Stop the polling thread.
void stop()
{
- LOG_DBG("Stopping " << _name << ".");
+ LOG_DBG("Stopping " << _name << '.');
_stop = true;
#if MOBILEAPP
{
@@ -512,7 +512,7 @@ public:
void removeSockets()
{
- LOG_DBG("Removing all sockets from " << _name << ".");
+ LOG_DBG("Removing all sockets from " << _name << '.');
assertCorrectThread();
while (!_pollSockets.empty())
@@ -817,7 +817,7 @@ public:
virtual void shutdown() override
{
_shutdownSignalled = true;
- LOG_TRC("#" << getFD() << ": Async shutdown requested.");
+ LOG_TRC('#' << getFD() << ": Async shutdown requested.");
}
/// Perform the real shutdown.
@@ -994,7 +994,7 @@ public:
size_t count = map._headerSize;
size_t toErase = std::min(count, _inBuffer.size());
if (toErase < count)
- LOG_ERR("#" << getFD() << ": attempted to remove: " << count << " which is > size: " << _inBuffer.size() << " clamped to " << toErase);
+ LOG_ERR('#' << getFD() << ": attempted to remove: " << count << " which is > size: " << _inBuffer.size() << " clamped to " << toErase);
if (toErase > 0)
_inBuffer.erase(_inBuffer.begin(), _inBuffer.begin() + count);
}
@@ -1055,7 +1055,7 @@ protected:
// Always try to read.
closed = !readIncomingData() || closed;
- LOG_TRC("#" << getFD() << ": Incoming data buffer " << _inBuffer.size() <<
+ LOG_TRC('#' << getFD() << ": Incoming data buffer " << _inBuffer.size() <<
" bytes, closeSocket? " << closed);
#ifdef LOG_SOCKET_DATA
@@ -1101,7 +1101,7 @@ protected:
if (closed)
{
- LOG_TRC("#" << getFD() << ": Closed. Firing onDisconnect.");
+ LOG_TRC('#' << getFD() << ": Closed. Firing onDisconnect.");
_closed = true;
_socketHandler->onDisconnect();
}
@@ -1125,7 +1125,7 @@ public:
len = writeData(&_outBuffer[0], std::min((int)_outBuffer.size(),
getSendBufferSize()));
- LOG_TRC("#" << getFD() << ": Wrote outgoing data " << len << " bytes of "
+ LOG_TRC('#' << getFD() << ": Wrote outgoing data " << len << " bytes of "
<< _outBuffer.size() << " bytes buffered.");
#ifdef LOG_SOCKET_DATA
@@ -1135,7 +1135,7 @@ public:
#endif
if (len <= 0 && errno != EAGAIN && errno != EWOULDBLOCK)
- LOG_SYS("#" << getFD() << ": Socket write returned " << len);
+ LOG_SYS('#' << getFD() << ": Socket write returned " << len);
}
while (len < 0 && errno == EINTR);
diff --git a/net/Ssl.cpp b/net/Ssl.cpp
index 5dc8ba874..92f60064d 100644
--- a/net/Ssl.cpp
+++ b/net/Ssl.cpp
@@ -88,7 +88,7 @@ SslContext::SslContext(const std::string& certFilePath,
if (errCode != 1)
{
std::string msg = getLastErrorMsg();
- throw std::runtime_error(std::string("Cannot load CA file/directory at ") + caFilePath + " (" + msg + ")");
+ throw std::runtime_error(std::string("Cannot load CA file/directory at ") + caFilePath + " (" + msg + ')');
}
}
@@ -98,7 +98,7 @@ SslContext::SslContext(const std::string& certFilePath,
if (errCode != 1)
{
std::string msg = getLastErrorMsg();
- throw std::runtime_error(std::string("Error loading private key from file ") + keyFilePath + " (" + msg + ")");
+ throw std::runtime_error(std::string("Error loading private key from file ") + keyFilePath + " (" + msg + ')');
}
}
@@ -108,7 +108,7 @@ SslContext::SslContext(const std::string& certFilePath,
if (errCode != 1)
{
std::string msg = getLastErrorMsg();
- throw std::runtime_error(std::string("Error loading certificate from file ") + certFilePath + " (" + msg + ")");
+ throw std::runtime_error(std::string("Error loading certificate from file ") + certFilePath + " (" + msg + ')');
}
}
diff --git a/net/WebSocketHandler.hpp b/net/WebSocketHandler.hpp
index 5815a720e..9c4ac5bb4 100644
--- a/net/WebSocketHandler.hpp
+++ b/net/WebSocketHandler.hpp
@@ -97,7 +97,7 @@ public:
void onConnect(const std::shared_ptr<StreamSocket>& socket) override
{
_socket = socket;
- LOG_TRC("#" << socket->getFD() << " Connected to WS Handler " << this);
+ LOG_TRC('#' << socket->getFD() << " Connected to WS Handler " << this);
}
/// Status codes sent to peer on shutdown.
@@ -128,7 +128,7 @@ public:
return;
}
- LOG_TRC("#" << socket->getFD() << ": Shutdown websocket, code: " <<
+ LOG_TRC('#' << socket->getFD() << ": Shutdown websocket, code: " <<
static_cast<unsigned>(statusCode) << ", message: " << statusMessage);
_shuttingDown = true;
@@ -193,7 +193,7 @@ public:
#if !MOBILEAPP
if (len < 2) // partial read
{
- LOG_TRC("#" << socket->getFD() << ": Still incomplete WebSocket message, have " << len << " bytes");
+ LOG_TRC('#' << socket->getFD() << ": Still incomplete WebSocket message, have " << len << " bytes");
return false;
}
@@ -209,7 +209,7 @@ public:
{
if (len < 2 + 2)
{
- LOG_TRC("#" << socket->getFD() << ": Still incomplete WebSocket message, have " << len << " bytes");
+ LOG_TRC('#' << socket->getFD() << ": Still incomplete WebSocket message, have " << len << " bytes");
return false;
}
@@ -220,7 +220,7 @@ public:
{
if (len < 2 + 8)
{
- LOG_TRC("#" << socket->getFD() << ": Still incomplete WebSocket message, have " << len << " bytes");
+ LOG_TRC('#' << socket->getFD() << ": Still incomplete WebSocket message, have " << len << " bytes");
return false;
}
payloadLen = ((((uint64_t)p[9]) << 0) + (((uint64_t)p[8]) << 8) +
@@ -241,19 +241,19 @@ public:
if (payloadLen + headerLen > len)
{ // partial read wait for more data.
- LOG_TRC("#" << socket->getFD() << ": Still incomplete WebSocket frame, have " << len
+ LOG_TRC('#' << socket->getFD() << ": Still incomplete WebSocket frame, have " << len
<< " bytes, frame is " << payloadLen + headerLen << " bytes");
return false;
}
if (hasMask && _isClient)
{
- LOG_ERR("#" << socket->getFD() << ": Servers should not send masked frames. Only clients.");
+ LOG_ERR('#' << socket->getFD() << ": Servers should not send masked frames. Only clients.");
shutdown(StatusCodes::PROTOCOL_ERROR);
return true;
}
- LOG_TRC("#" << socket->getFD() << ": Incoming WebSocket data of " << len << " bytes: "
+ LOG_TRC('#' << socket->getFD() << ": Incoming WebSocket data of " << len << " bytes: "
<< Util::stringifyHexLine(socket->getInBuffer(), 0, std::min((size_t)32, len)));
data = p + headerLen;
@@ -266,20 +266,20 @@ public:
readPayload(data, payloadLen, mask, ctrlPayload);
socket->getInBuffer().erase(socket->getInBuffer().begin(), socket->getInBuffer().begin() + headerLen + payloadLen);
- LOG_TRC("#" << socket->getFD() << ": Incoming WebSocket frame code " << static_cast<unsigned>(code) <<
+ LOG_TRC('#' << socket->getFD() << ": Incoming WebSocket frame code " << static_cast<unsigned>(code) <<
", fin? " << fin << ", mask? " << hasMask << ", payload length: " << payloadLen <<
", residual socket data: " << socket->getInBuffer().size() << " bytes.");
// All control frames MUST NOT be fragmented and MUST have a payload length of 125 bytes or less
if (!fin)
{
- LOG_ERR("#" << socket->getFD() << ": A control frame cannot be fragmented.");
+ LOG_ERR('#' << socket->getFD() << ": A control frame cannot be fragmented.");
shutdown(StatusCodes::PROTOCOL_ERROR);
return true;
}
if (payloadLen > 125)
{
- LOG_ERR("#" << socket->getFD() << ": The payload length of a control frame must not exceed 125 bytes.");
+ LOG_ERR('#' << socket->getFD() << ": The payload length of a control frame must not exceed 125 bytes.");
shutdown(StatusCodes::PROTOCOL_ERROR);
return true;
}
@@ -289,7 +289,7 @@ public:
case WSOpCode::Pong:
if (_isClient)
{
- LOG_ERR("#" << socket->getFD() << ": Servers should not send pongs, only clients");
+ LOG_ERR('#' << socket->getFD() << ": Servers should not send pongs, only clients");
shutdown(StatusCodes::POLICY_VIOLATION);
return true;
}
@@ -297,7 +297,7 @@ public:
{
_pingTimeUs = std::chrono::duration_cast<std::chrono::microseconds>
(std::chrono::steady_clock::now() - _lastPingSentTime).count();
- LOG_TRC("#" << socket->getFD() << ": Pong received: " << _pingTimeUs << " microseconds");
+ LOG_TRC('#' << socket->getFD() << ": Pong received: " << _pingTimeUs << " microseconds");
}
break;
case WSOpCode::Ping:
@@ -310,7 +310,7 @@ public:
}
else
{
- LOG_ERR("#" << socket->getFD() << ": Clients should not send pings, only servers");
+ LOG_ERR('#' << socket->getFD() << ": Clients should not send pings, only servers");
shutdown(StatusCodes::POLICY_VIOLATION);
return true;
}
@@ -323,7 +323,7 @@ public:
{
// Peer-initiated shutdown must be echoed.
// Otherwise, this is the echo to _our_ shutdown message, which we should ignore.
- LOG_TRC("#" << socket->getFD() << ": Peer initiated socket shutdown. Code: " << static_cast<int>(statusCode));
+ LOG_TRC('#' << socket->getFD() << ": Peer initiated socket shutdown. Code: " << static_cast<int>(statusCode));
if (ctrlPayload.size())
{
statusCode = static_cast<StatusCodes>((((uint64_t)(unsigned char)ctrlPayload[0]) << 8) +
@@ -336,7 +336,7 @@ public:
return true;
}
default:
- LOG_ERR("#" << socket->getFD() << ": Received unknown control code");
+ LOG_ERR('#' << socket->getFD() << ": Received unknown control code");
shutdown(StatusCodes::PROTOCOL_ERROR);
break;
}
@@ -349,14 +349,14 @@ public:
{
if (code != WSOpCode::Continuation)
{
- LOG_ERR("#" << socket->getFD() << ": A fragment that is not the first fragment of a message must have the opcode equal to 0.");
+ LOG_ERR('#' << socket->getFD() << ": A fragment that is not the first fragment of a message must have the opcode equal to 0.");
shutdown(StatusCodes::PROTOCOL_ERROR);
return true;
}
}
else if (code == WSOpCode::Continuation)
{
- LOG_ERR("#" << socket->getFD() << ": An unfragmented message or the first fragment of a fragmented message must have the opcode different than 0.");
+ LOG_ERR('#' << socket->getFD() << ": An unfragmented message or the first fragment of a fragmented message must have the opcode different than 0.");
shutdown(StatusCodes::PROTOCOL_ERROR);
return true;
}
@@ -374,7 +374,7 @@ public:
#if !MOBILEAPP
- LOG_TRC("#" << socket->getFD() << ": Incoming WebSocket frame code " << static_cast<unsigned>(code) <<
+ LOG_TRC('#' << socket->getFD() << ": Incoming WebSocket frame code " << static_cast<unsigned>(code) <<
", fin? " << fin << ", mask? " << hasMask << ", payload length: " << payloadLen <<
", residual socket data: " << socket->getInBuffer().size() << " bytes, unmasked data: "+
Util::stringifyHexLine(_wsPayload, 0, std::min((size_t)32, _wsPayload.size())));
@@ -460,7 +460,7 @@ private:
return;
}
- LOG_TRC("#" << socket->getFD() << ": Sending " <<
+ LOG_TRC('#' << socket->getFD() << ": Sending " <<
(const char *)(code == WSOpCode::Ping ? " ping." : "pong."));
// FIXME: allow an empty payload.
sendMessage(data, len, code, false);
@@ -629,7 +629,7 @@ protected:
if (flush)
socket->writeOutgoingData();
#else
- LOG_TRC("WebSocketHandle::sendFrame: Writing to #" << socket->getFD() << " " << len << " bytes");
+ LOG_TRC("WebSocketHandle::sendFrame: Writing to #" << socket->getFD() << ' ' << len << " bytes");
// We ignore the flush parameter and always flush in the MOBILEAPP case because there is no
// WebSocket framing, we put the messages as such into the FakeSocket queue.
@@ -705,7 +705,7 @@ protected:
if (!socket)
throw std::runtime_error("Invalid socket while upgrading to WebSocket. Request: " + req.getURI());
- LOG_TRC("#" << socket->getFD() << ": Upgrading to WebSocket.");
+ LOG_TRC('#' << socket->getFD() << ": Upgrading to WebSocket.");
assert(!socket->isWebSocket());
#if !MOBILEAPP
@@ -714,7 +714,7 @@ protected:
const std::string wsKey = req.get("Sec-WebSocket-Key", "");
const std::string wsProtocol = req.get("Sec-WebSocket-Protocol", "chat");
// FIXME: other sanity checks ...
- LOG_INF("#" << socket->getFD() << ": WebSocket version: " << wsVersion <<
+ LOG_INF('#' << socket->getFD() << ": WebSocket version: " << wsVersion <<
", key: [" << wsKey << "], protocol: [" << wsProtocol << "].");
#if ENABLE_DEBUG
@@ -730,7 +730,7 @@ protected:
<< "\r\n";
const std::string res = oss.str();
- LOG_TRC("#" << socket->getFD() << ": Sending WS Upgrade response: " << res);
+ LOG_TRC('#' << socket->getFD() << ": Sending WS Upgrade response: " << res);
socket->send(res);
#endif
setWebSocket();
diff --git a/net/clientnb.cpp b/net/clientnb.cpp
index 6d8e7c494..2e00bd4be 100644
--- a/net/clientnb.cpp
+++ b/net/clientnb.cpp
@@ -75,7 +75,7 @@ public:
{
Poco::Net::HTTPRequest request(
Poco::Net::HTTPRequest::HTTP_POST,
- "/ping/" + _session_name + "/" + std::to_string(i));
+ "/ping/" + _session_name + '/' + std::to_string(i));
try {
Poco::Net::HTMLForm form;
form.setEncoding(Poco::Net::HTMLForm::ENCODING_MULTIPART);
@@ -85,7 +85,7 @@ public:
catch (const Poco::Exception &e)
{
std::cerr << "Failed to write data: " << e.name() <<
- " " << e.message() << "\n";
+ ' ' << e.message() << '\n';
throw;
}
}
@@ -111,7 +111,7 @@ public:
catch (const Poco::Exception &e)
{
std::cerr << "Exception converting: " << e.name() <<
- " " << e.message() << "\n";
+ ' ' << e.message() << '\n';
throw;
}
return number;
@@ -164,11 +164,11 @@ struct Client : public Poco::Util::Application
second.sendPing(count + 1);
back = first.getResponseInt();
- std::cerr << "testPing: " << back << "\n";
+ std::cerr << "testPing: " << back << '\n';
assert (back == count + 1);
back = second.getResponseInt();
- std::cerr << "testPing: " << back << "\n";
+ std::cerr << "testPing: " << back << '\n';
assert (back == count + 2);
}
diff --git a/test/DeltaTests.cpp b/test/DeltaTests.cpp
index 1af8acf33..c0ecf22bf 100644
--- a/test/DeltaTests.cpp
+++ b/test/DeltaTests.cpp
@@ -85,7 +85,7 @@ std::vector<char> DeltaTests::applyDelta(
int srcRow = (uint8_t)(delta[i+2]);
int destRow = (uint8_t)(delta[i+3]);
-// std::cout << "copy " << count <<" row(s) " << srcRow << " to " << destRow << "\n";
+// std::cout << "copy " << count <<" row(s) " << srcRow << " to " << destRow << '\n';
for (int cnt = 0; cnt < count; ++cnt)
{
const char *src = &pixmap[width * (srcRow + cnt) * 4];
@@ -103,7 +103,7 @@ std::vector<char> DeltaTests::applyDelta(
size_t length = (uint8_t)(delta[i+3]);
i += 4;
-// std::cout << "new " << length << " at " << destCol << ", " << destRow << "\n";
+// std::cout << "new " << length << " at " << destCol << ", " << destRow << '\n';
LOK_ASSERT(length <= width - destCol);
char *dest = &output[width * destRow * 4 + destCol * 4];
@@ -112,7 +112,7 @@ std::vector<char> DeltaTests::applyDelta(
break;
}
default:
- std::cout << "Unknown delta code " << delta[i] << "\n";
+ std::cout << "Unknown delta code " << delta[i] << '\n';
LOK_ASSERT(false);
break;
}
@@ -130,7 +130,7 @@ void DeltaTests::assertEqual(const std::vector<char> &a,
{
if (a[i] != b[i])
{
- std::cout << "Differences starting at byte " << i << " "
+ std::cout << "Differences starting at byte " << i << ' '
<< (i/4 % width) << ", " << (i / (width * 4)) << ":\n";
size_t len;
for (len = 0; (a[i+len] != b[i+len] || len < 8) && i + len < a.size(); ++len)
@@ -138,9 +138,9 @@ void DeltaTests::assertEqual(const std::vector<char> &a,
std::cout << std::hex << (int)((unsigned char)a[i+len]) << " != ";
std::cout << std::hex << (int)((unsigned char)b[i+len]) << " ";
if (len > 0 && (len % 16 == 0))
- std::cout<< "\n";
+ std::cout<< '\n';
}
- std::cout << " size " << len << "\n";
+ std::cout << " size " << len << '\n';
LOK_ASSERT(false);
}
}
diff --git a/test/TileCacheTests.cpp b/test/TileCacheTests.cpp
index 973d6722e..9df566372 100644
--- a/test/TileCacheTests.cpp
+++ b/test/TileCacheTests.cpp
@@ -326,7 +326,7 @@ void TileCacheTests::testCancelTiles()
LOK_ASSERT_MESSAGE("Did not expect getting message [" + res + "].", res.empty());
}
- TST_LOG("Unexpected: [" << res << "]");
+ TST_LOG("Unexpected: [" << res << ']');
}
}
}
@@ -363,7 +363,7 @@ void TileCacheTests::testCancelTilesMultiView()
LOK_ASSERT_MESSAGE("Did not expect getting message [" + res1 + "].", res1.empty());
}
- TST_LOG("Unexpected: [" << res1 << "]");
+ TST_LOG("Unexpected: [" << res1 << ']');
continue;
}
@@ -384,7 +384,7 @@ void TileCacheTests::testCancelTilesMultiView()
LOK_ASSERT_MESSAGE("Did not expect getting message [" + res2 + "].", res1.empty());
}
- TST_LOG("Unexpected: [" << res2 << "]");
+ TST_LOG("Unexpected: [" << res2 << ']');
continue;
}
@@ -1349,11 +1349,11 @@ void TileCacheTests::testTileProcessed()
// Store tileID, so we can send it back
StringVector tokens(LOOLProtocol::tokenize(tile, ' '));
- std::string tileID = tokens[2].substr(std::string("part=").size()) + ":" +
- tokens[5].substr(std::string("tileposx=").size()) + ":" +
- tokens[6].substr(std::string("tileposy=").size()) + ":" +
- tokens[7].substr(std::string("tileWidth=").size()) + ":" +
- tokens[8].substr(std::string("tileHeight=").size()) + ":" +
+ std::string tileID = tokens[2].substr(std::string("part=").size()) + ':' +
+ tokens[5].substr(std::string("tileposx=").size()) + ':' +
+ tokens[6].substr(std::string("tileposy=").size()) + ':' +
+ tokens[7].substr(std::string("tileWidth=").size()) + ':' +
+ tokens[8].substr(std::string("tileHeight=").size()) + ':' +
tokens[1].substr(std::string("nviewid=").size());
tileIDs.push_back(tileID);
}
diff --git a/test/UnitAdmin.cpp b/test/UnitAdmin.cpp
index 4cb030047..7c1eb0eea 100644
--- a/test/UnitAdmin.cpp
+++ b/test/UnitAdmin.cpp
@@ -444,7 +444,7 @@ public:
? "FAIL"
: (res == TestResult::TimedOut)
? "TIMEOUT"
- : "??? (" + std::to_string((int)res) + ")"));
+ : "??? (" + std::to_string((int)res) + ')'));
exitTest(res);
assert(false);
return;
diff --git a/test/UnitClient.cpp b/test/UnitClient.cpp
index bd2378eb3..995566912 100644
--- a/test/UnitClient.cpp
+++ b/test/UnitClient.cpp
@@ -39,7 +39,7 @@ public:
bool filterAlertAllusers(const std::string & msg) override
{
- std::cout << "Alert: " << msg << "\n";
+ std::cout << "Alert: " << msg << '\n';
return false;
}
diff --git a/test/UnitConvert.cpp b/test/UnitConvert.cpp
index 4f281ad20..237649d15 100644
--- a/test/UnitConvert.cpp
+++ b/test/UnitConvert.cpp
@@ -97,7 +97,7 @@ public:
}
bool filterKitMessage(WebSocketHandler *, std::string &message) override
{
- std::cerr << "kit message " << message << "\n";
+ std::cerr << "kit message " << message << '\n';
if (message.find("load") != std::string::npos)
{
std::cerr << "Load message received - starting to sleep\n";
diff --git a/test/UnitCopyPaste.cpp b/test/UnitCopyPaste.cpp
index ca48667e7..17f7ba381 100644
--- a/test/UnitCopyPaste.cpp
+++ b/test/UnitCopyPaste.cpp
@@ -82,7 +82,7 @@ public:
if (response.getContentType() != "application/octet-stream")
{
- std::cerr << "Error: mismatching content type for clipboard: " << response.getContentType() << "\n";
+ std::cerr << "Error: mismatching content type for clipboard: " << response.getContentType() << '\n';
exitTest(TestResult::Failed);
return std::shared_ptr<ClipboardData>();
}
@@ -94,7 +94,7 @@ public:
std::cerr << "got response\n";
return clipboard;
} catch (Poco::Exception &e) {
- std::cerr << "Poco exception: " << e.message() << "\n";
+ std::cerr << "Poco exception: " << e.message() << '\n';
exitTest(TestResult::Failed);
return std::shared_ptr<ClipboardData>();
}
@@ -118,7 +118,7 @@ public:
}
else if (value != content)
{
- std::cerr << "Error: clipboard content mismatch " << value.length() << " vs. " << content.length() << "\n";
+ std::cerr << "Error: clipboard content mismatch " << value.length() << " vs. " << content.length() << '\n';
sleep (1); // output settle.
Util::dumpHex(std::cerr, "\tclipboard:\n", "", value);
Util::dumpHex(std::cerr, "\tshould be:\n", "", content);
@@ -184,7 +184,7 @@ public:
if (response.getStatus() != expected)
{
std::cerr << "Error: response for clipboard "<< response.getStatus() <<
- " != expected " << expected << "\n";
+ " != expected " << expected << '\n';
exitTest(TestResult::Failed);
return false;
}
@@ -205,7 +205,7 @@ public:
clientSession = sessions[session];
std::string tag = clientSession->getClipboardURI(false); // nominally thread unsafe
- std::cerr << "Got tag '" << tag << "' for session " << session << "\n";
+ std::cerr << "Got tag '" << tag << "' for session " << session << '\n';
return tag;
}
@@ -213,8 +213,8 @@ public:
{
std::stringstream clipData;
clipData << "text/plain;charset=utf-8\n"
- << std::hex << text.length() << "\n"
- << text << "\n";
+ << std::hex << text.length() << '\n'
+ << text << '\n';
return clipData.str();
}
@@ -261,7 +261,7 @@ public:
helpers::sendTextFrame(socket, "uno .uno:Copy", testname);
std::string existing = "2\t\n3\t\n5\t";
- if (!fetchClipboardAssert(clipURI, "text/plain;charset=utf-8", existing + text + "\n"))
+ if (!fetchClipboardAssert(clipURI, "text/plain;charset=utf-8", existing + text + '\n'))
return;
std::cerr << "re-check no clipboard content\n";
@@ -281,7 +281,7 @@ public:
std::cerr << "Check the result.\n";
helpers::sendTextFrame(socket, "uno .uno:SelectAll", testname);
helpers::sendTextFrame(socket, "uno .uno:Copy", testname);
- if (!fetchClipboardAssert(clipURI, "text/plain;charset=utf-8", existing + newcontent + "\n"))
+ if (!fetchClipboardAssert(clipURI, "text/plain;charset=utf-8", existing + newcontent + '\n'))
return;
std::cerr << "Setup clipboards:\n";
diff --git a/test/UnitHTTP.cpp b/test/UnitHTTP.cpp
index f173638eb..e49853f52 100644
--- a/test/UnitHTTP.cpp
+++ b/test/UnitHTTP.cpp
@@ -41,6 +41,7 @@ public:
void testContinue()
{
+ //FIXME: use logging
std::cerr << "testContinue\n";
for (int i = 0; i < 3; ++i)
{
@@ -188,7 +189,7 @@ public:
LOK_ASSERT_MESSAGE("Missing separator, got " + std::string(buffer), ptr);
if (!ptr)
{
- std::cerr << "missing separator " << got << " '" << buffer << "\n";
+ std::cerr << "missing separator " << got << " '" << buffer << '\n';
exitTest(TestResult::Failed);
return;
}
@@ -206,14 +207,14 @@ public:
buffer[got] = '\0';
else
{
- std::cerr << "No content returned " << got << "\n";
+ std::cerr << "No content returned " << got << '\n';
exitTest(TestResult::Failed);
return;
}
if (strcmp(buffer, "\357\273\277This is some text.\nAnd some more.\n"))
{
- std::cerr << "unexpected file content " << got << " '" << buffer << "\n";
+ std::cerr << "unexpected file content " << got << " '" << buffer << '\n';
exitTest(TestResult::Failed);
return;
}
diff --git a/test/UnitSession.cpp b/test/UnitSession.cpp
index f8b859fa1..eabd338da 100644
--- a/test/UnitSession.cpp
+++ b/test/UnitSession.cpp
@@ -200,7 +200,7 @@ UnitBase::TestResult UnitSession::testSlideShow()
std::string encodedDoc;
Poco::URI::encode(documentPath, ":/?", encodedDoc);
- const std::string path = "/lool/" + encodedDoc + "/" + jail + "/" + dir + "/" + name;
+ const std::string path = "/lool/" + encodedDoc + '/' + jail + '/' + dir + '/' + name;
std::unique_ptr<Poco::Net::HTTPClientSession> session(
helpers::createSession(Poco::URI(helpers::getTestServerURI())));
Poco::Net::HTTPRequest requestSVG(Poco::Net::HTTPRequest::HTTP_GET, path);
diff --git a/test/UnitTyping.cpp b/test/UnitTyping.cpp
index 63835e3b4..ae21c8bcc 100644
--- a/test/UnitTyping.cpp
+++ b/test/UnitTyping.cpp
@@ -46,7 +46,7 @@ public:
bool filterAlertAllusers(const std::string & msg) override
{
- std::cout << "Alert: " << msg << "\n";
+ std::cout << "Alert: " << msg << '\n';
return false;
}
@@ -235,8 +235,8 @@ public:
if (!(num & 0x300)) // occasionally sleep some more - why not.
std::this_thread::sleep_for(std::chrono::milliseconds(waitMS*25));
- LOG_TRC("Send to " << which << " message " << msg);
-// std::cout << "Send to " << which << " message " << msg << "\n";
+ LOG_TRC("Send to " << which << " message " << msg);
+ // std::cout << "Send to " << which << " message " << msg << '\n';
sendTextFrame(sock, msg, testname);
}
liveTyping--;
@@ -264,12 +264,12 @@ public:
results[i] = result;
char target = 'a'+i;
- LOG_TRC("Result [" << i << "] target " << target << " is '" << result << "'");
+ LOG_TRC("Result [" << i << "] target " << target << " is '" << result << '\'');
for (size_t j = sizeof("textselectioncontent:"); j < result.size(); ++j)
{
if (result[j] != ' ' && result[j] != target)
{
- LOG_TRC("Text contains incorrect char[" << j << "] = '" << result[j] << "' not " << target << " '" << result << "'");
+ LOG_TRC("Text contains incorrect char[" << j << "] = '" << result[j] << "' not " << target << " '" << result << '\'');
if (result[j] != target)
return TestResult::Failed;
}
diff --git a/test/UnitUNOCommand.cpp b/test/UnitUNOCommand.cpp
index e50b1c158..ae420c862 100644
--- a/test/UnitUNOCommand.cpp
+++ b/test/UnitUNOCommand.cpp
@@ -26,7 +26,7 @@ namespace
{
void testStateChanged(const std::string& filename, std::set<std::string>& commands)
{
- const auto testname = "stateChanged_" + filename + " ";
+ const auto testname = "stateChanged_" + filename + ' ';
Poco::RegularExpression reUno("\\.[a-zA-Z]*\\:[a-zA-Z]*\\=");
diff --git a/test/countloolkits.hpp b/test/countloolkits.hpp
index 4948e97fc..d1ebd57cd 100644
--- a/test/countloolkits.hpp
+++ b/test/countloolkits.hpp
@@ -71,7 +71,7 @@ static int countLoolKitProcesses(const int expected)
std::ostringstream oss;
oss << "Test kit pids are ";
for (auto i : pids)
- oss << i << " ";
+ oss << i << ' ';
TST_LOG(oss.str());
return count;
diff --git a/test/fakesockettest.cpp b/test/fakesockettest.cpp
index 1b5573359..acc2ea952 100644
--- a/test/fakesockettest.cpp
+++ b/test/fakesockettest.cpp
@@ -51,7 +51,7 @@ public:
{
fakeSocketSetLoggingCallback([](const std::string& line)
{
- std::cerr << line << "\n";
+ std::cerr << line << '\n';
});
}
diff --git a/test/helpers.hpp b/test/helpers.hpp
index bbbf3fc2a..d7bd71fdb 100644
--- a/test/helpers.hpp
+++ b/test/helpers.hpp
@@ -324,7 +324,7 @@ std::vector<char> getResponseMessage(LOOLWebSocket& ws, const std::string& prefi
{
if (LOOLProtocol::matchPrefix(prefix, message))
{
- TST_LOG("[" << prefix << "] Matched " <<
+ TST_LOG('[' << prefix << "] Matched " <<
LOOLWebSocket::getAbbreviatedFrameDump(response.data(), bytes, flags));
return response;
}
@@ -348,7 +348,7 @@ std::vector<char> getResponseMessage(LOOLWebSocket& ws, const std::string& prefi
throw std::runtime_error(message);
}
- TST_LOG("[" << prefix << "] Ignored " <<
+ TST_LOG('[' << prefix << "] Ignored " <<
LOOLWebSocket::getAbbreviatedFrameDump(response.data(), bytes, flags));
}
}
@@ -674,7 +674,7 @@ inline void saveTileAs(const std::vector<char> &tileResponse,
std::fstream outStream(filename, std::ios::out);
outStream.write(res.data(), res.size());
outStream.close();
- TST_LOG("Saved [" << firstLine << "] to [" << filename << "]");
+ TST_LOG("Saved [" << firstLine << "] to [" << filename << ']');
}
inline std::vector<char> getTileAndSave(std::shared_ptr<LOOLWebSocket>& socket,
@@ -741,7 +741,7 @@ inline bool svgMatch(const char *testname, const std::vector<char> &response, co
TST_LOG_APPEND(std::string(expectedSVG.data(), expectedSVG.size()));
std::string newName = templateFile;
newName += ".new";
- TST_LOG_APPEND("Updated template writing to: " << newName << "\n");
+ TST_LOG_APPEND("Updated template writing to: " << newName << '\n');
TST_LOG_END;
FILE *of = fopen(Poco::Path(TDOC, newName).toString().c_str(), "w");
diff --git a/test/lokassert.hpp b/test/lokassert.hpp
index bf50a8ef3..612161b69 100644
--- a/test/lokassert.hpp
+++ b/test/lokassert.hpp
@@ -47,7 +47,7 @@ inline std::ostream& operator<<(std::ostream& os, const std::vector<char>& v)
if (!((expected) == (actual))) \
{ \
std::cerr << "Assertion failure: Expected [" << (expected) << "] but got [" \
- << (actual) << "]" << std::endl; \
+ << (actual) << ']' << std::endl; \
LOK_ASSERT_IMPL((expected) == (actual)); \
CPPUNIT_ASSERT_EQUAL((expected), (actual)); \
} \
diff --git a/tools/Config.cpp b/tools/Config.cpp
index 86339915a..9c4093910 100644
--- a/tools/Config.cpp
+++ b/tools/Config.cpp
@@ -289,8 +289,8 @@ int Config::main(const std::vector<std::string>& args)
const std::string passwordHash = stream.str();
std::stringstream pwdConfigValue("pbkdf2.sha512.", std::ios_base::in | std::ios_base::out | std::ios_base::ate);
- pwdConfigValue << std::to_string(_adminConfig.getPwdIterations()) << ".";
- pwdConfigValue << saltHash << "." << passwordHash;
+ pwdConfigValue << std::to_string(_adminConfig.getPwdIterations()) << '.';
+ pwdConfigValue << saltHash << '.' << passwordHash;
_loolConfig.setString("admin_console.username", adminUser);
_loolConfig.setString("admin_console.secure_password[@desc]",
"Salt and password hash combination generated using PBKDF2 with SHA512 digest.");
@@ -348,8 +348,8 @@ int Config::main(const std::vector<std::string>& args)
if (_loolConfig.has(args[1]))
{
const std::string val = _loolConfig.getString(args[1]);
- std::cout << "Previous value found in config file: \"" << val << "\"" << std::endl;
- std::cout << "Changing value to: \"" << args[2] << "\"" << std::endl;
+ std::cout << "Previous value found in config file: \"" << val << '"' << std::endl;
+ std::cout << "Changing value to: \"" << args[2] << '"' << std::endl;
_loolConfig.setString(args[1], args[2]);
changed = true;
}
@@ -388,7 +388,7 @@ int Config::main(const std::vector<std::string>& args)
}
else
{
- std::cerr << "No such command, \"" << args[0] << "\"" << std::endl;
+ std::cerr << "No such command, \"" << args[0] << '"' << std::endl;
displayHelp();
}
diff --git a/tools/Connect.cpp b/tools/Connect.cpp
index 0a115960b..32172da5c 100644
--- a/tools/Connect.cpp
+++ b/tools/Connect.cpp
@@ -209,7 +209,7 @@ protected:
{
{
std::unique_lock<std::mutex> lock(coutMutex);
- std::cout << "Sending: '" << line << "'" << std::endl;
+ std::cout << "Sending: '" << line << '\'' << std::endl;
}
ws.sendFrame(line.c_str(), line.size());
}
diff --git a/tools/KitClient.cpp b/tools/KitClient.cpp
index 54d270677..b3fa02a62 100644
--- a/tools/KitClient.cpp
+++ b/tools/KitClient.cpp
@@ -112,7 +112,7 @@ protected:
std::cout << LOKitHelper::documentStatus(loKitDocument) << std::endl;
for (int i = 0; i < loKitDocument->pClass->getParts(loKitDocument); i++)
{
- std::cout << " " << i << ": '" << loKitDocument->pClass->getPartName(loKitDocument, i) << "'" << std::endl;
+ std::cout << " " << i << ": '" << loKitDocument->pClass->getPartName(loKitDocument, i) << '\'' << std::endl;
}
}
else if (tokens.equals(0, "tile"))
diff --git a/tools/Replay.hpp b/tools/Replay.hpp
index 4417814e6..a2e7e661b 100644
--- a/tools/Replay.hpp
+++ b/tools/Replay.hpp
@@ -192,7 +192,7 @@ protected:
}
else
{
- std::cout << "New Document: " << uri << "\n";
+ std::cout << "New Document: " << uri << '\n';
_childToDoc.emplace(rec.getPid(), uri);
std::shared_ptr<Connection> connection = Connection::create(_serverUri, uri, rec.getSessionId());
if (connection)
@@ -209,7 +209,7 @@ protected:
auto it = _sessions.find(uri);
if (it != _sessions.end())
{
- std::cout << "EndSession [" << rec.getSessionId() << "]: " << uri << "\n";
+ std::cout << "EndSession [" << rec.getSessionId() << "]: " << uri << '\n';
it->second.erase(rec.getSessionId());
if (it->second.empty())
diff --git a/tools/Tool.cpp b/tools/Tool.cpp
index 91c9164b6..f62c57177 100644
--- a/tools/Tool.cpp
+++ b/tools/Tool.cpp
@@ -115,7 +115,7 @@ public:
catch (const Poco::Exception &e)
{
std::cerr << "Failed to write data: " << e.name() <<
- " " << e.message() << "\n";
+ ' ' << e.message() << '\n';
return;
}
@@ -126,7 +126,7 @@ public:
std::istream& responseStream = session->receiveResponse(response);
Poco::Path path(document);
- std::string outPath = _app.getDestinationDir() + "/" + path.getBaseName() + "." + _app.getDestinationFormat();
+ std::string outPath = _app.getDestinationDir() + '/' + path.getBaseName() + '.' + _app.getDestinationFormat();
std::ofstream fileStream(outPath);
Poco::StreamCopier::copyStream(responseStream, fileStream);
@@ -134,7 +134,7 @@ public:
catch (const Poco::Exception &e)
{
std::cerr << "Exception converting: " << e.name() <<
- " " << e.message() << "\n";
+ ' ' << e.message() << '\n';
return;
}
diff --git a/tools/WebSocketDump.cpp b/tools/WebSocketDump.cpp
index 711cbaca9..7a592c550 100644
--- a/tools/WebSocketDump.cpp
+++ b/tools/WebSocketDump.cpp
@@ -63,7 +63,7 @@ private:
void onConnect(const std::shared_ptr<StreamSocket>& socket) override
{
_socket = socket;
- LOG_TRC("#" << socket->getFD() << " Connected to ClientRequestDispatcher.");
+ LOG_TRC('#' << socket->getFD() << " Connected to ClientRequestDispatcher.");
}
/// Called after successful socket reads.
@@ -77,7 +77,7 @@ private:
}
std::vector<char>& in = socket->getInBuffer();
- LOG_TRC("#" << socket->getFD() << " handling incoming " << in.size() << " bytes.");
+ LOG_TRC('#' << socket->getFD() << " handling incoming " << in.size() << " bytes.");
// Find the end of the header, if any.
static const std::string marker("\r\n\r\n");
@@ -85,7 +85,7 @@ private:
marker.begin(), marker.end());
if (itBody == in.end())
{
- LOG_DBG("#" << socket->getFD() << " doesn't have enough data yet.");
+ LOG_DBG('#' << socket->getFD() << " doesn't have enough data yet.");
return;
}
@@ -101,7 +101,7 @@ private:
Log::StreamLogger logger = Log::info();
if (logger.enabled())
{
- logger << "#" << socket->getFD() << ": Client HTTP Request: "
+ logger << '#' << socket->getFD() << ": Client HTTP Request: "
<< request.getMethod() << ' '
<< request.getURI() << ' '
<< request.getVersion();
@@ -172,7 +172,7 @@ private:
socket->shutdown();
// NOTE: Check _wsState to choose between HTTP response or WebSocket (app-level) error.
- LOG_INF("#" << socket->getFD() << " Exception while processing incoming request: [" <<
+ LOG_INF('#' << socket->getFD() << " Exception while processing incoming request: [" <<
LOOLProtocol::getAbbreviatedMessage(in) << "]: " << exc.what());
}
diff --git a/tools/map.cpp b/tools/map.cpp
index 7c36f93d1..472abe589 100644
--- a/tools/map.cpp
+++ b/tools/map.cpp
@@ -301,7 +301,7 @@ static void dumpDiff(const AddrSpace &space,
haveAnnots = true;
}
str.resize(24, ' ');
- annots << str << " ";
+ annots << str << ' ';
}
if (haveAnnots)
printf ("annot: %s\n", annots.str().c_str());
diff --git a/wsd/Admin.cpp b/wsd/Admin.cpp
index 5e6668326..b02e88883 100644
--- a/wsd/Admin.cpp
+++ b/wsd/Admin.cpp
@@ -94,7 +94,7 @@ void AdminSocketHandler::handleMessage(const std::vector<char> &payload)
if (!_isAuthenticated)
{
LOG_DBG("Not authenticated - message is '" << firstLine << "' " <<
- tokens.size() << " first: '" << tokens[0] << "'");
+ tokens.size() << " first: '" << tokens[0] << '\'');
sendMessage("NotAuthenticated");
shutdown();
return;
@@ -321,11 +321,11 @@ void AdminSocketHandler::sendTextFrame(const std::string& message)
if (_isAuthenticated)
{
- LOG_TRC("send admin text frame '" << message << "'");
+ LOG_TRC("send admin text frame '" << message << '\'');
sendMessage(message);
}
else
- LOG_TRC("Skip sending message to non-authenticated client: '" << message << "'");
+ LOG_TRC("Skip sending message to non-authenticated client: '" << message << '\'');
}
void AdminSocketHandler::subscribeAsync(const std::shared_ptr<AdminSocketHandler>& handler)
@@ -596,7 +596,7 @@ std::string Admin::getChannelLogLevels()
for (size_t i = 0; i < nameList.size(); i++)
{
- result += (nameList[i] != "" ? nameList[i]: "?") + "=" + levelList[Log::logger().get(nameList[i]).getLevel()] + (i != nameList.size() - 1 ? " ": "");
+ result += (nameList[i] != "" ? nameList[i]: "?") + '=' + levelList[Log::logger().get(nameList[i]).getLevel()] + (i != nameList.size() - 1 ? " ": "");
}
return result;
@@ -861,7 +861,7 @@ void Admin::start()
for (size_t i = 0; ; ++i)
{
- const std::string path = "monitors.monitor[" + std::to_string(i) + "]";
+ const std::string path = "monitors.monitor[" + std::to_string(i) + ']';
const std::string uri = config.getString(path, "");
if (!config.has(path))
break;
diff --git a/wsd/AdminModel.cpp b/wsd/AdminModel.cpp
index 9579a4e51..a5ccea5c3 100644
--- a/wsd/AdminModel.cpp
+++ b/wsd/AdminModel.cpp
@@ -69,7 +69,7 @@ std::pair<std::time_t, std::string> Document::getSnapshot() const
{
std::time_t ct = std::time(nullptr);
std::ostringstream oss;
- oss << "{";
+ oss << '{';
oss << "\"creationTime\"" << ":" << ct << ",";
oss << "\"memoryDirty\"" << ":" << getMemoryDirty() << ",";
oss << "\"activeViews\"" << ":" << getActiveViews() << ",";
@@ -78,12 +78,12 @@ std::pair<std::time_t, std::string> Document::getSnapshot() const
std::string separator;
for (const auto& view : getViews())
{
- oss << separator << "\"";
+ oss << separator << '"';
if(view.second.isExpired())
{
- oss << "-";
+ oss << '-';
}
- oss << view.first << "\"";
+ oss << view.first << '"';
separator = ",";
}
oss << "],";
@@ -726,12 +726,12 @@ std::string AdminModel::getDocuments() const
separator = ',';
}
}
- oss << "]"
- << "}";
+ oss << ']'
+ << '}';
separator1 = ',';
}
}
- oss << "]" << "}";
+ oss << ']' << '}';
return oss.str();
}
@@ -861,10 +861,10 @@ public:
std::string newUnit = std::string(unit && unit[0] ? "_" : "") + unit;
std::string newPrefix = prefix + std::string(prefix && prefix[0] ? "_" : "");
- oss << newPrefix << "total" << newUnit << " " << _total << std::endl;
- oss << newPrefix << "average" << newUnit << " " << getIntAverage() << std::endl;
- oss << newPrefix << "min" << newUnit << " " << getMin() << std::endl;
- oss << newPrefix << "max" << newUnit << " " << _max << std::endl;
+ oss << newPrefix << "total" << newUnit << ' ' << _total << std::endl;
+ oss << newPrefix << "average" << newUnit << ' ' << getIntAverage() << std::endl;
+ oss << newPrefix << "min" << newUnit << ' ' << getMin() << std::endl;
+ oss << newPrefix << "max" << newUnit << ' ' << _max << std::endl;
}
private:
diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp
index 3f37c88c4..d9e6eb0a4 100644
--- a/wsd/ClientSession.cpp
+++ b/wsd/ClientSession.cpp
@@ -885,7 +885,7 @@ bool ClientSession::sendFontRendering(const char *buffer, int length, const Stri
TileCache::Tile cachedTile = docBroker->tileCache().lookupCachedStream(TileCache::StreamType::Font, font+text);
if (cachedTile)
{
- const std::string response = "renderfont: " + tokens.cat(std::string(" "), 1) + "\n";
+ const std::string response = "renderfont: " + tokens.cat(std::string(" "), 1) + '\n';
return sendTile(response, cachedTile);
}
@@ -1047,7 +1047,7 @@ void ClientSession::postProcessCopyPayload(std::shared_ptr<Message> payload)
if (pos != std::string::npos) // assume text/html
{
const std::string meta = getClipboardURI();
- LOG_TRC("Inject clipboard meta origin of '" << meta << "'");
+ LOG_TRC("Inject clipboard meta origin of '" << meta << '\'');
const std::string origin = "<meta name=\"origin\" content=\"" + meta + "\"/>\n";
data.insert(data.begin() + pos, origin.begin(), origin.end());
return true;
@@ -1269,7 +1269,7 @@ bool ClientSession::handleKitToClientMessage(const char* buffer, const int lengt
const std::string fileName = Poco::Path(resultURL.getPath()).getFileName();
Poco::Net::HTTPResponse response;
if (!fileName.empty())
- response.set("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
+ response.set("Content-Disposition", "attachment; filename=\"" + fileName + '"');
HttpHelper::sendFile(_saveAsSocket, encodedFilePath, mimeType, response);
}
@@ -1721,8 +1721,8 @@ void ClientSession::dumpState(std::ostream& os)
<< "\n\t\tkeyEvents: " << _keyEvents
// << "\n\t\tvisibleArea: " << _clientVisibleArea
<< "\n\t\tclientSelectedPart: " << _clientSelectedPart
- << "\n\t\ttile size Pixel: " << _tileWidthPixel << "x" << _tileHeightPixel
- << "\n\t\ttile size Twips: " << _tileWidthTwips << "x" << _tileHeightTwips
+ << "\n\t\ttile size Pixel: " << _tileWidthPixel << 'x' << _tileHeightPixel
+ << "\n\t\ttile size Twips: " << _tileWidthTwips << 'x' << _tileHeightTwips
<< "\n\t\tkit ViewId: " << _kitViewId
<< "\n\t\tour URL (un-trusted): " << _serverURL.getSubURLForEndpoint("")
<< "\n\t\tisTextDocument: " << _isTextDocument
@@ -1738,7 +1738,7 @@ void ClientSession::dumpState(std::ostream& os)
os << "\n\t\tsent/keystroke: " << (double)sent/_keyEvents << "bytes";
}
- os << "\n";
+ os << '\n';
_senderQueue.dumpState(os);
}
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 717adec15..a3dece823 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -205,7 +205,7 @@ DocumentBroker::DocumentBroker(ChildType type,
assert(!LOOLWSD::ChildRoot.empty());
LOG_INF("DocumentBroker [" << LOOLWSD::anonymizeUrl(_uriPublic.toString()) <<
- "] created with docKey [" << _docKey << "]");
+ "] created with docKey [" << _docKey << ']');
}
void DocumentBroker::setupPriorities()
@@ -729,7 +729,7 @@ bool DocumentBroker::load(const std::shared_ptr<ClientSession>& session, const s
#endif
LOG_DBG("Setting username [" << LOOLWSD::anonymizeUsername(username) << "] and userId [" <<
- LOOLWSD::anonymizeUsername(userId) << "] for session [" << sessionId << "]");
+ LOOLWSD::anonymizeUsername(userId) << "] for session [" << sessionId << ']');
session->setUserId(userId);
session->setUserName(username);
@@ -799,7 +799,7 @@ bool DocumentBroker::load(const std::shared_ptr<ClientSession>& session, const s
// Extension matches, try the conversion. We convert the file to another one in
// the same (jail) directory, with just the new extension tacked on.
- const std::string newRootPath = _storage->getRootFilePath() + "." + newExtension;
+ const std::string newRootPath = _storage->getRootFilePath() + '.' + newExtension;
// The commandline must contain the space-separated substring @INPUT@ that is
// replaced with the input file name, and @OUTPUT@ for the output file name.
@@ -838,7 +838,7 @@ bool DocumentBroker::load(const std::shared_ptr<ClientSession>& session, const s
}
_storage->setRootFilePath(newRootPath);
- localPath += "." + newExtension;
+ localPath += '.' + newExtension;
}
// We successfully converted the file to something LO can use; break out of the for
@@ -996,7 +996,7 @@ bool DocumentBroker::saveToStorageInternal(const std::string& sessionId, bool su
const std::string newFilename = Util::getFilenameFromURL(uri);
const std::string fileId = Util::getFilenameFromURL(_docKey);
if (LOOLWSD::AnonymizeUserData)
- LOG_DBG("New filename [" << LOOLWSD::anonymizeUrl(newFilename) << "] will be known by its fileId [" << fileId << "]");
+ LOG_DBG("New filename [" << LOOLWSD::anonymizeUrl(newFilename) << "] will be known by its fileId [" << fileId << ']');
Util::mapAnonymized(newFilename, fileId);
const std::string uriAnonym = LOOLWSD::anonymizeUrl(uri);
@@ -1258,31 +1258,31 @@ bool DocumentBroker::sendUnoSave(const std::string& sessionId, bool dontTerminat
std::ostringstream oss;
// arguments init
- oss << "{";
+ oss << '{';
if (dontTerminateEdit)
{
oss << "\"DontTerminateEdit\":"
- << "{"
- << "\"type\":\"boolean\","
- << "\"value\":true"
- << "}";
+ "{"
+ "\"type\":\"boolean\","
+ "\"value\":true"
+ "}";
}
if (dontSaveIfUnmodified)
{
if (dontTerminateEdit)
- oss << ",";
+ oss << ',';
oss << "\"DontSaveIfUnmodified\":"
- << "{"
- << "\"type\":\"boolean\","
- << "\"value\":true"
- << "}";
+ "{"
+ "\"type\":\"boolean\","
+ "\"value\":true"
+ "}";
}
// arguments end
- oss << "}";
+ oss << '}';
assert(_storage);
_storage->setIsAutosave(isAutosave || UnitWSD::get().isAutosave());
@@ -1958,7 +1958,7 @@ void DocumentBroker::handleTileResponse(const std::vector<char>& payload)
}
catch (const std::exception& exc)
{
- LOG_ERR("Failed to process tile response [" << firstLine << "]: " << exc.what() << ".");
+ LOG_ERR("Failed to process tile response [" << firstLine << "]: " << exc.what() << '.');
}
}
@@ -1992,7 +1992,7 @@ void DocumentBroker::handleTileCombinedResponse(const std::vector<char>& payload
}
catch (const std::exception& exc)
{
- LOG_ERR("Failed to process tile response [" << firstLine << "]: " << exc.what() << ".");
+ LOG_ERR("Failed to process tile response [" << firstLine << "]: " << exc.what() << '.');
}
}
@@ -2393,7 +2393,7 @@ void DocumentBroker::dumpState(std::ostream& os)
else
os << "\n still loading... " <<
std::chrono::duration_cast<std::chrono::seconds>(
- now - _threadStart).count() << "s";
+ now - _threadStart).count() << 's';
os << "\n sent: " << sent;
os << "\n recv: " << recv;
os << "\n modified?: " << isModified();
diff --git a/wsd/FileServer.cpp b/wsd/FileServer.cpp
index b7cd523a3..791e6313f 100644
--- a/wsd/FileServer.cpp
+++ b/wsd/FileServer.cpp
@@ -466,7 +466,7 @@ void FileServerRequestHandler::handleRequest(const HTTPRequest& request,
std::ostringstream oss;
response.write(oss);
const std::string header = oss.str();
- LOG_TRC("#" << socket->getFD() << ": Sending " <<
+ LOG_TRC('#' << socket->getFD() << ": Sending " <<
(!gzip ? "un":"") << "compressed : file [" << relPath << "]: " << header);
socket->send(header);
socket->send(*content);
@@ -544,8 +544,7 @@ void FileServerRequestHandler::readDirToHash(const std::string &basePath, const
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list