[Libreoffice-commits] core.git: vcl/source

Stephan Bergmann sbergman at redhat.com
Thu Sep 3 03:31:01 PDT 2015


 vcl/source/edit/texteng.cxx |    9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

New commits:
commit 187017ee35386018ac4bf249d30c863dd839df07
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Sep 3 12:28:01 2015 +0200

    clang-tidy clang-analyzer-deadcode.DeadStores
    
    ...given that setting bCalcPortion to false is always followed by a break out of
    the while loop ever since the code's inception in
    8ab086b6cc054501bfbf7ef6fa509c393691e860 "initial import," bCalcPortion is
    apparently always true when read
    
    Change-Id: I83ba29a78512360500a0c9c8c1baf1ccbad87951

diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx
index abacae2..bc9bc3f 100644
--- a/vcl/source/edit/texteng.cxx
+++ b/vcl/source/edit/texteng.cxx
@@ -2210,8 +2210,6 @@ bool TextEngine::CreateLines( sal_uInt32 nPara )
 
     vcl::Font aFont;
 
-    bool bCalcPortion = true;
-
     while ( nIndex < pNode->GetText().getLength() )
     {
         bool bEOL = false;
@@ -2255,8 +2253,7 @@ bool TextEngine::CreateLines( sal_uInt32 nPara )
             else
             {
 
-                if ( bCalcPortion || !pPortion->HasValidSize() )
-                    pPortion->GetWidth() = CalcTextWidth( nPara, nTmpPos, pPortion->GetLen() );
+                pPortion->GetWidth() = CalcTextWidth( nPara, nTmpPos, pPortion->GetLen() );
                 nTmpWidth += pPortion->GetWidth();
 
                 pPortion->SetRightToLeft( ImpGetRightToLeft( nPara, nTmpPos+1 ) );
@@ -2361,9 +2358,8 @@ bool TextEngine::CreateLines( sal_uInt32 nPara )
                             ( ( nEnd-nInvalidDiff ) == aSaveLine.GetEnd() ) )
                     {
                         pLine->SetValid();
-                        if ( bCalcPortion && bQuickFormat )
+                        if ( bQuickFormat )
                         {
-                            bCalcPortion = false;
                             pTEParaPortion->CorrectValuesBehindLastFormattedLine( nLine );
                             break;
                         }
@@ -2376,7 +2372,6 @@ bool TextEngine::CreateLines( sal_uInt32 nPara )
                     // the text width does not have to be recalculated.
                     if ( nEnd == ( aSaveLine.GetEnd() + nInvalidDiff ) )
                     {
-                        bCalcPortion = false;
                         pTEParaPortion->CorrectValuesBehindLastFormattedLine( nLine );
                         break;
                     }


More information about the Libreoffice-commits mailing list