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

Pranav Kant pranavk at collabora.com
Fri May 6 09:32:50 UTC 2016


 loolwsd/LOOLKit.cpp |   22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

New commits:
commit 1f990d3fc2e85dab478f26971ebe1927c9d2f381
Author: Pranav Kant <pranavk at collabora.com>
Date:   Fri May 6 14:44:03 2016 +0530

    loolwsd: Fix incorrect position of id=, editlock= params
    
    editlock= is always the last parameter. This fixes the slide
    previews in impress documents for editing session.
    
    Change-Id: I3531c7f52e09e655524fa0afd6fe66da504b5d70

diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp
index cebb4c9..3d80548 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -578,6 +578,8 @@ public:
     {
         int part, width, height, tilePosX, tilePosY, tileWidth, tileHeight;
 
+        // There would be another param, editlock=, as the last parameter.
+        // For presentations, it would be followed by id=
         if (tokens.count() < 9 ||
             !getTokenInteger(tokens[1], "part", part) ||
             !getTokenInteger(tokens[2], "width", width) ||
@@ -589,6 +591,7 @@ public:
         {
             //FIXME: Return error.
             //sendTextFrame("error: cmd=tile kind=syntax");
+            Log::error() << "Invalid tile request" << Log::end;
             return;
         }
 
@@ -602,22 +605,31 @@ public:
         {
             //FIXME: Return error.
             //sendTextFrame("error: cmd=tile kind=invalid");
+            Log::error() << "Invalid tile request" << Log::end;
             return;
         }
 
-        int editLock = 0;
         size_t index = 8;
+        int editLock = -1;
+        int id = -1;
+        if (tokens.count() > index && tokens[index].find("id") == 0)
+        {
+            getTokenInteger(tokens[index], "id", id);
+            ++index;
+        }
+
         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)
+        // For time being, editlock information in tile requests is mandatory
+        // till we have a better solution to handle multi-part documents
+        if (editLock == -1)
         {
-            getTokenInteger(tokens[index], "id", id);
-            ++index;
+            Log::error("No editlock information found.");
+            return;
         }
 
         std::unique_lock<std::recursive_mutex> lock(ChildProcessSession::getLock());


More information about the Libreoffice-commits mailing list