[Libreoffice-commits] online.git: wsd/DocumentBroker.cpp wsd/LOOLWSD.cpp wsd/LOOLWSD.hpp

Ashod Nakashian (via logerrit) logerrit at kemper.freedesktop.org
Fri Apr 17 00:36:10 UTC 2020


 wsd/DocumentBroker.cpp |    8 ++++----
 wsd/LOOLWSD.cpp        |    3 ++-
 wsd/LOOLWSD.hpp        |    4 ++--
 3 files changed, 8 insertions(+), 7 deletions(-)

New commits:
commit 40684c46872899f9ef705f267b8597007f3703d1
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Fri Apr 10 09:37:29 2020 -0400
Commit:     Ashod Nakashian <ashnakash at gmail.com>
CommitDate: Fri Apr 17 02:35:52 2020 +0200

    wsd: const correctness and cosmetics
    
    Change-Id: I46751dc0a6d7c693fd9ab371c1e9a12bac309611
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92098
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index bbe3b7937..8c342c4c3 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -75,7 +75,7 @@ void sendLastModificationTime(const std::shared_ptr<Session>& session,
 
     std::stringstream stream;
     stream << "lastmodtime: " << documentLastModifiedTime;
-    std::string message = stream.str();
+    const std::string message = stream.str();
     session->sendTextFrame(message);
     if (documentBroker)
         documentBroker->broadcastMessage(message);
@@ -982,7 +982,7 @@ bool DocumentBroker::saveToStorageInternal(const std::string& sessionId, bool su
     if (!isSaveAs && newFileModifiedTime == _lastFileModifiedTime && !isRename)
     {
         // Nothing to do.
-        auto timeInSec = std::chrono::duration_cast<std::chrono::seconds>
+        const auto timeInSec = std::chrono::duration_cast<std::chrono::seconds>
                                             (std::chrono::system_clock::now() - _lastFileModifiedTime);
         LOG_DBG("Skipping unnecessary saving to URI [" << uriAnonym << "] with docKey [" << _docKey <<
                 "]. File last modified " << timeInSec.count() << " seconds ago.");
@@ -1140,7 +1140,7 @@ void DocumentBroker::refreshLock()
 {
     assertCorrectThread();
 
-    std::string savingSessionId = getWriteableSessionId();
+    const std::string savingSessionId = getWriteableSessionId();
     LOG_TRC("Refresh lock " << _lockCtx->_lockToken << " with session " << savingSessionId);
 
     auto it = _sessions.find(savingSessionId);
@@ -1171,7 +1171,7 @@ bool DocumentBroker::autoSave(const bool force, const bool dontSaveIfUnmodified)
     LOG_TRC("Checking to autosave [" << _docKey << "].");
 
     // Which session to use when auto saving ?
-    std::string savingSessionId = getWriteableSessionId();
+    const std::string savingSessionId = getWriteableSessionId();
 
     bool sent = false;
     if (force)
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index e40ec7a47..0796b53dd 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -1755,7 +1755,7 @@ bool LOOLWSD::createForKit()
     // Below line will be executed by PrisonerPoll thread.
     ForKitProc = nullptr;
     PrisonerPoll.setForKitProcess(ForKitProc);
-    
+
     // ForKit always spawns one.
     ++OutstandingForks;
 
@@ -3691,6 +3691,7 @@ int LOOLWSD::innerMain()
         LOG_INF("Removing jail [" << path << "].");
         FileUtil::removeFile(path, true);
     }
+
     if (UnitBase::isUnitTesting())
     {
         LOG_TRC("Removing sub-childroot: of " + ChildRoot);
diff --git a/wsd/LOOLWSD.hpp b/wsd/LOOLWSD.hpp
index 4470e8871..821a7e5e4 100644
--- a/wsd/LOOLWSD.hpp
+++ b/wsd/LOOLWSD.hpp
@@ -48,7 +48,7 @@ class WSProcess
 public:
     /// @param pid is the process ID.
     /// @param socket is the underlying Sockeet to the process.
-    WSProcess(const std::string& name, 
+    WSProcess(const std::string& name,
               const Poco::Process::PID pid,
               const std::shared_ptr<StreamSocket>& socket,
               std::shared_ptr<WebSocketHandler> handler) :
@@ -369,7 +369,7 @@ public:
     /// Close document with @docKey and a @message
     static void closeDocument(const std::string& docKey, const std::string& message);
 
-    /// Autosave a given document
+    /// Autosave a given document (currently only called from Admin).
     static void autoSave(const std::string& docKey);
 
     /// Anonymize the basename of filenames, preserving the path and extension.


More information about the Libreoffice-commits mailing list