tdf#120703 PVS: V560 A part of conditional expression is always true/false
Change-Id: I1ac4c52ea51503373644bc58dcd4395c69f1a675
Reviewed-on: https://gerrit.libreoffice.org/64007
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx
index abf4a4b..20ead90 100644
--- a/cui/source/options/optlingu.cxx
+++ b/cui/source/options/optlingu.cxx
@@ -613,40 +613,40 @@
for (sal_uLong i = 0; i < nEntries; ++i)
{
ServiceInfo_Impl* pEntry = &rSvcInfoArr[i];
if (pEntry && pEntry->sDisplayName == rToAdd.sDisplayName)
ServiceInfo_Impl& rEntry = rSvcInfoArr[i];
if (rEntry.sDisplayName == rToAdd.sDisplayName)
{
if(rToAdd.xSpell.is())
{
DBG_ASSERT( !pEntry->xSpell.is() &&
pEntry->sSpellImplName.isEmpty(),
DBG_ASSERT( !rEntry.xSpell.is() &&
rEntry.sSpellImplName.isEmpty(),
"merge conflict" );
pEntry->sSpellImplName = rToAdd.sSpellImplName;
pEntry->xSpell = rToAdd.xSpell;
rEntry.sSpellImplName = rToAdd.sSpellImplName;
rEntry.xSpell = rToAdd.xSpell;
}
if(rToAdd.xGrammar.is())
{
DBG_ASSERT( !pEntry->xGrammar.is() &&
pEntry->sGrammarImplName.isEmpty(),
DBG_ASSERT( !rEntry.xGrammar.is() &&
rEntry.sGrammarImplName.isEmpty(),
"merge conflict" );
pEntry->sGrammarImplName = rToAdd.sGrammarImplName;
pEntry->xGrammar = rToAdd.xGrammar;
rEntry.sGrammarImplName = rToAdd.sGrammarImplName;
rEntry.xGrammar = rToAdd.xGrammar;
}
if(rToAdd.xHyph.is())
{
DBG_ASSERT( !pEntry->xHyph.is() &&
pEntry->sHyphImplName.isEmpty(),
DBG_ASSERT( !rEntry.xHyph.is() &&
rEntry.sHyphImplName.isEmpty(),
"merge conflict" );
pEntry->sHyphImplName = rToAdd.sHyphImplName;
pEntry->xHyph = rToAdd.xHyph;
rEntry.sHyphImplName = rToAdd.sHyphImplName;
rEntry.xHyph = rToAdd.xHyph;
}
if(rToAdd.xThes.is())
{
DBG_ASSERT( !pEntry->xThes.is() &&
pEntry->sThesImplName.isEmpty(),
DBG_ASSERT( !rEntry.xThes.is() &&
rEntry.sThesImplName.isEmpty(),
"merge conflict" );
pEntry->sThesImplName = rToAdd.sThesImplName;
pEntry->xThes = rToAdd.xThes;
rEntry.sThesImplName = rToAdd.sThesImplName;
rEntry.xThes = rToAdd.xThes;
}
return ;
}
@@ -797,17 +797,17 @@
{
for (sal_uLong i = 0; i < nDisplayServices; ++i)
{
ServiceInfo_Impl* pEntry = &aDisplayServiceArr[i];
if (pEntry && !pEntry->bConfigured)
ServiceInfo_Impl& rEntry = aDisplayServiceArr[i];
if (!rEntry.bConfigured)
{
const OUString &rSrvcImplName = pConfiguredServices[n];
if (!rSrvcImplName.isEmpty() &&
(pEntry->sSpellImplName == rSrvcImplName ||
pEntry->sGrammarImplName == rSrvcImplName ||
pEntry->sHyphImplName == rSrvcImplName ||
pEntry->sThesImplName == rSrvcImplName))
(rEntry.sSpellImplName == rSrvcImplName ||
rEntry.sGrammarImplName == rSrvcImplName ||
rEntry.sHyphImplName == rSrvcImplName ||
rEntry.sThesImplName == rSrvcImplName))
{
pEntry->bConfigured = true;
rEntry.bConfigured = true;
break;
}
}
@@ -848,13 +848,12 @@
DBG_ASSERT( !rDisplayName.isEmpty(), "empty DisplayName" );
ServiceInfo_Impl *pInfo = nullptr;
ServiceInfo_Impl *pTmp = nullptr;
for (sal_uLong i = 0; i < nDisplayServices; ++i)
{
pTmp = &aDisplayServiceArr[i];
if (pTmp && pTmp->sDisplayName == rDisplayName)
ServiceInfo_Impl& rTmp = aDisplayServiceArr[i];
if (rTmp.sDisplayName == rDisplayName)
{
pInfo = pTmp;
pInfo = &rTmp;
break;
}
}
diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx
index ce32432..4bec38e3 100644
--- a/desktop/source/migration/migration.cxx
+++ b/desktop/source/migration/migration.cxx
@@ -339,7 +339,8 @@
{
bool bInserted( false );
migrations_available::iterator pIter = rAvailableMigrations.begin();
while ( !bInserted && pIter != rAvailableMigrations.end()) {
while (pIter != rAvailableMigrations.end())
{
if ( pIter->nPriority < aSupportedMigration.nPriority ) {
rAvailableMigrations.insert(pIter, aSupportedMigration );
bInserted = true;
diff --git a/sfx2/source/doc/Metadatable.cxx b/sfx2/source/doc/Metadatable.cxx
index 65b3866..d25b16c 100644
--- a/sfx2/source/doc/Metadatable.cxx
+++ b/sfx2/source/doc/Metadatable.cxx
@@ -1385,7 +1385,7 @@
// may happen if src got its id via UNO call
if (!pLink) return;
// only register copy if clipboard content is from this SwDoc!
if (pLink && (&GetRegistryConst(*pLink) == pRegDoc))
if (&GetRegistryConst(*pLink) == pRegDoc)
{
// this is a copy _from_ the clipboard; check if the
// element is still in the same stream
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index 4e1ae9b..62027f9 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -755,12 +755,13 @@
// Document called "Untitled" for the time being
return aNoName;
}
assert(pMed);
const INetURLObject aURL( IsDocShared() ? GetSharedFileURL() : GetMedium()->GetName() );
if ( nMaxLength > SFX_TITLE_CAPTION && nMaxLength <= SFX_TITLE_HISTORY )
{
sal_uInt16 nRemote;
if( !pMed || aURL.GetProtocol() == INetProtocol::File )
if (aURL.GetProtocol() == INetProtocol::File)
nRemote = 0;
else
nRemote = 1;
diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx
index 8c0e164..0a7325f 100644
--- a/sfx2/source/doc/objxtor.cxx
+++ b/sfx2/source/doc/objxtor.cxx
@@ -343,7 +343,7 @@
pMedium->CloseAndReleaseStreams_Impl();
#if HAVE_FEATURE_MULTIUSER_ENVIRONMENT
if ( IsDocShared() && pMedium )
if (IsDocShared())
FreeSharedFile( pMedium->GetURLObject().GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
#endif
DELETEZ( pMedium );
diff --git a/svx/source/form/navigatortree.cxx b/svx/source/form/navigatortree.cxx
index c3f0aad..f6aee2a8 100644
--- a/svx/source/form/navigatortree.cxx
+++ b/svx/source/form/navigatortree.cxx
@@ -713,7 +713,7 @@
{ // bHasHiddenControlsFormat means that only hidden controls are part of the data
// hidden controls can be copied to a form only
if ( !_pTargetEntry || ( _pTargetEntry == m_pRootEntry ) || !IsFormEntry( _pTargetEntry ) )
if ((_pTargetEntry == m_pRootEntry) || !IsFormEntry(_pTargetEntry))
return DND_ACTION_NONE;
return bSelfSource ? ( DND_ACTION_COPYMOVE & _nAction ) : DND_ACTION_COPY;
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index 19cafd5..5fe4e05 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -1868,7 +1868,7 @@
const SwTableNode* pTableNd = pSttNd->FindTableNode();
const SwTableBox* pBox;
if( pTableNd && nullptr != ( pBox = pTableNd->GetTable().
GetTableBox( pSttNd->GetIndex() ) ) && pBox &&
GetTableBox(pSttNd->GetIndex()) ) &&
pBox->IsInHeadline( &pTableNd->GetTable() ) )
nCond = Master_CollCondition::PARA_IN_TABLEHEAD;
}
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 04bce461..1adf941 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -2278,7 +2278,7 @@
eRet = OVERLAP1;
// 4, 5, 6, 7
else if ( mnStartPos <= rNew.mnStartPos && mnEndPos >= rNew.mnEndPos )
else if (mnStartPos <= rNew.mnStartPos)
eRet = OVERLAP2;
// 8, 9
diff --git a/sw/source/ui/misc/outline.cxx b/sw/source/ui/misc/outline.cxx
index 112d35d..424b4c2 100644
--- a/sw/source/ui/misc/outline.cxx
+++ b/sw/source/ui/misc/outline.cxx
@@ -93,7 +93,7 @@
{
m_xFormBox->remove(i);
m_xFormBox->insert_text(i, *pList[i]);
if (i == nSelect && nSelect < SwChapterNumRules::nMaxRules)
if (i == nSelect)
nSelect++;
}
}
diff --git a/sw/source/uibase/lingu/olmenu.cxx b/sw/source/uibase/lingu/olmenu.cxx
index 7295008..56f56cb 100644
--- a/sw/source/uibase/lingu/olmenu.cxx
+++ b/sw/source/uibase/lingu/olmenu.cxx
@@ -637,8 +637,8 @@
{
sal_Int32 nAltIdx = (MN_SUGGESTION_START <= nId && nId <= MN_SUGGESTION_END) ?
nId - MN_SUGGESTION_START : nId - MN_AUTOCORR_START;
OSL_ENSURE( 0 <= nAltIdx && nAltIdx < m_aSuggestions.getLength(), "index out of range" );
if (0 <= nAltIdx && nAltIdx < m_aSuggestions.getLength() && (m_bGrammarResults || m_xSpellAlt.is()))
OSL_ENSURE(nAltIdx < m_aSuggestions.getLength(), "index out of range");
if (nAltIdx < m_aSuggestions.getLength() && (m_bGrammarResults || m_xSpellAlt.is()))
{
bool bOldIns = m_pSh->IsInsMode();
m_pSh->SetInsMode();
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index b9833ae..45532cd 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -629,7 +629,7 @@
{
for ( size_t n = nPos; n; )
{
if ( n && ImplIsVisible( --n ) )
if (ImplIsVisible(--n))
return n;
}
return ITEMPOS_INVALID;