tdf#120703 PVS: V560 A part of conditional expression is always true/false
Change-Id: Ia9c496ec93bedb13764969bf21c3f21d84caacef
Reviewed-on: https://gerrit.libreoffice.org/64413
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
diff --git a/basic/source/sbx/sbxform.cxx b/basic/source/sbx/sbxform.cxx
index 45a88b5..ce394fa 100644
--- a/basic/source/sbx/sbxform.cxx
+++ b/basic/source/sbx/sbxform.cxx
@@ -647,7 +647,7 @@
// Remark: in Visual-Basic the first 0 turns on the 0 for
// all the following # (up to the decimal point),
// this behaviour is simulated here with the flag.
if( bGenerateThousandSeparator && ( c=='0' || nMaxDigit >= nDigitPos ) && nDigitPos > 0 && (nDigitPos % 3 == 0) )
if (bGenerateThousandSeparator && c == '0' && nDigitPos > 0 && (nDigitPos % 3 == 0))
{
sReturnStrg.append(cThousandSep);
}
diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx
index b47c872..9a42963 100644
--- a/dbaccess/source/ui/querydesign/querycontroller.cxx
+++ b/dbaccess/source/ui/querydesign/querycontroller.cxx
@@ -1200,7 +1200,7 @@
if(bNew)
{
OUString aDefaultName;
if ( ( _bSaveAs && !bNew ) || ( bNew && !m_sName.isEmpty() ) )
if (!m_sName.isEmpty())
aDefaultName = m_sName;
else
{
diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx
index 6475a93..5fdbd63 100644
--- a/sd/source/core/sdpage.cxx
+++ b/sd/source/core/sdpage.cxx
@@ -2902,8 +2902,7 @@
// OutlinerParaObjects needs to be changed. The
// AutoGrowWidth/Height items still exist in the
// not changed object.
if(pTextObj
&& pTextObj->GetOutlinerParaObject()
if(pTextObj->GetOutlinerParaObject()
&& pTextObj->GetOutlinerParaObject()->IsVertical() != bVertical)
{
::tools::Rectangle aObjectRect = pTextObj->GetSnapRect();
diff --git a/sd/source/core/sdpage2.cxx b/sd/source/core/sdpage2.cxx
index 93d56c5..0744eca 100644
--- a/sd/source/core/sdpage2.cxx
+++ b/sd/source/core/sdpage2.cxx
@@ -480,15 +480,13 @@
{
SdrObjListIter aShapeIter( this, SdrIterMode::DeepWithGroups );
SdrObject* pShape;
for( pShape = aShapeIter.Next(); pShape; pShape = aShapeIter.Next() )
for (SdrObject* pShape = aShapeIter.Next(); pShape; pShape = aShapeIter.Next())
{
if( pShape && pShape->IsEmptyPresObj() )
if (pShape->IsEmptyPresObj())
{
RemoveObject( pShape->GetOrdNum() );
SdrObject::Free( pShape );
}
}
}
diff --git a/sd/source/ui/app/sdmod2.cxx b/sd/source/ui/app/sdmod2.cxx
index 979b46c..04aa365 100644
--- a/sd/source/ui/app/sdmod2.cxx
+++ b/sd/source/ui/app/sdmod2.cxx
@@ -135,7 +135,7 @@
if(pPage)
{
bMasterView = pPage && pPage->IsMasterPage();
bMasterView = pPage->IsMasterPage();
}
}
diff --git a/sd/source/ui/app/sdxfer.cxx b/sd/source/ui/app/sdxfer.cxx
index 14543f4..2c87360 100644
--- a/sd/source/ui/app/sdxfer.cxx
+++ b/sd/source/ui/app/sdxfer.cxx
@@ -177,7 +177,7 @@
{
SdrUnoObj* pUnoCtrl = static_cast< SdrUnoObj* >( pObj );
if (pUnoCtrl && SdrInventor::FmForm == pUnoCtrl->GetObjInventor())
if (SdrInventor::FmForm == pUnoCtrl->GetObjInventor())
{
const Reference< css::awt::XControlModel >& xControlModel( pUnoCtrl->GetUnoControlModel() );
diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx
index caee8ab..5938c80 100644
--- a/sd/source/ui/view/sdview.cxx
+++ b/sd/source/ui/view/sdview.cxx
@@ -1254,7 +1254,7 @@
continue;
pOutliner->SetText(*(pText->GetOutlinerParaObject()));
sal_Int16 nStatus = pOutliner->GetBulletsNumberingStatus();
bToggleOn = (bNormalBullet && nStatus != 0) || (!bNormalBullet && nStatus != 1) || bToggleOn;
bToggleOn = (bNormalBullet && nStatus != 0) || (!bNormalBullet && nStatus != 1);
pOutliner->Clear();
}
}
@@ -1266,7 +1266,7 @@
continue;
pOutliner->SetText(*pParaObj);
sal_Int16 nStatus = pOutliner->GetBulletsNumberingStatus();
bToggleOn = (bNormalBullet && nStatus != 0) || (!bNormalBullet && nStatus != 1) || bToggleOn;
bToggleOn = (bNormalBullet && nStatus != 0) || (!bNormalBullet && nStatus != 1);
pOutliner->Clear();
}
}
diff --git a/sd/source/ui/view/sdview2.cxx b/sd/source/ui/view/sdview2.cxx
index 13526f2..cf5fc2c 100644
--- a/sd/source/ui/view/sdview2.cxx
+++ b/sd/source/ui/view/sdview2.cxx
@@ -282,7 +282,7 @@
if( pObj && pPage && pPage->GetPresObjKind(pObj) == PRESOBJ_TITLE )
{
// remove all hard linebreaks from the title
if( pOutliner && pOutliner->GetParagraphCount() > 1 )
if (pOutliner->GetParagraphCount() > 1)
{
bool bOldUpdateMode = pOutliner->GetUpdateMode();
@@ -305,7 +305,7 @@
if( !mrDoc.IsChanged() )
{
if( pOutliner && pOutliner->IsModified() )
if (pOutliner->IsModified())
mrDoc.SetChanged();
}
}
@@ -502,7 +502,8 @@
bool bXFillExchange = rTargetHelper.IsDropFormatSupported( SotClipboardFormatId::XFA );
// check handle insert
if( !nRet && ( (bXFillExchange && ( SdrDragMode::Gradient == GetDragMode() )) || ( SdrDragMode::Transparence == GetDragMode() ) ) )
if ((bXFillExchange && (SdrDragMode::Gradient == GetDragMode()))
|| (SdrDragMode::Transparence == GetDragMode()))
{
const SdrHdlList& rHdlList = GetHdlList();
@@ -654,7 +655,9 @@
aPos = pTargetWindow->PixelToLogic( rEvt.maPosPixel );
// handle insert?
if( (!nRet && ( SdrDragMode::Gradient == GetDragMode() )) || (( SdrDragMode::Transparence == GetDragMode() ) && aDataHelper.HasFormat( SotClipboardFormatId::XFA )) )
if ((SdrDragMode::Gradient == GetDragMode())
|| ((SdrDragMode::Transparence == GetDragMode())
&& aDataHelper.HasFormat(SotClipboardFormatId::XFA)))
{
const SdrHdlList& rHdlList = GetHdlList();
diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx
index 80ae308..bf05282 100644
--- a/sw/source/core/docnode/section.cxx
+++ b/sw/source/core/docnode/section.cxx
@@ -595,10 +595,9 @@
const ::sfx2::SvBaseLinks& rLnks = rSectNd.GetDoc()->getIDocumentLinksAdministration().GetLinkManager().GetLinks();
for( auto n = rLnks.size(); n; )
{
::sfx2::SvBaseLink* pBLnk = &(*rLnks[ --n ]);
if( pBLnk && !pBLnk->IsVisible() &&
dynamic_cast< const SwBaseLink *>( pBLnk ) != nullptr &&
nullptr != ( pNd = static_cast<SwBaseLink*>(pBLnk)->GetAnchor() ) )
sfx2::SvBaseLink& rBLnk = *rLnks[--n];
if (!rBLnk.IsVisible() && dynamic_cast<const SwBaseLink*>(&rBLnk) != nullptr
&& nullptr != (pNd = static_cast<SwBaseLink&>(rBLnk).GetAnchor()))
{
pNd = pNd->StartOfSectionNode(); // If it's a SectionNode
const SwSectionNode* pParent;
@@ -609,7 +608,7 @@
// It's within a normal Section, so show again
if( !pParent )
pBLnk->SetVisible( true );
rBLnk.SetVisible(true);
}
}
}
@@ -1134,7 +1133,7 @@
SwBaseLink* pBLink;
::sfx2::SvBaseLink* pLnk = &(*rLnks[ --n ]);
if( pLnk && pLnk != &rUpdLnk &&
if( pLnk != &rUpdLnk &&
OBJECT_CLIENT_FILE == pLnk->GetObjType() &&
dynamic_cast< const SwBaseLink *>( pLnk ) != nullptr &&
( pBLink = static_cast<SwBaseLink*>(pLnk) )->IsInRange( rSectNd.GetIndex(),
diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx
index 093d84d..0596f50 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -613,8 +613,8 @@
}
bGoingUp = !( bGoingFwdOrBwd || bGoingDown );
if( !bFwd && bGoingDown && p )
assert(p);
if (!bFwd && bGoingDown)
while ( p->GetNext() )
p = p->GetNext();
@@ -2184,7 +2184,7 @@
if( nGrow <= 0 )
{
nGrow = 0;
if( nDist && !bTst )
if (!bTst)
{
if( bInCalcContent )
InvalidateSize_();
diff --git a/sw/source/uibase/wrtsh/select.cxx b/sw/source/uibase/wrtsh/select.cxx
index 3f4c254..6459ef5 100644
--- a/sw/source/uibase/wrtsh/select.cxx
+++ b/sw/source/uibase/wrtsh/select.cxx
@@ -880,7 +880,7 @@
int cWord = NO_WORD;
// is a word selected?
if(!cWord && cPrev && cNext &&
if (cPrev && cNext &&
CH_TXTATR_BREAKWORD != cPrev && CH_TXTATR_INWORD != cPrev &&
CH_TXTATR_BREAKWORD != cNext && CH_TXTATR_INWORD != cNext &&
!rCC.isLetterNumeric( ( sText = OUString(cPrev) ), 0 ) &&
diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index 9262c2b..e9225e8 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -1070,7 +1070,7 @@
{
k = Int16FromMOTA(subHeader2Keys[theHighByte]) / 8;
// check if the subheader record fits into available space
if((k >= 0) && (reinterpret_cast<sal_uInt8 const *>(&subHeader2s[k]) - cmap >= int(nMaxCmapSize - sizeof(subHeader2))))
if(reinterpret_cast<sal_uInt8 const *>(&subHeader2s[k]) - cmap >= int(nMaxCmapSize - sizeof(subHeader2)))
k = -1;
}
diff --git a/vcl/win/gdi/salnativewidgets-luna.cxx b/vcl/win/gdi/salnativewidgets-luna.cxx
index 00c5c4c..bda55c4 100644
--- a/vcl/win/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/gdi/salnativewidgets-luna.cxx
@@ -871,15 +871,15 @@
OSL_ASSERT( aValue.getType() == ControlType::TabItem );
const TabitemValue *pValue = static_cast<const TabitemValue*>(&aValue);
if( pValue->isBothAligned() )
const TabitemValue& rValue = static_cast<const TabitemValue&>(aValue);
if (rValue.isBothAligned())
{
iPart = TABP_TABITEMLEFTEDGE;
rc.right--;
}
else if( pValue->isLeftAligned() )
else if (rValue.isLeftAligned())
iPart = TABP_TABITEMLEFTEDGE;
else if( pValue->isRightAligned() )
else if (rValue.isRightAligned())
iPart = TABP_TABITEMRIGHTEDGE;
else iPart = TABP_TABITEM;
@@ -890,11 +890,11 @@
iState = TILES_SELECTED;
// increase the selected tab
rc.left-=2;
if( pValue && !pValue->isBothAligned() )
if (rValue.isBothAligned())
{
if( pValue->isLeftAligned() || pValue->isNotAligned() )
if (rValue.isLeftAligned() || rValue.isNotAligned())
rc.right+=2;
if( pValue->isRightAligned() )
if (rValue.isRightAligned())
rc.right+=1;
}
rc.top-=2;
@@ -1498,18 +1498,18 @@
if( rControlValue.getType() == ControlType::TabItem )
{
const TabitemValue *pValue = static_cast<const TabitemValue*>(&rControlValue);
if ( pValue->isBothAligned() )
const TabitemValue& rValue = static_cast<const TabitemValue&>(rControlValue);
if (rValue.isBothAligned())
aControlRect.AdjustRight(-1);
if ( nState & ControlState::SELECTED )
{
aControlRect.AdjustLeft(-2);
if ( pValue && !pValue->isBothAligned() )
if (!rValue.isBothAligned())
{
if ( pValue->isLeftAligned() || pValue->isNotAligned() )
if (rValue.isLeftAligned() || rValue.isNotAligned())
aControlRect.AdjustRight(2);
if ( pValue->isRightAligned() )
if (rValue.isRightAligned())
aControlRect.AdjustRight(1);
}
aControlRect.AdjustTop(-2);
diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index c3e2d29..50f9940a 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -2339,12 +2339,12 @@
{
nSysCode = VK_F1 + (nCode - KEY_F1);
aFBuf[0] = 'F';
if ( (nCode >= KEY_F1) && (nCode <= KEY_F9) )
if (nCode <= KEY_F9)
{
aFBuf[1] = sal::static_int_cast<sal_Char>('1' + (nCode - KEY_F1));
aFBuf[2] = 0;
}
else if ( (nCode >= KEY_F10) && (nCode <= KEY_F19) )
else if (nCode <= KEY_F19)
{
aFBuf[1] = '1';
aFBuf[2] = sal::static_int_cast<sal_Char>('0' + (nCode - KEY_F10));
@@ -3600,7 +3600,6 @@
{
SalKeyEvent aKeyEvt;
SalEvent nEvent;
bool bKeyUp = (nMsg == WM_KEYUP) || (nMsg == WM_SYSKEYUP);
// convert KeyCode
aKeyEvt.mnCode = ImplSalGetKeyCode( wParam );
@@ -3608,7 +3607,7 @@
if ( aKeyEvt.mnCode )
{
if ( bKeyUp )
if (nMsg == WM_KEYUP)
nEvent = SalEvent::KeyUp;
else
nEvent = SalEvent::KeyInput;
@@ -4080,7 +4079,7 @@
if ( pFrame && pFrame->mpLocalGraphics && pFrame->mpLocalGraphics->getHDC() )
{
WinSalGraphics* pGraphics = pFrame->mpLocalGraphics;
if ( pGraphics && pGraphics->getDefPal() )
if (pGraphics->getDefPal())
{
SelectPalette( pGraphics->getHDC(), hPal, FALSE );
if ( RealizePalette( pGraphics->getHDC() ) )