diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2017-10-18 22:39:33 +0200 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2017-10-20 06:14:32 +0200 |
commit | c16804de78b1cf1ad906eaacbcc7c51d35218d8a (patch) | |
tree | 20657bd85d2115dbc89206e7df3138955e51a8f5 /vcl/unx/generic/printer | |
parent | ba9e09be72a6bd5709fcc51f5dc3cb70b3b80540 (diff) |
Replace list by unordered_set for m_aAlternateFiles (vcl)
Change-Id: I66ea61972fed87245b33dfe355eff58d23041120
Reviewed-on: https://gerrit.libreoffice.org/43520
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'vcl/unx/generic/printer')
-rw-r--r-- | vcl/unx/generic/printer/printerinfomanager.cxx | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/vcl/unx/generic/printer/printerinfomanager.cxx b/vcl/unx/generic/printer/printerinfomanager.cxx index 842f11deea22..ac5779a6ae57 100644 --- a/vcl/unx/generic/printer/printerinfomanager.cxx +++ b/vcl/unx/generic/printer/printerinfomanager.cxx @@ -463,7 +463,7 @@ void PrinterInfoManager::initialize() if( find_it != m_aPrinters.end() ) { aPrinter.m_aAlternateFiles = find_it->second.m_aAlternateFiles; - aPrinter.m_aAlternateFiles.push_front( find_it->second.m_aFile ); + aPrinter.m_aAlternateFiles.emplace( find_it->second.m_aFile ); } m_aPrinters[ aPrinterName ] = aPrinter; } @@ -627,10 +627,9 @@ bool PrinterInfoManager::writePrinterConfig() { rofiles[ it->second.m_aFile ] = 1; // update alternate file list - // the remove operation ensures uniqueness of each alternate - it->second.m_aAlternateFiles.remove( it->second.m_aFile ); - it->second.m_aAlternateFiles.remove( files.begin()->first ); - it->second.m_aAlternateFiles.push_front( it->second.m_aFile ); + // be sure m_aAlternateFiles doesn't contain the m_aFile value + it->second.m_aAlternateFiles.erase( files.begin()->first ); + it->second.m_aAlternateFiles.emplace( it->second.m_aFile ); // update file it->second.m_aFile = files.begin()->first; } @@ -770,11 +769,13 @@ bool PrinterInfoManager::removePrinter( const OUString& rPrinterName, bool bChec bSuccess = false; else { - for( std::list< OUString >::const_iterator file_it = it->second.m_aAlternateFiles.begin(); - file_it != it->second.m_aAlternateFiles.end() && bSuccess; ++file_it ) + for (auto const& file : it->second.m_aAlternateFiles) { - if( ! checkWriteability( *file_it ) ) + if( ! checkWriteability(file) ) + { bSuccess = false; + break; + } } } if( bSuccess && ! bCheckOnly ) @@ -783,10 +784,9 @@ bool PrinterInfoManager::removePrinter( const OUString& rPrinterName, bool bChec Config aConfig( it->second.m_aFile ); aConfig.DeleteGroup( it->second.m_aGroup ); aConfig.Flush(); - for( std::list< OUString >::const_iterator file_it = it->second.m_aAlternateFiles.begin(); - file_it != it->second.m_aAlternateFiles.end() && bSuccess; ++file_it ) + for (auto const& file : it->second.m_aAlternateFiles) { - Config aAltConfig( *file_it ); + Config aAltConfig( file ); aAltConfig.DeleteGroup( it->second.m_aGroup ); aAltConfig.Flush(); } |