diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-15 09:11:54 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-15 19:25:53 +0200 |
commit | 076fa17b5c04dc7afe593132c00ad9e57dd486f8 (patch) | |
tree | 7ea4be4a92337d196a57f9ec7dc32445351aba17 | |
parent | 4cc702a7055c0e12c7cbf5e5e359e7cbc8b88020 (diff) |
loplugin:buriedassign in l,o,p*
Change-Id: Ib2dd157d43c4387eda009475311761fe2eb627cb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92241
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | l10ntools/source/merge.cxx | 6 | ||||
-rw-r--r-- | linguistic/source/dicimp.cxx | 10 | ||||
-rw-r--r-- | linguistic/source/hyphdsp.hxx | 10 | ||||
-rw-r--r-- | linguistic/source/misc.cxx | 8 | ||||
-rw-r--r-- | linguistic/source/spelldsp.hxx | 10 | ||||
-rw-r--r-- | linguistic/source/thesdsp.hxx | 5 | ||||
-rw-r--r-- | oox/source/dump/dumperbase.cxx | 4 | ||||
-rw-r--r-- | package/source/zipapi/XUnbufferedStream.cxx | 7 | ||||
-rw-r--r-- | package/source/zippackage/ZipPackageEntry.cxx | 6 |
9 files changed, 41 insertions, 25 deletions
diff --git a/l10ntools/source/merge.cxx b/l10ntools/source/merge.cxx index 60d88b927c1b..75afdf77b9a6 100644 --- a/l10ntools/source/merge.cxx +++ b/l10ntools/source/merge.cxx @@ -196,8 +196,10 @@ MergeDataFile::MergeDataFile( bSkipCurrentPOFile = true; break; } - } while( !aPoInput.eof() && - ( bInSameComp = PoEntry::IsInSameComp(aActPo, aNextPo) ) ); + if (aPoInput.eof()) + break; + bInSameComp = PoEntry::IsInSameComp(aActPo, aNextPo); + } while( bInSameComp ); InsertEntry( aActPo.getResourceType(), aActPo.getGroupId(), diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx index cae5f9871858..de8d5326c22a 100644 --- a/linguistic/source/dicimp.cxx +++ b/linguistic/source/dicimp.cxx @@ -542,8 +542,11 @@ int DictionaryNeo::cmpDicEntry(const OUString& rWord1, { // skip chars to be ignored IgnState = false; - while (nIdx1 < nLen1 && ((cChar1 = rWord1[ nIdx1 ]) == cIgnChar || cChar1 == cIgnBeg || IgnState )) + while (nIdx1 < nLen1) { + cChar1 = rWord1[ nIdx1 ]; + if (cChar1 != cIgnChar && cChar1 != cIgnBeg && !IgnState ) + break; if ( cChar1 == cIgnBeg ) IgnState = true; else if (cChar1 == cIgnEnd) @@ -552,8 +555,11 @@ int DictionaryNeo::cmpDicEntry(const OUString& rWord1, nNumIgnChar1++; } IgnState = false; - while (nIdx2 < nLen2 && ((cChar2 = rWord2[ nIdx2 ]) == cIgnChar || cChar2 == cIgnBeg || IgnState )) + while (nIdx2 < nLen2) { + cChar2 = rWord2[ nIdx2 ]; + if (cChar2 != cIgnChar && cChar2 != cIgnBeg && !IgnState ) + break; if ( cChar2 == cIgnBeg ) IgnState = true; else if (cChar2 == cIgnEnd) diff --git a/linguistic/source/hyphdsp.hxx b/linguistic/source/hyphdsp.hxx index 938ab2758597..0061e9255401 100644 --- a/linguistic/source/hyphdsp.hxx +++ b/linguistic/source/hyphdsp.hxx @@ -111,16 +111,18 @@ public: inline css::uno::Reference< css::linguistic2::XLinguProperties > HyphenatorDispatcher::GetPropSet() { - return xPropSet.is() ? - xPropSet : xPropSet = ::linguistic::GetLinguProperties(); + if (!xPropSet.is()) + xPropSet = ::linguistic::GetLinguProperties(); + return xPropSet; } inline css::uno::Reference< css::linguistic2::XSearchableDictionaryList > HyphenatorDispatcher::GetDicList() { - return xDicList.is() ? - xDicList : xDicList = ::linguistic::GetDictionaryList(); + if (!xDicList.is()) + xDicList = ::linguistic::GetDictionaryList(); + return xDicList; } diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx index eb10b709e21d..87cdb02721c7 100644 --- a/linguistic/source/misc.cxx +++ b/linguistic/source/misc.cxx @@ -290,11 +290,9 @@ uno::Reference< XDictionaryEntry > SearchDicList( if ( (!bSearchPosDics && eType == DictionaryType_NEGATIVE) || ( bSearchPosDics && eType == DictionaryType_POSITIVE)) { - if ( (xEntry = axDic->getEntry( rWord )).is() ) - { - if (bSearchSpellEntry || lcl_HasHyphInfo( xEntry )) - break; - } + xEntry = axDic->getEntry( rWord ); + if ( xEntry.is() && (bSearchSpellEntry || lcl_HasHyphInfo( xEntry )) ) + break; xEntry = nullptr; } } diff --git a/linguistic/source/spelldsp.hxx b/linguistic/source/spelldsp.hxx index f9a30634d9ef..492321527595 100644 --- a/linguistic/source/spelldsp.hxx +++ b/linguistic/source/spelldsp.hxx @@ -121,16 +121,18 @@ inline linguistic::SpellCache & SpellCheckerDispatcher::GetCache() const inline css::uno::Reference< css::linguistic2::XLinguProperties > SpellCheckerDispatcher::GetPropSet() { - return m_xPropSet.is() ? - m_xPropSet : m_xPropSet = linguistic::GetLinguProperties(); + if (!m_xPropSet.is()) + m_xPropSet = linguistic::GetLinguProperties(); + return m_xPropSet; } inline css::uno::Reference< css::linguistic2::XSearchableDictionaryList > SpellCheckerDispatcher::GetDicList() { - return m_xDicList.is() ? - m_xDicList : m_xDicList = linguistic::GetDictionaryList(); + if (!m_xDicList.is()) + m_xDicList = linguistic::GetDictionaryList(); + return m_xDicList; } diff --git a/linguistic/source/thesdsp.hxx b/linguistic/source/thesdsp.hxx index 954723417a0a..077413d6e791 100644 --- a/linguistic/source/thesdsp.hxx +++ b/linguistic/source/thesdsp.hxx @@ -81,8 +81,9 @@ public: inline css::uno::Reference< css::linguistic2::XLinguProperties > ThesaurusDispatcher::GetPropSet() { - return xPropSet.is() ? - xPropSet : xPropSet = linguistic::GetLinguProperties(); + if (!xPropSet.is()) + xPropSet = linguistic::GetLinguProperties(); + return xPropSet; } diff --git a/oox/source/dump/dumperbase.cxx b/oox/source/dump/dumperbase.cxx index 3329cc5e12aa..1fdcd267edca 100644 --- a/oox/source/dump/dumperbase.cxx +++ b/oox/source/dump/dumperbase.cxx @@ -1249,7 +1249,9 @@ void UnitConverter::implIncludeList( const NameListBase& /*rList*/ ) NameListRef NameListWrapper::getNameList( const Config& rCfg ) const { - return mxList.get() ? mxList : (mxList = rCfg.getNameList( maName )); + if (!mxList.get()) + mxList = rCfg.getNameList( maName ); + return mxList; } SharedConfigData::SharedConfigData( const OUString& rFileName, diff --git a/package/source/zipapi/XUnbufferedStream.cxx b/package/source/zipapi/XUnbufferedStream.cxx index 4539829f20f0..c4bebeeb83da 100644 --- a/package/source/zipapi/XUnbufferedStream.cxx +++ b/package/source/zipapi/XUnbufferedStream.cxx @@ -223,11 +223,12 @@ sal_Int32 SAL_CALL XUnbufferedStream::readBytes( Sequence< sal_Int8 >& aData, sa } else { - while ( 0 == ( nLastRead = maInflater.doInflateSegment( aData, nRead, aData.getLength() - nRead ) ) || - ( nRead + nLastRead != nRequestedBytes && mnZipCurrent < mnZipEnd ) ) + for (;;) { + nLastRead = maInflater.doInflateSegment( aData, nRead, aData.getLength() - nRead ); + if ( 0 != nLastRead && ( nRead + nLastRead == nRequestedBytes || mnZipCurrent >= mnZipEnd ) ) + break; nRead += nLastRead; - if ( nRead > nRequestedBytes ) throw RuntimeException( "Should not be possible to read more than requested!" ); diff --git a/package/source/zippackage/ZipPackageEntry.cxx b/package/source/zippackage/ZipPackageEntry.cxx index 35789653b35d..86b4906711bd 100644 --- a/package/source/zippackage/ZipPackageEntry.cxx +++ b/package/source/zippackage/ZipPackageEntry.cxx @@ -92,9 +92,11 @@ void ZipPackageEntry::doSetParent ( ZipPackageFolder * pNewParent ) void SAL_CALL ZipPackageEntry::setParent( const uno::Reference< XInterface >& xNewParent ) { - sal_Int64 nTest(0); + if ( !xNewParent.is() ) + throw NoSupportException(THROW_WHERE ); uno::Reference < XUnoTunnel > xTunnel ( xNewParent, UNO_QUERY ); - if ( !xNewParent.is() || ( nTest = xTunnel->getSomething ( ZipPackageFolder::getUnoTunnelId () ) ) == 0 ) + sal_Int64 nTest = xTunnel->getSomething ( ZipPackageFolder::getUnoTunnelId () ); + if ( nTest == 0 ) throw NoSupportException(THROW_WHERE ); ZipPackageFolder *pNewParent = reinterpret_cast < ZipPackageFolder * > ( nTest ); |