[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-4-0' - test/UnitHTTP.cpp

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Wed Jul 10 11:18:08 UTC 2019


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

New commits:
commit 48c4d3a136a8e443042fa56dcba3f5ca2d792dc3
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Wed May 22 15:14:48 2019 +0200
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Wed Jul 10 13:17:47 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 1bd3f5437..4dfe58702 100644
--- a/test/UnitHTTP.cpp
+++ b/test/UnitHTTP.cpp
@@ -92,7 +92,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