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

Ashod Nakashian ashod.nakashian at collabora.co.uk
Thu Nov 10 05:02:36 UTC 2016


 loolwsd/LOOLWSD.cpp |   33 ++++++++++++++++-----------------
 1 file changed, 16 insertions(+), 17 deletions(-)

New commits:
commit 793e00e134e23eaec7280871e1bc2446f4f24360
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Wed Nov 9 19:44:28 2016 -0500

    loolwsd: use ostringstream when concatinating many strings
    
    Change-Id: I55d4d0a14c81977568032d8a7dd1655b2f69ae67
    Reviewed-on: https://gerrit.libreoffice.org/30739
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 39a3239..4c9ed10 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -1065,16 +1065,15 @@ public:
     static void handleClientRequest(HTTPServerRequest& request, HTTPServerResponse& response)
     {
         const auto id = LOOLWSD::GenSessionId();
+        Util::setThreadName("client_ws_" + id);
+
+        LOG_DBG("Thread started.");
 
         Poco::URI requestUri(request.getURI());
         LOG_DBG("Handling: " << request.getURI());
 
         StringTokenizer reqPathTokens(request.getURI(), "/?", StringTokenizer::TOK_IGNORE_EMPTY | StringTokenizer::TOK_TRIM);
 
-        Util::setThreadName("client_ws_" + id);
-
-        LOG_DBG("Thread started.");
-
         bool responded = false;
         try
         {
@@ -1386,19 +1385,19 @@ ServerSocket* findFreeMasterPort(int &nMasterPortNumber)
 
 static inline std::string getLaunchURI()
 {
-    std::string aAbsTopSrcDir = Poco::Path(Application::instance().commandPath()).parent().toString();
-    aAbsTopSrcDir = Poco::Path(aAbsTopSrcDir).absolute().toString();
-
-    std::string aLaunchURI("    ");
-    aLaunchURI += ((LOOLWSD::isSSLEnabled() || LOOLWSD::isSSLTermination()) ? "https://" : "http://");
-    aLaunchURI += LOOLWSD_TEST_HOST ":";
-    aLaunchURI += std::to_string(ClientPortNumber);
-    aLaunchURI += LOOLWSD_TEST_LOLEAFLET_UI;
-    aLaunchURI += "?file_path=file://";
-    aLaunchURI += aAbsTopSrcDir;
-    aLaunchURI += LOOLWSD_TEST_DOCUMENT_RELATIVE_PATH;
-
-    return aLaunchURI;
+    const std::string aAbsTopSrcDir = Poco::Path(Application::instance().commandPath()).parent().toString();
+
+    std::ostringstream oss;
+    oss << "    ";
+    oss << ((LOOLWSD::isSSLEnabled() || LOOLWSD::isSSLTermination()) ? "https://" : "http://");
+    oss << LOOLWSD_TEST_HOST ":";
+    oss << ClientPortNumber;
+    oss << LOOLWSD_TEST_LOLEAFLET_UI;
+    oss << "?file_path=file://";
+    oss << Poco::Path(aAbsTopSrcDir).absolute().toString();
+    oss << LOOLWSD_TEST_DOCUMENT_RELATIVE_PATH;
+
+    return oss.str();
 }
 
 } // anonymous namespace


More information about the Libreoffice-commits mailing list