[Libreoffice-commits] core.git: include/o3tl

Stephan Bergmann sbergman at redhat.com
Tue Jun 27 16:03:21 UTC 2017


 include/o3tl/lru_map.hxx |   24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

New commits:
commit 538c649f799c8c03218654588e6fd37162a151a1
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jun 27 18:02:32 2017 +0200

    -Werror=shadow (GCC 8)
    
    > include/o3tl/lru_map.hxx:70:24: error: declaration of ‘iterator’ shadows a previous local [-Werror=shadow]
    >          map_iterator_t iterator = mLruMap.find(rPair.first);
    >                         ^~~~~~~~
    > include/o3tl/lru_map.hxx:61:29: note: shadowed declaration is here
    >      typedef list_iterator_t iterator;
    >                              ^~~~~~~~
    
    Change-Id: Ic0f8ab4609a06b713ffa6e8e9fdd04f0c42869d7

diff --git a/include/o3tl/lru_map.hxx b/include/o3tl/lru_map.hxx
index c1bfff733f5b..2f41521795fc 100644
--- a/include/o3tl/lru_map.hxx
+++ b/include/o3tl/lru_map.hxx
@@ -67,9 +67,9 @@ public:
 
     void insert(key_value_pair_t& rPair)
     {
-        map_iterator_t iterator = mLruMap.find(rPair.first);
+        map_iterator_t i = mLruMap.find(rPair.first);
 
-        if (iterator == mLruMap.end()) // doesn't exist -> add to queue and map
+        if (i == mLruMap.end()) // doesn't exist -> add to queue and map
         {
             // add to front of the list
             mLruList.push_front(rPair);
@@ -80,17 +80,17 @@ public:
         else // already exists -> replace value
         {
             // replace value
-            iterator->second->second = rPair.second;
+            i->second->second = rPair.second;
             // bring to front of the lru list
-            mLruList.splice(mLruList.begin(), mLruList, iterator->second);
+            mLruList.splice(mLruList.begin(), mLruList, i->second);
         }
     }
 
     void insert(key_value_pair_t&& rPair)
     {
-        map_iterator_t iterator = mLruMap.find(rPair.first);
+        map_iterator_t i = mLruMap.find(rPair.first);
 
-        if (iterator == mLruMap.end()) // doesn't exist -> add to list and map
+        if (i == mLruMap.end()) // doesn't exist -> add to list and map
         {
             // add to front of the list
             mLruList.push_front(std::move(rPair));
@@ -101,16 +101,16 @@ public:
         else // already exists -> replace value
         {
             // replace value
-            iterator->second->second = std::move(rPair.second);
+            i->second->second = std::move(rPair.second);
             // push to back of the lru list
-            mLruList.splice(mLruList.begin(), mLruList, iterator->second);
+            mLruList.splice(mLruList.begin(), mLruList, i->second);
         }
     }
 
     const list_const_iterator_t find(const Key& key)
     {
-        const map_iterator_t iterator = mLruMap.find(key);
-        if (iterator == mLruMap.cend()) // can't find entry for the key
+        const map_iterator_t i = mLruMap.find(key);
+        if (i == mLruMap.cend()) // can't find entry for the key
         {
             // return empty iterator
             return mLruList.cend();
@@ -118,8 +118,8 @@ public:
         else
         {
             // push to back of the lru list
-            mLruList.splice(mLruList.begin(), mLruList, iterator->second);
-            return iterator->second;
+            mLruList.splice(mLruList.begin(), mLruList, i->second);
+            return i->second;
         }
     }
 


More information about the Libreoffice-commits mailing list