[Libreoffice-commits] core.git: vcl/unx

Julien Nabet serval2412 at yahoo.fr
Thu Oct 26 05:28:22 UTC 2017


 vcl/unx/generic/printer/cupsmgr.cxx |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

New commits:
commit f4df7d2df596bd88e434759a5c108d458a8324b7
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Wed Oct 25 19:56:34 2017 +0200

    Simplify and remove useless aRemovePrinters list (vcl)
    
    Change-Id: I33120b62b114bbac62752888301e62268f45768c
    Reviewed-on: https://gerrit.libreoffice.org/43852
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>

diff --git a/vcl/unx/generic/printer/cupsmgr.cxx b/vcl/unx/generic/printer/cupsmgr.cxx
index 621afce153a1..328e9246e9f5 100644
--- a/vcl/unx/generic/printer/cupsmgr.cxx
+++ b/vcl/unx/generic/printer/cupsmgr.cxx
@@ -349,21 +349,21 @@ void CUPSManager::initialize()
 
     // remove everything that is not a CUPS printer and not
     // a special purpose printer (PDF, Fax)
-    std::list< OUString > aRemovePrinters;
-    for( std::unordered_map< OUString, Printer >::iterator it = m_aPrinters.begin();
-         it != m_aPrinters.end(); ++it )
+    std::unordered_map< OUString, Printer >::iterator it = m_aPrinters.begin();
+    while(it != m_aPrinters.end())
     {
         if( m_aCUPSDestMap.find( it->first ) != m_aCUPSDestMap.end() )
+        {
+            ++it;
             continue;
+        }
 
         if( !it->second.m_aInfo.m_aFeatures.isEmpty() )
+        {
+            ++it;
             continue;
-        aRemovePrinters.push_back( it->first );
-    }
-    while( aRemovePrinters.begin() != aRemovePrinters.end() )
-    {
-        m_aPrinters.erase( aRemovePrinters.front() );
-        aRemovePrinters.pop_front();
+        }
+        it = m_aPrinters.erase(it);
     }
 
     cupsSetPasswordCB( setPasswordCallback );


More information about the Libreoffice-commits mailing list