From 065edb4c8e91170017df482843d0c3eb8d4db114 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Tue, 6 Nov 2018 10:12:29 +0300 Subject: tdf#120703 PVS: V547 Expression is always true/false Change-Id: I0b3c407331bfa1fa0c5003250d327d4f26de3643 Reviewed-on: https://gerrit.libreoffice.org/63235 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- vcl/source/edit/texteng.cxx | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'vcl/source/edit') diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx index fd38f2413c57..a8fe3486be61 100644 --- a/vcl/source/edit/texteng.cxx +++ b/vcl/source/edit/texteng.cxx @@ -2000,25 +2000,21 @@ void TextEngine::ImpPaint( OutputDevice* pOutDev, const Point& rStartPos, tools: break; case PORTIONKIND_TAB: // for HideSelection() only Range, pSelection = 0. - if ( pSelStart ) + if ( pSelStart ) // also implies pSelEnd { const tools::Rectangle aTabArea( aTmpPos, Point( aTmpPos.X()+nTxtWidth, aTmpPos.Y()+mnCharHeight-1 ) ); - bool bDone = false; - if ( pSelStart ) + // is the Tab in the Selection??? + const TextPaM aTextStart(nPara, nIndex); + const TextPaM aTextEnd(nPara, nIndex + 1); + if ((aTextStart < *pSelEnd) && (aTextEnd > *pSelStart)) { - // is the Tab in the Selection??? - const TextPaM aTextStart( nPara, nIndex ); - const TextPaM aTextEnd( nPara, nIndex+1 ); - if ( ( aTextStart < *pSelEnd ) && ( aTextEnd > *pSelStart ) ) - { - const Color aOldColor = pOutDev->GetFillColor(); - pOutDev->SetFillColor( rStyleSettings.GetHighlightColor() ); - pOutDev->DrawRect( aTabArea ); - pOutDev->SetFillColor( aOldColor ); - bDone = true; - } + const Color aOldColor = pOutDev->GetFillColor(); + pOutDev->SetFillColor( + rStyleSettings.GetHighlightColor()); + pOutDev->DrawRect(aTabArea); + pOutDev->SetFillColor(aOldColor); } - if ( !bDone ) + else { pOutDev->Erase( aTabArea ); } -- cgit