[Libreoffice-commits] core.git: cui/source dbaccess/source sc/source sd/source sw/source

Caolán McNamara caolanm at redhat.com
Tue Mar 10 08:45:25 PDT 2015


 cui/source/dialogs/cuigaldlg.cxx                          |   10 -
 cui/source/factory/dlgfact.cxx                            |   17 --
 dbaccess/source/ui/dlg/ConnectionHelper.cxx               |    6 
 dbaccess/source/ui/misc/WNameMatch.cxx                    |    3 
 sc/source/core/opencl/formulagroupcl.cxx                  |    3 
 sc/source/ui/namedlg/namedefdlg.cxx                       |   19 +-
 sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx |   17 +-
 sd/source/ui/app/sdmod1.cxx                               |   89 ++++++--------
 sd/source/ui/dlg/TemplateScanner.cxx                      |    9 -
 sd/source/ui/docshell/docshel4.cxx                        |   38 +----
 sd/source/ui/view/sdview3.cxx                             |    2 
 sw/source/core/attr/swatrset.cxx                          |   21 +--
 sw/source/core/draw/dcontact.cxx                          |    7 -
 sw/source/core/text/txtfld.cxx                            |   32 +----
 sw/source/core/undo/untbl.cxx                             |   10 -
 sw/source/core/unocore/unoportenum.cxx                    |    6 
 sw/source/filter/ww8/docxexportfilter.cxx                 |    9 -
 sw/source/filter/ww8/rtfexportfilter.cxx                  |    9 -
 18 files changed, 114 insertions(+), 193 deletions(-)

New commits:
commit b6d6dab920a9e14a6fe9c61446da64ab62dcbfdf
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Mar 10 13:07:45 2015 +0000

    V668 no sense in testing the result of new against null
    
    Change-Id: I1cff71d15f4d1b5ee47cc734b3fc2168d7f99201

diff --git a/cui/source/dialogs/cuigaldlg.cxx b/cui/source/dialogs/cuigaldlg.cxx
index f8c6c50..b1b0451 100644
--- a/cui/source/dialogs/cuigaldlg.cxx
+++ b/cui/source/dialogs/cuigaldlg.cxx
@@ -448,13 +448,9 @@ short ActualizeProgress::Execute()
     short nRet;
 
     pIdle = new Idle;
-
-    if ( pIdle )
-    {
-        pIdle->SetIdleHdl( LINK( this, ActualizeProgress, TimeoutHdl ) );
-        pIdle->SetPriority( SchedulerPriority::LOWEST );
-        pIdle->Start();
-    }
+    pIdle->SetIdleHdl( LINK( this, ActualizeProgress, TimeoutHdl ) );
+    pIdle->SetPriority( SchedulerPriority::LOWEST );
+    pIdle->Start();
 
     nRet = ModalDialog::Execute();
 
diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx
index 1421e83..062d67e 100644
--- a/cui/source/factory/dlgfact.cxx
+++ b/cui/source/factory/dlgfact.cxx
@@ -1216,13 +1216,8 @@ void AbstractScriptSelectorDialog_Impl::SetRunLabel()
 VclAbstractDialog * AbstractDialogFactory_Impl::CreateSvxScriptOrgDialog( vcl::Window* pParent,
                                             const OUString& rLanguage)
 {
-    Dialog* pDlg=NULL;
-
-    pDlg = new SvxScriptOrgDialog( pParent, rLanguage);
-
-    if ( pDlg )
-        return new CuiVclAbstractDialog_Impl( pDlg );
-    return 0;
+    Dialog* pDlg = new SvxScriptOrgDialog( pParent, rLanguage);
+    return new CuiVclAbstractDialog_Impl( pDlg );
 }
 
 AbstractTitleDialog * AbstractDialogFactory_Impl::CreateTitleDialog( vcl::Window* pParent,
@@ -1295,9 +1290,7 @@ AbstractSvxSearchSimilarityDialog * AbstractDialogFactory_Impl::CreateSvxSearchS
                                                             sal_uInt16 nLonger)
 {
     SvxSearchSimilarityDialog* pDlg = new SvxSearchSimilarityDialog( pParent, bRelax, nOther, nShorter, nLonger );
-    if ( pDlg )
-        return new AbstractSvxSearchSimilarityDialog_Impl( pDlg );
-    return NULL;
+    return new AbstractSvxSearchSimilarityDialog_Impl( pDlg );
 }
 
 //UUUU
@@ -1460,9 +1453,7 @@ AbstractFmSearchDialog*  AbstractDialogFactory_Impl::CreateFmSearchDialog(vcl::W
                                                         const Link& lnkContextSupplier)
 {
     FmSearchDialog* pDlg = new FmSearchDialog( pParent, strInitialText, _rContexts, nInitialContext, lnkContextSupplier );
-    if ( pDlg )
-        return new AbstractFmSearchDialog_Impl( pDlg );
-    return 0;
+    return new AbstractFmSearchDialog_Impl( pDlg );
 }
 
 AbstractGraphicFilterDialog * AbstractDialogFactory_Impl::CreateGraphicFilterEmboss (vcl::Window* pParent,
diff --git a/dbaccess/source/ui/dlg/ConnectionHelper.cxx b/dbaccess/source/ui/dlg/ConnectionHelper.cxx
index eeb3bd4..ec19a52 100644
--- a/dbaccess/source/ui/dlg/ConnectionHelper.cxx
+++ b/dbaccess/source/ui/dlg/ConnectionHelper.cxx
@@ -548,10 +548,10 @@ namespace dbaui
             const bool bExists = bIsFile? aCheckExistence.isDocument(): aCheckExistence.isFolder();
             eExists = bExists? PATH_EXIST: PATH_NOT_EXIST;
         }
-        catch(const Exception&)
+        catch (const Exception&)
         {
-            eExists = ( pHandler && pHandler->isDoesNotExist() ) ? PATH_NOT_EXIST: (bIsFile ? PATH_NOT_EXIST : PATH_NOT_KNOWN);
-           }
+            eExists = pHandler->isDoesNotExist() ? PATH_NOT_EXIST : (bIsFile ? PATH_NOT_EXIST : PATH_NOT_KNOWN);
+        }
         return eExists;
     }
     bool OConnectionHelper::PreNotify( NotifyEvent& _rNEvt )
diff --git a/dbaccess/source/ui/misc/WNameMatch.cxx b/dbaccess/source/ui/misc/WNameMatch.cxx
index 8126f1c..6ff7531 100644
--- a/dbaccess/source/ui/misc/WNameMatch.cxx
+++ b/dbaccess/source/ui/misc/WNameMatch.cxx
@@ -363,8 +363,7 @@ void OColumnTreeBox::InitEntry(SvTreeListEntry* pEntry, const OUString& rStr, co
 {
     DBTreeListBox::InitEntry(pEntry, rStr, rImg1, rImg2, eButtonKind);
     SvLBoxString* pString = new OColumnString(pEntry, 0, rStr,false);
-    if (pString)
-        pEntry->ReplaceItem( pString, pEntry->ItemCount() - 1 );
+    pEntry->ReplaceItem( pString, pEntry->ItemCount() - 1 );
 }
 
 bool OColumnTreeBox::Select( SvTreeListEntry* pEntry, bool bSelect )
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index e83069d..c4a2c3f 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -4029,9 +4029,6 @@ DynamicKernel* DynamicKernel::create( const ScCalcConfig& rConfig, ScTokenArray&
 
     DynamicKernel* pDynamicKernel = new DynamicKernel(rConfig, Root, nResultSize);
 
-    if (!pDynamicKernel)
-        return NULL;
-
     // OpenCL source code generation and kernel compilation
     try
     {
diff --git a/sc/source/ui/namedlg/namedefdlg.cxx b/sc/source/ui/namedlg/namedefdlg.cxx
index 43b4ecc..b784e93 100644
--- a/sc/source/ui/namedlg/namedefdlg.cxx
+++ b/sc/source/ui/namedlg/namedefdlg.cxx
@@ -204,23 +204,20 @@ void ScNameDefDlg::AddPushed()
     {
         if ( mpDoc )
         {
-            ScRangeData*    pNewEntry   = NULL;
             RangeType       nType       = RT_NAME;
 
-            pNewEntry = new ScRangeData( mpDoc,
+            ScRangeData* pNewEntry = new ScRangeData( mpDoc,
                     aName,
                     aExpression,
                     maCursorPos,
                     nType );
-            if (pNewEntry)
-            {
-                nType = nType
-                    | (m_pBtnRowHeader->IsChecked() ? RT_ROWHEADER  : RangeType(0))
-                    | (m_pBtnColHeader->IsChecked() ? RT_COLHEADER  : RangeType(0))
-                    | (m_pBtnPrintArea->IsChecked() ? RT_PRINTAREA  : RangeType(0))
-                    | (m_pBtnCriteria->IsChecked() ? RT_CRITERIA   : RangeType(0));
-                pNewEntry->AddType(nType);
-            }
+
+            nType = nType
+                | (m_pBtnRowHeader->IsChecked() ? RT_ROWHEADER  : RangeType(0))
+                | (m_pBtnColHeader->IsChecked() ? RT_COLHEADER  : RangeType(0))
+                | (m_pBtnPrintArea->IsChecked() ? RT_PRINTAREA  : RangeType(0))
+                | (m_pBtnCriteria->IsChecked() ? RT_CRITERIA   : RangeType(0));
+            pNewEntry->AddType(nType);
 
             // aExpression valid?
             if ( 0 == pNewEntry->GetErrCode() )
diff --git a/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx b/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx
index fffc50c..16208b1 100644
--- a/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx
+++ b/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx
@@ -112,17 +112,16 @@ void AccessibleDrawDocumentView::Init (void)
 
     // Create the children manager.
     mpChildrenManager = new ChildrenManager(this, xShapeList, maShapeTreeInfo, *this);
-    if (mpChildrenManager != NULL)
+
+    rtl::Reference<AccessiblePageShape> xPage(CreateDrawPageShape());
+    if (xPage.is())
     {
-        rtl::Reference<AccessiblePageShape> xPage(CreateDrawPageShape());
-        if (xPage.is())
-        {
-            xPage->Init();
-            mpChildrenManager->AddAccessibleShape (xPage.get());
-            mpChildrenManager->Update ();
-        }
-        mpChildrenManager->UpdateSelection ();
+        xPage->Init();
+        mpChildrenManager->AddAccessibleShape (xPage.get());
+        mpChildrenManager->Update ();
     }
+
+    mpChildrenManager->UpdateSelection ();
 }
 
 void AccessibleDrawDocumentView::ViewForwarderChanged (ChangeType aChangeType,
diff --git a/sd/source/ui/app/sdmod1.cxx b/sd/source/ui/app/sdmod1.cxx
index dad7b14..8df6940 100644
--- a/sd/source/ui/app/sdmod1.cxx
+++ b/sd/source/ui/app/sdmod1.cxx
@@ -266,47 +266,45 @@ bool SdModule::OutlineToImpress(SfxRequest& rRequest)
             ::sd::DrawDocShell* pDocSh;
             xDocShell = pDocSh = new ::sd::DrawDocShell(
                 SFX_CREATE_MODE_STANDARD, false);
-            if(pDocSh)
+
+            pDocSh->DoInitNew(NULL);
+            SdDrawDocument* pDoc = pDocSh->GetDoc();
+            if(pDoc)
             {
-                pDocSh->DoInitNew(NULL);
-                SdDrawDocument* pDoc = pDocSh->GetDoc();
-                if(pDoc)
-                {
-                    pDoc->CreateFirstPages();
-                    pDoc->StopWorkStartupDelay();
-                }
+                pDoc->CreateFirstPages();
+                pDoc->StopWorkStartupDelay();
+            }
 
-                SFX_REQUEST_ARG( rRequest, pFrmItem, SfxFrameItem, SID_DOCFRAME, false);
-                SfxViewFrame::LoadDocumentIntoFrame( *pDocSh, pFrmItem, ::sd::OUTLINE_FACTORY_ID );
+            SFX_REQUEST_ARG( rRequest, pFrmItem, SfxFrameItem, SID_DOCFRAME, false);
+            SfxViewFrame::LoadDocumentIntoFrame( *pDocSh, pFrmItem, ::sd::OUTLINE_FACTORY_ID );
 
-                ::sd::ViewShell* pViewSh = pDocSh->GetViewShell();
+            ::sd::ViewShell* pViewSh = pDocSh->GetViewShell();
 
-                if (pViewSh && pDoc)
-                {
-                    // AutoLayouts have to be finished
-                    pDoc->StopWorkStartupDelay();
+            if (pViewSh && pDoc)
+            {
+                // AutoLayouts have to be finished
+                pDoc->StopWorkStartupDelay();
 
-                    SfxViewFrame* pViewFrame = pViewSh->GetViewFrame();
+                SfxViewFrame* pViewFrame = pViewSh->GetViewFrame();
 
-                    // When the view frame has not been just created we have
-                    // to switch synchronously to the outline view.
-                    // (Otherwise the request will be ignored anyway.)
-                    ::sd::ViewShellBase* pBase
-                        = dynamic_cast< ::sd::ViewShellBase*>(pViewFrame->GetViewShell());
-                    if (pBase != NULL)
-                    {
-                        ::boost::shared_ptr<FrameworkHelper> pHelper (
-                            FrameworkHelper::Instance(*pBase));
-                        pHelper->RequestView(
-                            FrameworkHelper::msOutlineViewURL,
-                            FrameworkHelper::msCenterPaneURL);
-
-                        pHelper->RunOnResourceActivation(
-                            FrameworkHelper::CreateResourceId(
-                            FrameworkHelper::msOutlineViewURL,
-                            FrameworkHelper::msCenterPaneURL),
-                            OutlineToImpressFinalizer(*pBase, *pDoc, *pBytes));
-                    }
+                // When the view frame has not been just created we have
+                // to switch synchronously to the outline view.
+                // (Otherwise the request will be ignored anyway.)
+                ::sd::ViewShellBase* pBase
+                    = dynamic_cast< ::sd::ViewShellBase*>(pViewFrame->GetViewShell());
+                if (pBase != NULL)
+                {
+                    ::boost::shared_ptr<FrameworkHelper> pHelper (
+                        FrameworkHelper::Instance(*pBase));
+                    pHelper->RequestView(
+                        FrameworkHelper::msOutlineViewURL,
+                        FrameworkHelper::msCenterPaneURL);
+
+                    pHelper->RunOnResourceActivation(
+                        FrameworkHelper::CreateResourceId(
+                        FrameworkHelper::msOutlineViewURL,
+                        FrameworkHelper::msCenterPaneURL),
+                        OutlineToImpressFinalizer(*pBase, *pDoc, *pBytes));
                 }
             }
         }
@@ -724,21 +722,18 @@ SfxFrame* SdModule::CreateEmptyDocument( DocumentType eDocType, const Reference<
     SfxObjectShellLock xDocShell;
     ::sd::DrawDocShell* pNewDocSh;
     xDocShell = pNewDocSh = new ::sd::DrawDocShell(SFX_CREATE_MODE_STANDARD,false,eDocType);
-    if(pNewDocSh)
+    pNewDocSh->DoInitNew(NULL);
+    SdDrawDocument* pDoc = pNewDocSh->GetDoc();
+    if (pDoc)
     {
-        pNewDocSh->DoInitNew(NULL);
-        SdDrawDocument* pDoc = pNewDocSh->GetDoc();
-        if(pDoc)
-        {
-            pDoc->CreateFirstPages();
-            pDoc->StopWorkStartupDelay();
-        }
-
-        SfxViewFrame* pViewFrame = SfxViewFrame::LoadDocumentIntoFrame( *pNewDocSh, i_rFrame );
-        OSL_ENSURE( pViewFrame, "SdModule::CreateEmptyDocument: no view frame - was the document really loaded?" );
-        pFrame = pViewFrame ? &pViewFrame->GetFrame() : NULL;
+        pDoc->CreateFirstPages();
+        pDoc->StopWorkStartupDelay();
     }
 
+    SfxViewFrame* pViewFrame = SfxViewFrame::LoadDocumentIntoFrame( *pNewDocSh, i_rFrame );
+    OSL_ENSURE( pViewFrame, "SdModule::CreateEmptyDocument: no view frame - was the document really loaded?" );
+    pFrame = pViewFrame ? &pViewFrame->GetFrame() : NULL;
+
     return pFrame;
 }
 
diff --git a/sd/source/ui/dlg/TemplateScanner.cxx b/sd/source/ui/dlg/TemplateScanner.cxx
index 617f6401..3e43b19 100644
--- a/sd/source/ui/dlg/TemplateScanner.cxx
+++ b/sd/source/ui/dlg/TemplateScanner.cxx
@@ -373,12 +373,9 @@ TemplateScanner::State TemplateScanner::ScanFolder (void)
             // Scan the folder and insert it into the list of template
             // folders.
             mpTemplateDirectory = new TemplateDir (sTitle, sTargetDir);
-            if (mpTemplateDirectory != NULL)
-            {
-                mpTemplateDirectory->EnableSorting(mbEntrySortingEnabled);
-                // Continue with scanning all entries in the folder.
-                eNextState = INITIALIZE_ENTRY_SCAN;
-            }
+            mpTemplateDirectory->EnableSorting(mbEntrySortingEnabled);
+            // Continue with scanning all entries in the folder.
+            eNextState = INITIALIZE_ENTRY_SCAN;
         }
     }
     else
diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx
index cd90438..af598c2 100644
--- a/sd/source/ui/docshell/docshel4.cxx
+++ b/sd/source/ui/docshell/docshel4.cxx
@@ -909,24 +909,13 @@ bool DrawDocShell::GetObjectIsmarked(const OUString& rBookmark)
             // Jump to the page.  This is done by using the API because this
             // takes care of all the little things to be done.  Especially
             // writing the view data to the frame view (see bug #107803#).
-            sal_uInt16 nSdPgNum = (nPgNum - 1) / 2;
             SdUnoDrawView* pUnoDrawView = new SdUnoDrawView (
                 *pDrViewSh,
                 *pDrViewSh->GetView());
-            if (pUnoDrawView != NULL)
-            {
-                ::com::sun::star::uno::Reference<
-                      ::com::sun::star::drawing::XDrawPage> xDrawPage (
-                          pPage->getUnoPage(), ::com::sun::star::uno::UNO_QUERY);
-                pUnoDrawView->setCurrentPage (xDrawPage);
-            }
-            else
-            {
-                // As a fall back switch to the page via the core.
-                DBG_ASSERT (pUnoDrawView!=NULL,
-                    "SdDrawDocShell::GotoBookmark: can't switch page via API");
-                pDrViewSh->SwitchPage(nSdPgNum);
-            }
+            ::com::sun::star::uno::Reference<
+                  ::com::sun::star::drawing::XDrawPage> xDrawPage (
+                      pPage->getUnoPage(), ::com::sun::star::uno::UNO_QUERY);
+            pUnoDrawView->setCurrentPage (xDrawPage);
             delete pUnoDrawView;
 
             if (pObj)
@@ -1002,24 +991,13 @@ bool DrawDocShell::GotoTreeBookmark(const OUString& rBookmark)
             // Jump to the page.  This is done by using the API because this
             // takes care of all the little things to be done.  Especially
             // writing the view data to the frame view (see bug #107803#).
-            sal_uInt16 nSdPgNum = (nPgNum - 1) / 2;
             SdUnoDrawView* pUnoDrawView = new SdUnoDrawView (
                 *pDrViewSh,
                 *pDrViewSh->GetView());
-            if (pUnoDrawView != NULL)
-            {
-                ::com::sun::star::uno::Reference<
-                      ::com::sun::star::drawing::XDrawPage> xDrawPage (
-                          pPage->getUnoPage(), ::com::sun::star::uno::UNO_QUERY);
-                pUnoDrawView->setCurrentPage (xDrawPage);
-            }
-            else
-            {
-                // As a fall back switch to the page via the core.
-                DBG_ASSERT (pUnoDrawView!=NULL,
-                    "SdDrawDocShell::GotoBookmark: can't switch page via API");
-                pDrViewSh->SwitchPage(nSdPgNum);
-            }
+            ::com::sun::star::uno::Reference<
+                  ::com::sun::star::drawing::XDrawPage> xDrawPage (
+                      pPage->getUnoPage(), ::com::sun::star::uno::UNO_QUERY);
+            pUnoDrawView->setCurrentPage (xDrawPage);
             delete pUnoDrawView;
 
             if (pObj)
diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx
index 5ad3d45..77ae263 100644
--- a/sd/source/ui/view/sdview3.cxx
+++ b/sd/source/ui/view/sdview3.cxx
@@ -993,7 +993,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
                     if( pImageMap )
                         pObj->AppendUserData( new SdIMapInfo( *pImageMap ) );
 
-                    if ( pObj && pObj->IsChart() )
+                    if (pObj->IsChart())
                     {
                         bool bDisableDataTableDialog = false;
                         svt::EmbeddedObjectRef::TryRunningState( xObj );
diff --git a/sw/source/core/attr/swatrset.cxx b/sw/source/core/attr/swatrset.cxx
index e746c20..8631b06 100644
--- a/sw/source/core/attr/swatrset.cxx
+++ b/sw/source/core/attr/swatrset.cxx
@@ -86,20 +86,17 @@ void SwAttrPool::createAndAddSecondaryPools()
 
     // #75371# change DefaultItems for the SdrEdgeObj distance items
     // to TWIPS.
-    if(pSdrPool)
-    {
-        // 1/100th mm in twips
-        const long nDefEdgeDist = ((500 * 72) / 127);
+    // 1/100th mm in twips
+    const long nDefEdgeDist = ((500 * 72) / 127);
 
-        pSdrPool->SetPoolDefaultItem(SdrEdgeNode1HorzDistItem(nDefEdgeDist));
-        pSdrPool->SetPoolDefaultItem(SdrEdgeNode1VertDistItem(nDefEdgeDist));
-        pSdrPool->SetPoolDefaultItem(SdrEdgeNode2HorzDistItem(nDefEdgeDist));
-        pSdrPool->SetPoolDefaultItem(SdrEdgeNode2VertDistItem(nDefEdgeDist));
+    pSdrPool->SetPoolDefaultItem(SdrEdgeNode1HorzDistItem(nDefEdgeDist));
+    pSdrPool->SetPoolDefaultItem(SdrEdgeNode1VertDistItem(nDefEdgeDist));
+    pSdrPool->SetPoolDefaultItem(SdrEdgeNode2HorzDistItem(nDefEdgeDist));
+    pSdrPool->SetPoolDefaultItem(SdrEdgeNode2VertDistItem(nDefEdgeDist));
 
-        // #i33700# // Set shadow distance defaults as PoolDefaultItems
-        pSdrPool->SetPoolDefaultItem(makeSdrShadowXDistItem((300 * 72) / 127));
-        pSdrPool->SetPoolDefaultItem(makeSdrShadowYDistItem((300 * 72) / 127));
-    }
+    // #i33700# // Set shadow distance defaults as PoolDefaultItems
+    pSdrPool->SetPoolDefaultItem(makeSdrShadowXDistItem((300 * 72) / 127));
+    pSdrPool->SetPoolDefaultItem(makeSdrShadowYDistItem((300 * 72) / 127));
 
     SfxItemPool *pEEgPool = EditEngine::CreatePool(false);
 
diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index 09e104d..4490134 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -2189,11 +2189,8 @@ SwDrawVirtObj* SwDrawVirtObj::Clone() const
 {
     SwDrawVirtObj* pObj = new SwDrawVirtObj( rRefObj, mrDrawContact );
 
-    if ( pObj )
-    {
-        pObj->operator=( *this );
-        // Note: Member <maAnchoredDrawObj> hasn't to be considered.
-    }
+    pObj->operator=( *this );
+    // Note: Member <maAnchoredDrawObj> hasn't to be considered.
 
     return pObj;
 }
diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx
index e98104e..3a86463 100644
--- a/sw/source/core/text/txtfld.cxx
+++ b/sw/source/core/text/txtfld.cxx
@@ -145,8 +145,7 @@ SwExpandPortion *SwTxtFormatter::NewFldPortion( SwTxtFormatInfo &rInf,
                         : pFld->ExpandField(bInClipboard) );
                 pRet = new SwFldPortion( aStr );
             }
-            if(pRet)
-                static_cast<SwFldPortion*>(pRet)->m_nAttrFldType= ATTR_PAGECOOUNTFLD;
+            static_cast<SwFldPortion*>(pRet)->m_nAttrFldType= ATTR_PAGECOOUNTFLD;
             break;
 
         case RES_PAGENUMBERFLD:
@@ -174,8 +173,7 @@ SwExpandPortion *SwTxtFormatter::NewFldPortion( SwTxtFormatInfo &rInf,
                         : pFld->ExpandField(bInClipboard) );
                 pRet = new SwFldPortion( aStr );
             }
-            if(pRet)
-                static_cast<SwFldPortion*>(pRet)->m_nAttrFldType= ATTR_PAGENUMBERFLD;
+            static_cast<SwFldPortion*>(pRet)->m_nAttrFldType= ATTR_PAGENUMBERFLD;
             break;
         }
         case RES_GETEXPFLD:
@@ -248,14 +246,11 @@ SwExpandPortion *SwTxtFormatter::NewFldPortion( SwTxtFormatInfo &rInf,
                         : pFld->ExpandField(bInClipboard) );
                 pRet = new SwFldPortion(str);
             }
-            if(pRet)
-            {
-                if( subType == REF_BOOKMARK  )
-                    static_cast<SwFldPortion*>(pRet)->m_nAttrFldType = ATTR_BOOKMARKFLD;
-                else if( subType == REF_SETREFATTR )
-                    static_cast<SwFldPortion*>(pRet)->m_nAttrFldType = ATTR_SETREFATTRFLD;
-                break;
-            }
+            if( subType == REF_BOOKMARK  )
+                static_cast<SwFldPortion*>(pRet)->m_nAttrFldType = ATTR_BOOKMARKFLD;
+            else if( subType == REF_SETREFATTR )
+                static_cast<SwFldPortion*>(pRet)->m_nAttrFldType = ATTR_SETREFATTRFLD;
+            break;
         case RES_DATETIMEFLD:
             subType = static_cast<SwDateTimeField*>(pFld)->GetSubType();
             {
@@ -264,14 +259,11 @@ SwExpandPortion *SwTxtFormatter::NewFldPortion( SwTxtFormatInfo &rInf,
                         : pFld->ExpandField(bInClipboard) );
                 pRet = new SwFldPortion(str);
             }
-            if(pRet)
-            {
-                if( subType & DATEFLD  )
-                    static_cast<SwFldPortion*>(pRet)->m_nAttrFldType= ATTR_DATEFLD;
-                else if( subType & TIMEFLD )
-                    static_cast<SwFldPortion*>(pRet)->m_nAttrFldType = ATTR_TIMEFLD;
-                break;
-            }
+            if( subType & DATEFLD  )
+                static_cast<SwFldPortion*>(pRet)->m_nAttrFldType= ATTR_DATEFLD;
+            else if( subType & TIMEFLD )
+                static_cast<SwFldPortion*>(pRet)->m_nAttrFldType = ATTR_TIMEFLD;
+            break;
         default:
             {
                 OUString const aStr( (bName)
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index aab5ca9..ea74663 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -1187,15 +1187,7 @@ void _SaveLine::CreateNew( SwTable& rTbl, SwTableBox& rParent, _SaveTable& rSTbl
 
     rParent.GetTabLines().push_back( pNew );
 
-    // HB, #127868# robustness: in some cases - which I
-    // cannot reproduce nor see from the code - pNew seems
-    // to be set to NULL in C40_INSERT.
-    OSL_ENSURE(pNew, "Table line just created set to NULL in C40_INSERT");
-
-    if (pNew)
-    {
-        pBox->CreateNew( rTbl, *pNew, rSTbl );
-    }
+    pBox->CreateNew( rTbl, *pNew, rSTbl );
 
     if( pNext )
         pNext->CreateNew( rTbl, rParent, rSTbl );
diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx
index 422bce9..61a64df 100644
--- a/sw/source/core/unocore/unoportenum.cxx
+++ b/sw/source/core/unocore/unoportenum.cxx
@@ -469,7 +469,7 @@ lcl_ExportFieldMark(
         SwXTextPortion* pPortion = new SwXTextPortion(
             pUnoCrsr, i_xParentText, PORTION_FIELD_START);
         xRef = pPortion;
-        if (pPortion && pFieldmark && pDoc)
+        if (pFieldmark && pDoc)
         {
             pPortion->SetBookmark(
                 SwXFieldmark::CreateXFieldmark(*pDoc, pFieldmark));
@@ -486,7 +486,7 @@ lcl_ExportFieldMark(
         SwXTextPortion* pPortion = new SwXTextPortion(
             pUnoCrsr, i_xParentText, PORTION_FIELD_END);
         xRef = pPortion;
-        if (pPortion && pFieldmark && pDoc)
+        if (pFieldmark && pDoc)
         {
             pPortion->SetBookmark(
                 SwXFieldmark::CreateXFieldmark(*pDoc, pFieldmark));
@@ -502,7 +502,7 @@ lcl_ExportFieldMark(
         SwXTextPortion* pPortion = new SwXTextPortion(
             pUnoCrsr, i_xParentText, PORTION_FIELD_START_END);
         xRef = pPortion;
-        if (pPortion && pFieldmark && pDoc)
+        if (pFieldmark && pDoc)
         {
             pPortion->SetBookmark(
                 SwXFieldmark::CreateXFieldmark(*pDoc, pFieldmark));
diff --git a/sw/source/filter/ww8/docxexportfilter.cxx b/sw/source/filter/ww8/docxexportfilter.cxx
index 9e3524e8..aaa857e 100644
--- a/sw/source/filter/ww8/docxexportfilter.cxx
+++ b/sw/source/filter/ww8/docxexportfilter.cxx
@@ -76,12 +76,9 @@ bool DocxExportFilter::exportDocument()
     commitStorage();
 
     // delete the pCurPam
-    if ( pCurPam )
-    {
-        while ( pCurPam->GetNext() != pCurPam )
-            delete pCurPam->GetNext();
-        delete pCurPam;
-    }
+    while ( pCurPam->GetNext() != pCurPam )
+        delete pCurPam->GetNext();
+    delete pCurPam;
 
     return true;
 }
diff --git a/sw/source/filter/ww8/rtfexportfilter.cxx b/sw/source/filter/ww8/rtfexportfilter.cxx
index 7774a22..91923e3a 100644
--- a/sw/source/filter/ww8/rtfexportfilter.cxx
+++ b/sw/source/filter/ww8/rtfexportfilter.cxx
@@ -81,12 +81,9 @@ sal_Bool RtfExportFilter::filter(const uno::Sequence< beans::PropertyValue >& aD
     }
 
     // delete the pCurPam
-    if (pCurPam)
-    {
-        while (pCurPam->GetNext() != pCurPam)
-            delete pCurPam->GetNext();
-        delete pCurPam;
-    }
+    while (pCurPam->GetNext() != pCurPam)
+        delete pCurPam->GetNext();
+    delete pCurPam;
     delete pStream;
 
     return sal_True;


More information about the Libreoffice-commits mailing list