Blob Blame History Raw
From 5b7391b183885ce1d85b76d2d6ddc46a771abc35 Mon Sep 17 00:00:00 2001
From: Jan Holesovsky <kendy@collabora.com>
Date: Thu, 12 Nov 2015 18:22:06 +0100
Subject: [PATCH 315/398] lok: Use reference instead of copy constructing in
 range-based for.

Change-Id: Ie5bf5d4ab139f22e67f3654b0bb31e10b8c9f337
(cherry picked from commit addd884799b88213df813fd8501c3ab8306593e1)
---
 desktop/source/lib/init.cxx | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 1d56f2e8abae..04a902780e6c 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1281,10 +1281,10 @@ static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand)
         if (sStyleFam == "ParagraphStyles"
             && doc_getDocumentType(pThis) == LOK_DOCTYPE_TEXT)
         {
-            for( OUString aStyle: aWriterStyles )
+            for (const OUString& rStyle: aWriterStyles)
             {
                 uno::Reference< beans::XPropertySet > xStyle;
-                xStyleFamily->getByName( aStyle ) >>= xStyle;
+                xStyleFamily->getByName(rStyle) >>= xStyle;
                 OUString sName;
                 xStyle->getPropertyValue("DisplayName") >>= sName;
                 if( !sName.isEmpty() )
@@ -1299,14 +1299,14 @@ static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand)
         }
 
         uno::Sequence<OUString> aStyles = xStyleFamily->getElementNames();
-        for ( OUString aStyle: aStyles )
+        for (const OUString& rStyle: aStyles )
         {
             // Filter out the default styles - they are already at the top
             // of the list
-            if (aDefaultStyleNames.find(aStyle) == aDefaultStyleNames.end())
+            if (aDefaultStyleNames.find(rStyle) == aDefaultStyleNames.end())
             {
                 boost::property_tree::ptree aChild;
-                aChild.put("", aStyle);
+                aChild.put("", rStyle);
                 aChildren.push_back(std::make_pair("", aChild));
             }
         }
-- 
2.12.0