[Libreoffice-commits] core.git: vcl/unx
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Sun Jan 13 18:01:20 UTC 2019
vcl/unx/generic/printer/ppdparser.cxx | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
New commits:
commit 6bedf7bd840c7c6d4afea45b825b6a22cbdae240
Author: Matteo Casalin <matteo.casalin at yahoo.com>
AuthorDate: Thu Jan 3 17:04:16 2019 +0100
Commit: Matteo Casalin <matteo.casalin at yahoo.com>
CommitDate: Sun Jan 13 19:00:59 2019 +0100
Simplify, avoid getToken
Change-Id: I215edc7cd9fe94af833d8a9738eb9eff9538e6d0
Reviewed-on: https://gerrit.libreoffice.org/66232
Tested-by: Jenkins
Reviewed-by: Matteo Casalin <matteo.casalin at yahoo.com>
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();
More information about the Libreoffice-commits
mailing list