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

Miklos Vajna vmiklos at collabora.co.uk
Thu Apr 28 06:44:21 UTC 2016


 loolwsd/LOOLWSD.cpp      |    8 ++++----
 loolwsd/MessageQueue.cpp |    4 ++--
 loolwsd/Storage.cpp      |    3 +--
 3 files changed, 7 insertions(+), 8 deletions(-)

New commits:
commit 30d90d6b9643a43fdf00fcd64806453ff5b9ca52
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Apr 28 08:43:19 2016 +0200

    loolwsd: using range-based loops is more readable here
    
    Change-Id: I9533c74dbcd6622a01b21096109edc3b27e797e3

diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index e8f2e05..395770f 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -1002,9 +1002,9 @@ public:
                << request.getMethod() << " " << request.getURI() << " "
                << request.getVersion();
 
-        for (HTTPServerRequest::ConstIterator it = request.begin(); it != request.end(); ++it)
+        for (const auto& it : request)
         {
-            logger << " / " << it->first << ": " << it->second;
+            logger << " / " << it.first << ": " << it.second;
         }
 
         logger << Log::end;
@@ -1051,9 +1051,9 @@ public:
                << request.getMethod() << " " << request.getURI() << " "
                << request.getVersion();
 
-        for (HTTPServerRequest::ConstIterator it = request.begin(); it != request.end(); ++it)
+        for (const auto& it : request)
         {
-            logger << " / " << it->first << ": " << it->second;
+            logger << " / " << it.first << ": " << it.second;
         }
 
         logger << Log::end;
diff --git a/loolwsd/MessageQueue.cpp b/loolwsd/MessageQueue.cpp
index e6ef3d6..642c7c0 100644
--- a/loolwsd/MessageQueue.cpp
+++ b/loolwsd/MessageQueue.cpp
@@ -106,9 +106,9 @@ void TileQueue::put_impl(const Payload& value)
         //   so that get_impl() returns optimal results
         //
         // For now: just don't put duplicates into the queue
-        for (auto it = _queue.cbegin(); it != _queue.cend(); ++it)
+        for (const auto& it : _queue)
         {
-            if (value == *it)
+            if (value == it)
             {
                 return;
             }
diff --git a/loolwsd/Storage.cpp b/loolwsd/Storage.cpp
index 911c68d..bbaccb0 100644
--- a/loolwsd/Storage.cpp
+++ b/loolwsd/Storage.cpp
@@ -115,9 +115,8 @@ bool isLocalhost(const std::string& targetHost)
     }
 
     Poco::Net::NetworkInterface::NetworkInterfaceList list = Poco::Net::NetworkInterface::list(true,true);
-    for (unsigned i = 0; i < list.size(); i++)
+    for (auto& netif : list)
     {
-        Poco::Net::NetworkInterface& netif = list[i];
         std::string address = netif.address().toString();
         address = address.substr(0, address.find('%', 0));
         if (address == targetAddress)


More information about the Libreoffice-commits mailing list