[Libreoffice-commits] online.git: loolwsd/Util.cpp loolwsd/Util.hpp

Miklos Vajna vmiklos at collabora.co.uk
Mon Oct 3 06:39:41 UTC 2016


 loolwsd/Util.cpp |    2 +-
 loolwsd/Util.hpp |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 3dbaae7f448f35fff443e9a13347cd7ea1d82285
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Oct 3 08:38:01 2016 +0200

    Util: avoid unnecessary copy
    
    Change-Id: I773cc9bafc1593e125af2dbcd2471daf4685d125

diff --git a/loolwsd/Util.cpp b/loolwsd/Util.cpp
index add0fdd..548698a 100644
--- a/loolwsd/Util.cpp
+++ b/loolwsd/Util.cpp
@@ -157,7 +157,7 @@ namespace Util
         return std::getenv("DISPLAY") != nullptr;
     }
 
-    bool saveDataToFileSafely(std::string fileName, const char *data, size_t size)
+    bool saveDataToFileSafely(const std::string& fileName, const char *data, size_t size)
     {
         const auto tempFileName = fileName + ".temp";
         std::fstream outStream(tempFileName, std::ios::out);
diff --git a/loolwsd/Util.hpp b/loolwsd/Util.hpp
index 935264e..ffb269d 100644
--- a/loolwsd/Util.hpp
+++ b/loolwsd/Util.hpp
@@ -54,7 +54,7 @@ namespace Util
     // if everything goes well. In case of any error, both the destination file (if it already
     // exists) and the temporary file (if was created, or existed already) are removed. Return true
     // if everything succeeded.
-    bool saveDataToFileSafely(std::string fileName, const char *data, size_t size);
+    bool saveDataToFileSafely(const std::string& fileName, const char *data, size_t size);
 
     // We work around some of the mess of using the same sources both on the server side and in unit
     // tests with conditional compilation based on BUILDING_TESTS.


More information about the Libreoffice-commits mailing list