[Libreoffice-commits] online.git: loolwsd/test

Ashod Nakashian ashod.nakashian at collabora.co.uk
Wed May 11 03:53:17 UTC 2016


 loolwsd/test/helpers.hpp    |    3 +--
 loolwsd/test/httpwstest.cpp |    4 ++--
 2 files changed, 3 insertions(+), 4 deletions(-)

New commits:
commit a4bfca2dd3c6951ad52f98f381cb013333a73ce0
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Tue May 10 21:08:55 2016 -0400

    loolwsd: uninitialized variables
    
    Change-Id: I2144c8f8ae9ad6298ba596faa504880b7c52256a
    Reviewed-on: https://gerrit.libreoffice.org/24866
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/test/helpers.hpp b/loolwsd/test/helpers.hpp
index 5f48ce6..57937ba 100644
--- a/loolwsd/test/helpers.hpp
+++ b/loolwsd/test/helpers.hpp
@@ -90,7 +90,6 @@ bool isDocumentLoaded(Poco::Net::WebSocket& ws, std::string name = "")
         do
         {
             char buffer[READ_BUFFER_SIZE];
-
             if (ws.poll(waitTime, Poco::Net::Socket::SELECT_READ))
             {
                 bytes = ws.receiveFrame(buffer, sizeof(buffer), flags);
@@ -354,7 +353,7 @@ std::shared_ptr<Poco::Net::WebSocket> loadDocAndGetSocket(const Poco::URI& uri,
         Poco::Net::HTTPResponse response;
         auto socket = connectLOKit(uri, request, response);
 
-        sendTextFrame(*socket, "load url=" + documentURL);
+        sendTextFrame(socket, "load url=" + documentURL);
         CPPUNIT_ASSERT_MESSAGE("cannot load the document " + documentURL, isDocumentLoaded(*socket));
 
         return socket;
diff --git a/loolwsd/test/httpwstest.cpp b/loolwsd/test/httpwstest.cpp
index f14afdc..7a5aa46 100644
--- a/loolwsd/test/httpwstest.cpp
+++ b/loolwsd/test/httpwstest.cpp
@@ -183,7 +183,7 @@ void HTTPWSTest::testHandShake()
     {
         int bytes;
         int flags;
-        char buffer[1024];
+        char buffer[1024] = {0};
         // Load a document and get its status.
         std::string documentPath, documentURL;
         getDocumentPathAndURL("hello.odt", documentPath, documentURL);
@@ -203,7 +203,7 @@ void HTTPWSTest::testHandShake()
         CPPUNIT_ASSERT_EQUAL(static_cast<int>(Poco::Net::WebSocket::FRAME_TEXT), flags & Poco::Net::WebSocket::FRAME_TEXT);
 
         bytes = socket.receiveFrame(buffer, sizeof(buffer), flags);
-        if (!std::strstr(buffer, fail))
+        if (bytes > 0 && !std::strstr(buffer, fail))
         {
             payload = "statusindicator: connect";
             CPPUNIT_ASSERT_EQUAL(payload, std::string(buffer, bytes));


More information about the Libreoffice-commits mailing list