[Libreoffice-commits] online.git: wsd/FileServer.cpp

Miklos Vajna vmiklos at collabora.co.uk
Wed Jul 5 09:22:48 UTC 2017


 wsd/FileServer.cpp |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit c07efecdcfcae9c03128e3205fc6e233daa0c09a
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Jul 5 11:22:06 2017 +0200

    wsd: avoid string concatenation resulting in allocation of unnecessary temporary strings in FileServer
    
    By using operator+= instead, which does not have this problem.
    
    Change-Id: I6dd54cde7e430f2f1d549642dddd3ed1a0e9eefd

diff --git a/wsd/FileServer.cpp b/wsd/FileServer.cpp
index d09c2e6b..90636e08 100644
--- a/wsd/FileServer.cpp
+++ b/wsd/FileServer.cpp
@@ -376,8 +376,8 @@ void FileServerRequestHandler::readDirToHash(const std::string &basePath, const
                 const long unsigned int haveComp = compSize - strm.avail_out;
                 std::string partialcompFile(cbuf, haveComp);
                 std::string partialuncompFile(buf.get(), size);
-                compressedFile = compressedFile + partialcompFile;
-                uncompressedFile = uncompressedFile + partialuncompFile;
+                compressedFile += partialcompFile;
+                uncompressedFile += partialuncompFile;
                 free(cbuf);
 
             } while(true);


More information about the Libreoffice-commits mailing list