[Libreoffice-commits] online.git: tools/Connect.cpp tools/KitClient.cpp tools/WebSocketDump.cpp

Pranam Lashkari (via logerrit) logerrit at kemper.freedesktop.org
Wed Nov 13 08:43:29 UTC 2019


 tools/Connect.cpp       |    4 +---
 tools/KitClient.cpp     |   11 +++++------
 tools/WebSocketDump.cpp |    5 +----
 3 files changed, 7 insertions(+), 13 deletions(-)

New commits:
commit aabb5b06339f3de01d18231b0c58d8cbe86a8b43
Author:     Pranam Lashkari <lpranam at collabora.com>
AuthorDate: Wed Nov 13 13:05:39 2019 +0530
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Wed Nov 13 09:43:10 2019 +0100

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

diff --git a/tools/Connect.cpp b/tools/Connect.cpp
index 146d98294..af448f3c9 100644
--- a/tools/Connect.cpp
+++ b/tools/Connect.cpp
@@ -27,7 +27,6 @@
 #include <Poco/Net/NetException.h>
 #include <Poco/Net/SSLManager.h>
 #include <Poco/SharedPtr.h>
-#include <Poco/StringTokenizer.h>
 #include <Poco/TemporaryFile.h>
 #include <Poco/Thread.h>
 #include <Poco/URI.h>
@@ -56,7 +55,6 @@ using Poco::Net::WebSocket;
 using Poco::Net::WebSocketException;
 using Poco::Runnable;
 using Poco::SharedPtr;
-using Poco::StringTokenizer;
 using Poco::TemporaryFile;
 using Poco::Thread;
 using Poco::URI;
@@ -92,7 +90,7 @@ public:
                     }
 
                     std::string firstLine = getFirstLine(buffer, n);
-                    StringTokenizer tokens(firstLine, " ", StringTokenizer::TOK_IGNORE_EMPTY | StringTokenizer::TOK_TRIM);
+                    std::vector<std::string> tokens(LOOLProtocol::tokenize(firstLine, ' '));
 
                     if (std::getenv("DISPLAY") != nullptr && tokens[0] == "tile:")
                     {
diff --git a/tools/KitClient.cpp b/tools/KitClient.cpp
index a869a86f0..f734785a2 100644
--- a/tools/KitClient.cpp
+++ b/tools/KitClient.cpp
@@ -23,7 +23,6 @@
 #include <Poco/Buffer.h>
 #include <Poco/Process.h>
 #include <Poco/String.h>
-#include <Poco/StringTokenizer.h>
 #include <Poco/TemporaryFile.h>
 #include <Poco/URI.h>
 #include <Poco/Util/Application.h>
@@ -31,8 +30,8 @@
 #include <KitHelper.hpp>
 #include <Png.hpp>
 #include <Util.hpp>
+#include <Protocol.hpp>
 
-using Poco::StringTokenizer;
 using Poco::TemporaryFile;
 using Poco::Util::Application;
 
@@ -90,9 +89,9 @@ protected:
             std::string line;
             std::getline(std::cin, line);
 
-            StringTokenizer tokens(line, " ", StringTokenizer::TOK_IGNORE_EMPTY | StringTokenizer::TOK_TRIM);
+            std::vector<std::string> tokens(LOOLProtocol::tokenize(line, ' '));
 
-            if (tokens.count() == 0)
+            if (tokens.size() == 0)
                 continue;
 
             if (tokens[0] == "?" || tokens[0] == "help")
@@ -106,7 +105,7 @@ protected:
             }
             else if (tokens[0] == "status")
             {
-                if (tokens.count() != 1)
+                if (tokens.size() != 1)
                 {
                     std::cout << "? syntax" << std::endl;
                     continue;
@@ -119,7 +118,7 @@ protected:
             }
             else if (tokens[0] == "tile")
             {
-                if (tokens.count() != 8)
+                if (tokens.size() != 8)
                 {
                     std::cout << "? syntax" << std::endl;
                     continue;
diff --git a/tools/WebSocketDump.cpp b/tools/WebSocketDump.cpp
index e7fe14800..94371a18c 100644
--- a/tools/WebSocketDump.cpp
+++ b/tools/WebSocketDump.cpp
@@ -17,7 +17,6 @@
 #include <Poco/MemoryStream.h>
 #include <Poco/Net/HTTPRequest.h>
 #include <Poco/Net/HTTPResponse.h>
-#include <Poco/StringTokenizer.h>
 #include <Poco/Util/XMLConfiguration.h>
 
 #include <Log.hpp>
@@ -136,9 +135,7 @@ private:
             LOG_INF("Incoming websocket request: " << request.getURI());
 
             const std::string& requestURI = request.getURI();
-            Poco::StringTokenizer pathTokens(requestURI, "/", Poco::StringTokenizer::TOK_IGNORE_EMPTY |
-                                                              Poco::StringTokenizer::TOK_TRIM);
-
+            std::vector<std::string> pathTokens(LOOLProtocol::tokenize(requestURI, '/'));
             if (request.find("Upgrade") != request.end() && Poco::icompare(request["Upgrade"], "websocket") == 0)
             {
                 auto dumpHandler = std::make_shared<DumpSocketHandler>(_socket, request);


More information about the Libreoffice-commits mailing list