summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-03-10 15:55:33 +0100
committerStephan Bergmann <sbergman@redhat.com>2017-03-10 15:55:33 +0100
commitd3b5bd4a07a619db6bee1c39c32280ac3c620532 (patch)
tree99659a0ed9846b92765399c94005efea5b7d4645
parentd7685eb3f417e19a5e61f2fe550eb03d6848365d (diff)
loplugin:loopvartoosmall
Change-Id: I07c13c354df1d7f523b08a39f2ed3f008051f7aa
-rw-r--r--vcl/headless/svpprn.cxx9
-rw-r--r--vcl/unx/generic/print/genprnpsp.cxx7
2 files changed, 8 insertions, 8 deletions
diff --git a/vcl/headless/svpprn.cxx b/vcl/headless/svpprn.cxx
index ec5450a87c61..50a44320320c 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 7f6d70fccd51..179057172ec2 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