[Libreoffice-commits] online.git: test/httpwstest.cpp wsd/LOOLWSD.cpp

Ashod Nakashian ashod.nakashian at collabora.co.uk
Mon Jan 9 06:15:36 UTC 2017


 test/httpwstest.cpp |   10 +++-------
 wsd/LOOLWSD.cpp     |    3 +--
 2 files changed, 4 insertions(+), 9 deletions(-)

New commits:
commit e6ee7c2756d0898782dd2ad9b13752fcdd367d21
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Wed Jan 4 14:57:54 2017 -0500

    wsd: MAX_DOCUMENT is now always defined as positive
    
    Change-Id: I06018eeaab88bb3ede896bf7d74e1a7ce6f84325
    Reviewed-on: https://gerrit.libreoffice.org/32857
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/test/httpwstest.cpp b/test/httpwstest.cpp
index 02e66d1..9347f4e 100644
--- a/test/httpwstest.cpp
+++ b/test/httpwstest.cpp
@@ -2048,8 +2048,7 @@ void HTTPWSTest::testEachView(const std::string& doc, const std::string& type,
 
         // Check document size
         sendTextFrame(socket, "status", Poco::format(view, itView));
-        auto response = getResponseString(socket, "status:", Poco::format(view, itView));
-        CPPUNIT_ASSERT_MESSAGE(Poco::format(error, itView, std::string("status:")), !response.empty());
+        auto response = assertResponseString(socket, "status:", Poco::format(view, itView));
         int docPart = -1;
         int docParts = 0;
         int docHeight = 0;
@@ -2070,11 +2069,8 @@ void HTTPWSTest::testEachView(const std::string& doc, const std::string& type,
 
         // Connect and load 0..N Views, where N<=limit
         std::vector<std::shared_ptr<LOOLWebSocket>> views;
-#if MAX_DOCUMENTS > 0
-        const auto limit = std::min(5, MAX_DOCUMENTS - 1); // +1 connection above
-#else
-        constexpr auto limit = 5;
-#endif
+        static_assert(MAX_DOCUMENTS >= 2, "MAX_DOCUMENTS must be at least 2");
+        const auto limit = std::max(2, MAX_DOCUMENTS - 1); // +1 connection above
         for (itView = 0; itView < limit; ++itView)
         {
             views.emplace_back(loadDocAndGetSocket(_uri, documentURL, Poco::format(view, itView)));
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index 1eed34d..b9467bd 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -964,14 +964,13 @@ private:
 
         if (!docBroker)
         {
-#if MAX_DOCUMENTS > 0
+            static_assert(MAX_DOCUMENTS > 0, "MAX_DOCUMENTS must be positive");
             if (DocBrokers.size() + 1 > MAX_DOCUMENTS)
             {
                 LOG_ERR("Maximum number of open documents reached.");
                 shutdownLimitReached(*ws);
                 return nullptr;
             }
-#endif
 
             // Request a kit process for this doc.
             auto child = getNewChild();


More information about the Libreoffice-commits mailing list