[Libreoffice-commits] core.git: 2 commits - chart2/source lotuswordpro/source sc/source sd/source svx/source

Caolán McNamara caolanm at redhat.com
Tue Mar 10 18:17:04 PDT 2015


 chart2/source/controller/accessibility/AccessibleTextHelper.cxx |    9 
 chart2/source/controller/dialogs/dlg_CreationWizard.cxx         |    2 
 chart2/source/controller/main/ChartController.cxx               |   14 
 lotuswordpro/source/filter/lwpbackgroundstuff.cxx               |   23 
 sc/source/core/tool/chartarr.cxx                                |  235 ++++------
 sc/source/core/tool/chgtrack.cxx                                |   16 
 sc/source/filter/xml/xmlexprt.cxx                               |    7 
 sc/source/ui/Accessibility/AccessibleDocument.cxx               |    2 
 sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx    |   13 
 sd/source/filter/eppt/eppt.cxx                                  |   28 -
 sd/source/filter/ppt/pptin.cxx                                  |   39 -
 svx/source/dialog/contwnd.cxx                                   |   15 
 svx/source/form/datanavi.cxx                                    |    6 
 svx/source/form/tabwin.cxx                                      |    7 
 svx/source/sidebar/nbdtmg.cxx                                   |    2 
 15 files changed, 179 insertions(+), 239 deletions(-)

New commits:
commit ffe060e954d172f8603a4e9f625445e49132c7bf
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Mar 10 16:19:19 2015 +0000

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

diff --git a/chart2/source/controller/accessibility/AccessibleTextHelper.cxx b/chart2/source/controller/accessibility/AccessibleTextHelper.cxx
index 96564fc..878ecd1 100644
--- a/chart2/source/controller/accessibility/AccessibleTextHelper.cxx
+++ b/chart2/source/controller/accessibility/AccessibleTextHelper.cxx
@@ -80,8 +80,7 @@ void SAL_CALL AccessibleTextHelper::initialize( const Sequence< uno::Any >& aArg
 
     SolarMutexGuard aSolarGuard;
 
-    if( m_pTextHelper )
-        delete m_pTextHelper;
+    delete m_pTextHelper;
 
     vcl::Window* pWindow( VCLUnoHelper::GetWindow( xWindow ));
     if( pWindow )
@@ -93,10 +92,8 @@ void SAL_CALL AccessibleTextHelper::initialize( const Sequence< uno::Any >& aArg
             if( pTextObj )
             {
                 std::unique_ptr<SvxEditSource> pEditSource(new SvxTextEditSource( *pTextObj, 0, *pView, *pWindow ));
-                m_pTextHelper = new ::accessibility::AccessibleTextHelper(
-                    std::move(pEditSource));
-                if( m_pTextHelper )
-                    m_pTextHelper->SetEventSource( xEventSource );
+                m_pTextHelper = new ::accessibility::AccessibleTextHelper(std::move(pEditSource));
+                m_pTextHelper->SetEventSource( xEventSource );
             }
         }
     }
diff --git a/chart2/source/controller/dialogs/dlg_CreationWizard.cxx b/chart2/source/controller/dialogs/dlg_CreationWizard.cxx
index d7faca0..9094da8 100644
--- a/chart2/source/controller/dialogs/dlg_CreationWizard.cxx
+++ b/chart2/source/controller/dialogs/dlg_CreationWizard.cxx
@@ -124,7 +124,7 @@ svt::OWizardPage* CreationWizard::createPage(WizardState nState)
         ChartTypeTabPage* pChartTypeTabPage = new ChartTypeTabPage(this,m_xChartModel,m_xCC,bDoLiveUpdate);
         pRet  = pChartTypeTabPage;
         m_pTemplateProvider = pChartTypeTabPage;
-        if (m_pTemplateProvider && m_pDialogModel)
+        if (m_pDialogModel)
             m_pDialogModel->setTemplate( m_pTemplateProvider->getCurrentTemplate());
         }
         break;
diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx
index 780ea46..242fdf2 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -553,18 +553,12 @@ sal_Bool SAL_CALL ChartController::attachModel( const uno::Reference< frame::XMo
     m_aDispatchContainer.setChartDispatch( pDispatch, impl_getAvailableCommands() );
 
     DrawCommandDispatch* pDrawDispatch = new DrawCommandDispatch( m_xCC, this );
-    if ( pDrawDispatch )
-    {
-        pDrawDispatch->initialize();
-        m_aDispatchContainer.setDrawCommandDispatch( pDrawDispatch );
-    }
+    pDrawDispatch->initialize();
+    m_aDispatchContainer.setDrawCommandDispatch( pDrawDispatch );
 
     ShapeController* pShapeController = new ShapeController( m_xCC, this );
-    if ( pShapeController )
-    {
-        pShapeController->initialize();
-        m_aDispatchContainer.setShapeController( pShapeController );
-    }
+    pShapeController->initialize();
+    m_aDispatchContainer.setShapeController( pShapeController );
     aGuard.clear();
 
 #ifdef TEST_ENABLE_MODIFY_LISTENER
diff --git a/sc/source/core/tool/chartarr.cxx b/sc/source/core/tool/chartarr.cxx
index c92977f..33cbddb 100644
--- a/sc/source/core/tool/chartarr.cxx
+++ b/sc/source/core/tool/chartarr.cxx
@@ -39,14 +39,11 @@ ScMemChart::ScMemChart(SCCOL nCols, SCROW nRows)
     nColCnt = nCols;
     pData   = new double[nColCnt * nRowCnt];
 
-    if (pData)
-    {
-        double *pFill = pData;
+    double *pFill = pData;
 
-        for (SCCOL i = 0; i < nColCnt; i++)
-            for (SCROW j = 0; j < nRowCnt; j++)
-                *(pFill ++) = 0.0;
-    }
+    for (SCCOL i = 0; i < nColCnt; i++)
+        for (SCROW j = 0; j < nRowCnt; j++)
+            *(pFill ++) = 0.0;
 
     pColText = new OUString[nColCnt];
     pRowText = new OUString[nRowCnt];
@@ -238,71 +235,69 @@ ScMemChart* ScChartArray::CreateMemChartSingle()
 
     //  Data
     ScMemChart* pMemChart = new ScMemChart( nColCount, nRowCount );
-    if (pMemChart)
+
+    if ( bValidData )
     {
-        if ( bValidData )
+        bool bCalcAsShown = pDocument->GetDocOptions().IsCalcAsShown();
+        for (nCol=0; nCol<nColCount; nCol++)
         {
-            bool bCalcAsShown = pDocument->GetDocOptions().IsCalcAsShown();
-            for (nCol=0; nCol<nColCount; nCol++)
+            for (nRow=0; nRow<nRowCount; nRow++)
             {
-                for (nRow=0; nRow<nRowCount; nRow++)
-                {
-                    // DBL_MIN is a Hack for Chart to recognize empty cells.
-                    ScAddress aPos(aCols[nCol], aRows[nRow], nTab1);
-                    double nVal = getCellValue(*pDocument, aPos, DBL_MIN, bCalcAsShown);
-                    pMemChart->SetData(nCol, nRow, nVal);
-                }
+                // DBL_MIN is a Hack for Chart to recognize empty cells.
+                ScAddress aPos(aCols[nCol], aRows[nRow], nTab1);
+                double nVal = getCellValue(*pDocument, aPos, DBL_MIN, bCalcAsShown);
+                pMemChart->SetData(nCol, nRow, nVal);
             }
         }
-        else
-        {
-            // Flag marking data as invalid?
-            for (nCol=0; nCol<nColCount; nCol++)
-                for (nRow=0; nRow<nRowCount; nRow++)
-                    pMemChart->SetData( nCol, nRow, DBL_MIN );
-        }
+    }
+    else
+    {
+        // Flag marking data as invalid?
+        for (nCol=0; nCol<nColCount; nCol++)
+            for (nRow=0; nRow<nRowCount; nRow++)
+                pMemChart->SetData( nCol, nRow, DBL_MIN );
+    }
 
-        //  Column Header
+    //  Column Header
 
-        for (nCol=0; nCol<nColCount; nCol++)
+    for (nCol=0; nCol<nColCount; nCol++)
+    {
+        OUString aString;
+        if (HasColHeaders())
+            aString = pDocument->GetString(aCols[nCol], nStrRow, nTab1);
+        if (aString.isEmpty())
         {
-            OUString aString;
-            if (HasColHeaders())
-                aString = pDocument->GetString(aCols[nCol], nStrRow, nTab1);
-            if (aString.isEmpty())
-            {
-                OUStringBuffer aBuf;
-                aBuf.append(ScGlobal::GetRscString(STR_COLUMN));
-                aBuf.append(' ');
+            OUStringBuffer aBuf;
+            aBuf.append(ScGlobal::GetRscString(STR_COLUMN));
+            aBuf.append(' ');
 
-                ScAddress aPos( aCols[ nCol ], 0, 0 );
-                aBuf.append(aPos.Format(SCA_VALID_COL, NULL));
+            ScAddress aPos( aCols[ nCol ], 0, 0 );
+            aBuf.append(aPos.Format(SCA_VALID_COL, NULL));
 
-                aString = aBuf.makeStringAndClear();
-            }
-            pMemChart->SetColText( nCol, aString);
+            aString = aBuf.makeStringAndClear();
         }
+        pMemChart->SetColText( nCol, aString);
+    }
 
-        //  Row Header
+    //  Row Header
 
-        for (nRow=0; nRow<nRowCount; nRow++)
+    for (nRow=0; nRow<nRowCount; nRow++)
+    {
+        OUString aString;
+        if (HasRowHeaders())
         {
-            OUString aString;
-            if (HasRowHeaders())
-            {
-                ScAddress aAddr( nStrCol, aRows[nRow], nTab1 );
-                aString = pDocument->GetString(nStrCol, aRows[nRow], nTab1);
-            }
-            if (aString.isEmpty())
-            {
-                OUStringBuffer aBuf;
-                aBuf.append(ScGlobal::GetRscString(STR_ROW));
-                aBuf.append(' ');
-                aBuf.append(static_cast<sal_Int32>(aRows[nRow]+1));
-                aString = aBuf.makeStringAndClear();
-            }
-            pMemChart->SetRowText( nRow, aString);
+            ScAddress aAddr( nStrCol, aRows[nRow], nTab1 );
+            aString = pDocument->GetString(nStrCol, aRows[nRow], nTab1);
         }
+        if (aString.isEmpty())
+        {
+            OUStringBuffer aBuf;
+            aBuf.append(ScGlobal::GetRscString(STR_ROW));
+            aBuf.append(' ');
+            aBuf.append(static_cast<sal_Int32>(aRows[nRow]+1));
+            aString = aBuf.makeStringAndClear();
+        }
+        pMemChart->SetRowText( nRow, aString);
     }
 
     return pMemChart;
@@ -334,29 +329,14 @@ ScMemChart* ScChartArray::CreateMemChartMulti()
 
     //  Data
     ScMemChart* pMemChart = new ScMemChart( nColCount, nRowCount );
-    if (pMemChart)
+
+    SCSIZE nCol = 0;
+    SCSIZE nRow = 0;
+    bool bCalcAsShown = pDocument->GetDocOptions().IsCalcAsShown();
+    sal_uLong nIndex = 0;
+    if (bValidData)
     {
-        SCSIZE nCol = 0;
-        SCSIZE nRow = 0;
-        bool bCalcAsShown = pDocument->GetDocOptions().IsCalcAsShown();
-        sal_uLong nIndex = 0;
-        if (bValidData)
-        {
-            for ( nCol = 0; nCol < nColCount; nCol++ )
-            {
-                for ( nRow = 0; nRow < nRowCount; nRow++, nIndex++ )
-                {
-                    double nVal = DBL_MIN; // Hack for Chart to recognize empty cells
-                    const ScAddress* pPos = GetPositionMap()->GetPosition( nIndex );
-                    if (pPos)
-                        // otherwise: Gap
-                        nVal = getCellValue(*pDocument, *pPos, DBL_MIN, bCalcAsShown);
-
-                    pMemChart->SetData(nCol, nRow, nVal);
-                }
-            }
-        }
-        else
+        for ( nCol = 0; nCol < nColCount; nCol++ )
         {
             for ( nRow = 0; nRow < nRowCount; nRow++, nIndex++ )
             {
@@ -369,57 +349,70 @@ ScMemChart* ScChartArray::CreateMemChartMulti()
                 pMemChart->SetData(nCol, nRow, nVal);
             }
         }
+    }
+    else
+    {
+        for ( nRow = 0; nRow < nRowCount; nRow++, nIndex++ )
+        {
+            double nVal = DBL_MIN; // Hack for Chart to recognize empty cells
+            const ScAddress* pPos = GetPositionMap()->GetPosition( nIndex );
+            if (pPos)
+                // otherwise: Gap
+                nVal = getCellValue(*pDocument, *pPos, DBL_MIN, bCalcAsShown);
 
-        //TODO: Label when gaps
+            pMemChart->SetData(nCol, nRow, nVal);
+        }
+    }
 
-        //  Column header
+    //TODO: Label when gaps
 
-        SCCOL nPosCol = 0;
-        for ( nCol = 0; nCol < nColCount; nCol++ )
-        {
-            OUString aString;
-            const ScAddress* pPos = GetPositionMap()->GetColHeaderPosition( static_cast<SCCOL>(nCol) );
-            if ( HasColHeaders() && pPos )
-                aString = pDocument->GetString(pPos->Col(), pPos->Row(), pPos->Tab());
+    //  Column header
 
-            if (aString.isEmpty())
-            {
-                OUStringBuffer aBuf(ScGlobal::GetRscString(STR_COLUMN));
-                aBuf.append(' ');
-                if ( pPos )
-                    nPosCol = pPos->Col() + 1;
-                else
-                    nPosCol++;
-                ScAddress aPos( nPosCol - 1, 0, 0 );
-                aBuf.append(aPos.Format(SCA_VALID_COL, NULL));
-                aString = aBuf.makeStringAndClear();
-            }
-            pMemChart->SetColText( nCol, aString);
+    SCCOL nPosCol = 0;
+    for ( nCol = 0; nCol < nColCount; nCol++ )
+    {
+        OUString aString;
+        const ScAddress* pPos = GetPositionMap()->GetColHeaderPosition( static_cast<SCCOL>(nCol) );
+        if ( HasColHeaders() && pPos )
+            aString = pDocument->GetString(pPos->Col(), pPos->Row(), pPos->Tab());
+
+        if (aString.isEmpty())
+        {
+            OUStringBuffer aBuf(ScGlobal::GetRscString(STR_COLUMN));
+            aBuf.append(' ');
+            if ( pPos )
+                nPosCol = pPos->Col() + 1;
+            else
+                nPosCol++;
+            ScAddress aPos( nPosCol - 1, 0, 0 );
+            aBuf.append(aPos.Format(SCA_VALID_COL, NULL));
+            aString = aBuf.makeStringAndClear();
         }
+        pMemChart->SetColText( nCol, aString);
+    }
 
-        //  Row header
+    //  Row header
 
-        SCROW nPosRow = 0;
-        for ( nRow = 0; nRow < nRowCount; nRow++ )
-        {
-            OUString aString;
-            const ScAddress* pPos = GetPositionMap()->GetRowHeaderPosition( nRow );
-            if ( HasRowHeaders() && pPos )
-                aString = pDocument->GetString(pPos->Col(), pPos->Row(), pPos->Tab());
+    SCROW nPosRow = 0;
+    for ( nRow = 0; nRow < nRowCount; nRow++ )
+    {
+        OUString aString;
+        const ScAddress* pPos = GetPositionMap()->GetRowHeaderPosition( nRow );
+        if ( HasRowHeaders() && pPos )
+            aString = pDocument->GetString(pPos->Col(), pPos->Row(), pPos->Tab());
 
-            if (aString.isEmpty())
-            {
-                OUStringBuffer aBuf(ScGlobal::GetRscString(STR_ROW));
-                aBuf.append(' ');
-                if ( pPos )
-                    nPosRow = pPos->Row() + 1;
-                else
-                    nPosRow++;
-                aBuf.append(static_cast<sal_Int32>(nPosRow));
-                aString = aBuf.makeStringAndClear();
-            }
-            pMemChart->SetRowText( nRow, aString);
+        if (aString.isEmpty())
+        {
+            OUStringBuffer aBuf(ScGlobal::GetRscString(STR_ROW));
+            aBuf.append(' ');
+            if ( pPos )
+                nPosRow = pPos->Row() + 1;
+            else
+                nPosRow++;
+            aBuf.append(static_cast<sal_Int32>(nPosRow));
+            aString = aBuf.makeStringAndClear();
         }
+        pMemChart->SetRowText( nRow, aString);
     }
 
     return pMemChart;
diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index 9571960..029d502 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -4415,16 +4415,12 @@ sal_uLong ScChangeTrack::AddLoadedGenerated(
     const ScCellValue& rNewCell, const ScBigRange& aBigRange, const OUString& sNewValue )
 {
     ScChangeActionContent* pAct = new ScChangeActionContent( --nGeneratedMin, rNewCell, aBigRange, pDoc, sNewValue );
-    if ( pAct )
-    {
-        if ( pFirstGeneratedDelContent )
-            pFirstGeneratedDelContent->pPrev = pAct;
-        pAct->pNext = pFirstGeneratedDelContent;
-        pFirstGeneratedDelContent = pAct;
-        aGeneratedMap.insert( ::std::make_pair( pAct->GetActionNumber(), pAct ) );
-        return pAct->GetActionNumber();
-    }
-    return 0;
+    if ( pFirstGeneratedDelContent )
+        pFirstGeneratedDelContent->pPrev = pAct;
+    pAct->pNext = pFirstGeneratedDelContent;
+    pFirstGeneratedDelContent = pAct;
+    aGeneratedMap.insert( ::std::make_pair( pAct->GetActionNumber(), pAct ) );
+    return pAct->GetActionNumber();
 }
 
 void ScChangeTrack::AppendCloned( ScChangeAction* pAppend )
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index b488821..e6d7e3d 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -3465,11 +3465,8 @@ void ScXMLExport::ExportShape(const uno::Reference < drawing::XShape >& xShape,
                                     {
                                         bIsChart = true;
                                         SvXMLAttributeList* pAttrList = new SvXMLAttributeList();
-                                        if ( pAttrList )
-                                        {
-                                            pAttrList->AddAttribute(
-                                                GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_DRAW, GetXMLToken( XML_NOTIFY_ON_UPDATE_OF_RANGES ) ), sRanges );
-                                        }
+                                        pAttrList->AddAttribute(
+                                            GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_DRAW, GetXMLToken( XML_NOTIFY_ON_UPDATE_OF_RANGES ) ), sRanges );
                                         GetShapeExport()->exportShape( xShape, XMLShapeExportFlags::NO_CHART_DATA | SEF_DEFAULT, pPoint, pAttrList );
                                     }
                                 }
diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx
index fb17833..b671c79 100644
--- a/sc/source/ui/Accessibility/AccessibleDocument.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx
@@ -1195,7 +1195,7 @@ uno::Reference<XAccessibleRelationSet> ScChildrenShapes::GetRelationSet(const Sc
 {
     utl::AccessibleRelationSetHelper* pRelationSet = new utl::AccessibleRelationSetHelper();
 
-    if(pData && pRelationSet && mpAccessibleDocument)
+    if (pData && mpAccessibleDocument)
     {
         uno::Reference<XAccessible> xAccessible = mpAccessibleDocument->GetAccessibleSpreadsheet(); // should be the current table
         if (pData->pRelationCell && xAccessible.is())
diff --git a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
index f577923..c366349 100644
--- a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
@@ -140,20 +140,15 @@ ScNotesChildren::~ScNotesChildren()
 
 ::accessibility::AccessibleTextHelper* ScNotesChildren::CreateTextHelper(const OUString& rString, const Rectangle& rVisRect, const ScAddress& aCellPos, bool bMarkNote, sal_Int32 nChildOffset) const
 {
-    ::accessibility::AccessibleTextHelper* pTextHelper = NULL;
-
     ::std::unique_ptr < ScAccessibleTextData > pAccessiblePreviewHeaderCellTextData
         (new ScAccessibleNoteTextData(mpViewShell, rString, aCellPos, bMarkNote));
     ::std::unique_ptr< SvxEditSource > pEditSource (new ScAccessibilityEditSource(std::move(pAccessiblePreviewHeaderCellTextData)));
 
-    pTextHelper = new ::accessibility::AccessibleTextHelper(std::move(pEditSource));
+    ::accessibility::AccessibleTextHelper* pTextHelper = new ::accessibility::AccessibleTextHelper(std::move(pEditSource));
 
-    if (pTextHelper)
-    {
-        pTextHelper->SetEventSource(mpAccDoc);
-        pTextHelper->SetStartIndex(nChildOffset);
-        pTextHelper->SetOffset(rVisRect.TopLeft());
-    }
+    pTextHelper->SetEventSource(mpAccDoc);
+    pTextHelper->SetStartIndex(nChildOffset);
+    pTextHelper->SetOffset(rVisRect.TopLeft());
 
     return pTextHelper;
 }
diff --git a/sd/source/filter/eppt/eppt.cxx b/sd/source/filter/eppt/eppt.cxx
index c5e4b2f..4c98f0b 100644
--- a/sd/source/filter/eppt/eppt.cxx
+++ b/sd/source/filter/eppt/eppt.cxx
@@ -1453,17 +1453,10 @@ extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL ExportPPT( const std::vector<
                         ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > & rXStatInd,
                             SvMemoryStream* pVBA, sal_uInt32 nCnvrtFlags )
 {
-    PPTWriter*  pPPTWriter;
-    bool bStatus = false;
-
-    pPPTWriter = new PPTWriter( rSvStorage, rXModel, rXStatInd, pVBA, nCnvrtFlags );
-    if ( pPPTWriter )
-    {
-        pPPTWriter->exportPPT(rMediaData);
-        bStatus = pPPTWriter->IsValid();
-        delete pPPTWriter;
-    }
-
+    PPTWriter* pPPTWriter = new PPTWriter( rSvStorage, rXModel, rXStatInd, pVBA, nCnvrtFlags );
+    pPPTWriter->exportPPT(rMediaData);
+    bool bStatus = pPPTWriter->IsValid();
+    delete pPPTWriter;
     return bStatus;
 }
 
@@ -1486,14 +1479,11 @@ extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL SaveVBA( SfxObjectShell& rDocS
                 if ( nLen )
                 {
                     char* pTemp = new char[ nLen ];
-                    if ( pTemp )
-                    {
-                        xTemp->Seek( STREAM_SEEK_TO_BEGIN );
-                        xTemp->Read( pTemp, nLen );
-                        pBas = new SvMemoryStream( pTemp, nLen, StreamMode::READ );
-                        pBas->ObjectOwnsMemory( true );
-                        return true;
-                    }
+                    xTemp->Seek( STREAM_SEEK_TO_BEGIN );
+                    xTemp->Read( pTemp, nLen );
+                    pBas = new SvMemoryStream( pTemp, nLen, StreamMode::READ );
+                    pBas->ObjectOwnsMemory( true );
+                    return true;
                 }
             }
         }
diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
index ca8ba0d..88f5f4b 100644
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -853,8 +853,7 @@ bool ImplSdPPTImport::Import()
                 }
             }
         }
-        if( pStbMgr )
-            pStbMgr->SetState( nImportedPages++ );
+        pStbMgr->SetState( nImportedPages++ );
     }
 
     // importing slide pages
@@ -984,8 +983,7 @@ bool ImplSdPPTImport::Import()
                         static_cast<SdrPageObj*>(pPageObj)->SetReferencedPage(pSdrModel->GetPage(( nPage << 1 ) + 1));
                 }
 
-                if( pStbMgr )
-                    pStbMgr->SetState( nImportedPages++ );
+                pStbMgr->SetState( nImportedPages++ );
             }
         }
         else
@@ -1257,30 +1255,27 @@ bool ImplSdPPTImport::Import()
                                 if ( pList )
                                 {
                                     SdCustomShow* pSdCustomShow = new SdCustomShow( mpDoc );
-                                    if ( pSdCustomShow )
+                                    pSdCustomShow->SetName( aCuShow );
+                                    sal_uInt32 nFound = 0;
+                                    for ( sal_uInt32 nS = 0; nS < nSCount; nS++ )
                                     {
-                                        pSdCustomShow->SetName( aCuShow );
-                                        sal_uInt32 nFound = 0;
-                                        for ( sal_uInt32 nS = 0; nS < nSCount; nS++ )
+                                        sal_uInt32 nPageNumber;
+                                        rStCtrl.ReadUInt32( nPageNumber );
+                                        sal_uInt16 nPage = pPageList->FindPage( nPageNumber );
+                                        if ( nPage != PPTSLIDEPERSIST_ENTRY_NOTFOUND )
                                         {
-                                            sal_uInt32 nPageNumber;
-                                            rStCtrl.ReadUInt32( nPageNumber );
-                                            sal_uInt16 nPage = pPageList->FindPage( nPageNumber );
-                                            if ( nPage != PPTSLIDEPERSIST_ENTRY_NOTFOUND )
+                                            SdPage* pPage = mpDoc->GetSdPage( nPage, PK_STANDARD );
+                                            if ( pPage )
                                             {
-                                                SdPage* pPage = mpDoc->GetSdPage( nPage, PK_STANDARD );
-                                                if ( pPage )
-                                                {
-                                                    pSdCustomShow->PagesVector().push_back( pPage );
-                                                    nFound++;
-                                                }
+                                                pSdCustomShow->PagesVector().push_back( pPage );
+                                                nFound++;
                                             }
                                         }
-                                        if ( nFound )
-                                            pList->push_back( pSdCustomShow );
-                                        else
-                                            delete pSdCustomShow;
                                     }
+                                    if ( nFound )
+                                        pList->push_back( pSdCustomShow );
+                                    else
+                                        delete pSdCustomShow;
                                 }
                             }
                         }
diff --git a/svx/source/dialog/contwnd.cxx b/svx/source/dialog/contwnd.cxx
index 7587a24..cea52c2 100644
--- a/svx/source/dialog/contwnd.cxx
+++ b/svx/source/dialog/contwnd.cxx
@@ -67,18 +67,15 @@ void ContourWindow::SetPolyPolygon( const tools::PolyPolygon& rPolyPoly )
         aPolyPolygon.append(aPolyPoly[ i ].getB2DPolygon());
         SdrPathObj* pPathObj = new SdrPathObj( OBJ_PATHFILL, aPolyPolygon );
 
-        if ( pPathObj )
-        {
-            SfxItemSet aSet( pModel->GetItemPool() );
+        SfxItemSet aSet( pModel->GetItemPool() );
 
-            aSet.Put( XFillStyleItem( drawing::FillStyle_SOLID ) );
-            aSet.Put( XFillColorItem( "", TRANSCOL ) );
-            aSet.Put( XFillTransparenceItem( 50 ) );
+        aSet.Put( XFillStyleItem( drawing::FillStyle_SOLID ) );
+        aSet.Put( XFillColorItem( "", TRANSCOL ) );
+        aSet.Put( XFillTransparenceItem( 50 ) );
 
-            pPathObj->SetMergedItemSetAndBroadcast(aSet);
+        pPathObj->SetMergedItemSetAndBroadcast(aSet);
 
-            pPage->InsertObject( pPathObj );
-        }
+        pPage->InsertObject( pPathObj );
     }
 
     if ( nPolyCount )
diff --git a/svx/source/form/datanavi.cxx b/svx/source/form/datanavi.cxx
index 9081361..1b2f773 100644
--- a/svx/source/form/datanavi.cxx
+++ b/svx/source/form/datanavi.cxx
@@ -205,10 +205,8 @@ namespace svxform
         }
         OXFormsTransferable *pTransferable = new OXFormsTransferable(desc);
         Reference< XTransferable > xEnsureDelete = pTransferable;
-        if(pTransferable) {
-            EndSelection();
-            pTransferable->StartDrag( this, DND_ACTION_COPY );
-        }
+        EndSelection();
+        pTransferable->StartDrag( this, DND_ACTION_COPY );
     }
 
     PopupMenu* DataTreeListBox::CreateContextMenu()
diff --git a/svx/source/form/tabwin.cxx b/svx/source/form/tabwin.cxx
index 60edd9b..da4ad2d 100644
--- a/svx/source/form/tabwin.cxx
+++ b/svx/source/form/tabwin.cxx
@@ -159,11 +159,8 @@ void FmFieldWinListBox::StartDrag( sal_Int8 /*_nAction*/, const Point& /*_rPosPi
         aDescriptor, CTF_FIELD_DESCRIPTOR | CTF_CONTROL_EXCHANGE | CTF_COLUMN_DESCRIPTOR
     );
     Reference< XTransferable> xEnsureDelete = pTransferColumn;
-    if (pTransferColumn)
-    {
-        EndSelection();
-        pTransferColumn->StartDrag( this, DND_ACTION_COPY );
-    }
+    EndSelection();
+    pTransferColumn->StartDrag( this, DND_ACTION_COPY );
 }
 
 FmFieldWinData::FmFieldWinData()
diff --git a/svx/source/sidebar/nbdtmg.cxx b/svx/source/sidebar/nbdtmg.cxx
index e2ae286..de02aa9 100644
--- a/svx/source/sidebar/nbdtmg.cxx
+++ b/svx/source/sidebar/nbdtmg.cxx
@@ -524,7 +524,7 @@ GraphyicBulletsTypeMgr::GraphyicBulletsTypeMgr(const GraphyicBulletsTypeMgr& aTy
     {
         GrfBulDataRelation* pEntry = new GrfBulDataRelation(eNBType::GRAPHICBULLETS);
         GrfBulDataRelation* pSrcEntry = aTypeMgr.aGrfDataLst[i];
-        if ( pEntry && pSrcEntry)
+        if (pSrcEntry)
         {
             pEntry->bIsCustomized = pSrcEntry->bIsCustomized;
             pEntry->nTabIndex = pSrcEntry->nTabIndex;
commit d59358ee28f0cd3e1eb56a0a923f165304fc17c9
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Mar 10 20:37:16 2015 +0000

    slightly odd stuff here
    
    Change-Id: I715d49722ebe4658c108cb9b7bd6fa3934d973f8

diff --git a/lotuswordpro/source/filter/lwpbackgroundstuff.cxx b/lotuswordpro/source/filter/lwpbackgroundstuff.cxx
index 8a19cc9..ffaa752 100644
--- a/lotuswordpro/source/filter/lwpbackgroundstuff.cxx
+++ b/lotuswordpro/source/filter/lwpbackgroundstuff.cxx
@@ -83,14 +83,11 @@ void LwpBackgroundStuff::GetPattern(sal_uInt16 btPttnIndex, sal_uInt8* pPttnArra
         assert(false);
         return;
     }
-    if (pPttnArray)
+    assert((2 < btPttnIndex) && (btPttnIndex < 72));
+    const sal_uInt8* pTempArray = s_pLwpPatternTab[btPttnIndex];
+    for(sal_uInt8 i = 0; i < 32; i++)
     {
-        assert((2 < btPttnIndex) && (btPttnIndex < 72));
-        const sal_uInt8* pTempArray = s_pLwpPatternTab[btPttnIndex];
-        for(sal_uInt8 i = 0; i < 32; i++)
-        {
-            pPttnArray[i] = (i%4 == 0) ? pTempArray[7-i/4] : 0;
-        }
+        pPttnArray[i] = (i%4 == 0) ? pTempArray[7-i/4] : 0;
     }
 }
 
@@ -113,22 +110,16 @@ XFBGImage* LwpBackgroundStuff::GetFillPattern()
     }
 
     // get pattern array from pattern table
-    sal_uInt8* pPttnArray = new sal_uInt8 [32];
-    this->GetPattern(m_nID, pPttnArray);
+    sal_uInt8 aPttnArray[32];
+    GetPattern(m_nID, aPttnArray);
 
     // create bitmap object from the pattern array
     Bitmap aBmp( Size(8, 8), 1 );
     BitmapWriteAccess* pWA = aBmp.AcquireWriteAccess();
     sal_uInt8* pBuf = pWA->GetBuffer();
-    memcpy(pBuf, pPttnArray, 32);
+    memcpy(pBuf, aPttnArray, 32);
     aBmp.ReleaseAccess(pWA);
 
-    if (pPttnArray)
-    {
-        delete [] pPttnArray;
-        pPttnArray = NULL;
-    }
-
     // create XOBitmap object from bitmap object
     XOBitmap aXOBitmap( aBmp );
     aXOBitmap.Bitmap2Array();


More information about the Libreoffice-commits mailing list