[Libreoffice-commits] core.git: vcl/unx
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Sun Jan 13 15:08:08 UTC 2019
vcl/unx/generic/printer/printerinfomanager.cxx | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
New commits:
commit 087962e390719b6027b4c2cf795c49a2b92624d7
Author: Matteo Casalin <matteo.casalin at yahoo.com>
AuthorDate: Thu Jan 3 16:53:35 2019 +0100
Commit: Matteo Casalin <matteo.casalin at yahoo.com>
CommitDate: Sun Jan 13 16:07:44 2019 +0100
Simplify and use getToken index when possible/needed
Change-Id: I21f31a0e3ed1cebd7f77a34a2b7b89c528823ce7
Reviewed-on: https://gerrit.libreoffice.org/66231
Tested-by: Jenkins
Reviewed-by: Matteo Casalin <matteo.casalin at yahoo.com>
diff --git a/vcl/unx/generic/printer/printerinfomanager.cxx b/vcl/unx/generic/printer/printerinfomanager.cxx
index 9c1007cdcd09..cc4fb0b88485 100644
--- a/vcl/unx/generic/printer/printerinfomanager.cxx
+++ b/vcl/unx/generic/printer/printerinfomanager.cxx
@@ -234,10 +234,11 @@ void PrinterInfoManager::initialize()
aValue = aConfig.ReadKey( "MarginAdjust" );
if (!aValue.isEmpty())
{
- m_aGlobalDefaults.m_nLeftMarginAdjust = aValue.getToken(0, ',').toInt32();
- m_aGlobalDefaults.m_nRightMarginAdjust = aValue.getToken(1, ',').toInt32();
- m_aGlobalDefaults.m_nTopMarginAdjust = aValue.getToken(2, ',').toInt32();
- m_aGlobalDefaults.m_nBottomMarginAdjust = aValue.getToken(3, ',').toInt32();
+ sal_Int32 nIdx {0};
+ m_aGlobalDefaults.m_nLeftMarginAdjust = aValue.getToken(0, ',', nIdx).toInt32();
+ m_aGlobalDefaults.m_nRightMarginAdjust = aValue.getToken(0, ',', nIdx).toInt32();
+ m_aGlobalDefaults.m_nTopMarginAdjust = aValue.getToken(0, ',', nIdx).toInt32();
+ m_aGlobalDefaults.m_nBottomMarginAdjust = aValue.getToken(0, ',', nIdx).toInt32();
}
aValue = aConfig.ReadKey( "ColorDepth", "24" );
@@ -417,10 +418,11 @@ void PrinterInfoManager::initialize()
aValue = aConfig.ReadKey( "MarginAdjust" );
if (!aValue.isEmpty())
{
- aPrinter.m_aInfo.m_nLeftMarginAdjust = aValue.getToken(0, ',' ).toInt32();
- aPrinter.m_aInfo.m_nRightMarginAdjust = aValue.getToken(1, ',' ).toInt32();
- aPrinter.m_aInfo.m_nTopMarginAdjust = aValue.getToken(2, ',' ).toInt32();
- aPrinter.m_aInfo.m_nBottomMarginAdjust = aValue.getToken(3, ',' ).toInt32();
+ sal_Int32 nIdx {0};
+ aPrinter.m_aInfo.m_nLeftMarginAdjust = aValue.getToken(0, ',', nIdx).toInt32();
+ aPrinter.m_aInfo.m_nRightMarginAdjust = aValue.getToken(0, ',', nIdx).toInt32();
+ aPrinter.m_aInfo.m_nTopMarginAdjust = aValue.getToken(0, ',', nIdx).toInt32();
+ aPrinter.m_aInfo.m_nBottomMarginAdjust = aValue.getToken(0, ',', nIdx).toInt32();
}
aValue = aConfig.ReadKey( "ColorDepth" );
@@ -563,9 +565,7 @@ bool PrinterInfoManager::checkFeatureToken( const OUString& rPrinterName, const
while( nIndex != -1 )
{
OUString aOuterToken = rPrinterInfo.m_aFeatures.getToken( 0, ',', nIndex );
- sal_Int32 nInnerIndex = 0;
- OUString aInnerToken = aOuterToken.getToken( 0, '=', nInnerIndex );
- if( aInnerToken.equalsIgnoreAsciiCaseAscii( pToken ) )
+ if( aOuterToken.getToken( 0, '=' ).equalsIgnoreAsciiCaseAscii( pToken ) )
return true;
}
return false;
More information about the Libreoffice-commits
mailing list