[Libreoffice-commits] online.git: test/UnitHTTP.cpp

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed May 22 13:24:38 UTC 2019


 test/UnitHTTP.cpp |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 66fff0e8a9df7b8c4dc46f53e5154845eb951aa5
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Wed May 22 15:14:48 2019 +0200
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Wed May 22 15:23:59 2019 +0200

    test: avoid variable-sized object initialization
    
    UnitHTTP.cpp:94:21: error: variable-sized object may not be initialized
            char buffer[str.size() + 64] = { 0, };
                        ^~~~~~~~~~~~~~~
    
    Change-Id: I2e6c8b4ca123ac5bf6391aa460069d24066f728d

diff --git a/test/UnitHTTP.cpp b/test/UnitHTTP.cpp
index e86593f22..7d20b20c1 100644
--- a/test/UnitHTTP.cpp
+++ b/test/UnitHTTP.cpp
@@ -91,7 +91,8 @@ public:
 
     bool expectString(const std::shared_ptr<Poco::Net::StreamSocket> &socket, std::string str)
     {
-        char buffer[str.size() + 64] = { 0, };
+        char buffer[str.size() + 64];
+        memset(&buffer, 0, sizeof(buffer));
         int got = socket->receiveBytes(buffer, str.size());
         if (got != (int)str.size() ||
             strncmp(buffer, str.c_str(), got))


More information about the Libreoffice-commits mailing list