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

Miklos Vajna vmiklos at collabora.co.uk
Tue Apr 26 07:35:20 UTC 2016


 loolwsd/Storage.cpp |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 25fa9653b825dd2c47100834fa8ff3c412d77446
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Apr 26 09:34:32 2016 +0200

    Storage: avoid unnecessary copy-construct
    
    Change-Id: I592adb26590f8957e01ed55a4ba9a976a3aac246

diff --git a/loolwsd/Storage.cpp b/loolwsd/Storage.cpp
index 62a0ead..911c68d 100644
--- a/loolwsd/Storage.cpp
+++ b/loolwsd/Storage.cpp
@@ -119,7 +119,7 @@ bool isLocalhost(const std::string& targetHost)
     {
         Poco::Net::NetworkInterface& netif = list[i];
         std::string address = netif.address().toString();
-        address = address.substr(0, address.find("%",0));
+        address = address.substr(0, address.find('%', 0));
         if (address == targetAddress)
         {
             Log::info("WOPI host is on the same host as the WOPI client: \"" + targetAddress + "\". Connection is allowed.");
@@ -151,7 +151,7 @@ std::unique_ptr<StorageBase> StorageBase::create(const std::string& jailRoot, co
     else if (_wopiEnabled)
     {
         Log::info("Public URI [" + uri.toString() + "] considered WOPI.");
-        const auto targetHost = uri.getHost();
+        const auto& targetHost = uri.getHost();
         if (_wopiHosts.match(targetHost) || isLocalhost(targetHost))
         {
             return std::unique_ptr<StorageBase>(new WopiStorage(jailRoot, jailPath, uri.toString()));
@@ -170,7 +170,7 @@ StorageBase::FileInfo LocalStorage::getFileInfo(const Poco::URI& uri)
 {
     const auto path = Poco::Path(uri.getPath());
     Log::debug("Getting info for local uri [" + uri.toString() + "], path [" + path.toString() + "].");
-    const auto filename = path.getFileName();
+    const auto& filename = path.getFileName();
     const auto file = Poco::File(path);
     const auto lastModified = file.getLastModified();
     const auto size = file.getSize();


More information about the Libreoffice-commits mailing list