diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-15 09:02:32 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-15 14:01:15 +0200 |
commit | 52528a42892dbe7da7aad3bcf52971e02ec55999 (patch) | |
tree | a2b879cd3ba368d72335a7954659f766d7e9e2f8 /editeng/source | |
parent | ae3342857350c805f536c1af2f560a117be12da8 (diff) |
loplugin:buriedassign in e*
Change-Id: Ibbf5b576296bb73e7066f2426bf2fa28739bb761
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92238
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'editeng/source')
-rw-r--r-- | editeng/source/editeng/editdoc.cxx | 5 | ||||
-rw-r--r-- | editeng/source/editeng/eehtml.cxx | 5 | ||||
-rw-r--r-- | editeng/source/items/numitem.cxx | 19 | ||||
-rw-r--r-- | editeng/source/misc/svxacorr.cxx | 30 | ||||
-rw-r--r-- | editeng/source/rtf/svxrtf.cxx | 5 |
5 files changed, 42 insertions, 22 deletions
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index 6fa39bbddaf4..ebc55808da25 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -665,7 +665,10 @@ sal_Int32 FastGetPos(const Array& rArray, const Val* p, sal_Int32& rLastPos) // The world's lamest linear search from svarray... for (sal_Int32 nIdx = 0; nIdx < nArrayLen; ++nIdx) if (rArray.at(nIdx).get() == p) - return rLastPos = nIdx; + { + rLastPos = nIdx; + return rLastPos; + } // XXX "not found" condition for sal_Int32 indexes return EE_PARA_NOT_FOUND; diff --git a/editeng/source/editeng/eehtml.cxx b/editeng/source/editeng/eehtml.cxx index ff84bfe4a260..ce5721787ef3 100644 --- a/editeng/source/editeng/eehtml.cxx +++ b/editeng/source/editeng/eehtml.cxx @@ -669,8 +669,11 @@ void EditHTMLParser::SkipGroup( HtmlTokenId nEndToken ) // for example: <td><form></td> lacks a closing </form> sal_uInt8 nCellLevel = nInCell; HtmlTokenId nToken; - while( nCellLevel <= nInCell && ( (nToken = GetNextToken() ) != nEndToken ) && nToken != HtmlTokenId::NONE ) + while( nCellLevel <= nInCell ) { + nToken = GetNextToken(); + if (nToken == nEndToken || nToken == HtmlTokenId::NONE) + break; switch ( nToken ) { case HtmlTokenId::TABLEHEADER_ON: diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx index ca26e800f9f0..7f76e830ff25 100644 --- a/editeng/source/items/numitem.cxx +++ b/editeng/source/items/numitem.cxx @@ -894,16 +894,17 @@ void SvxNumRule::UnLinkGraphics() const SvxBrushItem* pBrush = aFmt.GetBrush(); if(SVX_NUM_BITMAP == aFmt.GetNumberingType()) { - const Graphic* pGraphic = nullptr; - if(pBrush && - !pBrush->GetGraphicLink().isEmpty() && - nullptr != (pGraphic = pBrush->GetGraphic())) + if(pBrush && !pBrush->GetGraphicLink().isEmpty()) { - SvxBrushItem aTempItem(*pBrush); - aTempItem.SetGraphicLink(""); - aTempItem.SetGraphic(*pGraphic); - sal_Int16 eOrient = aFmt.GetVertOrient(); - aFmt.SetGraphicBrush( &aTempItem, &aFmt.GetGraphicSize(), &eOrient ); + const Graphic* pGraphic = pBrush->GetGraphic(); + if (pGraphic) + { + SvxBrushItem aTempItem(*pBrush); + aTempItem.SetGraphicLink(""); + aTempItem.SetGraphic(*pGraphic); + sal_Int16 eOrient = aFmt.GetVertOrient(); + aFmt.SetGraphicBrush( &aTempItem, &aFmt.GetGraphicSize(), &eOrient ); + } } } else if((SVX_NUM_BITMAP|LINK_TOKEN) == static_cast<int>(aFmt.GetNumberingType())) diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index 4ea7eb901a97..4fcdb4d37b8d 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -661,8 +661,12 @@ bool SvxAutoCorrect::FnAddNonBrkSpace( // Get the last word delimiter position sal_Int32 nSttWdPos = nEndPos; bool bWasWordDelim = false; - while( nSttWdPos && !(bWasWordDelim = IsWordDelim( rTxt[ --nSttWdPos ]))) - ; + while( nSttWdPos ) + { + bWasWordDelim = IsWordDelim( rTxt[ --nSttWdPos ]); + if (bWasWordDelim) + break; + } //See if the text is the start of a protocol string, e.g. have text of //"http" see if it is the start of "http:" and if so leave it alone @@ -898,8 +902,12 @@ void SvxAutoCorrect::FnCapitalStartSentence( SvxAutoCorrDoc& rDoc, { if (NonFieldWordDelim(*pStr)) { - while (!(bAtStart = (pStart == pStr--)) && NonFieldWordDelim(*pStr)) - ; + for (;;) + { + bAtStart = (pStart == pStr--); + if (bAtStart || !NonFieldWordDelim(*pStr)) + break; + } } // Asian full stop, full width full stop, full width exclamation mark // and full width question marks are treated as word delimiters @@ -1881,11 +1889,11 @@ static bool lcl_FindAbbreviation(const SvStringsISortDtor* pList, const OUString { OUString sLowerWord(sWord.toAsciiLowerCase()); OUString sAbr; - for( SvStringsISortDtor::size_type n = nPos; - n < pList->size() && - '~' == ( sAbr = (*pList)[ n ])[ 0 ]; - ++n ) + for( SvStringsISortDtor::size_type n = nPos; n < pList->size(); ++n ) { + sAbr = (*pList)[ n ]; + if (sAbr[0] != '~') + break; // ~ and ~. are not allowed! if( 2 < sAbr.getLength() && sAbr.getLength() - 1 <= sWord.getLength() ) { @@ -2001,8 +2009,10 @@ bool SvxAutoCorrectLanguageLists::IsFileChanged_Imp() tools::Time nMinTime( 0, 2 ); tools::Time nAktTime( tools::Time::SYSTEM ); - if( aLastCheckTime > nAktTime || // overflow? - ( nAktTime -= aLastCheckTime ) > nMinTime ) // min time past + if( aLastCheckTime <= nAktTime) // overflow? + return false; + nAktTime -= aLastCheckTime; + if( nAktTime > nMinTime ) // min time past { Date aTstDate( Date::EMPTY ); tools::Time aTstTime( tools::Time::EMPTY ); if( FStatHelper::GetModifiedDateTimeOfFile( sShareAutoCorrFile, diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx index b766f4acc304..a5c1217ff3e7 100644 --- a/editeng/source/rtf/svxrtf.cxx +++ b/editeng/source/rtf/svxrtf.cxx @@ -398,8 +398,11 @@ void SvxRTFParser::ReadColorTable() int nToken; sal_uInt8 nRed = 0xff, nGreen = 0xff, nBlue = 0xff; - while( '}' != ( nToken = GetNextToken() ) && IsParserWorking() ) + for (;;) { + nToken = GetNextToken(); + if ( '}' == nToken || !IsParserWorking() ) + break; switch( nToken ) { case RTF_RED: nRed = sal_uInt8(nTokenValue); break; |