[Libreoffice-commits] online.git: wsd/FileServer.cpp wsd/FileServer.hpp

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Mar 5 22:28:28 UTC 2019


 wsd/FileServer.cpp |   29 ++++++++++++++++++++++++++++-
 wsd/FileServer.hpp |    2 +-
 2 files changed, 29 insertions(+), 2 deletions(-)

New commits:
commit 6144d55f44c2109d43bc45c408fe4d1ca8f42207
Author:     Henry Castro <hcastro at collabora.com>
AuthorDate: Sun Feb 10 13:40:38 2019 -0400
Commit:     Henry Castro <hcastro at collabora.com>
CommitDate: Tue Mar 5 18:27:58 2019 -0400

    wsd: tokenize symbol "_('') _("")"
    
    Change-Id: I9c0e7f30a96a355f6d69b2c5a5244dbfbd863e08

diff --git a/wsd/FileServer.cpp b/wsd/FileServer.cpp
index 7c297deb1..61259ac05 100644
--- a/wsd/FileServer.cpp
+++ b/wsd/FileServer.cpp
@@ -567,7 +567,7 @@ constexpr char BRANDING[] = "branding";
 constexpr char BRANDING_UNSUPPORTED[] = "branding-unsupported";
 #endif
 
-void FileServerRequestHandler::getToken(std::istream& istr, std::string& token)
+void FileServerRequestHandler::getToken(std::istringstream& istr, std::string& token)
 {
     token.clear();
     int chr = istr.get();
@@ -583,6 +583,33 @@ void FileServerRequestHandler::getToken(std::istream& istr, std::string& token)
             token += "%>";
             istr.get();
         }
+        else if (chr == '_' && istr.peek() == '(')
+        {
+            token += "_(";
+            istr.get();
+            chr = istr.peek();
+            switch (chr)
+            {
+                case '\"':
+                    chr = istr.get();
+                    token += (char) chr;
+                break;
+                case '\'':
+                    chr = istr.get();
+                    token += (char) chr;
+                break;
+            }
+        }
+        else if (chr == '"' && istr.peek() == ')')
+        {
+            token += "\")";
+            istr.get();
+        }
+        else if (chr == '\'' && istr.peek() == ')')
+        {
+            token += "')";
+            istr.get();
+        }
         else token += (char) chr;
     }
 }
diff --git a/wsd/FileServer.hpp b/wsd/FileServer.hpp
index 637424468..45cf7538b 100644
--- a/wsd/FileServer.hpp
+++ b/wsd/FileServer.hpp
@@ -20,7 +20,7 @@ class FileServerRequestHandler
 {
     static std::string getRequestPathname(const Poco::Net::HTTPRequest& request);
 
-    static void getToken(std::istream&, std::string&);
+    static void getToken(std::istringstream&, std::string&);
     static void preprocessFile(const Poco::Net::HTTPRequest& request, Poco::MemoryInputStream& message, const std::shared_ptr<StreamSocket>& socket);
     static void preprocessAdminFile(const Poco::Net::HTTPRequest& request, const std::shared_ptr<StreamSocket>& socket);
 public:


More information about the Libreoffice-commits mailing list