[Libreoffice-commits] core.git: 17 commits - sc/source sd/source sfx2/source svtools/source sw/source

Caolán McNamara caolanm at redhat.com
Wed Mar 5 12:41:32 PST 2014


 sc/source/core/data/funcdesc.cxx         |    2 -
 sd/source/ui/func/fuchar.cxx             |   13 ++++++-----
 sd/source/ui/func/fucopy.cxx             |   32 ++++++++++++++---------------
 sd/source/ui/func/fudraw.cxx             |    2 -
 sd/source/ui/func/fuparagr.cxx           |   34 +++++++++++++++----------------
 sd/source/ui/func/fupoor.cxx             |    2 -
 sd/source/ui/func/futext.cxx             |   23 +++++++++++++-------
 sd/source/ui/slideshow/showwin.cxx       |    3 +-
 sd/source/ui/slideshow/slideshowimpl.cxx |    8 ++++---
 sfx2/source/doc/docfilt.cxx              |   13 -----------
 svtools/source/control/scriptedtext.cxx  |    2 -
 sw/source/core/crsr/swcrsr.cxx           |   25 +++++++++++++++++-----
 sw/source/filter/ww8/docxexport.cxx      |    7 ++++--
 sw/source/filter/ww8/wrtw8sty.cxx        |    2 -
 sw/source/filter/ww8/wrtww8.cxx          |    2 -
 15 files changed, 93 insertions(+), 77 deletions(-)

New commits:
commit 4516e300534fe982bb42d5b58b872406fa7991c5
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Mar 5 20:39:27 2014 +0000

    crash indexing -1
    
    Change-Id: Ia339bed9bad3b43ec1e4ea813646cab81cf3a619

diff --git a/svtools/source/control/scriptedtext.cxx b/svtools/source/control/scriptedtext.cxx
index 23e5d56..acc1ab7 100644
--- a/svtools/source/control/scriptedtext.cxx
+++ b/svtools/source/control/scriptedtext.cxx
@@ -233,7 +233,7 @@ void SvtScriptedTextHelper_Impl::CalculateBreaks( const uno::Reference< i18n::XB
                                 maScriptVec.push_back( nScript );
                                 nCharIx = nNextCharIx;
                             }
-                            while( nCharIx < nNextPos );
+                            while( nCharIx < nNextPos && nCharIx != -1 );
                         }
                         // nothing to do for following portions
                     }
commit adb265b23118a8fe172e6ce978c77e4b1e0b0d67
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Mar 5 20:25:48 2014 +0000

    coverity#982309 Logically dead code
    
    Change-Id: Id05614cf8c90d1c845876e8a6592df8420d57d47

diff --git a/sfx2/source/doc/docfilt.cxx b/sfx2/source/doc/docfilt.cxx
index 60b53bc..f62ae7d 100644
--- a/sfx2/source/doc/docfilt.cxx
+++ b/sfx2/source/doc/docfilt.cxx
@@ -190,7 +190,6 @@ OUString SfxFilter::GetTypeFromStorage(
         throw ( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
 {
     SfxFilterMatcher aMatcher;
-    const char* pType=0;
     OUString aName;
     if ( pFilterName )
     {
@@ -243,17 +242,7 @@ OUString SfxFilter::GetTypeFromStorage(
         }
     }
 
-    //TODO: do it without SfxFilter
-    //TODO/LATER: don't yield FilterName, should be done in FWK!
-    OUString aRet;
-    if ( pType )
-    {
-        aRet = OUString::createFromAscii(pType);
-        if ( pFilterName )
-            *pFilterName = aMatcher.GetFilter4EA( aRet )->GetName();
-    }
-
-    return aRet;
+    return OUString();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit e7da9d42350a7d51798e0c60c7655f99d03aa3f5
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Mar 5 17:01:45 2014 +0000

    coverity#735941 Dereference after null check
    
    Change-Id: Ic4b27068cb3dc359ec24d4af12c64585a3a3f09a

diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index b68368c..493a57d 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -796,8 +796,11 @@ void DocxExport::WriteSettings()
             FSEND );
 
     // Zoom
-    OString aZoom(OString::number(pViewShell->GetViewOptions()->GetZoom()));
-    pFS->singleElementNS(XML_w, XML_zoom, FSNS(XML_w, XML_percent), aZoom.getStr(), FSEND);
+    if (pViewShell)
+    {
+        OString aZoom(OString::number(pViewShell->GetViewOptions()->GetZoom()));
+        pFS->singleElementNS(XML_w, XML_zoom, FSNS(XML_w, XML_percent), aZoom.getStr(), FSEND);
+    }
 
     // Display Background Shape
     if (boost::optional<const SvxBrushItem*> oBrush = getBackground())
commit 8e3593107b6eca1935b3b6134f662542a9013096
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Mar 5 17:00:11 2014 +0000

    coverity#735944 Dereference after null check
    
    Change-Id: I2123943de85d80127042a5b3e8f5b0c1b2b4f288

diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx
index a506801..57266c7 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -1048,7 +1048,7 @@ MSWordSections::MSWordSections( MSWordExportBase& rExport )
         pSet = &pTblNd->GetTable().GetFrmFmt()->GetAttrSet();
         pNd = pTblNd;
     }
-    else if ( 0 != ( pSectNd = pNd->FindSectionNode() ) )
+    else if (pNd && 0 != ( pSectNd = pNd->FindSectionNode() ))
     {
         if ( TOX_HEADER_SECTION == pSectNd->GetSection().GetType() &&
              pSectNd->StartOfSectionNode()->IsSectionNode() )
commit c64aac2f18c25f6c8c3c6261c80fd923bed0f9b2
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Mar 5 16:57:00 2014 +0000

    coverity#735945 Dereference after null check
    
    Change-Id: I960f91ad25036f39d173fdcd9425cd2196eaa11e

diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index cfc6680..6457e5a 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -3103,7 +3103,7 @@ void WW8Export::ExportDocument_Impl()
     aTempData.EnableKillingFile();
 
     msfilter::MSCodec_Std97 aCtx;
-    bool bEncrypt = m_pWriter ? m_pWriter->InitStd97CodecUpdateMedium( aCtx ) : false;
+    bool bEncrypt = GetWriter().InitStd97CodecUpdateMedium(aCtx);
     if ( bEncrypt )
     {
         GetWriter().SetStream(
commit b0c7d88f650e10f2d3b8e29fad547bcb8198ef08
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Mar 5 16:54:04 2014 +0000

    coverity#704764 Dereference after null check
    
    Change-Id: I93ae20005c3d4dbe0b85a4ae79eba683c7355c88

diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx
index b1c0f6f..a19950e 100644
--- a/sd/source/ui/slideshow/slideshowimpl.cxx
+++ b/sd/source/ui/slideshow/slideshowimpl.cxx
@@ -970,7 +970,7 @@ bool SlideshowImpl::startShow( PresentationSettingsEx* pPresSettings )
         }
         else
         {
-            if( pStartPage->GetPageKind() != PK_STANDARD )
+            if( !pStartPage || pStartPage->GetPageKind() != PK_STANDARD )
             {
                 bStartWithActualSlide = false;
             }
commit eef3f4ce5a5d7a653ac84a2716af717030a32fe0
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Mar 5 16:52:32 2014 +0000

    coverity#704763 Dereference after null check
    
    Change-Id: I7d78ef1ffc939602baf9a16c4ca18b8f5f4c4d48

diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx
index 4c1273f..b1c0f6f 100644
--- a/sd/source/ui/slideshow/slideshowimpl.cxx
+++ b/sd/source/ui/slideshow/slideshowimpl.cxx
@@ -741,7 +741,8 @@ void SAL_CALL SlideshowImpl::disposing()
                 Size aVisSizePixel = pActWin->GetOutputSizePixel();
                 Rectangle aVisAreaWin = pActWin->PixelToLogic( Rectangle( Point(0,0), aVisSizePixel) );
                 mpViewShell->VisAreaChanged(aVisAreaWin);
-                mpView->VisAreaChanged(pActWin);
+                if (mpView)
+                    mpView->VisAreaChanged(pActWin);
                 pActWin->GrabFocus();
             }
         }
commit 6509003628d635fb93cbcdef0365dc11801d125e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Mar 5 16:51:47 2014 +0000

    coverity#704762 Dereference after null check
    
    Change-Id: I28555dcf30eb3a6f71b3808025771294a088aaa8

diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx
index 953312e..4c1273f 100644
--- a/sd/source/ui/slideshow/slideshowimpl.cxx
+++ b/sd/source/ui/slideshow/slideshowimpl.cxx
@@ -673,7 +673,8 @@ void SAL_CALL SlideshowImpl::disposing()
     if( mpViewShell )
     {
         mpViewShell->SetActiveWindow(mpOldActiveWindow);
-        mpShowWindow->SetViewShell( NULL );
+        if (mpShowWindow)
+            mpShowWindow->SetViewShell( NULL );
     }
 
     if( mpView )
commit 76fe205d7e0fe0a73616453209d8094cab9ce79f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Mar 5 16:49:56 2014 +0000

    coverity#704761 Dereference after null check
    
    Change-Id: I8e65332f202158e503da9b707bb9d6305133e68e

diff --git a/sd/source/ui/slideshow/showwin.cxx b/sd/source/ui/slideshow/showwin.cxx
index aa4ae87..9d9f35c 100644
--- a/sd/source/ui/slideshow/showwin.cxx
+++ b/sd/source/ui/slideshow/showwin.cxx
@@ -481,7 +481,8 @@ void ShowWindow::RestartShow( sal_Int32 nPageIndexToRestart )
     // show navigator?
     if( mbShowNavigatorAfterSpecialMode )
     {
-        mpViewShell->GetViewFrame()->ShowChildWindow( SID_NAVIGATOR, sal_True );
+        if (mpViewShell)
+            mpViewShell->GetViewFrame()->ShowChildWindow( SID_NAVIGATOR, sal_True );
         mbShowNavigatorAfterSpecialMode = false;
     }
 }
commit a96c4e3b1456d0f11fcd3e3374b0d457374e207b
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Mar 5 16:48:52 2014 +0000

    coverity#704760 Dereference after null check
    
    Change-Id: I16a1b9803eb4cbd6ce77c9017262093908261097

diff --git a/sd/source/ui/func/futext.cxx b/sd/source/ui/func/futext.cxx
index 5555d3a..615ee4b 100644
--- a/sd/source/ui/func/futext.cxx
+++ b/sd/source/ui/func/futext.cxx
@@ -614,17 +614,24 @@ sal_Bool FuText::MouseButtonUp(const MouseEvent& rMEvt)
 
     if (mxTextObj.is())
     {
-        const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+        bool bReset = true;
 
-        if (rMarkList.GetMarkCount() == 1
-            && ( rMarkList.GetMark(0)->GetMarkedSdrObj() == mxTextObj.get()) )
+        if (mpView)
         {
-            if( mxTextObj.is() && !GetTextObj()->GetOutlinerParaObject() )
-                bEmptyTextObj = sal_True;
-            else
-                bFirstObjCreated = sal_True;
+            const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+
+            if (rMarkList.GetMarkCount() == 1
+                && ( rMarkList.GetMark(0)->GetMarkedSdrObj() == mxTextObj.get()) )
+            {
+                if( mxTextObj.is() && !GetTextObj()->GetOutlinerParaObject() )
+                    bEmptyTextObj = sal_True;
+                else
+                    bFirstObjCreated = sal_True;
+                bReset = false;
+            }
         }
-        else
+
+        if (bReset)
         {
             mxTextObj.reset( 0 );
         }
commit 5a6195974b8d1bb2ed15d80523782c062e886b93
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Mar 5 16:42:28 2014 +0000

    coverity#704755 Dereference after null check
    
    Change-Id: I887a3ce81b2eea878b98e5567a6faf4aa8df4ebe

diff --git a/sd/source/ui/func/fupoor.cxx b/sd/source/ui/func/fupoor.cxx
index e405536..1584306 100644
--- a/sd/source/ui/func/fupoor.cxx
+++ b/sd/source/ui/func/fupoor.cxx
@@ -676,7 +676,7 @@ sal_Bool FuPoor::KeyInput(const KeyEvent& rKEvt)
                     else if(rKEvt.GetKeyCode().IsMod2())
                     {
                         // move in 1 pixel distance
-                        Size aLogicSizeOnePixel = (mpWindow) ? mpWindow->PixelToLogic(Size(1,1)) : Size(100, 100);
+                        Size aLogicSizeOnePixel = mpWindow->PixelToLogic(Size(1,1));
                         nX *= aLogicSizeOnePixel.Width();
                         nY *= aLogicSizeOnePixel.Height();
                     }
commit bcea4ec750aa358c75b909633c7a8cd1b7f13a9b
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Mar 5 16:40:41 2014 +0000

    coverity#704754 Dereference after null check
    
    Change-Id: I3c70c9cfe84dc74836cf733e424cf7c2cd195c4f

diff --git a/sd/source/ui/func/fuparagr.cxx b/sd/source/ui/func/fuparagr.cxx
index 512bd7a..e4250ed 100644
--- a/sd/source/ui/func/fuparagr.cxx
+++ b/sd/source/ui/func/fuparagr.cxx
@@ -91,28 +91,28 @@ void FuParagraph::DoExecute( SfxRequest& rReq )
 
         SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
         SfxAbstractTabDialog* pDlg = pFact ? pFact->CreateSdParagraphTabDlg(NULL, &aNewAttr ) : 0;
-        if( pDlg )
+        if (!pDlg)
+            return;
+
+        sal_uInt16 nResult = pDlg->Execute();
+
+        switch( nResult )
         {
-            sal_uInt16 nResult = pDlg->Execute();
+            case RET_OK:
+            {
+                rReq.Done( *( pDlg->GetOutputItemSet() ) );
+
+                pArgs = rReq.GetArgs();
+            }
+            break;
 
-            switch( nResult )
+            default:
             {
-                case RET_OK:
-                {
-                    rReq.Done( *( pDlg->GetOutputItemSet() ) );
-
-                    pArgs = rReq.GetArgs();
-                }
-                break;
-
-                default:
-                {
-                    delete pDlg;
-                }
-                return; // Cancel
+                delete pDlg;
             }
-            delete( pDlg );
+            return; // Cancel
         }
+        delete( pDlg );
     }
     mpView->SetAttributes( *pArgs );
 
commit 229e59d478c77160659c93ed328b883552519e09
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Mar 5 16:35:41 2014 +0000

    coverity#704749 Dereference after null check
    
    Change-Id: Id74676712afb4753c9e2b1a81043190451b90f01

diff --git a/sd/source/ui/func/fudraw.cxx b/sd/source/ui/func/fudraw.cxx
index f91c4c4..6974f6a 100644
--- a/sd/source/ui/func/fudraw.cxx
+++ b/sd/source/ui/func/fudraw.cxx
@@ -381,7 +381,7 @@ sal_Bool FuDraw::KeyInput(const KeyEvent& rKEvt)
         {
             if (!mpDocSh->IsReadOnly())
             {
-                if ( mpView && mpView->IsPresObjSelected(sal_False, sal_True, sal_False, sal_True) )
+                if (mpView->IsPresObjSelected(sal_False, sal_True, sal_False, sal_True))
                 {
                     InfoBox(mpWindow, SD_RESSTR(STR_ACTION_NOTPOSSIBLE) ).Execute();
                 }
commit 0b6726867de88e49b9de19ea7da7defb7f808130
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Mar 5 16:24:25 2014 +0000

    coverity#704748 Dereference after null check
    
    Change-Id: I4dd13cb4a39422b26d4e695c1fbb739eaee96368

diff --git a/sd/source/ui/func/fucopy.cxx b/sd/source/ui/func/fucopy.cxx
index ee4e948..a2b1b1d 100644
--- a/sd/source/ui/func/fucopy.cxx
+++ b/sd/source/ui/func/fucopy.cxx
@@ -100,27 +100,27 @@ void FuCopy::DoExecute( SfxRequest& rReq )
             if( pFact )
             {
                 AbstractCopyDlg* pDlg = pFact->CreateCopyDlg(NULL, aSet, mpDoc->GetColorList(), mpView );
-                if( pDlg )
+                if (!pDlg)
+                    return;
+
+                sal_uInt16 nResult = pDlg->Execute();
+
+                switch( nResult )
                 {
-                    sal_uInt16 nResult = pDlg->Execute();
+                    case RET_OK:
+                        pDlg->GetAttr( aSet );
+                        rReq.Done( aSet );
+                        pArgs = rReq.GetArgs();
+                    break;
 
-                    switch( nResult )
+                    default:
                     {
-                        case RET_OK:
-                            pDlg->GetAttr( aSet );
-                            rReq.Done( aSet );
-                            pArgs = rReq.GetArgs();
-                        break;
-
-                        default:
-                        {
-                            delete pDlg;
-                            mpView->EndUndo();
-                        }
-                        return; // Cancel
+                        delete pDlg;
+                        mpView->EndUndo();
                     }
-                    delete( pDlg );
+                    return; // Cancel
                 }
+                delete pDlg;
             }
         }
 
commit 7eaa311ce2d917ac961eac0a26a7ced90dffdf40
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Mar 5 16:21:53 2014 +0000

    coverity#704747 Dereference after null check
    
    Change-Id: I1da494393c3a1a697bf31b00f57b33a03c674872

diff --git a/sd/source/ui/func/fuchar.cxx b/sd/source/ui/func/fuchar.cxx
index 95d3027..d9549b1 100644
--- a/sd/source/ui/func/fuchar.cxx
+++ b/sd/source/ui/func/fuchar.cxx
@@ -72,13 +72,15 @@ void FuChar::DoExecute( SfxRequest& rReq )
 
         SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
         SfxAbstractTabDialog* pDlg = pFact ? pFact->CreateSdTabCharDialog( NULL, &aNewAttr, mpDoc->GetDocSh() ) : 0;
+        sal_uInt16 nResult = RET_CANCEL;
         if( pDlg )
         {
             if (rReq.GetSlot() == SID_CHAR_DLG_EFFECT)
             {
                 pDlg->SetCurPageId(RID_SVXPAGE_CHAR_EFFECTS);
             }
-            sal_uInt16 nResult = pDlg->Execute();
+
+            nResult = pDlg->Execute();
 
             if( nResult == RET_OK )
             {
@@ -87,11 +89,10 @@ void FuChar::DoExecute( SfxRequest& rReq )
             }
 
             delete pDlg;
-
-            if( nResult != RET_OK )
-            {
-                return;
-            }
+        }
+        if( nResult != RET_OK )
+        {
+            return;
         }
     }
     mpView->SetAttributes(*pArgs);
commit e59e188404b2666ee04080bd46dc56e05b810d4f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Mar 5 16:08:40 2014 +0000

    coverity#704673 Dereference after null check
    
    Change-Id: I6302c2b8c721e7b2e2c640d905a0c95ee4ba711d

diff --git a/sc/source/core/data/funcdesc.cxx b/sc/source/core/data/funcdesc.cxx
index d0331dc..d7d1f9f 100644
--- a/sc/source/core/data/funcdesc.cxx
+++ b/sc/source/core/data/funcdesc.cxx
@@ -321,7 +321,7 @@ void ScFuncDesc::fillVisibleArgumentMapping(::std::vector<sal_uInt16>& _rArgumen
         nArgs -= VAR_ARGS - 1;
     for (sal_uInt16 i=0; i < nArgs; ++i)
     {
-        if (!pDefArgFlags[i].bSuppress)
+        if (!pDefArgFlags || !pDefArgFlags[i].bSuppress)
             _rArguments.push_back(i);
     }
 }
commit 3b6a4c3bee4696332dd547096d5501e28a195770
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date:   Wed Mar 5 13:24:23 2014 +0000

    Resolves: #i123979# treat application of new position due to...
    
    content frame without height to next/previous content frame as restore to saved
    position, if new position equals the saved one.
    
    This avoid cursor traveling loops due to hidden content at the beginning/end of
    the text document.
    
    (cherry picked from commit 83510855eff12832682adfb0c1093ccb5cfc7b13)
    
    Conflicts:
    	sw/source/core/crsr/swcrsr.cxx
    
    Change-Id: Ie8b6b80e9445d711bfce2143199c49ee238ce23e

diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
index ed73842..7cf197c 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -347,18 +347,31 @@ sal_Bool SwCursor::IsSelOvr( int eFlags )
                 }
             }
 
-            SwCntntNode* pCNd;
-            if( pFrm && 0 != (pCNd = (SwCntntNode*)pFrm->GetNode()) )
+            SwCntntNode* pCNd = (pFrm != NULL) ? (SwCntntNode*)pFrm->GetNode() : NULL;
+            if ( pCNd != NULL )
             {
                 // set this CntntNode as new position
                 rPtIdx = *pCNd;
                 pNd = pCNd;
 
-                // register ContentIndex:
-                GetPoint()->nContent.Assign( pCNd, bGoNxt ? 0 : pCNd->Len() );
+                // assign corresponding ContentIndex
+                const sal_Int32 nTmpPos = bGoNxt ? 0 : pCNd->Len();
+                GetPoint()->nContent.Assign( pCNd, nTmpPos );
 
-                if( IsInProtectTable( sal_True ) )
-                    pFrm = 0;
+                if ( rPtIdx.GetIndex() == pSavePos->nNode
+                     && nTmpPos == pSavePos->nCntnt )
+                {
+                    // new position equals saved one
+                    // --> trigger restore of saved pos by setting <pFrm> to NULL - see below
+                    pFrm = NULL;
+                }
+
+                if ( IsInProtectTable( sal_True ) )
+                {
+                    // new position in protected table
+                    // --> trigger restore of saved pos by setting <pFrm> to NULL - see below
+                    pFrm = NULL;
+                }
             }
         }
 


More information about the Libreoffice-commits mailing list