[Libreoffice-commits] online.git: 2 commits - loleaflet/src wsd/Admin.cpp wsd/AdminModel.cpp wsd/Auth.cpp wsd/FileServer.cpp wsd/TileDesc.hpp

Szymon Kłos (via logerrit) logerrit at kemper.freedesktop.org
Wed Nov 13 08:51:40 UTC 2019


 loleaflet/src/control/Control.JSDialogBuilder.js |   12 +++++++
 wsd/Admin.cpp                                    |   30 +++++++++----------
 wsd/AdminModel.cpp                               |    1 
 wsd/Auth.cpp                                     |    4 +-
 wsd/FileServer.cpp                               |    1 
 wsd/TileDesc.hpp                                 |   35 +++++++++++------------
 6 files changed, 45 insertions(+), 38 deletions(-)

New commits:
commit c8595eb7e45de9a1b05dc531c83f7c556c963c52
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Nov 12 16:27:59 2019 +0100
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Wed Nov 13 09:51:30 2019 +0100

    jsdialogs: apply .uno:ULSpacing updates
    
    Change-Id: I67e8600738bb380f5652d47b609d4db4c4e670e0
    Reviewed-on: https://gerrit.libreoffice.org/82530
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
    Tested-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js b/loleaflet/src/control/Control.JSDialogBuilder.js
index f9e827846..17e9b4c02 100644
--- a/loleaflet/src/control/Control.JSDialogBuilder.js
+++ b/loleaflet/src/control/Control.JSDialogBuilder.js
@@ -441,6 +441,18 @@ L.Control.JSDialogBuilder = L.Control.extend({
 			if (state)
 				return state.firstline.replace(',', '.');
 			break;
+
+		case 'aboveparaspacing':
+			state = items.getItemValue('.uno:ULSpacing');
+			if (state)
+				return state.upper.replace(',', '.');
+			break;
+
+		case 'belowparaspacing':
+			state = items.getItemValue('.uno:ULSpacing');
+			if (state)
+				return state.lower.replace(',', '.');
+			break;
 		}
 
 		return null;
commit a6b0e5b8271614ee239d6cb0e36ab843e27c1951
Author:     Pranam Lashkari <lpranam at collabora.com>
AuthorDate: Wed Nov 13 13:45:07 2019 +0530
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Wed Nov 13 09:51:04 2019 +0100

    killpoco: removed StringTokenizer from wsd directory
    
    removed use of Poco::StringTokenizer from the wsd directory using LOOLProtocol::tokenize and std::vecor<std::string>
    
    Change-Id: Ic50b4d4d71d4ffd005aacf6aef0ed2bfde66d40d
    Reviewed-on: https://gerrit.libreoffice.org/82569
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/wsd/Admin.cpp b/wsd/Admin.cpp
index 8a1d858b8..3e64b5a1f 100644
--- a/wsd/Admin.cpp
+++ b/wsd/Admin.cpp
@@ -17,7 +17,6 @@
 #include <Poco/Net/HTTPCookie.h>
 #include <Poco/Net/HTTPRequest.h>
 #include <Poco/Net/HTTPResponse.h>
-#include <Poco/StringTokenizer.h>
 
 #include "Admin.hpp"
 #include "AdminModel.hpp"
@@ -43,7 +42,6 @@
 using namespace LOOLProtocol;
 
 using Poco::Net::HTTPResponse;
-using Poco::StringTokenizer;
 using Poco::Util::Application;
 
 const int Admin::MinStatsIntervalMs = 50;
@@ -55,10 +53,10 @@ void AdminSocketHandler::handleMessage(bool /* fin */, WSOpCode /* code */,
 {
     // FIXME: check fin, code etc.
     const std::string firstLine = getFirstLine(payload.data(), payload.size());
-    StringTokenizer tokens(firstLine, " ", StringTokenizer::TOK_IGNORE_EMPTY | StringTokenizer::TOK_TRIM);
-    LOG_TRC("Recv: " << firstLine << " tokens " << tokens.count());
+    std::vector<std::string> tokens(LOOLProtocol::tokenize(firstLine, ' '));
+    LOG_TRC("Recv: " << firstLine << " tokens " << tokens.size());
 
-    if (tokens.count() < 1)
+    if (tokens.empty())
     {
         LOG_TRC("too few tokens");
         return;
@@ -68,7 +66,7 @@ void AdminSocketHandler::handleMessage(bool /* fin */, WSOpCode /* code */,
 
     if (tokens[0] == "auth")
     {
-        if (tokens.count() < 2)
+        if (tokens.size() < 2)
         {
             LOG_DBG("Auth command without any token");
             sendMessage("InvalidAuthToken");
@@ -98,7 +96,7 @@ void AdminSocketHandler::handleMessage(bool /* fin */, WSOpCode /* code */,
     if (!_isAuthenticated)
     {
         LOG_DBG("Not authenticated - message is '" << firstLine << "' " <<
-                tokens.count() << " first: '" << tokens[0] << "'");
+                tokens.size() << " first: '" << tokens[0] << "'");
         sendMessage("NotAuthenticated");
         shutdown();
         return;
@@ -126,16 +124,16 @@ void AdminSocketHandler::handleMessage(bool /* fin */, WSOpCode /* code */,
         // Send LOKit version information
         sendTextFrame("lokitversion " + LOOLWSD::LOKitVersion);
     }
-    else if (tokens[0] == "subscribe" && tokens.count() > 1)
+    else if (tokens[0] == "subscribe" && tokens.size() > 1)
     {
-        for (std::size_t i = 0; i < tokens.count() - 1; i++)
+        for (std::size_t i = 0; i < tokens.size() - 1; i++)
         {
             model.subscribe(_sessionId, tokens[i + 1]);
         }
     }
-    else if (tokens[0] == "unsubscribe" && tokens.count() > 1)
+    else if (tokens[0] == "unsubscribe" && tokens.size() > 1)
     {
-        for (std::size_t i = 0; i < tokens.count() - 1; i++)
+        for (std::size_t i = 0; i < tokens.size() - 1; i++)
         {
             model.unsubscribe(_sessionId, tokens[i + 1]);
         }
@@ -155,7 +153,7 @@ void AdminSocketHandler::handleMessage(bool /* fin */, WSOpCode /* code */,
     else if (tokens[0] == "uptime")
         sendTextFrame("uptime " + std::to_string(model.getServerUptime()));
 
-    else if (tokens[0] == "kill" && tokens.count() == 2)
+    else if (tokens[0] == "kill" && tokens.size() == 2)
     {
         try
         {
@@ -194,11 +192,11 @@ void AdminSocketHandler::handleMessage(bool /* fin */, WSOpCode /* code */,
         SigUtil::requestShutdown();
         return;
     }
-    else if (tokens[0] == "set" && tokens.count() > 1)
+    else if (tokens[0] == "set" && tokens.size() > 1)
     {
-        for (size_t i = 1; i < tokens.count(); i++)
+        for (size_t i = 1; i < tokens.size(); i++)
         {
-            StringTokenizer setting(tokens[i], "=", StringTokenizer::TOK_IGNORE_EMPTY | StringTokenizer::TOK_TRIM);
+            std::vector<std::string> setting(LOOLProtocol::tokenize(tokens[i], '='));
             int settingVal = 0;
             try
             {
@@ -320,7 +318,7 @@ bool AdminSocketHandler::handleInitialRequest(
     std::shared_ptr<StreamSocket> socket = socketWeak.lock();
 
     const std::string& requestURI = request.getURI();
-    StringTokenizer pathTokens(requestURI, "/", StringTokenizer::TOK_IGNORE_EMPTY | StringTokenizer::TOK_TRIM);
+    std::vector<std::string> pathTokens(LOOLProtocol::tokenize(requestURI, '/'));
 
     if (request.find("Upgrade") != request.end() && Poco::icompare(request["Upgrade"], "websocket") == 0)
     {
diff --git a/wsd/AdminModel.cpp b/wsd/AdminModel.cpp
index e0074ce5f..f5232d6db 100644
--- a/wsd/AdminModel.cpp
+++ b/wsd/AdminModel.cpp
@@ -18,7 +18,6 @@
 #include <string>
 
 #include <Poco/Process.h>
-#include <Poco/StringTokenizer.h>
 #include <Poco/URI.h>
 
 #include <Protocol.hpp>
diff --git a/wsd/Auth.cpp b/wsd/Auth.cpp
index 6a0ec5ef4..01f9e4f43 100644
--- a/wsd/Auth.cpp
+++ b/wsd/Auth.cpp
@@ -26,12 +26,12 @@
 #include <Poco/Net/HTTPRequest.h>
 #include <Poco/Net/HTTPResponse.h>
 #include <Poco/Net/NetException.h>
-#include <Poco/StringTokenizer.h>
 #include <Poco/Timestamp.h>
 #include <Poco/URI.h>
 
 #include <Log.hpp>
 #include <Util.hpp>
+#include <Protocol.hpp>
 
 using Poco::Base64Decoder;
 using Poco::Base64Encoder;
@@ -94,7 +94,7 @@ const std::string JWTAuth::getAccessToken()
 
 bool JWTAuth::verify(const std::string& accessToken)
 {
-    Poco::StringTokenizer tokens(accessToken, ".", Poco::StringTokenizer::TOK_IGNORE_EMPTY | Poco::StringTokenizer::TOK_TRIM);
+    std::vector<std::string> tokens(LOOLProtocol::tokenize(accessToken, '.'));
 
     try
     {
diff --git a/wsd/FileServer.cpp b/wsd/FileServer.cpp
index 0085bee28..32373f3b0 100644
--- a/wsd/FileServer.cpp
+++ b/wsd/FileServer.cpp
@@ -36,7 +36,6 @@
 #include <Poco/RegularExpression.h>
 #include <Poco/Runnable.h>
 #include <Poco/StreamCopier.h>
-#include <Poco/StringTokenizer.h>
 #include <Poco/URI.h>
 
 #include "Auth.hpp"
diff --git a/wsd/TileDesc.hpp b/wsd/TileDesc.hpp
index c5a98e5ee..a7e855ecc 100644
--- a/wsd/TileDesc.hpp
+++ b/wsd/TileDesc.hpp
@@ -15,10 +15,9 @@
 #include <sstream>
 #include <string>
 
-#include <Poco/StringTokenizer.h>
 
 #include "Exceptions.hpp"
-#include "Protocol.hpp"
+#include <Protocol.hpp>
 
 #define TILE_WIRE_ID
 typedef uint32_t TileWireId;
@@ -301,21 +300,21 @@ private:
             throw BadArgumentException("Invalid tilecombine descriptor.");
         }
 
-        Poco::StringTokenizer positionXtokens(tilePositionsX, ",", Poco::StringTokenizer::TOK_IGNORE_EMPTY | Poco::StringTokenizer::TOK_TRIM);
-        Poco::StringTokenizer positionYtokens(tilePositionsY, ",", Poco::StringTokenizer::TOK_IGNORE_EMPTY | Poco::StringTokenizer::TOK_TRIM);
-        Poco::StringTokenizer imgSizeTokens(imgSizes, ",", Poco::StringTokenizer::TOK_IGNORE_EMPTY | Poco::StringTokenizer::TOK_TRIM);
-        Poco::StringTokenizer verTokens(vers, ",", Poco::StringTokenizer::TOK_IGNORE_EMPTY | Poco::StringTokenizer::TOK_TRIM);
-        Poco::StringTokenizer oldWireIdTokens(oldWireIds, ",", Poco::StringTokenizer::TOK_IGNORE_EMPTY | Poco::StringTokenizer::TOK_TRIM);
-        Poco::StringTokenizer wireIdTokens(wireIds, ",", Poco::StringTokenizer::TOK_IGNORE_EMPTY | Poco::StringTokenizer::TOK_TRIM);
+        std::vector<std::string> positionXtokens(LOOLProtocol::tokenize(tilePositionsX, ','));
+        std::vector<std::string> positionYtokens(LOOLProtocol::tokenize(tilePositionsY, ','));
+        std::vector<std::string> imgSizeTokens(LOOLProtocol::tokenize(imgSizes, ','));
+        std::vector<std::string> verTokens(LOOLProtocol::tokenize(vers, ','));
+        std::vector<std::string> oldWireIdTokens(LOOLProtocol::tokenize(oldWireIds, ','));
+        std::vector<std::string> wireIdTokens(LOOLProtocol::tokenize(wireIds, ','));
 
-        const size_t numberOfPositions = positionXtokens.count();
+        const size_t numberOfPositions = positionXtokens.size();
 
         // check that the comma-separated strings have the same number of elements
-        if (numberOfPositions != positionYtokens.count() ||
-            (!imgSizes.empty() && numberOfPositions != imgSizeTokens.count()) ||
-            (!vers.empty() && numberOfPositions != verTokens.count()) ||
-            (!oldWireIds.empty() && numberOfPositions != oldWireIdTokens.count()) ||
-            (!wireIds.empty() && numberOfPositions != wireIdTokens.count()))
+        if (numberOfPositions != positionYtokens.size() ||
+            (!imgSizes.empty() && numberOfPositions != imgSizeTokens.size()) ||
+            (!vers.empty() && numberOfPositions != verTokens.size()) ||
+            (!oldWireIds.empty() && numberOfPositions != oldWireIdTokens.size()) ||
+            (!wireIds.empty() && numberOfPositions != wireIdTokens.size()))
         {
             throw BadArgumentException("Invalid tilecombine descriptor. Unequal number of tiles in parameters.");
         }
@@ -335,25 +334,25 @@ private:
             }
 
             int imgSize = 0;
-            if (imgSizeTokens.count() && !LOOLProtocol::stringToInteger(imgSizeTokens[i], imgSize))
+            if (!imgSizeTokens.empty() && !LOOLProtocol::stringToInteger(imgSizeTokens[i], imgSize))
             {
                 throw BadArgumentException("Invalid 'imgsize' in tilecombine descriptor.");
             }
 
             int ver = -1;
-            if (verTokens.count() && !verTokens[i].empty() && !LOOLProtocol::stringToInteger(verTokens[i], ver))
+            if (!verTokens.empty() && !verTokens[i].empty() && !LOOLProtocol::stringToInteger(verTokens[i], ver))
             {
                 throw BadArgumentException("Invalid 'ver' in tilecombine descriptor.");
             }
 
             TileWireId oldWireId = 0;
-            if (oldWireIdTokens.count() && !LOOLProtocol::stringToUInt32(oldWireIdTokens[i], oldWireId))
+            if (!oldWireIdTokens.empty() && !LOOLProtocol::stringToUInt32(oldWireIdTokens[i], oldWireId))
             {
                 throw BadArgumentException("Invalid tilecombine descriptor.");
             }
 
             TileWireId wireId = 0;
-            if (wireIdTokens.count() && !LOOLProtocol::stringToUInt32(wireIdTokens[i], wireId))
+            if (!wireIdTokens.empty() && !LOOLProtocol::stringToUInt32(wireIdTokens[i], wireId))
             {
                 throw BadArgumentException("Invalid tilecombine descriptor.");
             }


More information about the Libreoffice-commits mailing list