[Libreoffice-commits] online.git: loolwsd/DocumentBroker.cpp loolwsd/LOOLKit.cpp loolwsd/MasterProcessSession.cpp

Ashod Nakashian ashod.nakashian at collabora.co.uk
Thu May 5 14:23:12 UTC 2016


 loolwsd/DocumentBroker.cpp       |    7 +++----
 loolwsd/LOOLKit.cpp              |   20 +++++++++++++++++---
 loolwsd/MasterProcessSession.cpp |    3 ++-
 3 files changed, 22 insertions(+), 8 deletions(-)

New commits:
commit 346a063d0a0001c2a54e4c8f2f8310784c0028ba
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Thu May 5 10:18:31 2016 -0400

    loolwsd: fix regression to handling tile command
    
    Change-Id: Idedf25f3756ea1e04daf17540b1a57e1e7af8448
    Reviewed-on: https://gerrit.libreoffice.org/24679
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/DocumentBroker.cpp b/loolwsd/DocumentBroker.cpp
index 048e6a1..9785b94 100644
--- a/loolwsd/DocumentBroker.cpp
+++ b/loolwsd/DocumentBroker.cpp
@@ -413,8 +413,7 @@ void DocumentBroker::handleTileRequest(int part, int width, int height, int tile
     // Piggyback editlock information to kit process.
     // We do not allow requests without editlock to change document parts
     oss << " editlock=" << (session->isEditLocked() ? "1" : "0");
-
-    std::string tileMsg = oss.str();
+    const std::string tileMsg = oss.str();
 
     std::unique_lock<std::mutex> lock(_mutex);
 
@@ -423,9 +422,9 @@ void DocumentBroker::handleTileRequest(int part, int width, int height, int tile
     if (cachedTile)
     {
 #if ENABLE_DEBUG
-        std::string response = "tile:" + tileMsg + " renderid=cached\n";
+        const std::string response = "tile:" + tileMsg + " renderid=cached\n";
 #else
-        std::string response = "tile:" + tileMsg + "\n";
+        const std::string response = "tile:" + tileMsg + "\n";
 #endif
 
         std::vector<char> output;
diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp
index 318ae60..4a65094 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -576,7 +576,7 @@ public:
 
     void renderTile(StringTokenizer& tokens, const std::shared_ptr<Poco::Net::WebSocket>& ws)
     {
-        int part, width, height, tilePosX, tilePosY, tileWidth, tileHeight, editLock;
+        int part, width, height, tilePosX, tilePosY, tileWidth, tileHeight;
 
         if (tokens.count() < 9 ||
             !getTokenInteger(tokens[1], "part", part) ||
@@ -585,8 +585,7 @@ public:
             !getTokenInteger(tokens[4], "tileposx", tilePosX) ||
             !getTokenInteger(tokens[5], "tileposy", tilePosY) ||
             !getTokenInteger(tokens[6], "tilewidth", tileWidth) ||
-            !getTokenInteger(tokens[7], "tileheight", tileHeight) ||
-            !getTokenInteger(tokens[8], "editlock", editLock))
+            !getTokenInteger(tokens[7], "tileheight", tileHeight))
         {
             //FIXME: Return error.
             //sendTextFrame("error: cmd=tile kind=syntax");
@@ -606,6 +605,21 @@ public:
             return;
         }
 
+        int editLock = 0;
+        size_t index = 8;
+        if (tokens.count() > index && tokens[index].find("editlock") == 0)
+        {
+            getTokenInteger(tokens[index], "editlock", editLock);
+            ++index;
+        }
+
+        int id = -1;
+        if (tokens.count() > index && tokens[index].find("id") == 0)
+        {
+            getTokenInteger(tokens[index], "id", id);
+            ++index;
+        }
+
         std::unique_lock<std::recursive_mutex> lock(ChildProcessSession::getLock());
 
         if (_loKitDocument == nullptr)
diff --git a/loolwsd/MasterProcessSession.cpp b/loolwsd/MasterProcessSession.cpp
index 733b43b..6d24b1a 100644
--- a/loolwsd/MasterProcessSession.cpp
+++ b/loolwsd/MasterProcessSession.cpp
@@ -530,7 +530,7 @@ void MasterProcessSession::sendTile(const char * /*buffer*/, int /*length*/, Str
 
 void MasterProcessSession::sendCombinedTiles(const char* /*buffer*/, int /*length*/, StringTokenizer& tokens)
 {
-    int part, pixelWidth, pixelHeight, tileWidth, tileHeight, id = -1;
+    int part, pixelWidth, pixelHeight, tileWidth, tileHeight;
     std::string tilePositionsX, tilePositionsY;
     if (tokens.count() < 8 ||
         !getTokenInteger(tokens[1], "part", part) ||
@@ -561,6 +561,7 @@ void MasterProcessSession::sendCombinedTiles(const char* /*buffer*/, int /*lengt
         ++index;
     }
 
+    int id = -1;
     if (tokens.count() > index && tokens[index].find("id") == 0)
     {
         getTokenInteger(tokens[index], "id", id);


More information about the Libreoffice-commits mailing list