[Libreoffice-commits] core.git: sal/textenc sc/source sfx2/source sw/source ucb/source unoxml/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sun Oct 28 06:56:24 UTC 2018


 sal/textenc/convertisciidevangari.cxx                |    8 ++----
 sc/source/core/data/dociter.cxx                      |    8 ------
 sc/source/ui/Accessibility/AccessibleCell.cxx        |   17 ++++++--------
 sc/source/ui/Accessibility/AccessibleDocument.cxx    |   12 ++--------
 sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx |    5 ----
 sc/source/ui/app/client.cxx                          |    6 -----
 sc/source/ui/docshell/dbdocfun.cxx                   |   11 +++------
 sc/source/ui/docshell/dbdocimp.cxx                   |    2 -
 sc/source/ui/docshell/docsh.cxx                      |   14 +++---------
 sc/source/ui/drawfunc/drtxtob.cxx                    |   14 +++---------
 sc/source/ui/view/cellsh1.cxx                        |   22 ++++++-------------
 sc/source/ui/view/cellsh2.cxx                        |   16 +++----------
 sfx2/source/dialog/dinfdlg.cxx                       |    8 +-----
 sfx2/source/doc/docfile.cxx                          |    4 +--
 sw/source/uibase/app/docsh.cxx                       |   15 +++---------
 sw/source/uibase/app/docsh2.cxx                      |    2 -
 sw/source/uibase/dbui/dbmgr.cxx                      |    9 ++-----
 sw/source/uibase/docvw/edtwin.cxx                    |    2 -
 sw/source/uibase/frmdlg/colex.cxx                    |    6 +----
 ucb/source/cacher/cachedcontentresultset.cxx         |    4 +--
 unoxml/source/dom/attr.cxx                           |    7 +-----
 21 files changed, 58 insertions(+), 134 deletions(-)

New commits:
commit 5f0ddb2d2068a4388a7df12cd0e11f628b91e4c0
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Sun Oct 28 00:13:29 2018 +0300
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Sun Oct 28 07:55:59 2018 +0100

    tdf#120703 PVS: V547 Expression is always true/false
    
    Change-Id: Ic92cc594979cac2edac04a085957398672a5dfcc
    Reviewed-on: https://gerrit.libreoffice.org/62450
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/sal/textenc/convertisciidevangari.cxx b/sal/textenc/convertisciidevangari.cxx
index 852b8c65a3ce..16c453fb8487 100644
--- a/sal/textenc/convertisciidevangari.cxx
+++ b/sal/textenc/convertisciidevangari.cxx
@@ -194,11 +194,9 @@ sal_Size IsciiDevanagariToUnicode::convert(
                 continue;
             if (eAction == BAD_INPUT_STOP)
                 break;
-            if (eAction == BAD_INPUT_NO_OUTPUT)
-            {
-                nInfo |= RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL;
-                break;
-            }
+            assert(eAction == BAD_INPUT_NO_OUTPUT);
+            nInfo |= RTL_TEXTTOUNICODE_INFO_DESTBUFFERTOOSMALL;
+            break;
         }
         ++nConverted;
         if (bDouble)
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index db418e330154..3ceaf83c8048 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -1739,14 +1739,6 @@ bool ScQueryCellIterator::BinarySearch()
     {
         size_t nMid = (nLo+nHi)/2;
         size_t i = nMid;
-        if (i > nHi)
-        {
-            if (nMid > 0)
-                nHi = nMid - 1;
-            else
-                bDone = true;
-            continue; // while
-        }
 
         aCellData = aIndexer.getCell(i);
         aCell = aCellData.first;
diff --git a/sc/source/ui/Accessibility/AccessibleCell.cxx b/sc/source/ui/Accessibility/AccessibleCell.cxx
index d07a2a07f3fb..0c414eaf1beb 100644
--- a/sc/source/ui/Accessibility/AccessibleCell.cxx
+++ b/sc/source/ui/Accessibility/AccessibleCell.cxx
@@ -445,24 +445,21 @@ void ScAccessibleCell::AddRelation(const ScRange& rRange,
     uno::Reference < XAccessibleTable > xTable ( getAccessibleParent()->getAccessibleContext(), uno::UNO_QUERY );
     if (xTable.is())
     {
-        sal_uInt32 nCount(static_cast<sal_uInt32>(rRange.aEnd.Col() -
+        const sal_uInt32 nCount(static_cast<sal_uInt32>(rRange.aEnd.Col() -
                     rRange.aStart.Col() + 1) * (rRange.aEnd.Row() -
                     rRange.aStart.Row() + 1));
         uno::Sequence < uno::Reference < uno::XInterface > > aTargetSet( nCount );
         uno::Reference < uno::XInterface >* pTargetSet = aTargetSet.getArray();
-        if (pTargetSet)
+        sal_uInt32 nPos(0);
+        for (sal_uInt32 nRow = rRange.aStart.Row(); nRow <= sal::static_int_cast<sal_uInt32>(rRange.aEnd.Row()); ++nRow)
         {
-            sal_uInt32 nPos(0);
-            for (sal_uInt32 nRow = rRange.aStart.Row(); nRow <= sal::static_int_cast<sal_uInt32>(rRange.aEnd.Row()); ++nRow)
+            for (sal_uInt32 nCol = rRange.aStart.Col(); nCol <= sal::static_int_cast<sal_uInt32>(rRange.aEnd.Col()); ++nCol)
             {
-                for (sal_uInt32 nCol = rRange.aStart.Col(); nCol <= sal::static_int_cast<sal_uInt32>(rRange.aEnd.Col()); ++nCol)
-                {
-                    pTargetSet[nPos] = xTable->getAccessibleCellAt(nRow, nCol);
-                    ++nPos;
-                }
+                pTargetSet[nPos] = xTable->getAccessibleCellAt(nRow, nCol);
+                ++nPos;
             }
-            OSL_ENSURE(nCount == nPos, "something wents wrong");
         }
+        OSL_ENSURE(nCount == nPos, "something wents wrong");
         AccessibleRelation aRelation;
         aRelation.RelationType = aRelationType;
         aRelation.TargetSet = aTargetSet;
diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx
index 6966e9ac9428..fc59f7a4acc8 100644
--- a/sc/source/ui/Accessibility/AccessibleDocument.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx
@@ -1860,17 +1860,13 @@ void SAL_CALL
         if (xAccessible.is())
         {
             bool bWasTableSelected(IsTableSelected());
-
-            if (mpChildrenShapes)
-                mpChildrenShapes->Select(nChildIndex); // throws no lang::IndexOutOfBoundsException if Index is too high
-
+            mpChildrenShapes->Select(nChildIndex); // throws no lang::IndexOutOfBoundsException if Index is too high
             if (bWasTableSelected)
                 mpViewShell->SelectAll();
         }
         else
         {
-            if (mpViewShell)
-                mpViewShell->SelectAll();
+            mpViewShell->SelectAll();
         }
     }
 }
@@ -1998,9 +1994,7 @@ void SAL_CALL
         uno::Reference < XAccessible > xAccessible = mpChildrenShapes->Get(nChildIndex);
         if (xAccessible.is())
         {
-            if (mpChildrenShapes)
-                mpChildrenShapes->Deselect(nChildIndex); // throws no lang::IndexOutOfBoundsException if Index is too high
-
+            mpChildrenShapes->Deselect(nChildIndex); // throws no lang::IndexOutOfBoundsException if Index is too high
             if (bTabMarked)
                 mpViewShell->SelectAll(); // select the table again
         }
diff --git a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
index faff13dda9f7..d69114e07517 100644
--- a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
+++ b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
@@ -444,10 +444,7 @@ void ScAccessibleSpreadsheet::Notify( SfxBroadcaster& rBC, const SfxHint& rHint
                 {
                     OSL_ENSURE(!((nX > 0) && (nY > 0)), "should not be possible to add row and column at the same time");
                     nId = AccessibleTableModelChangeType::INSERT;
-                    if (nX < 0)
-                        nY = aRange.aEnd.Row() - aRange.aStart.Row();
-                    else
-                        nX = aRange.aEnd.Col() - aRange.aStart.Col();
+                    nX = aRange.aEnd.Col() - aRange.aStart.Col();
                 }
                 else
                 {
diff --git a/sc/source/ui/app/client.cxx b/sc/source/ui/app/client.cxx
index 06b13352aeba..316e31bf875f 100644
--- a/sc/source/ui/app/client.cxx
+++ b/sc/source/ui/app/client.cxx
@@ -171,11 +171,7 @@ void ScClient::ObjectAreaChanged()
         pDrawObj->setSuppressSetVisAreaSize(false);
 
         //  set document modified (SdrModel::SetChanged is not used)
-        // TODO/LATER: is there a reason that this code is not executed in Draw?
-//        SfxViewShell* pSfxViewSh = GetViewShell();
-//        ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>( pSfxViewSh  );
-        if (pViewSh)
-            pViewSh->GetViewData().GetDocShell()->SetDrawModified();
+        pViewSh->GetViewData().GetDocShell()->SetDrawModified();
     }
 
     if (pDrawObj)
diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx
index b2270a2bd80c..622d54755641 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -1242,14 +1242,11 @@ bool ScDBDocFunc::DataPilotUpdate( ScDPObject* pOldObj, const ScDPObject* pNewOb
         return CreatePivotTable(*pNewObj, bRecord, bApi);
     }
 
-    if (pOldObj)
-    {
-        if (!pNewObj)
-            return RemovePivotTable(*pOldObj, bRecord, bApi);
+    if (!pNewObj)
+        return RemovePivotTable(*pOldObj, bRecord, bApi);
 
-        if (pOldObj == pNewObj)
-            return UpdatePivotTable(*pOldObj, bRecord, bApi);
-    }
+    if (pOldObj == pNewObj)
+        return UpdatePivotTable(*pOldObj, bRecord, bApi);
 
     OSL_ASSERT(pOldObj && pNewObj && pOldObj != pNewObj);
 
diff --git a/sc/source/ui/docshell/dbdocimp.cxx b/sc/source/ui/docshell/dbdocimp.cxx
index a83b0c376ab5..3cae1be94c0b 100644
--- a/sc/source/ui/docshell/dbdocimp.cxx
+++ b/sc/source/ui/docshell/dbdocimp.cxx
@@ -580,7 +580,7 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
                                     nEndCol+nFormulaCols, nEndRow, nTab,
                                     InsertDeleteFlags::ALL & ~InsertDeleteFlags::NOTE, false, *pRedoDoc);
 
-            std::unique_ptr<ScDBData> pRedoDBData(pDBData ? new ScDBData( *pDBData ) : nullptr);
+            std::unique_ptr<ScDBData> pRedoDBData(new ScDBData(*pDBData));
 
             rDocShell.GetUndoManager()->AddUndoAction(
                 o3tl::make_unique<ScUndoImportData>( &rDocShell, nTab,
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 2968ea7f53c0..0a2a3525e11e 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -779,7 +779,7 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
                             bool bChecked = aWarningBox.get_active();
                             if (bChecked)
                             {
-                                aAppOptions.SetShowSharedDocumentWarning( !bChecked );
+                                aAppOptions.SetShowSharedDocumentWarning(false);
                                 SC_MOD()->SetAppOptions( aAppOptions );
                             }
                         }
@@ -1772,17 +1772,11 @@ bool ScDocShell::Save()
 
     PrepareSaveGuard aPrepareGuard( *this);
 
-    SfxViewFrame* pFrame1 = SfxViewFrame::GetFirst( this );
-    if (pFrame1)
+    if (const auto pFrame1 = SfxViewFrame::GetFirst(this))
     {
-        vcl::Window* pWindow = &pFrame1->GetWindow();
-        if ( pWindow )
+        if (auto pSysWin = pFrame1->GetWindow().GetSystemWindow())
         {
-            vcl::Window* pSysWin = pWindow->GetSystemWindow();
-            if ( pSysWin )
-            {
-                pSysWin->SetAccessibleName(OUString());
-            }
+            pSysWin->SetAccessibleName(OUString());
         }
     }
     //  wait cursor is handled with progress bar
diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx
index 385fbbee115e..1bbfe5144d1a 100644
--- a/sc/source/ui/drawfunc/drtxtob.cxx
+++ b/sc/source/ui/drawfunc/drtxtob.cxx
@@ -313,18 +313,12 @@ void ScDrawTextObjectBar::Execute( SfxRequest &rReq )
             break;
 
         case SID_OPEN_HYPERLINK:
+            if (const SvxFieldItem* pFieldItem = pOutView->GetFieldAtSelection())
             {
-                if ( pOutView )
+                const SvxFieldData* pField = pFieldItem->GetField();
+                if (const SvxURLField* pURLField = dynamic_cast<const SvxURLField*>(pField))
                 {
-                    const SvxFieldItem* pFieldItem = pOutView->GetFieldAtSelection();
-                    if ( pFieldItem )
-                    {
-                        const SvxFieldData* pField = pFieldItem->GetField();
-                        if (const SvxURLField* pURLField = dynamic_cast<const SvxURLField*>(pField))
-                        {
-                            ScGlobal::OpenURL( pURLField->GetURL(), pURLField->GetTargetFrame() );
-                        }
-                    }
+                    ScGlobal::OpenURL(pURLField->GetURL(), pURLField->GetTargetFrame());
                 }
             }
             break;
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 432469836a38..c57d3e75ac98 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -1523,7 +1523,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
 
                     if ( bRet )
                     {
-                        rReq.SetReturnValue(SfxInt16Item(nSlot, bRet ? 1 : 0)); // 1 = success, 0 = fail
+                        rReq.SetReturnValue(SfxInt16Item(nSlot, 1)); // 1 = success, 0 = fail
                         rReq.Done();
                     }
                     else
@@ -2482,20 +2482,12 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
 
                 if ( pReqArgs )
                 {
-                    const SfxStringItem* pItem =
-                        static_cast<const SfxStringItem*>(&pReqArgs->Get( SID_SELECT_SCENARIO ));
-
-                    if( pItem )
-                    {
-                        pTabViewShell->UseScenario( pItem->GetValue() );
-                        //! why should the return value be valid?!?!
-                        rReq.SetReturnValue( SfxStringItem( SID_SELECT_SCENARIO, pItem->GetValue() ) );
-                        rReq.Done();
-                    }
-                    else
-                    {
-                        OSL_FAIL("nullptr");
-                    }
+                    const SfxStringItem& rItem
+                        = static_cast<const SfxStringItem&>(pReqArgs->Get(SID_SELECT_SCENARIO));
+                    pTabViewShell->UseScenario(rItem.GetValue());
+                    //! why should the return value be valid?!?!
+                    rReq.SetReturnValue(SfxStringItem(SID_SELECT_SCENARIO, rItem.GetValue()));
+                    rReq.Done();
                 }
             }
             break;
diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx
index 390e396b43c4..41343911fe3f 100644
--- a/sc/source/ui/view/cellsh2.cxx
+++ b/sc/source/ui/view/cellsh2.cxx
@@ -713,18 +713,10 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
             {
                 if ( pReqArgs )
                 {
-                    const SfxStringItem* pItem =
-                        static_cast<const SfxStringItem*>(&pReqArgs->Get( SID_SELECT_DB ));
-
-                    if( pItem )
-                    {
-                        pTabViewShell->GotoDBArea( pItem->GetValue() );
-                        rReq.Done();
-                    }
-                    else
-                    {
-                        OSL_FAIL("NULL");
-                    }
+                    const SfxStringItem& rItem
+                        = static_cast<const SfxStringItem&>(pReqArgs->Get(SID_SELECT_DB));
+                    pTabViewShell->GotoDBArea(rItem.GetValue());
+                    rReq.Done();
                 }
                 else
                 {
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index c68ba3876925..1a503ca264f3 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -2132,7 +2132,6 @@ IMPL_LINK_NOARG(SfxCustomPropertiesPage, AddHdl, Button*, void)
 
 bool SfxCustomPropertiesPage::FillItemSet( SfxItemSet* rSet )
 {
-    bool bModified = false;
     const SfxPoolItem* pItem = nullptr;
     SfxDocumentInfoItem* pInfo = nullptr;
     bool bMustDelete = false;
@@ -2168,16 +2167,13 @@ bool SfxCustomPropertiesPage::FillItemSet( SfxItemSet* rSet )
         }
     }
 
-    bModified = true; //!!!
-
     if (pInfo)
     {
-        if ( bModified )
-            rSet->Put( *pInfo );
+        rSet->Put(*pInfo);
         if ( bMustDelete )
             delete pInfo;
     }
-    return bModified;
+    return true;
 }
 
 void SfxCustomPropertiesPage::Reset( const SfxItemSet* rItemSet )
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index ab0645207379..9e5fc078c635 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -1543,10 +1543,10 @@ uno::Reference < embed::XStorage > SfxMedium::GetStorage( bool bCreateTempIfNo )
             // The versions are numbered starting with 1, versions with
             // negative versions numbers are counted backwards from the
             // current version
-            short nVersion = pVersion ? pVersion->GetValue() : 0;
+            short nVersion = pVersion->GetValue();
             if ( nVersion<0 )
                 nVersion = static_cast<short>(pImpl->aVersions.getLength()) + nVersion;
-            else if ( nVersion )
+            else // nVersion > 0; pVersion->GetValue() != 0 was the condition to this block
                 nVersion--;
 
             util::RevisionTag& rTag = pImpl->aVersions[nVersion];
diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx
index 6976d844b2ea..3559a500fba6 100644
--- a/sw/source/uibase/app/docsh.cxx
+++ b/sw/source/uibase/app/docsh.cxx
@@ -222,8 +222,7 @@ Reader* SwDocShell::StartConvertFrom(SfxMedium& rMedium, SwReaderPtr& rpRdr,
             pSet->GetItemState( SID_FILE_FILTEROPTIONS, true, &pItem ) )
             aOpt.ReadUserData( static_cast<const SfxStringItem*>(pItem)->GetValue() );
 
-        if( pRead )
-            pRead->GetReaderOpt().SetASCIIOpts( aOpt );
+        pRead->GetReaderOpt().SetASCIIOpts( aOpt );
     }
 
     return pRead;
@@ -239,17 +238,11 @@ bool SwDocShell::ConvertFrom( SfxMedium& rMedium )
     tools::SvRef<SotStorage> pStg=pRead->getSotStorageRef(); // #i45333# save sot storage ref in case of recursive calls
 
     m_xDoc->setDocAccTitle(OUString());
-    SfxViewFrame* pFrame1 = SfxViewFrame::GetFirst( this );
-    if (pFrame1)
+    if (const auto pFrame1 = SfxViewFrame::GetFirst(this))
     {
-        vcl::Window* pWindow = &pFrame1->GetWindow();
-        if ( pWindow )
+        if (auto pSysWin = pFrame1->GetWindow().GetSystemWindow())
         {
-            vcl::Window* pSysWin = pWindow->GetSystemWindow();
-            if ( pSysWin )
-            {
-                pSysWin->SetAccessibleName(OUString());
-            }
+            pSysWin->SetAccessibleName(OUString());
         }
     }
     SwWait aWait( *this, true );
diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx
index d299b67de20f..b77c8d9951ec 100644
--- a/sw/source/uibase/app/docsh2.cxx
+++ b/sw/source/uibase/app/docsh2.cxx
@@ -747,7 +747,7 @@ void SwDocShell::Execute(SfxRequest& rReq)
                     GetDoc()->getIDocumentDeviceAccess().setPrinter( pSavePrinter, true, true);
                     //pSavePrinter must not be deleted again
                 }
-                pViewFrame->GetBindings().SetState(SfxBoolItem(SID_SOURCEVIEW, nSlot == SID_VIEWSHELL2));
+                pViewFrame->GetBindings().SetState(SfxBoolItem(SID_SOURCEVIEW, false)); // not SID_VIEWSHELL2
                 pViewFrame->GetBindings().Invalidate( SID_NEWWINDOW );
                 pViewFrame->GetBindings().Invalidate( SID_BROWSER_MODE );
                 pViewFrame->GetBindings().Invalidate( FN_PRINT_LAYOUT );
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index 81af597d8951..9af9d7933401 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -2357,12 +2357,9 @@ bool SwDBManager::ToRecordId(sal_Int32 nSet)
         return false;
     bool bRet = false;
     sal_Int32 nAbsPos = nSet;
-
-    if(nAbsPos >= 0)
-    {
-        bRet = lcl_MoveAbsolute(pImpl->pMergeData, nAbsPos);
-        pImpl->pMergeData->bEndOfDB = !bRet;
-    }
+    assert(nAbsPos >= 0);
+    bRet = lcl_MoveAbsolute(pImpl->pMergeData, nAbsPos);
+    pImpl->pMergeData->bEndOfDB = !bRet;
     return bRet;
 }
 
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index 6ce63b23a55d..1f1cb9adf328 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -1458,7 +1458,7 @@ void SwEditWin::KeyInput(const KeyEvent &rKEvt)
                 if( KEY_UP == nKey ) nKey = KEY_LEFT;
                 else if( KEY_DOWN == nKey ) nKey = KEY_RIGHT;
                 else if( KEY_LEFT == nKey ) nKey = KEY_DOWN;
-                else if( KEY_RIGHT == nKey ) nKey = KEY_UP;
+                else /* KEY_RIGHT == nKey */ nKey = KEY_UP;
             }
 
             if ( rSh.IsInRightToLeftText() )
diff --git a/sw/source/uibase/frmdlg/colex.cxx b/sw/source/uibase/frmdlg/colex.cxx
index 53028e9486fa..d00de282e8cb 100644
--- a/sw/source/uibase/frmdlg/colex.cxx
+++ b/sw/source/uibase/frmdlg/colex.cxx
@@ -54,10 +54,8 @@ void SwPageExample::UpdateExample( const SfxItemSet& rSet )
     if ( rSet.GetItemState( nWhich, false ) == SfxItemState::SET )
     {
         // alignment
-        const SvxPageItem* pPage = static_cast<const SvxPageItem*>(&rSet.Get( nWhich ));
-
-        if ( pPage )
-            SetUsage( pPage->GetPageUsage() );
+        const SvxPageItem& rPage = static_cast<const SvxPageItem&>(rSet.Get(nWhich));
+        SetUsage(rPage.GetPageUsage());
     }
 
     nWhich = pPool->GetWhich( SID_ATTR_PAGE_SIZE );
diff --git a/ucb/source/cacher/cachedcontentresultset.cxx b/ucb/source/cacher/cachedcontentresultset.cxx
index f719338dce63..a1788a201649 100644
--- a/ucb/source/cacher/cachedcontentresultset.cxx
+++ b/ucb/source/cacher/cachedcontentresultset.cxx
@@ -1679,7 +1679,7 @@ sal_Bool SAL_CALL CachedContentResultSet
     if( m_nRow )
         return false;
     if( m_nKnownCount )
-        return !m_nRow;
+        return true;
     if( m_bFinalCount )
         return false;
 
@@ -1717,7 +1717,7 @@ sal_Bool SAL_CALL CachedContentResultSet
         if( m_nRow != 1 )
             return false;
         if( m_nKnownCount )
-            return m_nRow == 1;
+            return true;
         if( m_bFinalCount )
             return false;
 
diff --git a/unoxml/source/dom/attr.cxx b/unoxml/source/dom/attr.cxx
index 22f214dbf384..4ff411d3f62c 100644
--- a/unoxml/source/dom/attr.cxx
+++ b/unoxml/source/dom/attr.cxx
@@ -156,11 +156,8 @@ namespace DOM
         if (nullptr == m_aAttrPtr->children) {
             return OUString();
         }
-        char const*const pContent((m_aAttrPtr->children)
-            ? reinterpret_cast<char const*>(m_aAttrPtr->children->content)
-            : "");
-        OUString const ret(pContent, strlen(pContent), RTL_TEXTENCODING_UTF8);
-        return ret;
+        char const*const pContent(reinterpret_cast<char const*>(m_aAttrPtr->children->content));
+        return OUString(pContent, strlen(pContent), RTL_TEXTENCODING_UTF8);
     }
 
     /**


More information about the Libreoffice-commits mailing list