editeng/source/editeng/editdoc.cxx |    5 ++++-
 editeng/source/editeng/eehtml.cxx  |    5 ++++-
 editeng/source/items/numitem.cxx   |   19 ++++++++++---------
 editeng/source/misc/svxacorr.cxx   |   30 ++++++++++++++++++++----------
 editeng/source/rtf/svxrtf.cxx      |    5 ++++-
 extensions/source/scanner/sane.cxx |   12 ++++++++----
 6 files changed, 50 insertions(+), 26 deletions(-)

New commits:
commit 52528a42892dbe7da7aad3bcf52971e02ec55999
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Wed Apr 15 09:02:32 2020 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Wed Apr 15 14:01:15 2020 +0200

    loplugin:buriedassign in e*
    
    Change-Id: Ibbf5b576296bb73e7066f2426bf2fa28739bb761
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92238
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

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;
diff --git a/extensions/source/scanner/sane.cxx 
b/extensions/source/scanner/sane.cxx
index 0127db4a0926..9030e5697a09 100644
--- a/extensions/source/scanner/sane.cxx
+++ b/extensions/source/scanner/sane.cxx
@@ -546,24 +546,28 @@ bool Sane::Start( BitmapTransporter& rBitmap )
     int nHeightMM   = 0;
     double fTLx, fTLy, fResl = 0.0;
     int nOption;
-    if( ( nOption = GetOptionByName( "tl-x" ) ) != -1   &&
+    nOption = GetOptionByName( "tl-x" );
+    if( nOption != -1   &&
         GetOptionValue( nOption, fTLx )              &&
         GetOptionUnit( nOption ) == SANE_UNIT_MM )
     {
         double fBRx;
-        if( ( nOption = GetOptionByName( "br-x" ) ) != -1   &&
+        nOption = GetOptionByName( "br-x" );
+        if( nOption != -1   &&
             GetOptionValue( nOption, fBRx )              &&
             GetOptionUnit( nOption ) == SANE_UNIT_MM )
         {
             nWidthMM = static_cast<int>(fabs(fBRx - fTLx));
         }
     }
-    if( ( nOption = GetOptionByName( "tl-y" ) ) != -1   &&
+    nOption = GetOptionByName( "tl-y" );
+    if( nOption != -1   &&
         GetOptionValue( nOption, fTLy )              &&
         GetOptionUnit( nOption ) == SANE_UNIT_MM )
     {
         double fBRy;
-        if( ( nOption = GetOptionByName( "br-y" ) ) != -1   &&
+        nOption = GetOptionByName( "br-y" );
+        if( nOption != -1   &&
             GetOptionValue( nOption, fBRy )              &&
             GetOptionUnit( nOption ) == SANE_UNIT_MM )
         {
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to