[Libreoffice-commits] core.git: cui/source desktop/source sfx2/source svx/source sw/source vcl/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Nov 26 05:31:22 UTC 2018


 cui/source/options/optlingu.cxx        |   57 ++++++++++++++++-----------------
 desktop/source/migration/migration.cxx |    3 +
 sfx2/source/doc/Metadatable.cxx        |    2 -
 sfx2/source/doc/objmisc.cxx            |    3 +
 sfx2/source/doc/objxtor.cxx            |    2 -
 svx/source/form/navigatortree.cxx      |    2 -
 sw/source/core/docnode/node.cxx        |    2 -
 sw/source/core/layout/paintfrm.cxx     |    2 -
 sw/source/ui/misc/outline.cxx          |    2 -
 sw/source/uibase/lingu/olmenu.cxx      |    4 +-
 vcl/source/window/menu.cxx             |    2 -
 11 files changed, 41 insertions(+), 40 deletions(-)

New commits:
commit 761546e088dcccf3aa66c3f5c4853f110b93770f
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Mon Nov 26 00:07:33 2018 +0300
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Mon Nov 26 06:30:58 2018 +0100

    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 at collabora.com>

diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx
index abf4a4b3b5a4..20ead90689cb 100644
--- a/cui/source/options/optlingu.cxx
+++ b/cui/source/options/optlingu.cxx
@@ -613,40 +613,40 @@ static void lcl_MergeDisplayArray(
 
     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 @@ void SvxLinguData_Impl::SetChecked(const Sequence<OUString>& rConfiguredServices
     {
         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 @@ void SvxLinguData_Impl::Reconfigure( const OUString &rDisplayName, bool bEnable
     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 ce32432e2dcf..4bec38e38bda 100644
--- a/desktop/source/migration/migration.cxx
+++ b/desktop/source/migration/migration.cxx
@@ -339,7 +339,8 @@ static void insertSorted(migrations_available& rAvailableMigrations, supported_m
 {
     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 65b386640845..d25b16cf7261 100644
--- a/sfx2/source/doc/Metadatable.cxx
+++ b/sfx2/source/doc/Metadatable.cxx
@@ -1385,7 +1385,7 @@ Metadatable::RegisterAsCopyOf(Metadatable const & i_rSource,
                 // 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 4e1ae9b99327..62027f98cec8 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -755,12 +755,13 @@ OUString SfxObjectShell::GetTitle( sal_uInt16  nMaxLength ) const
         // 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 8c0e1643a0fc..0a7325fd79e5 100644
--- a/sfx2/source/doc/objxtor.cxx
+++ b/sfx2/source/doc/objxtor.cxx
@@ -343,7 +343,7 @@ SfxObjectShell::~SfxObjectShell()
         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 c3f0aad652ce..f6aee2a8adc9 100644
--- a/svx/source/form/navigatortree.cxx
+++ b/svx/source/form/navigatortree.cxx
@@ -713,7 +713,7 @@ namespace svxform
         {   // 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 19cafd55a313..5fe4e056c442 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -1868,7 +1868,7 @@ bool SwContentNode::IsAnyCondition( SwCollCondition& rTmp ) const
                         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 04bce461ed05..1adf941b8e46 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -2278,7 +2278,7 @@ SwLineEntry::OverlapType SwLineEntry::Overlaps( const SwLineEntry& rNew )  const
         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 112d35de150d..424b4c22b381 100644
--- a/sw/source/ui/misc/outline.cxx
+++ b/sw/source/ui/misc/outline.cxx
@@ -93,7 +93,7 @@ void SwNumNamesDlg::SetUserNames(const OUString *pList[])
         {
             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 7295008727bb..56f56cbe5a03 100644
--- a/sw/source/uibase/lingu/olmenu.cxx
+++ b/sw/source/uibase/lingu/olmenu.cxx
@@ -637,8 +637,8 @@ void SwSpellPopup::Execute( sal_uInt16 nId )
     {
         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 b9833ae4a503..45532cd448a8 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -629,7 +629,7 @@ sal_uInt16 Menu::ImplGetPrevVisible( sal_uInt16 nPos ) const
 {
     for ( size_t n = nPos; n; )
     {
-        if ( n && ImplIsVisible( --n ) )
+        if (ImplIsVisible(--n))
             return n;
     }
     return ITEMPOS_INVALID;


More information about the Libreoffice-commits mailing list