[Libreoffice-commits] core.git: vcl/headless vcl/unx
Stephan Bergmann
sbergman at redhat.com
Fri Mar 10 14:56:21 UTC 2017
vcl/headless/svpprn.cxx | 9 +++++----
vcl/unx/generic/print/genprnpsp.cxx | 7 +++----
2 files changed, 8 insertions(+), 8 deletions(-)
New commits:
commit d3b5bd4a07a619db6bee1c39c32280ac3c620532
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Mar 10 15:55:33 2017 +0100
loplugin:loopvartoosmall
Change-Id: I07c13c354df1d7f523b08a39f2ed3f008051f7aa
diff --git a/vcl/headless/svpprn.cxx b/vcl/headless/svpprn.cxx
index ec5450a..50a4432 100644
--- a/vcl/headless/svpprn.cxx
+++ b/vcl/headless/svpprn.cxx
@@ -99,14 +99,15 @@ static void copyJobDataToJobSetup( ImplJobSetup* pJobSetup, JobData& rData )
pValue = rData.m_aContext.getValue( pKey );
if( pKey && pValue )
{
- sal_uInt16 nPaperBin;
+ int nPaperBin;
for( nPaperBin = 0;
pValue != pKey->getValue( nPaperBin ) &&
nPaperBin < pKey->countValues();
nPaperBin++ );
- pJobSetup->SetPaperBin(nPaperBin);
- if( nPaperBin >= pKey->countValues() || pValue == pKey->getDefaultValue() )
- pJobSetup->SetPaperBin( 0xffff );
+ pJobSetup->SetPaperBin(
+ (nPaperBin < 0 || nPaperBin >= pKey->countValues()
+ || pValue == pKey->getDefaultValue())
+ ? 0xffff : nPaperBin);
}
// copy duplex
diff --git a/vcl/unx/generic/print/genprnpsp.cxx b/vcl/unx/generic/print/genprnpsp.cxx
index 7f6d70f..1790571 100644
--- a/vcl/unx/generic/print/genprnpsp.cxx
+++ b/vcl/unx/generic/print/genprnpsp.cxx
@@ -195,14 +195,13 @@ static void copyJobDataToJobSetup( ImplJobSetup* pJobSetup, JobData& rData )
pValue = rData.m_aContext.getValue( pKey );
if( pKey && pValue )
{
- sal_uInt16 nPaperBin;
+ int nPaperBin;
for( nPaperBin = 0;
pValue != pKey->getValue( nPaperBin ) &&
nPaperBin < pKey->countValues();
nPaperBin++);
- pJobSetup->SetPaperBin(nPaperBin);
- if( pJobSetup->GetPaperBin() >= pKey->countValues() )
- pJobSetup->SetPaperBin( 0 );
+ pJobSetup->SetPaperBin(
+ nPaperBin < 0 || nPaperBin >= pKey->countValues() ? 0 : nPaperBin);
}
// copy duplex
More information about the Libreoffice-commits
mailing list