diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-12-21 20:22:48 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-12-22 07:43:35 +0100 |
commit | 494b3e69fd4bef0af19627cf31da98da376019d0 (patch) | |
tree | f0c9f434cfcc5775c45c79e8dba93453ec0ac8d0 /package | |
parent | 968b64d054eb164cee9fb92b6bf7dd93f478bf24 (diff) |
loplugin:flatten in package..reportdesign
Change-Id: I2da242fcb59709ebdd0819ec04d051d794da71e9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127277
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'package')
-rw-r--r-- | package/source/zippackage/zipfileaccess.cxx | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/package/source/zippackage/zipfileaccess.cxx b/package/source/zippackage/zipfileaccess.cxx index a02d416286f1..85a674ef6e50 100644 --- a/package/source/zippackage/zipfileaccess.cxx +++ b/package/source/zippackage/zipfileaccess.cxx @@ -134,34 +134,32 @@ bool OZipFileAccess::StringGoodForPattern_Impl( const OUString& aString, sal_Int32 nBeginInd = aPattern[0].getLength(); sal_Int32 nEndInd = aString.getLength() - aPattern[nInd].getLength(); - if ( nEndInd >= nBeginInd - && ( nEndInd == aString.getLength() || aString.subView( nEndInd ) == aPattern[nInd] ) - && ( nBeginInd == 0 || aString.subView( 0, nBeginInd ) == aPattern[0] ) ) - { - for ( sal_Int32 nCurInd = aPattern.getLength() - 2; nCurInd > 0; nCurInd-- ) - { - if ( aPattern[nCurInd].isEmpty() ) - continue; + if ( nEndInd < nBeginInd + || ( nEndInd != aString.getLength() && aString.subView( nEndInd ) != aPattern[nInd] ) + || ( nBeginInd != 0 && aString.subView( 0, nBeginInd ) != aPattern[0] ) ) + return false; - if ( nEndInd == nBeginInd ) - return false; + for ( sal_Int32 nCurInd = aPattern.getLength() - 2; nCurInd > 0; nCurInd-- ) + { + if ( aPattern[nCurInd].isEmpty() ) + continue; - // check that search does not use nEndInd position - sal_Int32 nLastInd = aString.lastIndexOf( aPattern[nCurInd], nEndInd - 1 ); + if ( nEndInd == nBeginInd ) + return false; - if ( nLastInd == -1 ) - return false; + // check that search does not use nEndInd position + sal_Int32 nLastInd = aString.lastIndexOf( aPattern[nCurInd], nEndInd - 1 ); - if ( nLastInd < nBeginInd ) - return false; + if ( nLastInd == -1 ) + return false; - nEndInd = nLastInd; - } + if ( nLastInd < nBeginInd ) + return false; - return true; + nEndInd = nLastInd; } - return false; + return true; } // XInitialization |