summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@yahoo.com>2019-01-03 17:04:16 +0100
committerMatteo Casalin <matteo.casalin@yahoo.com>2019-01-13 19:00:59 +0100
commit6bedf7bd840c7c6d4afea45b825b6a22cbdae240 (patch)
tree59bb863013612e6f5f9cecb2aa127def8b080a35 /vcl
parent49c16a49afb95d844df5746860e0ef6130bc929f (diff)
Simplify, avoid getToken
Change-Id: I215edc7cd9fe94af833d8a9738eb9eff9538e6d0 Reviewed-on: https://gerrit.libreoffice.org/66232 Tested-by: Jenkins Reviewed-by: Matteo Casalin <matteo.casalin@yahoo.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/unx/generic/printer/ppdparser.cxx10
1 files changed, 4 insertions, 6 deletions
diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx
index a7ef431c3340..2401855b892c 100644
--- a/vcl/unx/generic/printer/ppdparser.cxx
+++ b/vcl/unx/generic/printer/ppdparser.cxx
@@ -1512,18 +1512,16 @@ void PPDParser::getResolutionFromString(
const OUString& rString,
int& rXRes, int& rYRes )
{
- sal_Int32 nDPIPos;
-
rXRes = rYRes = 300;
- nDPIPos = rString.indexOf( "dpi" );
+ const sal_Int32 nDPIPos {rString.indexOf( "dpi" )};
if( nDPIPos != -1 )
{
- sal_Int32 nPos = 0;
- if( ( nPos = rString.indexOf( 'x' ) ) != -1 )
+ const sal_Int32 nPos {rString.indexOf( 'x' )};
+ if( nPos >=0 )
{
rXRes = rString.copy( 0, nPos ).toInt32();
- rYRes = rString.getToken( 1, 'x' ).copy(0, nDPIPos - nPos - 1).toInt32();
+ rYRes = rString.copy(nPos+1, nDPIPos - nPos - 1).toInt32();
}
else
rXRes = rYRes = rString.copy( 0, nDPIPos ).toInt32();