[Libreoffice-commits] core.git: vcl/headless vcl/inc vcl/null vcl/unx
Julien Nabet
serval2412 at yahoo.fr
Sat Sep 2 04:51:14 UTC 2017
vcl/headless/svpprn.cxx | 4 +-
vcl/inc/printerinfomanager.hxx | 7 ++-
vcl/inc/unx/helper.hxx | 4 +-
vcl/null/printerinfomanager.cxx | 4 +-
vcl/unx/generic/fontmanager/helper.cxx | 2 -
vcl/unx/generic/print/genprnpsp.cxx | 4 +-
vcl/unx/generic/printer/ppdparser.cxx | 4 +-
vcl/unx/generic/printer/printerinfomanager.cxx | 44 ++++++++++++-------------
8 files changed, 37 insertions(+), 36 deletions(-)
New commits:
commit 1e8a38488f553ec2449dbc316a7a1a1fe17f48c2
Author: Julien Nabet <serval2412 at yahoo.fr>
Date: Fri Sep 1 21:52:08 2017 +0200
Replace lists by vectors printer part (vcl)
Change-Id: I0e4685b78f114296b115b4fef5eed4140755e1a1
Reviewed-on: https://gerrit.libreoffice.org/41804
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>
diff --git a/vcl/headless/svpprn.cxx b/vcl/headless/svpprn.cxx
index 09b43a37ae28..92a11e99d03a 100644
--- a/vcl/headless/svpprn.cxx
+++ b/vcl/headless/svpprn.cxx
@@ -211,10 +211,10 @@ void SvpSalInstance::GetPrinterQueueInfo( ImplPrnQueueList* pList )
// #i62663# synchronize possible asynchronouse printer detection now
rManager.checkPrintersChanged( true );
}
- ::std::list< OUString > aPrinters;
+ ::std::vector< OUString > aPrinters;
rManager.listPrinters( aPrinters );
- for( ::std::list< OUString >::iterator it = aPrinters.begin(); it != aPrinters.end(); ++it )
+ for( ::std::vector< OUString >::iterator it = aPrinters.begin(); it != aPrinters.end(); ++it )
{
const PrinterInfo& rInfo( rManager.getPrinterInfo( *it ) );
// Neuen Eintrag anlegen
diff --git a/vcl/inc/printerinfomanager.hxx b/vcl/inc/printerinfomanager.hxx
index 0bfeab7289d2..7a3e1c7a0e1b 100644
--- a/vcl/inc/printerinfomanager.hxx
+++ b/vcl/inc/printerinfomanager.hxx
@@ -22,6 +22,7 @@
#include <memory>
#include <list>
+#include <vector>
#include <unordered_map>
#include <vcl/dllapi.h>
@@ -102,11 +103,11 @@ protected:
std::unordered_map< OUString, Printer, OUStringHash > m_aPrinters;
PrinterInfo m_aGlobalDefaults;
- std::list< WatchFile > m_aWatchFiles;
+ std::vector< WatchFile > m_aWatchFiles;
OUString m_aDefaultPrinter;
OUString m_aSystemPrintCommand;
- std::list< SystemPrintQueue > m_aSystemPrintQueues;
+ std::vector< SystemPrintQueue > m_aSystemPrintQueues;
std::unique_ptr<SystemQueueInfo>
m_pQueueInfo;
@@ -136,7 +137,7 @@ public:
Type getType() const { return m_eType; }
// lists the names of all known printers
- void listPrinters( std::list< OUString >& rList ) const;
+ void listPrinters( std::vector< OUString >& rVector ) const;
// gets info about a named printer
const PrinterInfo& getPrinterInfo( const OUString& rPrinter ) const;
diff --git a/vcl/inc/unx/helper.hxx b/vcl/inc/unx/helper.hxx
index ce4f10876ec7..c02d9578426f 100644
--- a/vcl/inc/unx/helper.hxx
+++ b/vcl/inc/unx/helper.hxx
@@ -20,7 +20,7 @@
#ifndef INCLUDED_VCL_INC_UNX_HELPER_HXX
#define INCLUDED_VCL_INC_UNX_HELPER_HXX
-#include <list>
+#include <vector>
#include <vcl/dllapi.h>
#include <vcl/vclevent.hxx>
@@ -34,7 +34,7 @@ namespace osl { class File; }
namespace psp
{
-void getPrinterPathList( std::list< OUString >& rPathList, const char* pSubDir );
+void getPrinterPathList( std::vector< OUString >& rPathList, const char* pSubDir );
OUString const & getFontPath();
diff --git a/vcl/null/printerinfomanager.cxx b/vcl/null/printerinfomanager.cxx
index 6545ffb2a898..3361988d4af5 100644
--- a/vcl/null/printerinfomanager.cxx
+++ b/vcl/null/printerinfomanager.cxx
@@ -74,11 +74,11 @@ void PrinterInfoManager::initialize()
// ???
}
-void PrinterInfoManager::listPrinters( ::std::list< OUString >& rList ) const
+void PrinterInfoManager::listPrinters( ::std::vector< OUString >& rVector ) const
{
(void) this;
- rList.clear();
+ rVector.clear();
}
const PrinterInfo& PrinterInfoManager::getPrinterInfo( const OUString& /* rPrinter */ ) const
diff --git a/vcl/unx/generic/fontmanager/helper.cxx b/vcl/unx/generic/fontmanager/helper.cxx
index 0c8ba1e33003..af06413190a1 100644
--- a/vcl/unx/generic/fontmanager/helper.cxx
+++ b/vcl/unx/generic/fontmanager/helper.cxx
@@ -102,7 +102,7 @@ static OString getEnvironmentPath( const char* pKey )
} // namespace psp
-void psp::getPrinterPathList( std::list< OUString >& rPathList, const char* pSubDir )
+void psp::getPrinterPathList( std::vector< OUString >& rPathList, const char* pSubDir )
{
rPathList.clear();
rtl_TextEncoding aEncoding = osl_getThreadTextEncoding();
diff --git a/vcl/unx/generic/print/genprnpsp.cxx b/vcl/unx/generic/print/genprnpsp.cxx
index 32f0204fdae6..b7fb41665bcb 100644
--- a/vcl/unx/generic/print/genprnpsp.cxx
+++ b/vcl/unx/generic/print/genprnpsp.cxx
@@ -426,10 +426,10 @@ void SalGenericInstance::GetPrinterQueueInfo( ImplPrnQueueList* pList )
// #i62663# synchronize possible asynchronouse printer detection now
rManager.checkPrintersChanged( true );
}
- ::std::list< OUString > aPrinters;
+ ::std::vector< OUString > aPrinters;
rManager.listPrinters( aPrinters );
- for( ::std::list< OUString >::iterator it = aPrinters.begin(); it != aPrinters.end(); ++it )
+ for( ::std::vector< OUString >::iterator it = aPrinters.begin(); it != aPrinters.end(); ++it )
{
const PrinterInfo& rInfo( rManager.getPrinterInfo( *it ) );
// Neuen Eintrag anlegen
diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx
index b9841d5252dc..927e6a284d4a 100644
--- a/vcl/unx/generic/printer/ppdparser.cxx
+++ b/vcl/unx/generic/printer/ppdparser.cxx
@@ -445,9 +445,9 @@ void PPDParser::initPPDFiles(PPDCache &rPPDCache)
rPPDCache.pAllPPDFiles = new std::unordered_map< OUString, OUString, OUStringHash >;
// check installation directories
- std::list< OUString > aPathList;
+ std::vector< OUString > aPathList;
psp::getPrinterPathList( aPathList, PRINTER_PPDDIR );
- for( std::list< OUString >::const_iterator ppd_it = aPathList.begin(); ppd_it != aPathList.end(); ++ppd_it )
+ for( std::vector< OUString >::const_iterator ppd_it = aPathList.begin(); ppd_it != aPathList.end(); ++ppd_it )
{
INetURLObject aPPDDir( *ppd_it, INetProtocol::File, INetURLObject::EncodeMechanism::All );
scanPPDDir( aPPDDir.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
diff --git a/vcl/unx/generic/printer/printerinfomanager.cxx b/vcl/unx/generic/printer/printerinfomanager.cxx
index dc97c97bb943..ae2128768c3e 100644
--- a/vcl/unx/generic/printer/printerinfomanager.cxx
+++ b/vcl/unx/generic/printer/printerinfomanager.cxx
@@ -55,7 +55,7 @@ namespace psp
{
mutable Mutex m_aMutex;
bool m_bChanged;
- std::list< PrinterInfoManager::SystemPrintQueue >
+ std::vector< PrinterInfoManager::SystemPrintQueue >
m_aQueues;
OUString m_aCommand;
@@ -69,7 +69,7 @@ namespace psp
OUString getCommand() const;
// sets changed status to false; therefore not const
- void getSystemQueues( std::list< PrinterInfoManager::SystemPrintQueue >& rQueues );
+ void getSystemQueues( std::vector< PrinterInfoManager::SystemPrintQueue >& rQueues );
};
} // namespace
@@ -128,7 +128,7 @@ PrinterInfoManager::~PrinterInfoManager()
bool PrinterInfoManager::checkPrintersChanged( bool bWait )
{
// check if files were created, deleted or modified since initialize()
- ::std::list< WatchFile >::const_iterator it;
+ ::std::vector< WatchFile >::const_iterator it;
bool bChanged = false;
for( it = m_aWatchFiles.begin(); it != m_aWatchFiles.end() && ! bChanged; ++it )
{
@@ -199,9 +199,9 @@ void PrinterInfoManager::initialize()
return;
}
- std::list< OUString > aDirList;
+ std::vector< OUString > aDirList;
psp::getPrinterPathList( aDirList, nullptr );
- std::list< OUString >::const_iterator print_dir_it;
+ std::vector< OUString >::const_iterator print_dir_it;
for( print_dir_it = aDirList.begin(); print_dir_it != aDirList.end(); ++print_dir_it )
{
INetURLObject aFile( *print_dir_it, INetProtocol::File, INetURLObject::EncodeMechanism::All );
@@ -504,7 +504,7 @@ void PrinterInfoManager::initialize()
m_pQueueInfo->getSystemQueues( m_aSystemPrintQueues );
m_pQueueInfo.reset();
}
- for( ::std::list< SystemPrintQueue >::iterator it = m_aSystemPrintQueues.begin(); it != m_aSystemPrintQueues.end(); ++it )
+ for( ::std::vector< SystemPrintQueue >::iterator it = m_aSystemPrintQueues.begin(); it != m_aSystemPrintQueues.end(); ++it )
{
OUString aPrinterName( "<" );
aPrinterName += it->m_aQueue;
@@ -532,12 +532,12 @@ void PrinterInfoManager::initialize()
}
}
-void PrinterInfoManager::listPrinters( ::std::list< OUString >& rList ) const
+void PrinterInfoManager::listPrinters( ::std::vector< OUString >& rVector ) const
{
std::unordered_map< OUString, Printer, OUStringHash >::const_iterator it;
- rList.clear();
+ rVector.clear();
for( it = m_aPrinters.begin(); it != m_aPrinters.end(); ++it )
- rList.push_back( it->first );
+ rVector.push_back( it->first );
}
const PrinterInfo& PrinterInfoManager::getPrinterInfo( const OUString& rPrinter ) const
@@ -569,7 +569,7 @@ bool PrinterInfoManager::writePrinterConfig()
std::unordered_map< OUString, int, OUStringHash > rofiles;
std::unordered_map< OUString, Config*, OUStringHash >::iterator file_it;
- for( ::std::list< WatchFile >::const_iterator wit = m_aWatchFiles.begin(); wit != m_aWatchFiles.end(); ++wit )
+ for( ::std::vector< WatchFile >::const_iterator wit = m_aWatchFiles.begin(); wit != m_aWatchFiles.end(); ++wit )
{
if( checkWriteability( wit->m_aFilePath ) )
{
@@ -928,7 +928,7 @@ bool SystemQueueInfo::hasChanged() const
return bChanged;
}
-void SystemQueueInfo::getSystemQueues( std::list< PrinterInfoManager::SystemPrintQueue >& rQueues )
+void SystemQueueInfo::getSystemQueues( std::vector< PrinterInfoManager::SystemPrintQueue >& rQueues )
{
MutexGuard aGuard( m_aMutex );
rQueues = m_aQueues;
@@ -943,8 +943,8 @@ OUString SystemQueueInfo::getCommand() const
}
struct SystemCommandParameters;
-typedef void(* tokenHandler)(const std::list< OString >&,
- std::list< PrinterInfoManager::SystemPrintQueue >&,
+typedef void(* tokenHandler)(const std::vector< OString >&,
+ std::vector< PrinterInfoManager::SystemPrintQueue >&,
const SystemCommandParameters*);
struct SystemCommandParameters
@@ -959,8 +959,8 @@ struct SystemCommandParameters
#if ! (defined(LINUX) || defined(NETBSD) || defined(FREEBSD) || defined(OPENBSD))
static void lpgetSysQueueTokenHandler(
- const std::list< OString >& i_rLines,
- std::list< PrinterInfoManager::SystemPrintQueue >& o_rQueues,
+ const std::vector< OString >& i_rLines,
+ std::vector< PrinterInfoManager::SystemPrintQueue >& o_rQueues,
const SystemCommandParameters* )
{
rtl_TextEncoding aEncoding = osl_getThreadTextEncoding();
@@ -975,7 +975,7 @@ static void lpgetSysQueueTokenHandler(
// find _all: line
OString aAllLine( "_all:" );
OString aAllAttr( "all=" );
- for( std::list< OString >::const_iterator it = i_rLines.begin();
+ for( std::vector< OString >::const_iterator it = i_rLines.begin();
it != i_rLines.end(); ++it )
{
if( it->indexOf( aAllLine, 0 ) == 0 )
@@ -1005,7 +1005,7 @@ static void lpgetSysQueueTokenHandler(
bool bInsertAttribute = false;
OString aDescrStr( "description=" );
OString aLocStr( "location=" );
- for( std::list< OString >::const_iterator it = i_rLines.begin();
+ for( std::vector< OString >::const_iterator it = i_rLines.begin();
it != i_rLines.end(); ++it )
{
sal_Int32 nPos = 0;
@@ -1056,8 +1056,8 @@ static void lpgetSysQueueTokenHandler(
}
#endif
static void standardSysQueueTokenHandler(
- const std::list< OString >& i_rLines,
- std::list< PrinterInfoManager::SystemPrintQueue >& o_rQueues,
+ const std::vector< OString >& i_rLines,
+ std::vector< PrinterInfoManager::SystemPrintQueue >& o_rQueues,
const SystemCommandParameters* i_pParms)
{
rtl_TextEncoding aEncoding = osl_getThreadTextEncoding();
@@ -1066,7 +1066,7 @@ static void standardSysQueueTokenHandler(
OString aAftToken( i_pParms->pAftToken );
/* Normal Unix print queue discovery, also used for Darwin 5 LPR printing
*/
- for( std::list< OString >::const_iterator it = i_rLines.begin();
+ for( std::vector< OString >::const_iterator it = i_rLines.begin();
it != i_rLines.end(); ++it )
{
sal_Int32 nPos = 0;
@@ -1119,7 +1119,7 @@ void SystemQueueInfo::run()
osl_setThreadName("LPR psp::SystemQueueInfo");
char pBuffer[1024];
- std::list< OString > aLines;
+ std::vector< OString > aLines;
/* Discover which command we can use to get a list of all printer queues */
for(const auto & rParm : aParms)
@@ -1138,7 +1138,7 @@ void SystemQueueInfo::run()
aLines.push_back( OString( pBuffer ) );
if( ! pclose( pPipe ) )
{
- std::list< PrinterInfoManager::SystemPrintQueue > aSysPrintQueues;
+ std::vector< PrinterInfoManager::SystemPrintQueue > aSysPrintQueues;
rParm.pHandler( aLines, aSysPrintQueues, &rParm );
MutexGuard aGuard( m_aMutex );
m_bChanged = true;
More information about the Libreoffice-commits
mailing list