tdf#120703 PVS: V560 A part of conditional expression is always true/false
Change-Id: I60bb778a88dd5619efd4858eb74d56d28616c777
Reviewed-on: https://gerrit.libreoffice.org/63520
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
diff --git a/basctl/source/dlged/dlgedfunc.cxx b/basctl/source/dlged/dlgedfunc.cxx
index 665bd7c..78fe1ef 100644
--- a/basctl/source/dlged/dlgedfunc.cxx
+++ b/basctl/source/dlged/dlgedfunc.cxx
@@ -256,43 +256,39 @@
}
}
}
else
else if (nX || nY)
{
// move the handle
if ( pHdl && ( nX || nY ) )
Point aStartPoint(pHdl->GetPos());
Point aEndPoint(pHdl->GetPos() + Point(nX, nY));
const SdrDragStat& rDragStat = rView.GetDragStat();
// start dragging
rView.BegDragObj(aStartPoint, nullptr, pHdl, 0);
if (rView.IsDragObj())
{
Point aStartPoint( pHdl->GetPos() );
Point aEndPoint( pHdl->GetPos() + Point( nX, nY ) );
const SdrDragStat& rDragStat = rView.GetDragStat();
bool const bWasNoSnap = rDragStat.IsNoSnap();
bool const bWasSnapEnabled = rView.IsSnapEnabled();
// start dragging
rView.BegDragObj( aStartPoint, nullptr, pHdl, 0 );
// switch snapping off
if (!bWasNoSnap)
const_cast<SdrDragStat&>(rDragStat).SetNoSnap();
if (bWasSnapEnabled)
rView.SetSnapEnabled(false);
if ( rView.IsDragObj() )
{
bool const bWasNoSnap = rDragStat.IsNoSnap();
bool const bWasSnapEnabled = rView.IsSnapEnabled();
rView.MovAction(aEndPoint);
rView.EndDragObj();
// switch snapping off
if ( !bWasNoSnap )
const_cast<SdrDragStat&>(rDragStat).SetNoSnap();
if ( bWasSnapEnabled )
rView.SetSnapEnabled(false);
rView.MovAction( aEndPoint );
rView.EndDragObj();
// restore snap
if ( !bWasNoSnap )
const_cast<SdrDragStat&>(rDragStat).SetNoSnap( bWasNoSnap );
if ( bWasSnapEnabled )
rView.SetSnapEnabled( bWasSnapEnabled );
}
// make moved handle visible
tools::Rectangle aVisRect( aEndPoint - Point( 100, 100 ), Size( 200, 200 ) );
rView.MakeVisible( aVisRect, rWindow );
// restore snap
if (!bWasNoSnap)
const_cast<SdrDragStat&>(rDragStat).SetNoSnap(bWasNoSnap);
if (bWasSnapEnabled)
rView.SetSnapEnabled(bWasSnapEnabled);
}
// make moved handle visible
tools::Rectangle aVisRect(aEndPoint - Point(100, 100), Size(200, 200));
rView.MakeVisible(aVisRect, rWindow);
}
}
else
diff --git a/embedserv/source/inprocserv/dllentry.cxx b/embedserv/source/inprocserv/dllentry.cxx
index 963342c..5c8c4f6 100644
--- a/embedserv/source/inprocserv/dllentry.cxx
+++ b/embedserv/source/inprocserv/dllentry.cxx
@@ -52,7 +52,7 @@
char nSign = ( nValue / ( 1 << ( ( nLen - nInd - 1 ) * 4 ) ) ) % 16;
if ( nSign >= 0 && nSign <= 9 )
pBuf[nInd] = nSign + L'0';
else if ( nSign >= 10 && nSign <= 15 )
else if (nSign >= 10)
pBuf[nInd] = nSign - 10 + L'a';
nInd++;
diff --git a/framework/source/uielement/controlmenucontroller.cxx b/framework/source/uielement/controlmenucontroller.cxx
index 9685ac3..bcb8803 100644
--- a/framework/source/uielement/controlmenucontroller.cxx
+++ b/framework/source/uielement/controlmenucontroller.cxx
@@ -292,9 +292,8 @@
// Check if some modes have changed so we have to update our menu images
const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();
bool bShowMenuImages = rSettings.GetUseImagesInMenus();
bool bUpdateImages = (bShowMenuImages != m_bShowMenuImages);
if ( bUpdateImages )
if (bShowMenuImages != m_bShowMenuImages)
{
m_bShowMenuImages = bShowMenuImages;
@@ -302,7 +301,7 @@
if ( pPopupMenu )
{
PopupMenu* pVCLPopupMenu = static_cast<PopupMenu *>(pPopupMenu->GetMenu());
if ( pVCLPopupMenu && bUpdateImages )
if (pVCLPopupMenu)
updateImagesPopupMenu( pVCLPopupMenu );
}
}
diff --git a/sc/source/core/tool/charthelper.cxx b/sc/source/core/tool/charthelper.cxx
index 9b36ea8..b7ca024 100644
--- a/sc/source/core/tool/charthelper.cxx
+++ b/sc/source/core/tool/charthelper.cxx
@@ -415,7 +415,7 @@
}
}
if ( pModelObj && pModelObj->HasChangesListeners() )
if (pModelObj->HasChangesListeners())
{
tools::Rectangle aRectangle = pSdrOle2Obj->GetSnapRect();
ScRange aRange( pDoc->GetRange( nTab, aRectangle ) );
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index ad52515..2a0f21f 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -1862,13 +1862,12 @@
ScDocAttrIterator aTestIter( &rDoc, i, nMergeTestStartCol, nMergeTestStartRow, nMergeTestEndCol, nMergeTestEndRow );
ScRange aExtendRange( nMergeTestStartCol, nMergeTestStartRow, i, nMergeTestEndCol, nMergeTestEndRow, i );
const ScPatternAttr* pPattern = nullptr;
const ScMergeFlagAttr* pMergeFlagAttr = nullptr;
while ( ( pPattern = aTestIter.GetNext( nTestCol, nTestRow1, nTestRow2 ) ) != nullptr )
{
const ScMergeAttr* pMergeFlag = &pPattern->GetItem(ATTR_MERGE);
pMergeFlagAttr = &pPattern->GetItem(ATTR_MERGE_FLAG);
ScMF nNewFlags = pMergeFlagAttr->GetValue() & ( ScMF::Hor | ScMF::Ver );
if( ( pMergeFlag && pMergeFlag->IsMerged() ) || nNewFlags == ScMF::Hor || nNewFlags == ScMF::Ver )
const ScMergeAttr& rMergeFlag = pPattern->GetItem(ATTR_MERGE);
const ScMergeFlagAttr& rMergeFlagAttr = pPattern->GetItem(ATTR_MERGE_FLAG);
ScMF nNewFlags = rMergeFlagAttr.GetValue() & (ScMF::Hor | ScMF::Ver);
if (rMergeFlag.IsMerged() || nNewFlags == ScMF::Hor || nNewFlags == ScMF::Ver)
{
ScRange aRange( nTestCol, nTestRow1, i );
rDoc.ExtendOverlapped(aRange);
@@ -2338,13 +2337,12 @@
ScDocAttrIterator aTestIter( &rDoc, i, nUndoStartCol, nUndoStartRow, nMergeTestEndCol, nMergeTestEndRow );
ScRange aExtendRange( nUndoStartCol, nUndoStartRow, i, nMergeTestEndCol, nMergeTestEndRow, i );
const ScPatternAttr* pPattern = nullptr;
const ScMergeFlagAttr* pMergeFlagAttr = nullptr;
while ( ( pPattern = aTestIter.GetNext( nTestCol, nTestRow1, nTestRow2 ) ) != nullptr )
{
const ScMergeAttr* pMergeFlag = &pPattern->GetItem( ATTR_MERGE );
pMergeFlagAttr = &pPattern->GetItem( ATTR_MERGE_FLAG );
ScMF nNewFlags = pMergeFlagAttr->GetValue() & ( ScMF::Hor | ScMF::Ver );
if( ( pMergeFlag && pMergeFlag->IsMerged() ) || nNewFlags == ScMF::Hor || nNewFlags == ScMF::Ver )
const ScMergeAttr& rMergeFlag = pPattern->GetItem(ATTR_MERGE);
const ScMergeFlagAttr& rMergeFlagAttr = pPattern->GetItem(ATTR_MERGE_FLAG);
ScMF nNewFlags = rMergeFlagAttr.GetValue() & (ScMF::Hor | ScMF::Ver);
if (rMergeFlag.IsMerged() || nNewFlags == ScMF::Hor || nNewFlags == ScMF::Ver)
{
ScRange aRange( nTestCol, nTestRow1, i );
rDoc.ExtendOverlapped( aRange );
diff --git a/sd/source/ui/sidebar/DocumentHelper.cxx b/sd/source/ui/sidebar/DocumentHelper.cxx
index f48065c..9392d5f 100644
--- a/sd/source/ui/sidebar/DocumentHelper.cxx
+++ b/sd/source/ui/sidebar/DocumentHelper.cxx
@@ -95,8 +95,7 @@
for (sal_uInt16 nMaster=0; nMaster<nMasterPageCount; nMaster++)
{
SdPage* pCandidate = rTargetDocument.GetMasterSdPage (nMaster, PageKind::Standard);
if (pMasterPage!=nullptr
&& pCandidate->GetName() == pMasterPage->GetName())
if (pCandidate->GetName() == pMasterPage->GetName())
{
bPageExists = true;
pNewMasterPage = pCandidate;
diff --git a/sfx2/source/view/classificationhelper.cxx b/sfx2/source/view/classificationhelper.cxx
index 9d83d33..049f800 100644
--- a/sfx2/source/view/classificationhelper.cxx
+++ b/sfx2/source/view/classificationhelper.cxx
@@ -490,14 +490,12 @@
SfxClassificationCheckPasteResult SfxClassificationHelper::CheckPaste(const uno::Reference<document::XDocumentProperties>& xSource,
const uno::Reference<document::XDocumentProperties>& xDestination)
{
bool bSourceClassified = SfxClassificationHelper::IsClassified(xSource);
if (!bSourceClassified)
if (!SfxClassificationHelper::IsClassified(xSource))
// No classification on the source side. Return early, regardless the
// state of the destination side.
return SfxClassificationCheckPasteResult::None;
bool bDestinationClassified = SfxClassificationHelper::IsClassified(xDestination);
if (bSourceClassified && !bDestinationClassified)
if (!SfxClassificationHelper::IsClassified(xDestination))
{
// Paste from a classified document to a non-classified one -> deny.
return SfxClassificationCheckPasteResult::TargetDocNotClassified;
diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx
index 112ce7e..a5625a1 100644
--- a/svtools/source/control/ctrlbox.cxx
+++ b/svtools/source/control/ctrlbox.cxx
@@ -155,14 +155,14 @@
double nWidth1 = lcl_getGuessedWidth( nLine1, m_nRate1, bLine1Change );
if ( bLine1Change )
aToCompare.push_back( nWidth1 );
else if ( !bLine1Change && nWidth1 < 0 )
else if (nWidth1 < 0)
bInvalid = true;
bool bLine2Change = bool( m_nFlags & BorderWidthImplFlags::CHANGE_LINE2 );
double nWidth2 = lcl_getGuessedWidth( nLine2, m_nRate2, bLine2Change );
if ( bLine2Change )
aToCompare.push_back( nWidth2 );
else if ( !bLine2Change && nWidth2 < 0 )
else if (nWidth2 < 0)
bInvalid = true;
bool bGapChange = bool( m_nFlags & BorderWidthImplFlags::CHANGE_DIST );
diff --git a/svx/source/accessibility/ChildrenManagerImpl.cxx b/svx/source/accessibility/ChildrenManagerImpl.cxx
index 74a956b..ce77aed 100644
--- a/svx/source/accessibility/ChildrenManagerImpl.cxx
+++ b/svx/source/accessibility/ChildrenManagerImpl.cxx
@@ -783,12 +783,12 @@
for (sal_Int32 index=0;index<count;index++)
{
AccessibleShape* pAccShape = maVisibleChildren[index].GetAccessibleShape();
if (pAccShape && ::accessibility::ShapeTypeHandler::Instance().GetTypeId (pAccShape->GetXShape()) == DRAWING_CONTROL)
{
::accessibility::AccessibleControlShape *pCtlAccShape = static_cast < ::accessibility::AccessibleControlShape* >(pAccShape);
if (pCtlAccShape && pCtlAccShape->GetControlModel() == pSet)
if (pAccShape && ::accessibility::ShapeTypeHandler::Instance().GetTypeId(pAccShape->GetXShape()) == DRAWING_CONTROL)
{
auto* pCtlAccShape = static_cast<::accessibility::AccessibleControlShape*>(pAccShape);
if (pCtlAccShape->GetControlModel() == pSet)
return pCtlAccShape;
}
}
}
return nullptr;
}
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index d02eca6..84e6ab9 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -1714,7 +1714,7 @@
m_pVisibleCursor->Show(); // show again
}
m_eMvState = MV_NONE; // state for cursor travelling - GetCursorOfst
if( pTableFrame && Imp()->IsAccessible() )
if (Imp()->IsAccessible())
Imp()->InvalidateAccessibleCursorPosition( pTableFrame );
return;
}
@@ -1957,6 +1957,8 @@
} while( eFlags & SwCursorShell::SCROLLWIN );
assert(pFrame);
if( m_pBlockCursor )
RefreshBlockCursor();
@@ -1984,7 +1986,7 @@
m_eMvState = MV_NONE; // state for cursor travelling - GetCursorOfst
if( pFrame && Imp()->IsAccessible() )
if (Imp()->IsAccessible())
Imp()->InvalidateAccessibleCursorPosition( pFrame );
// switch from blinking cursor to read-only-text-selection cursor
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index 7b14d31..9a899ba 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -1314,8 +1314,7 @@
{
if( !aTmpState.m_bPosCorr )
{
if ( !bRet
&& IsAttrAtPos::SmartTag & rContentAtPos.eContentAtPos
if ( IsAttrAtPos::SmartTag & rContentAtPos.eContentAtPos
&& !aTmpState.m_bFootnoteNoInfo )
{
const SwWrongList* pSmartTagList = pTextNd->GetSmartTags();
@@ -1427,7 +1426,8 @@
{
IDocumentMarkAccess* pMarksAccess = GetDoc()->getIDocumentMarkAccess( );
sw::mark::IFieldmark* pFieldBookmark = pMarksAccess->getFieldmarkFor( aPos );
if( bCursorFoundExact && pTextNd && pFieldBookmark) {
if (bCursorFoundExact && pFieldBookmark)
{
rContentAtPos.eContentAtPos = IsAttrAtPos::FormControl;
rContentAtPos.aFnd.pFieldmark = pFieldBookmark;
bRet=true;
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 72e0c5f..2dd37a5 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -446,7 +446,7 @@
bRet = false;
break;
}
} while ( pTextNd && pTextNd != pEndTextNd );
} while (pTextNd != pEndTextNd);
}
return bRet;
diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx b/sw/source/core/doc/DocumentFieldsManager.cxx
index 15b89a5..25beaac 100644
--- a/sw/source/core/doc/DocumentFieldsManager.cxx
+++ b/sw/source/core/doc/DocumentFieldsManager.cxx
@@ -1442,7 +1442,7 @@
SwIterator<SwFormatField,SwFieldType> aIter( *pFieldType );
for( SwFormatField* pFormatField = aIter.First(); pFormatField; pFormatField = aIter.Next() )
{
if( pFormatField && pFormatField->GetTextField() )
if (pFormatField->GetTextField())
{
bool bChgd = false;
switch( aType )
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index a323b59..f9fe20b 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -1453,7 +1453,7 @@
if( pCSttNd )
{
SwTextFormatColl* pColl = (pCSttNd && pCSttNd->IsTextNode() )
SwTextFormatColl* pColl = pCSttNd->IsTextNode()
? pCSttNd->GetTextNode()->GetTextColl()
: pDoc->getIDocumentStylePoolAccess().GetTextCollFromPool(RES_POOLCOLL_STANDARD);
diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx
index 3559a50..b91e5a9 100644
--- a/sw/source/uibase/app/docsh.cxx
+++ b/sw/source/uibase/app/docsh.cxx
@@ -1402,12 +1402,11 @@
bool bRes = false;
const SfxAllItemSet aSet( GetPool() );
const SfxItemSet* pArgs = &aSet;
const SfxPoolItem* pItem = nullptr;
IDocumentRedlineAccess& rIDRA = m_pWrtShell->getIDocumentRedlineAccess();
const Sequence< sal_Int8 >& aPasswdHash( rIDRA.GetRedlinePassword() );
if (pArgs && SfxItemState::SET == pArgs->GetItemState( FN_REDLINE_PROTECT, false, &pItem )
if (SfxItemState::SET == aSet.GetItemState(FN_REDLINE_PROTECT, false, &pItem)
&& static_cast<const SfxBoolItem*>(pItem)->GetValue() == (aPasswdHash.getLength() != 0))
return false;
rPasswordHash = aPasswdHash;
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index b426ad3..d91f5ae 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -148,7 +148,7 @@
pChild = pParent->GetWindow(GetWindowType::Next);
}
if (pChild && isContainerWindow(*pChild))
if (isContainerWindow(*pChild))
pChild = nextLogicalChildOfParent(pTopLevel, pChild);
return const_cast<vcl::Window *>(pChild);
@@ -176,7 +176,7 @@
pChild = pParent->GetWindow(GetWindowType::Prev);
}
if (pChild && isContainerWindow(*pChild))
if (isContainerWindow(*pChild))
pChild = prevLogicalChildOfParent(pTopLevel, pChild);
return const_cast<vcl::Window *>(pChild);