[Libreoffice-commits] online.git: kit/ChildSession.cpp kit/Kit.cpp test/WopiTestServer.hpp wsd/Admin.cpp wsd/AdminModel.cpp wsd/DocumentBroker.cpp wsd/FileServer.cpp
Ashod Nakashian (via logerrit)
logerrit at kemper.freedesktop.org
Tue Jun 2 15:22:46 UTC 2020
kit/ChildSession.cpp | 4 ++--
kit/Kit.cpp | 2 +-
test/WopiTestServer.hpp | 2 +-
wsd/Admin.cpp | 2 +-
wsd/AdminModel.cpp | 16 ++++++++--------
wsd/DocumentBroker.cpp | 2 +-
wsd/FileServer.cpp | 4 +++-
7 files changed, 17 insertions(+), 15 deletions(-)
New commits:
commit 6ab64ac992a72681f6d8ce3436295ea4878dbece
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Mon Jun 1 19:41:08 2020 -0400
Commit: Ashod Nakashian <ashnakash at gmail.com>
CommitDate: Tue Jun 2 17:22:26 2020 +0200
wsd: single-char string literals -> char
Change-Id: I163d6fe1c80334317d38f8fed2199ad2b31a0f8a
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95335
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Tested-by: Jenkins
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/kit/ChildSession.cpp b/kit/ChildSession.cpp
index 2526819c6..69ccab599 100644
--- a/kit/ChildSession.cpp
+++ b/kit/ChildSession.cpp
@@ -1601,7 +1601,7 @@ bool ChildSession::renderWindow(const char* /*buffer*/, int /*length*/, const St
const auto elapsed = std::chrono::duration_cast<std::chrono::microseconds>(duration).count();
const double totalTime = elapsed/1000.;
LOG_TRC("paintWindow for " << winId << " returned " << width << "X" << height
- << "@(" << startX << "," << startY << ")"
+ << "@(" << startX << ',' << startY << ','
<< " with dpi scale: " << dpiScale
<< " and rendered in " << totalTime
<< "ms (" << area / elapsed << " MP/s).");
@@ -2095,7 +2095,7 @@ bool ChildSession::saveAs(const char* /*buffer*/, int /*length*/, const StringVe
bool ChildSession::setClientPart(const char* /*buffer*/, int /*length*/, const StringVector& tokens)
{
- int part;
+ int part = 0;
if (tokens.size() < 2 ||
!getTokenInteger(tokens[1], "part", part))
{
diff --git a/kit/Kit.cpp b/kit/Kit.cpp
index db18fd858..da722b369 100644
--- a/kit/Kit.cpp
+++ b/kit/Kit.cpp
@@ -1558,7 +1558,7 @@ private:
const std::string username = itView->second.getUserName();
oss << "\"username\":\"" << username << "\",";
if (!itView->second.getUserExtraInfo().empty())
- oss << "\"userextrainfo\":" << itView->second.getUserExtraInfo() << ",";
+ oss << "\"userextrainfo\":" << itView->second.getUserExtraInfo() << ',';
const bool readonly = itView->second.isReadOnly();
oss << "\"readonly\":\"" << readonly << "\",";
const auto it = viewColorsMap.find(username);
diff --git a/test/WopiTestServer.hpp b/test/WopiTestServer.hpp
index 40bacc45d..6fac6c336 100644
--- a/test/WopiTestServer.hpp
+++ b/test/WopiTestServer.hpp
@@ -227,7 +227,7 @@ protected:
oss << "HTTP/1.1 409 Conflict\r\n"
"User-Agent: " WOPI_AGENT_STRING "\r\n"
"\r\n"
- "{\"LOOLStatusCode\":" << static_cast<int>(LOOLStatusCode::DocChanged) << "}";
+ "{\"LOOLStatusCode\":" << static_cast<int>(LOOLStatusCode::DocChanged) << '}';
socket->send(oss.str());
socket->shutdown();
diff --git a/wsd/Admin.cpp b/wsd/Admin.cpp
index b02e88883..734672b7c 100644
--- a/wsd/Admin.cpp
+++ b/wsd/Admin.cpp
@@ -113,7 +113,7 @@ void AdminSocketHandler::handleMessage(const std::vector<char> &payload)
}
else if (tokens.equals(0, "history"))
{
- sendTextFrame("{ \"History\": " + model.getAllHistory() + "}");
+ sendTextFrame("{ \"History\": " + model.getAllHistory() + '}');
}
else if (tokens.equals(0, "version"))
{
diff --git a/wsd/AdminModel.cpp b/wsd/AdminModel.cpp
index a5ccea5c3..ab2d81df7 100644
--- a/wsd/AdminModel.cpp
+++ b/wsd/AdminModel.cpp
@@ -70,9 +70,9 @@ std::pair<std::time_t, std::string> Document::getSnapshot() const
std::time_t ct = std::time(nullptr);
std::ostringstream oss;
oss << '{';
- oss << "\"creationTime\"" << ":" << ct << ",";
- oss << "\"memoryDirty\"" << ":" << getMemoryDirty() << ",";
- oss << "\"activeViews\"" << ":" << getActiveViews() << ",";
+ oss << "\"creationTime\"" << ':' << ct << ',';
+ oss << "\"memoryDirty\"" << ':' << getMemoryDirty() << ',';
+ oss << "\"activeViews\"" << ':' << getActiveViews() << ',';
oss << "\"views\"" << ":[";
std::string separator;
@@ -88,8 +88,8 @@ std::pair<std::time_t, std::string> Document::getSnapshot() const
}
oss << "],";
- oss << "\"lastActivity\"" << ":" << _lastActivity;
- oss << "}";
+ oss << "\"lastActivity\"" << ':' << _lastActivity;
+ oss << '}';
return std::make_pair(ct, oss.str());
}
@@ -99,9 +99,9 @@ const std::string Document::getHistory() const
oss << "{";
oss << "\"docKey\"" << ":\"" << _docKey << "\",";
oss << "\"filename\"" << ":\"" << LOOLWSD::anonymizeUrl(getFilename()) << "\",";
- oss << "\"start\"" << ":" << _start << ",";
- oss << "\"end\"" << ":" << _end << ",";
- oss << "\"pid\"" << ":" << getPid() << ",";
+ oss << "\"start\"" << ':' << _start << ',';
+ oss << "\"end\"" << ':' << _end << ',';
+ oss << "\"pid\"" << ':' << getPid() << ',';
oss << "\"snapshots\"" << ":[";
std::string separator;
for (const auto& s : _snapshots)
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 7dd78664e..01bf64955 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -2414,7 +2414,7 @@ void DocumentBroker::dumpState(std::ostream& os)
os << "\n life limit in seconds: " << _limitLifeSeconds;
os << "\n idle time: " << getIdleTimeSecs();
os << "\n cursor " << _cursorPosX << ", " << _cursorPosY
- << "( " << _cursorWidth << "," << _cursorHeight << ")\n";
+ << "( " << _cursorWidth << ',' << _cursorHeight << ")\n";
_lockCtx->dumpState(os);
if (_tileCache)
_tileCache->dumpState(os);
diff --git a/wsd/FileServer.cpp b/wsd/FileServer.cpp
index 791e6313f..e833a7f82 100644
--- a/wsd/FileServer.cpp
+++ b/wsd/FileServer.cpp
@@ -529,6 +529,7 @@ void FileServerRequestHandler::readDirToHash(const std::string &basePath, const
size_t fileCount = 0;
std::string filesRead;
+ filesRead.reserve(1024);
while ((currentFile = readdir(workingdir)) != nullptr)
{
@@ -544,7 +545,8 @@ void FileServerRequestHandler::readDirToHash(const std::string &basePath, const
else if (S_ISREG(fileStat.st_mode))
{
fileCount++;
- filesRead.append(currentFile->d_name) + ' ';
+ filesRead.append(currentFile->d_name);
+ filesRead += ' ';
std::ifstream file(basePath + relPath, std::ios::binary);
More information about the Libreoffice-commits
mailing list