[Libreoffice-commits] core.git: 20 commits - cppuhelper/source dbaccess/source extensions/source formula/source framework/source oox/source sc/source sd/source sw/source ucb/source

Caolán McNamara caolanm at redhat.com
Sat Mar 22 13:34:05 PDT 2014


 cppuhelper/source/findsofficepath.c                   |    2 
 dbaccess/source/core/api/CRowSetDataColumn.hxx        |    1 
 dbaccess/source/ui/dlg/odbcconfig.cxx                 |    2 
 extensions/source/nsplugin/source/npshell.cxx         |    4 -
 formula/source/ui/dlg/formula.cxx                     |    7 ++
 framework/source/fwi/classes/protocolhandlercache.cxx |    3 -
 oox/source/shape/ShapeContextHandler.cxx              |    2 
 sc/source/core/data/document.cxx                      |   11 ++-
 sc/source/ui/unoobj/dapiuno.cxx                       |    5 +
 sc/source/ui/view/gridwin5.cxx                        |   33 +++++------
 sd/source/core/drawdoc3.cxx                           |   20 ++++---
 sd/source/ui/dlg/sdtreelb.cxx                         |    8 --
 sw/source/core/crsr/pam.cxx                           |   21 ++-----
 sw/source/core/layout/flycnt.cxx                      |    2 
 sw/source/core/uibase/app/docstyle.cxx                |    3 -
 sw/source/core/unocore/unodraw.cxx                    |    2 
 sw/source/core/unocore/unostyle.cxx                   |   50 ++++++++----------
 sw/source/filter/xml/xmlimp.cxx                       |    2 
 ucb/source/inc/regexpmap.hxx                          |    2 
 19 files changed, 89 insertions(+), 91 deletions(-)

New commits:
commit 3eb06071874d2d3a6f868e74876a3129efea434c
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Mar 22 20:33:14 2014 +0000

    coverity#738615 Uninitialized pointer field
    
    Change-Id: I33e67198c99cfa6bd240b4ca7eeeb32c8f91cb6d

diff --git a/dbaccess/source/ui/dlg/odbcconfig.cxx b/dbaccess/source/ui/dlg/odbcconfig.cxx
index f54b3f2..cc9fffa 100644
--- a/dbaccess/source/ui/dlg/odbcconfig.cxx
+++ b/dbaccess/source/ui/dlg/odbcconfig.cxx
@@ -160,12 +160,12 @@ struct OdbcTypesImpl
 OOdbcEnumeration::OOdbcEnumeration()
 #ifdef HAVE_ODBC_SUPPORT
     :m_pAllocHandle(NULL)
+    ,m_pFreeHandle(NULL)
     ,m_pSetEnvAttr(NULL)
     ,m_pDataSources(NULL)
     ,m_pImpl(new OdbcTypesImpl)
 #endif
 {
-
     sal_Bool bLoaded = load(ODBC_LIBRARY);
 #ifdef ODBC_LIBRARY_1
     if ( !bLoaded )
commit 6df6fefed82a4ee37f253f48de61a650db5c4f3a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Mar 22 20:20:37 2014 +0000

    coverity#738610 unused member pointer value
    
    Change-Id: I157c3bb7323767a27ac8a11361e6013bfee1de15

diff --git a/dbaccess/source/core/api/CRowSetDataColumn.hxx b/dbaccess/source/core/api/CRowSetDataColumn.hxx
index a25ccb7..d68dacc 100644
--- a/dbaccess/source/core/api/CRowSetDataColumn.hxx
+++ b/dbaccess/source/core/api/CRowSetDataColumn.hxx
@@ -42,7 +42,6 @@ namespace dbaccess
 
         OUString             m_sLabel;
         OUString             m_aDescription;     // description
-        ORowSetBase*                m_pRowSet;
 
         virtual ~ORowSetDataColumn();
     public:
commit 8a0d8f4c0b72ba69e3ae6109ce871a385b280349
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Mar 22 20:18:46 2014 +0000

    coverity#738657 Uninitialized pointer field
    
    Change-Id: I37c946d37a7f3add6b6798b15f5fb6ab4b7274ff

diff --git a/formula/source/ui/dlg/formula.cxx b/formula/source/ui/dlg/formula.cxx
index 4bef88e..54ea9a6 100644
--- a/formula/source/ui/dlg/formula.cxx
+++ b/formula/source/ui/dlg/formula.cxx
@@ -236,6 +236,7 @@ namespace formula
         ~FormulaDlg_Impl();
 
     };
+
 FormulaDlg_Impl::FormulaDlg_Impl(Dialog* pParent
                                         , bool _bSupportFunctionResult
                                         , bool _bSupportResult
@@ -244,6 +245,10 @@ FormulaDlg_Impl::FormulaDlg_Impl(Dialog* pParent
                                         ,const IFunctionManager* _pFunctionMgr
                                         ,IControlReferenceHandler* _pDlg)
     :
+    m_pSpecialOpCodesEnd(NULL),
+    m_pFunctionOpCodesEnd(NULL),
+    m_pUnaryOpCodesEnd(NULL),
+    m_pBinaryOpCodesEnd(NULL),
     m_pHelper       (_pHelper),
     m_pParent       (pParent),
     m_pDlg          (_pDlg),
@@ -269,6 +274,7 @@ FormulaDlg_Impl::FormulaDlg_Impl(Dialog* pParent
     aFtFormResult   ( pParent, ModuleRes( FT_FORMULA_RESULT)),
     aWndFormResult  ( pParent, ModuleRes( WND_FORMULA_RESULT)),
     pTheRefEdit     (NULL),
+    pTheRefButton   (NULL),
     pMEdit          (NULL),
     bUserMatrixFlag (sal_False),
     aTitle1         ( ModuleRes( STR_TITLE1 ) ),        // local resource
@@ -348,6 +354,7 @@ FormulaDlg_Impl::FormulaDlg_Impl(Dialog* pParent
     aFtFuncName.SetFont(aFntLight);
     aFtFuncDesc.SetFont(aFntLight);
 }
+
 FormulaDlg_Impl::~FormulaDlg_Impl()
 {
     if(aTimer.IsActive())
commit 7ac3a623798fd0f7ca0b8daa51b0005fc2a7eb05
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Mar 22 19:27:03 2014 +0000

    coverity#738659 Uninitialized pointer field
    
    Change-Id: I5d3ebc066f36f9cdcfb031a58ecb9c64ddea26c3

diff --git a/framework/source/fwi/classes/protocolhandlercache.cxx b/framework/source/fwi/classes/protocolhandlercache.cxx
index 64ecf8b..43b59e7 100644
--- a/framework/source/fwi/classes/protocolhandlercache.cxx
+++ b/framework/source/fwi/classes/protocolhandlercache.cxx
@@ -176,7 +176,8 @@ void HandlerCache::takeOver(HandlerHash* pHandler, PatternHash* pPattern)
                 specifies the package name of the configuration data which should be used
  */
 HandlerCFGAccess::HandlerCFGAccess( const OUString& sPackage )
-    : ConfigItem( sPackage )
+    : ConfigItem(sPackage)
+    , m_pCache(0)
 {
     css::uno::Sequence< OUString > lListenPaths(1);
     lListenPaths[0] = SETNAME_HANDLER;
commit 058eb46c9108e8120c06f8a508dbfe5c13a82f96
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Mar 22 19:25:07 2014 +0000

    coverity#1038295 Unchecked dynamic_cast
    
    Change-Id: I80488cc2c5edfaf5e3eb11bed1684d230549a663

diff --git a/oox/source/shape/ShapeContextHandler.cxx b/oox/source/shape/ShapeContextHandler.cxx
index 7e6a217..6ddce1c 100644
--- a/oox/source/shape/ShapeContextHandler.cxx
+++ b/oox/source/shape/ShapeContextHandler.cxx
@@ -476,7 +476,7 @@ ShapeContextHandler::getShape() throw (uno::RuntimeException, std::exception)
         }
         else if (mxWpsContext.is())
         {
-            ShapePtr pShape = dynamic_cast<WpsContext*>(mxWpsContext.get())->getShape();
+            ShapePtr pShape = dynamic_cast<WpsContext&>(*mxWpsContext.get()).getShape();
             if (pShape)
             {
                 basegfx::B2DHomMatrix aMatrix;
commit 3013d986244a916ee5d397db75588f4bc6995d81
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Mar 22 19:19:41 2014 +0000

    coverity#705327 Missing break in switch
    
    Change-Id: Idd05d33394dd56d82be560a6efbdbc96a86d329c

diff --git a/ucb/source/inc/regexpmap.hxx b/ucb/source/inc/regexpmap.hxx
index 0d5fcb7..f677e0b 100644
--- a/ucb/source/inc/regexpmap.hxx
+++ b/ucb/source/inc/regexpmap.hxx
@@ -221,11 +221,13 @@ void RegexpMapIterImpl< Val >::next()
         case Regexp::KIND_DOMAIN:
             if (m_aIndex == m_pMap->m_aList[m_nList].end())
                 return;
+            //fall-through
         default:
             ++m_aIndex;
             if (m_nList == Regexp::KIND_DOMAIN
                 || m_aIndex != m_pMap->m_aList[m_nList].end())
                 break;
+            //fall-through
         case -1:
             do
             {
commit f2598f43568e7de1c84e6ac7e8e01b658e7f06c8
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Mar 22 19:14:05 2014 +0000

    coverity#704372 Logically dead code
    
    handled in earlier special case
    
    Change-Id: I5f1a821504b899802a078d4c7b83eb7cc45e8f97

diff --git a/sw/source/core/uibase/app/docstyle.cxx b/sw/source/core/uibase/app/docstyle.cxx
index 7681b32..a1351bc 100644
--- a/sw/source/core/uibase/app/docstyle.cxx
+++ b/sw/source/core/uibase/app/docstyle.cxx
@@ -2212,9 +2212,6 @@ void  SwDocStyleSheetPool::Replace( SfxStyleSheetBase& rSource,
             pTargetFmt = ((SwDocStyleSheet&)rTarget).GetFrmFmt();
             break;
         case SFX_STYLE_FAMILY_PAGE:
-            if( bSwSrcPool )
-                pSourceFmt = &((SwDocStyleSheet&)rSource).GetPageDesc()
-                                ->GetMaster();
             {
                 SwPageDesc *pDesc = rDoc.FindPageDescByName(
                     ((SwDocStyleSheet&)rTarget).GetPageDesc()->GetName(),
commit 4fecc8cb22c61b2915627ec5732babbe9c16fd43
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Mar 22 19:10:26 2014 +0000

    fix coverity#983381
    
    Change-Id: Ief19052360760977f86b8aa0aa066c9d2b741c98

diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx
index bccdcee..3fa9a40 100644
--- a/sw/source/core/crsr/pam.cxx
+++ b/sw/source/core/crsr/pam.cxx
@@ -724,7 +724,7 @@ bool SwPaM::HasReadonlySel( bool bFormView, bool bAnnotationMode ) const
             // exactly at the end.
             SwPosition aPrevChar(*GetPoint());
             aPrevChar.nContent--;
-            sw::mark::IFieldmark* pFieldmark = pMarksAccess->getFieldmarkFor(aPrevChar);
+            pFieldmark = pMarksAccess->getFieldmarkFor(aPrevChar);
             if (pFieldmark && pFieldmark->GetMarkEnd() == *GetPoint())
                 bRet = true;
         }
commit 691cbc64250e18bfd9c7e02745b2ac4c35d87ea4
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Mar 22 17:56:38 2014 +0000

    coverity#704365 Logically dead code
    
    Change-Id: I8981dfcd3f8c0fcf0ad84bbe87a6d40c1a1a49db

diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index 448b548..0c1f0a4 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -863,38 +863,34 @@ void SwXStyleFamily::insertByName(const OUString& rName, const uno::Any& rElemen
                     pNewStyle = reinterpret_cast< SwXStyle * >(
                             sal::static_int_cast< sal_IntPtr >( xStyleTunnel->getSomething( SwXStyle::getUnoTunnelId()) ));
                 }
-                if(!pNewStyle || !pNewStyle->IsDescriptor() ||
-                    pNewStyle->GetFamily() != eFamily)
-                        throw lang::IllegalArgumentException();
-                if(pNewStyle)
-                {
-                    sal_uInt16 nMask = SFXSTYLEBIT_ALL;
-                    if(eFamily == SFX_STYLE_FAMILY_PARA && !pNewStyle->IsConditional())
-                        nMask &= ~SWSTYLEBIT_CONDCOLL;
+
+                if (!pNewStyle || !pNewStyle->IsDescriptor() || pNewStyle->GetFamily() != eFamily)
+                    throw lang::IllegalArgumentException();
+
+                sal_uInt16 nMask = SFXSTYLEBIT_ALL;
+                if(eFamily == SFX_STYLE_FAMILY_PARA && !pNewStyle->IsConditional())
+                    nMask &= ~SWSTYLEBIT_CONDCOLL;
 #if OSL_DEBUG_LEVEL > 1
-                    SfxStyleSheetBase& rNewBase =
+                SfxStyleSheetBase& rNewBase =
 #endif
-                    pBasePool->Make(sStyleName, eFamily, nMask);
-                    pNewStyle->SetDoc(pDocShell->GetDoc(), pBasePool);
-                    pNewStyle->SetStyleName(sStyleName);
-                    const OUString sParentStyleName(pNewStyle->GetParentStyleName());
-                    if (!sParentStyleName.isEmpty())
-                    {
-                        pBasePool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL );
-                        SfxStyleSheetBase* pParentBase = pBasePool->Find(sParentStyleName);
-                        if(pParentBase && pParentBase->GetFamily() == eFamily &&
-                            &pParentBase->GetPool() == pBasePool)
-                            pBasePool->SetParent( eFamily, sStyleName, sParentStyleName );
+                pBasePool->Make(sStyleName, eFamily, nMask);
+                pNewStyle->SetDoc(pDocShell->GetDoc(), pBasePool);
+                pNewStyle->SetStyleName(sStyleName);
+                const OUString sParentStyleName(pNewStyle->GetParentStyleName());
+                if (!sParentStyleName.isEmpty())
+                {
+                    pBasePool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL );
+                    SfxStyleSheetBase* pParentBase = pBasePool->Find(sParentStyleName);
+                    if(pParentBase && pParentBase->GetFamily() == eFamily &&
+                        &pParentBase->GetPool() == pBasePool)
+                        pBasePool->SetParent( eFamily, sStyleName, sParentStyleName );
 
-                    }
+                }
 #if OSL_DEBUG_LEVEL > 1
-                    (void)rNewBase;
+                (void)rNewBase;
 #endif
-                    //so, jetzt sollten noch die Properties des Descriptors angewandt werden
-                    pNewStyle->ApplyDescriptorProperties();
-                }
-                else
-                    throw lang::IllegalArgumentException();
+                //so, jetzt sollten noch die Properties des Descriptors angewandt werden
+                pNewStyle->ApplyDescriptorProperties();
             }
             else
                 throw lang::IllegalArgumentException();
commit 43ceb40901d97773d729298a8cfedf37685fff99
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Mar 22 17:54:10 2014 +0000

    coverity#704361 bDone initialized to true instead of false
    
    Logically dead code, strongly indicates it should be false initially
    
    since original checkin of 622b652b949b2a339f3328744999bc38e3d6dc2f
    which makes me nervous about fixing it
    
    Change-Id: If482172752693cca94359320b0caee0ae42c4e3b

diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index d45243f..101f998 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -1074,7 +1074,7 @@ void SwXShape::setPropertyValue(const OUString& rPropertyName, const uno::Any& a
                 SwDoc* pDoc = pFmt->GetDoc();
                 if(RES_ANCHOR == pEntry->nWID && MID_ANCHOR_ANCHORFRAME == pEntry->nMemberId)
                 {
-                    bool bDone = true;
+                    bool bDone = false;
                     uno::Reference<text::XTextFrame> xFrame;
                     if(aValue >>= xFrame)
                     {
commit 5f01a51762d1eba9a5c2ea3f04bc87590faa33a3
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Mar 22 17:50:27 2014 +0000

    coverity#983375 Dereference before null check
    
    Change-Id: Ib00b65a5c532c2968785c8783d43d1728b1dfb29

diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 6ff1f7a..e9417bf 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -2166,6 +2166,12 @@ void ScDocument::CopyTabToClip(SCCOL nCol1, SCROW nRow1,
 {
     if (!bIsClip)
     {
+        if (!pClipDoc)
+        {
+            OSL_TRACE("CopyTabToClip: no ClipDoc");
+            pClipDoc = SC_MOD()->GetClipDoc();
+        }
+
         if (pShell->GetMedium())
         {
             pClipDoc->maFileURL = pShell->GetMedium()->GetURLObject().GetMainURL(INetURLObject::DECODE_TO_IURI);
@@ -2193,11 +2199,6 @@ void ScDocument::CopyTabToClip(SCCOL nCol1, SCROW nRow1,
 
         PutInOrder( nCol1, nCol2 );
         PutInOrder( nRow1, nRow2 );
-        if (!pClipDoc)
-        {
-            OSL_TRACE("CopyTabToClip: no ClipDoc");
-            pClipDoc = SC_MOD()->GetClipDoc();
-        }
 
         ScClipParam& rClipParam = pClipDoc->GetClipParam();
         pClipDoc->aDocName = aDocName;
commit efc13bf4928abc56722e1e7762441091f8f390b8
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Mar 22 17:44:27 2014 +0000

    coverity#983377 Dereference before null check
    
    Change-Id: Ifca7439523d63919b631b24d9edc8e471027a7d3

diff --git a/sc/source/ui/view/gridwin5.cxx b/sc/source/ui/view/gridwin5.cxx
index ca2c578..905f5ea 100644
--- a/sc/source/ui/view/gridwin5.cxx
+++ b/sc/source/ui/view/gridwin5.cxx
@@ -213,24 +213,21 @@ bool ScGridWindow::ShowNoteMarker( SCsCOL nPosX, SCsROW nPosY, bool bKeyboard )
             if ( pViewData->GetScDrawView() )
             {
                 // get position for aCellPos
-                if ( pDoc )
-                {
-                    // get draw position in hmm for aCellPos
-                    Point aOldPos( pDoc->GetColOffset( aCellPos.Col(), aCellPos.Tab() ), pDoc->GetRowOffset( aCellPos.Row(), aCellPos.Tab() ) );
-                    aOldPos.X() = sc::TwipsToHMM( aOldPos.X() );
-                    aOldPos.Y() = sc::TwipsToHMM( aOldPos.Y() );
-                    // get screen pos in hmm for aCellPos
-                    // and equiv screen pos
-                    Point aScreenPos = pViewData->GetScrPos( aCellPos.Col(), aCellPos.Row(), eWhich, true );
-                    MapMode aDrawMode = GetDrawMapMode();
-                    Point aCurPosHmm = PixelToLogic(aScreenPos, aDrawMode );
-                    Point aGridOff = aCurPosHmm -aOldPos;
-                    // fdo#63323 fix the X Position for the showing comment when
-                    // the mouse over the cell when the sheet are RTL
-                    if ( pDoc->IsNegativePage(nTab))
-                        aGridOff.setX(aCurPosHmm.getX() + aOldPos.getX());
-                    pNoteMarker->SetGridOff( aGridOff );
-                }
+                // get draw position in hmm for aCellPos
+                Point aOldPos( pDoc->GetColOffset( aCellPos.Col(), aCellPos.Tab() ), pDoc->GetRowOffset( aCellPos.Row(), aCellPos.Tab() ) );
+                aOldPos.X() = sc::TwipsToHMM( aOldPos.X() );
+                aOldPos.Y() = sc::TwipsToHMM( aOldPos.Y() );
+                // get screen pos in hmm for aCellPos
+                // and equiv screen pos
+                Point aScreenPos = pViewData->GetScrPos( aCellPos.Col(), aCellPos.Row(), eWhich, true );
+                MapMode aDrawMode = GetDrawMapMode();
+                Point aCurPosHmm = PixelToLogic(aScreenPos, aDrawMode );
+                Point aGridOff = aCurPosHmm -aOldPos;
+                // fdo#63323 fix the X Position for the showing comment when
+                // the mouse over the cell when the sheet are RTL
+                if ( pDoc->IsNegativePage(nTab))
+                    aGridOff.setX(aCurPosHmm.getX() + aOldPos.getX());
+                pNoteMarker->SetGridOff( aGridOff );
             }
         }
 
commit e14c70c0d5094360a288fed3f428391e337b95de
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Mar 22 17:43:04 2014 +0000

    coverity#983379 Dereference before null check
    
    Change-Id: I357e0618bf31983466566d6b36f63f7830f0a296

diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx
index 70a521c..08f7e5c 100644
--- a/sd/source/ui/dlg/sdtreelb.cxx
+++ b/sd/source/ui/dlg/sdtreelb.cxx
@@ -1487,13 +1487,7 @@ sal_Bool SdPageObjsTLB::NotifyMoving(
         }
 
         // Update the tree list.
-        if (pTarget == NULL)
-        {
-            rpNewParent = 0;
-            rNewChildPos = 0;
-            return sal_True;
-        }
-        else if (GetParent(pDestination) == NULL)
+        if (GetParent(pDestination) == NULL)
         {
             rpNewParent = pDestination;
             rNewChildPos = 0;
commit cb5488b20c5fe102b730574bacc8ab8cda0e1145
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Mar 22 17:20:20 2014 +0000

    coverity#983381 Dereference before null check
    
    Change-Id: Iebf35b42ab6eb34acb1ad0bea02fb746d815e6ba

diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx
index 25c6af0..bccdcee 100644
--- a/sw/source/core/crsr/pam.cxx
+++ b/sw/source/core/crsr/pam.cxx
@@ -683,19 +683,14 @@ bool SwPaM::HasReadonlySel( bool bFormView, bool bAnnotationMode ) const
     //FIXME FieldBk
     // TODO: Form Protection when Enhanced Fields are enabled
     const SwDoc *pDoc = GetDoc();
-    sw::mark::IMark* pA = NULL;
-    sw::mark::IMark* pB = NULL;
-    bool bUnhandledMark = false;
     const IDocumentMarkAccess* pMarksAccess = pDoc->getIDocumentMarkAccess();
-    if ( pDoc )
-    {
-        pA = GetPoint() ? pMarksAccess->getFieldmarkFor( *GetPoint( ) ) : NULL;
-        pB = GetMark( ) ? pMarksAccess->getFieldmarkFor( *GetMark( ) ) : pA;
+    sw::mark::IMark* pA = GetPoint() ? pMarksAccess->getFieldmarkFor( *GetPoint( ) ) : NULL;
+    sw::mark::IMark* pB = GetMark( ) ? pMarksAccess->getFieldmarkFor( *GetMark( ) ) : pA;
 
-        sw::mark::IFieldmark* pFieldmark = pMarksAccess->getFieldmarkFor( *GetPoint() );
-        if ( pFieldmark )
-            bUnhandledMark = pFieldmark->GetFieldname( ) == ODF_UNHANDLED;
-    }
+    bool bUnhandledMark = false;
+    sw::mark::IFieldmark* pFieldmark = pMarksAccess->getFieldmarkFor( *GetPoint() );
+    if ( pFieldmark )
+        bUnhandledMark = pFieldmark->GetFieldname( ) == ODF_UNHANDLED;
 
     if (!bRet)
     {
@@ -708,7 +703,7 @@ bool SwPaM::HasReadonlySel( bool bFormView, bool bAnnotationMode ) const
             bool bAtStartA = pA != NULL && pA->GetMarkStart() == *GetPoint();
             bool bAtStartB = pB != NULL && pB->GetMarkStart() == *GetMark();
             bRet = ( pA != pB ) || bAtStartA || bAtStartB;
-            bool bProtectForm = pDoc ? pDoc->get( IDocumentSettingAccess::PROTECT_FORM ) : false;
+            bool bProtectForm = pDoc->get( IDocumentSettingAccess::PROTECT_FORM );
             if ( bProtectForm )
                 bRet |= ( pA == NULL || pB == NULL );
         }
commit dcd07731c8741c6308812ea789925bdfda7c41db
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Mar 22 17:15:43 2014 +0000

    coverity#705471 Dereference null return value
    
    Change-Id: I7706744e046d0c641300a9d9167d89f00acacd62

diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx
index 48fdf5e..9af780d 100644
--- a/sc/source/ui/unoobj/dapiuno.cxx
+++ b/sc/source/ui/unoobj/dapiuno.cxx
@@ -1296,11 +1296,14 @@ void SAL_CALL ScDataPilotTableObj::insertDrillDownSheet(const CellAddress& aAddr
     ScDPObject* pDPObj = GetDPObject();
     if (!pDPObj)
         throw RuntimeException();
+    ScTabViewShell* pViewSh = GetDocShell()->GetBestViewShell();
+    if (!pViewSh)
+        throw RuntimeException();
 
     Sequence<DataPilotFieldFilter> aFilters;
     pDPObj->GetDataFieldPositionData(
         ScAddress(static_cast<SCCOL>(aAddr.Column), static_cast<SCROW>(aAddr.Row), aAddr.Sheet), aFilters);
-    GetDocShell()->GetBestViewShell()->ShowDataPilotSourceData(*pDPObj, aFilters);
+    pViewSh->ShowDataPilotSourceData(*pDPObj, aFilters);
 }
 
 CellRangeAddress SAL_CALL ScDataPilotTableObj::getOutputRangeByType( sal_Int32 nType )
commit c2d6d947a2b5fc76dfb0ad5d880cc943f2dd8269
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Mar 22 17:11:53 2014 +0000

    coverity#705457 Dereference null return value
    
    Change-Id: Ifde26af3d00fee3aa52afafa3986ef180be39908

diff --git a/cppuhelper/source/findsofficepath.c b/cppuhelper/source/findsofficepath.c
index 0f1245f..1c24d80 100644
--- a/cppuhelper/source/findsofficepath.c
+++ b/cppuhelper/source/findsofficepath.c
@@ -131,6 +131,8 @@ static char* platformSpecific()
 
     /* get the value of the PATH environment variable */
     env = getenv( PATHVARNAME );
+    if (env == NULL)
+        return NULL;
     str = (char*) malloc( strlen( env ) + 1 );
     strcpy( str, env );
 
commit 95ff4bb714d0814b40de723cd7fa7f120b88bbc8
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Mar 22 17:10:10 2014 +0000

    coverity#1103725 Dereference before null check
    
    Change-Id: Ie09af4913d3ac7681a7328c43595d01a98050a07

diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx
index b7c9d83..8e806bd 100644
--- a/sd/source/core/drawdoc3.cxx
+++ b/sd/source/core/drawdoc3.cxx
@@ -1392,14 +1392,17 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
                                    sal_Bool bMaster,
                                    sal_Bool bCheckMasters)
 {
+    ::svl::IUndoManager* pUndoMgr = NULL;
+
     if( mpDocSh )
+    {
         mpDocSh->SetWaitCursor( true );
+        pUndoMgr = mpDocSh->GetUndoManager();
+    }
 
-    ::svl::IUndoManager* pUndoMgr = mpDocSh->GetUndoManager();
-
-    const bool bUndo = IsUndoEnabled();
+    const bool bUndo = pUndoMgr && IsUndoEnabled();
 
-    if( bUndo )
+    if (bUndo)
     {
         pUndoMgr->EnterListAction(SD_RESSTR(STR_UNDO_SET_PRESLAYOUT), OUString());
     }
@@ -1464,7 +1467,8 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
         // we should never reach this, but one never knows...
         if( (pMaster == NULL) || (pNotesMaster == NULL) )
         {
-            pUndoMgr->LeaveListAction();
+            if (bUndo)
+                pUndoMgr->LeaveListAction();
 
             if( mpDocSh )
                 mpDocSh->SetWaitCursor( false );
@@ -1568,7 +1572,8 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
 
                         StyleSheetUndoAction* pUndoChStyle = new StyleSheetUndoAction(this,
                                                                  pMySheet, &pHisSheet->GetItemSet());
-                        pUndoMgr->AddUndoAction(pUndoChStyle);
+                        if (bUndo)
+                            pUndoMgr->AddUndoAction(pUndoChStyle);
                         pMySheet->GetItemSet().Put(pHisSheet->GetItemSet());
                         pMySheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
                     }
@@ -1642,7 +1647,8 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
                 // Add UndoAction for creating and inserting the stylesheets to
                 // the top of the UndoManager
                 SdMoveStyleSheetsUndoAction* pMovStyles = new SdMoveStyleSheetsUndoAction( this, aCreatedStyles, true);
-                pUndoMgr->AddUndoAction(pMovStyles);
+                if (bUndo)
+                    pUndoMgr->AddUndoAction(pMovStyles);
             }
         }
 
commit 079a90ef7e76bff3b692d2782b01f6120d385e43
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Mar 22 16:59:42 2014 +0000

    coverity#983382 Dereference before null check
    
    Change-Id: Ifc665a78794dc86e2dbf98ae5f84b790739813ca

diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx
index 6b7ac63..ea15254 100644
--- a/sw/source/core/layout/flycnt.cxx
+++ b/sw/source/core/layout/flycnt.cxx
@@ -865,7 +865,7 @@ static sal_uInt64 lcl_FindCntDiff( const Point &rPt, const SwLayoutFrm *pLay,
     rpCnt = 0;
     sal_uInt64 nDistance = SAL_MAX_UINT64;
     sal_uInt64 nNearest  = SAL_MAX_UINT64;
-    const SwCntntFrm *pCnt = pLay->ContainsCntnt();
+    const SwCntntFrm *pCnt = pLay ? pLay->ContainsCntnt() : NULL;
 
     while ( pCnt && (bBody != pCnt->IsInDocBody() || bFtn != pCnt->IsInFtn()))
     {
commit 82e80112082b0cc71bdab3d12ac6c503cc126e0d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Mar 22 16:57:17 2014 +0000

    coverity#983370 Dereference before null check
    
    Change-Id: I524ce73811f32b7da38ef127ee4633a2c6a9f933

diff --git a/extensions/source/nsplugin/source/npshell.cxx b/extensions/source/nsplugin/source/npshell.cxx
index 48fc539..ae0714b 100644
--- a/extensions/source/nsplugin/source/npshell.cxx
+++ b/extensions/source/nsplugin/source/npshell.cxx
@@ -427,9 +427,7 @@ NPMIMEType
 dupMimeType(NPMIMEType type)
 {
     NPMIMEType mimetype = (NPMIMEType) NPN_MemAlloc(strlen(type)+1);
-    mimetype[strlen(type)] = 0;
-    if (mimetype)
-        strcpy(mimetype, type);
+    strcpy(mimetype, type);
     return(mimetype);
 }
 #endif // end of UNIX
commit 9e5f76941eb63fd3a6257895f0731315165ddb12
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Mar 22 16:55:03 2014 +0000

    coverity#705005 Dereference after null check
    
    Change-Id: I4ed75d05777d55bd58542f4ffb39cc9af6215c56

diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index 738caaf..4515603 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -744,7 +744,7 @@ void SwXMLImport::endDocument( void )
             {
                 // If the PaM points to the first new node, move the PaM to the
                 // end of the previous node.
-                if( pPaM && pPaM->GetPoint()->nNode == aNxtIdx )
+                if( pPaM->GetPoint()->nNode == aNxtIdx )
                 {
                     pPaM->GetPoint()->nNode = *pSttNdIdx;
                     pPaM->GetPoint()->nContent.Assign( pTxtNode,


More information about the Libreoffice-commits mailing list