[Libreoffice-commits] online.git: loolwsd/ChildProcessSession.cpp loolwsd/ChildProcessSession.hpp loolwsd/MasterProcessSession.cpp loolwsd/Util.cpp

Ashod Nakashian ashod.nakashian at collabora.co.uk
Wed Dec 23 09:06:44 PST 2015


 loolwsd/ChildProcessSession.cpp  |    6 ++++--
 loolwsd/ChildProcessSession.hpp  |   14 ++++++++++----
 loolwsd/MasterProcessSession.cpp |   17 +++++++++--------
 loolwsd/Util.cpp                 |    6 +++---
 4 files changed, 26 insertions(+), 17 deletions(-)

New commits:
commit 30e1bbba1477260a66124d8350e7c1a8ee3e8f0e
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Sun Dec 13 12:47:14 2015 -0500

    loolwsd: const and cleanups
    
    Change-Id: I2fff14407c35a3c6119f44fbee1b4c458b7eac16
    Reviewed-on: https://gerrit.libreoffice.org/20897
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/ChildProcessSession.cpp b/loolwsd/ChildProcessSession.cpp
index ab92478..5d73230 100644
--- a/loolwsd/ChildProcessSession.cpp
+++ b/loolwsd/ChildProcessSession.cpp
@@ -40,7 +40,9 @@ using Poco::StringTokenizer;
 using Poco::URI;
 using Poco::Util::Application;
 
-ChildProcessSession::ChildProcessSession(std::shared_ptr<WebSocket> ws, LibreOfficeKit *loKit, std::string childId) :
+ChildProcessSession::ChildProcessSession(std::shared_ptr<WebSocket> ws,
+                                         LibreOfficeKit *loKit,
+                                         const std::string& childId) :
     LOOLSession(ws, Kind::ToMaster),
     _loKitDocument(NULL),
     _loKit(loKit),
@@ -817,4 +819,4 @@ bool ChildProcessSession::setPage(const char* /*buffer*/, int /*length*/, String
     return true;
 }
 
-
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/loolwsd/ChildProcessSession.hpp b/loolwsd/ChildProcessSession.hpp
index d2665d0..24bebc5 100644
--- a/loolwsd/ChildProcessSession.hpp
+++ b/loolwsd/ChildProcessSession.hpp
@@ -7,15 +7,20 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef INCLUDED_CHILDPROCESSSESSION_HPP
-#define INCLUDED_CHILDPROCESSSESSION_HPP
+#ifndef INCLUDED_LOOLCHILDPROCESSSESSION_HPP
+#define INCLUDED_LOOLCHILDPROCESSSESSION_HPP
+
+#define LOK_USE_UNSTABLE_API
+#include <LibreOfficeKit/LibreOfficeKit.h>
 
 #include "LOOLSession.hpp"
 
 class ChildProcessSession final : public LOOLSession
 {
 public:
-    ChildProcessSession(std::shared_ptr<Poco::Net::WebSocket> ws, LibreOfficeKit *loKit, std::string _childId);
+    ChildProcessSession(std::shared_ptr<Poco::Net::WebSocket> ws,
+                        LibreOfficeKit *loKit,
+                        const std::string& _childId);
     virtual ~ChildProcessSession();
 
     virtual bool handleInput(const char *buffer, int length) override;
@@ -54,7 +59,7 @@ public:
 
     std::string _loSubPath;
     LibreOfficeKit *_loKit;
-    std::string _childId;
+    const std::string _childId;
 
  private:
     int _clientPart;
@@ -62,3 +67,4 @@ public:
 
 #endif
 
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/loolwsd/MasterProcessSession.cpp b/loolwsd/MasterProcessSession.cpp
index 21f8caf..b931f41 100644
--- a/loolwsd/MasterProcessSession.cpp
+++ b/loolwsd/MasterProcessSession.cpp
@@ -9,27 +9,30 @@
 
 #include <iostream>
 
+#include <Poco/FileStream.h>
 #include <Poco/JSON/Object.h>
 #include <Poco/JSON/Parser.h>
 #include <Poco/Process.h>
 #include <Poco/Random.h>
-#include <Poco/Util/Application.h>
-#include <Poco/FileStream.h>
 #include <Poco/URI.h>
 #include <Poco/URIStreamOpener.h>
+#include <Poco/Util/Application.h>
 
-#include "MasterProcessSession.hpp"
-#include "LOOLSession.hpp"
-#include "Util.hpp"
 #include "LOOLProtocol.hpp"
+#include "LOOLSession.hpp"
 #include "LOOLWSD.hpp"
+#include "MasterProcessSession.hpp"
+#include "Util.hpp"
 
 using namespace LOOLProtocol;
+
 using Poco::Dynamic::Var;
+using Poco::Exception;
 using Poco::File;
 using Poco::IOException;
 using Poco::JSON::Object;
 using Poco::JSON::Parser;
+using Poco::Net::SocketAddress;
 using Poco::Net::WebSocket;
 using Poco::Path;
 using Poco::Process;
@@ -40,8 +43,6 @@ using Poco::Thread;
 using Poco::UInt64;
 using Poco::URI;
 using Poco::Util::Application;
-using Poco::Exception;
-using Poco::Net::SocketAddress;
 
 std::map<Process::PID, UInt64> MasterProcessSession::_childProcesses;
 
@@ -51,7 +52,7 @@ std::condition_variable MasterProcessSession::_availableChildSessionCV;
 Random MasterProcessSession::_rng;
 std::mutex MasterProcessSession::_rngMutex;
 
-MasterProcessSession::MasterProcessSession(std::shared_ptr<WebSocket> ws, Kind kind) :
+MasterProcessSession::MasterProcessSession(std::shared_ptr<WebSocket> ws, const Kind kind) :
     LOOLSession(ws, kind),
     _childId(0),
     _pidChild(0),
diff --git a/loolwsd/Util.cpp b/loolwsd/Util.cpp
index 232e425..02a2c2f 100644
--- a/loolwsd/Util.cpp
+++ b/loolwsd/Util.cpp
@@ -59,11 +59,11 @@ namespace Util
         Poco::Int64 usec = Poco::Timestamp().epochMicroseconds() - epochStart;
 
         const Poco::Int64 one_s = 1000000;
-        Poco::Int64 hours = usec / (one_s*60*60);
+        const Poco::Int64 hours = usec / (one_s*60*60);
         usec %= (one_s*60*60);
-        Poco::Int64 minutes = usec / (one_s*60);
+        const Poco::Int64 minutes = usec / (one_s*60);
         usec %= (one_s*60);
-        Poco::Int64 seconds = usec / (one_s);
+        const Poco::Int64 seconds = usec / (one_s);
         usec %= (one_s);
 
         std::ostringstream stream;


More information about the Libreoffice-commits mailing list