[Libreoffice-commits] core.git: 24 commits - filter/source lotuswordpro/source sc/source sd/inc sd/source sw/source vcl/generic vcl/inc vcl/source vcl/workben

Caolán McNamara caolanm at redhat.com
Wed Feb 4 03:11:31 PST 2015


 filter/source/config/cache/filtercache.cxx         |   69 +++++++++------------
 filter/source/config/cache/filtercache.hxx         |    7 --
 filter/source/msfilter/msdffimp.cxx                |    6 +
 filter/source/msfilter/svdfppt.cxx                 |   10 +--
 lotuswordpro/source/filter/lwpparastyle.cxx        |    2 
 lotuswordpro/source/filter/xfilter/xfstylecont.cxx |   18 +----
 lotuswordpro/source/filter/xfilter/xftable.cxx     |    4 -
 sc/source/core/tool/interpr1.cxx                   |   11 ++-
 sc/source/filter/starcalc/scflt.cxx                |    2 
 sd/inc/sdmod.hxx                                   |    9 ++
 sd/source/ui/unoidl/unoobj.cxx                     |   22 ++----
 sd/source/ui/view/drviews6.cxx                     |    3 
 sw/source/core/crsr/crsrsh.cxx                     |    4 +
 sw/source/core/text/txtfrm.cxx                     |    6 -
 sw/source/uibase/shells/basesh.cxx                 |   22 +++---
 sw/source/uibase/uiview/view2.cxx                  |    3 
 vcl/generic/glyphs/gcach_layout.cxx                |    2 
 vcl/inc/sallayout.hxx                              |    7 --
 vcl/source/filter/wmf/winwmf.cxx                   |    5 +
 vcl/workben/vcldemo.cxx                            |    2 
 20 files changed, 107 insertions(+), 107 deletions(-)

New commits:
commit e537d227d3a801076aff98c113650942fb6b3699
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Feb 4 09:28:37 2015 +0000

    hard to find accidental leaks with all the deliberate ones
    
    so make these globals belong to the SfxModule which gets
    torn down before exit
    
    Change-Id: Iad655f8726ba6784a5d606ef469522950906360a

diff --git a/sd/inc/sdmod.hxx b/sd/inc/sdmod.hxx
index d339c09..d2a64ac 100644
--- a/sd/inc/sdmod.hxx
+++ b/sd/inc/sdmod.hxx
@@ -26,11 +26,13 @@
 #include <sot/storage.hxx>
 #include <tools/shl.hxx>
 #include "sddllapi.h"
+#include <svl/itemprop.hxx>
 #include <svl/lstner.hxx>
 #include <com/sun/star/text/WritingMode.hpp>
 #include <sfx2/module.hxx>
 #include <vcl/vclevent.hxx>
 #include <sal/types.h>
+#include <boost/ptr_container/ptr_map.hpp>
 #include <memory>
 
 class SdOptions;
@@ -58,6 +60,9 @@ enum SdOptionStreamMode
     SD_OPTION_STORE = 1
 };
 
+typedef boost::ptr_map< sal_uIntPtr, SfxExtItemPropertySetInfo > SdExtPropertySetInfoCache;
+typedef boost::ptr_map< sal_uInt32, css::uno::Sequence< css::uno::Type> > SdTypesCache;
+
 /*
 
   This subclass of <SfxModule> (which is a subclass of <SfxShell>) is
@@ -122,6 +127,10 @@ public:
     virtual void         ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) SAL_OVERRIDE;
     virtual SfxTabPage*  CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet ) SAL_OVERRIDE;
 
+    SdExtPropertySetInfoCache gImplImpressPropertySetInfoCache;
+    SdExtPropertySetInfoCache gImplDrawPropertySetInfoCache;
+    SdTypesCache gImplTypesCache;
+
 protected:
 
     SdOptions*              pImpressOptions;
diff --git a/sd/source/ui/unoidl/unoobj.cxx b/sd/source/ui/unoidl/unoobj.cxx
index 329dd98..47fe407 100644
--- a/sd/source/ui/unoidl/unoobj.cxx
+++ b/sd/source/ui/unoidl/unoobj.cxx
@@ -85,13 +85,6 @@ using ::com::sun::star::uno::Any;
 using ::com::sun::star::uno::Reference;
 using ::com::sun::star::drawing::XShape;
 
-typedef std::map<sal_uIntPtr, SfxExtItemPropertySetInfo*> SdExtPropertySetInfoCache;
-static SdExtPropertySetInfoCache gImplImpressPropertySetInfoCache;
-static SdExtPropertySetInfoCache gImplDrawPropertySetInfoCache;
-
-typedef std::map<sal_uInt32, uno::Sequence< uno::Type >*> SdTypesCache;
-static SdTypesCache gImplTypesCache;
-
 #define WID_EFFECT          1
 #define WID_SPEED           2
 #define WID_TEXTEFFECT      3
@@ -344,8 +337,9 @@ uno::Sequence< uno::Type > SAL_CALL SdXShape::getTypes()
     }
     else
     {
-        const sal_uInt32 nObjId = mpShape->getShapeKind();
+        sal_uInt32 nObjId = mpShape->getShapeKind();
         uno::Sequence< uno::Type >* pTypes;
+        SdTypesCache& gImplTypesCache = SD_MOD()->gImplTypesCache;
         SdTypesCache::iterator aIter( gImplTypesCache.find( nObjId ) );
         if( aIter == gImplTypesCache.end() )
         {
@@ -354,7 +348,7 @@ uno::Sequence< uno::Type > SAL_CALL SdXShape::getTypes()
             pTypes->realloc( nCount+1 );
             (*pTypes)[nCount] = cppu::UnoType<lang::XTypeProvider>::get();
 
-            gImplTypesCache[ nObjId ] = pTypes;
+            gImplTypesCache.insert(nObjId, pTypes);
         }
         else
         {
@@ -430,17 +424,17 @@ uno::Any SAL_CALL SdXShape::getPropertyDefault( const OUString& aPropertyName )
     sal_uIntPtr nObjId = reinterpret_cast<sal_uIntPtr>(mpShape->getPropertyMapEntries());
     SfxExtItemPropertySetInfo* pInfo = NULL;
 
-    SdExtPropertySetInfoCache* pCache = (mpModel && mpModel->IsImpressDocument()) ?
-        &gImplImpressPropertySetInfoCache : &gImplDrawPropertySetInfoCache;
+    SdExtPropertySetInfoCache& rCache = (mpModel && mpModel->IsImpressDocument()) ?
+        SD_MOD()->gImplImpressPropertySetInfoCache : SD_MOD()->gImplDrawPropertySetInfoCache;
 
-    SdExtPropertySetInfoCache::iterator aIter( pCache->find( nObjId ) );
-    if( aIter == pCache->end() )
+    SdExtPropertySetInfoCache::iterator aIter( rCache.find( nObjId ) );
+    if( aIter == rCache.end() )
     {
         uno::Reference< beans::XPropertySetInfo > xInfo( mpShape->_getPropertySetInfo() );
         pInfo = new SfxExtItemPropertySetInfo( mpMap, xInfo->getProperties() );
         pInfo->acquire();
 
-        (*pCache)[ nObjId ] = pInfo;
+        rCache.insert(nObjId, pInfo);
     }
     else
     {
commit 8af6c125226b55af21efd60edc6ed59a9214fa8c
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Feb 4 10:34:03 2015 +0000

    coverity#1265801 Dereference null return value
    
    Change-Id: I7ac111ad66dd51d13df866bac4396cdb2aecb27e

diff --git a/sd/source/ui/view/drviews6.cxx b/sd/source/ui/view/drviews6.cxx
index d35ddef..31c9f08 100644
--- a/sd/source/ui/view/drviews6.cxx
+++ b/sd/source/ui/view/drviews6.cxx
@@ -156,8 +156,7 @@ void DrawViewShell::ExecAnimationWin( SfxRequest& rReq )
 
             SfxChildWindow* pWnd = GetViewFrame()->GetChildWindow(nId);
 
-            pAnimWin = pWnd ? static_cast<AnimationWindow*>(
-                GetViewFrame()->GetChildWindow(nId)->GetWindow()) : NULL;
+            pAnimWin = pWnd ? static_cast<AnimationWindow*>(pWnd->GetWindow()) : NULL;
 
             if ( pAnimWin )
             {
commit c7949a9451597b3bc9e39deb2254183eda13b351
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Feb 4 10:33:12 2015 +0000

    coverity#1266467 Dereference null return value
    
    Change-Id: I3c4f4b64c0247ba849df3f74e385b36b020a0da1

diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx
index 6de9bb7..6813b0a 100644
--- a/sw/source/uibase/shells/basesh.cxx
+++ b/sw/source/uibase/shells/basesh.cxx
@@ -1465,7 +1465,7 @@ void SwBaseShell::GetState( SfxItemSet &rSet )
                     else
                     {
                         SvxIMapDlg *pDlg = GetIMapDlg(GetView());
-                        if( pDlg->GetEditingObject() != rSh.GetIMapInventor() )
+                        if (pDlg && pDlg->GetEditingObject() != rSh.GetIMapInventor())
                             lcl_UpdateIMapDlg( rSh );
                     }
                 }
commit 3edd1e697609559b507581352a7c3aa807f4d642
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Feb 4 10:32:33 2015 +0000

    coverity#1266468 Dereference null return value
    
    Change-Id: Id37b0bc2618cf3aa47616116c62ac3ef8cf60304

diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx
index 40925db..be7e8ec 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -900,7 +900,10 @@ void SwView::Execute(SfxRequest &rReq)
                 pCh = pVFrame->GetChildWindow( SID_NAVIGATOR );
 
             }
+            if (pCh)
+            {
                 static_cast<SwNavigationPI*>( pCh->GetContextWindow(SW_MOD()))->GotoPage();
+            }
         }
         break;
         case  FN_EDIT_CURRENT_TOX:
commit f9c3d4e81d54b0e520e797cada2af32fa979c089
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Feb 4 10:30:55 2015 +0000

    coverity#1266469 Dereference null return value
    
    Change-Id: I87318ba286ad2d8ded5d3e467b7a1e371318bef8

diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx
index 054bb02..6de9bb7 100644
--- a/sw/source/uibase/shells/basesh.cxx
+++ b/sw/source/uibase/shells/basesh.cxx
@@ -1263,9 +1263,10 @@ IMPL_LINK_NOARG(SwBaseShell, GraphicArrivedHdl)
                 if( !bProtect )
                 {
                     sal_uInt16 nId = SvxContourDlgChildWindow::GetChildWindowId();
-                    SvxIMapDlg *pDlg = pVFrame->HasChildWindow( nId ) ?
-                        static_cast<SvxIMapDlg*>( pVFrame->GetChildWindow( nId )
-                                            ->GetWindow()) : 0;
+                    SfxChildWindow *pChildWindow = pVFrame->HasChildWindow(nId) ?
+                        pVFrame->GetChildWindow(nId) : 0;
+                    SvxIMapDlg *pDlg = pChildWindow ?
+                        static_cast<SvxIMapDlg*>(pChildWindow->GetWindow()) : 0;
                     if( pDlg && pDlg->GetEditingObject() !=
                                 rSh.GetIMapInventor() )
                         lcl_UpdateContourDlg( rSh, nsSelectionType::SEL_GRF );
commit dbf601891b2cc20adc9815771ad68dcc9635fa29
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Feb 4 10:29:41 2015 +0000

    coverity#1266472 Dereference null return value
    
    Change-Id: Ifb7c4da642b254d41bf746725ee9435f6bd1efeb

diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx
index dc418f9..054bb02 100644
--- a/sw/source/uibase/shells/basesh.cxx
+++ b/sw/source/uibase/shells/basesh.cxx
@@ -140,11 +140,14 @@ namespace
 
         return pChildWindow ? static_cast<SvxContourDlg*>(pChildWindow->GetWindow()) : NULL;
     }
+
+    SvxIMapDlg* GetIMapDlg(SwView &rView)
+    {
+        SfxChildWindow* pWnd = rView.GetViewFrame()->GetChildWindow(SvxIMapDlgChildWindow::GetChildWindowId());
+        return pWnd ? static_cast<SvxIMapDlg*>(pWnd->GetWindow()) : NULL;
+    }
 }
 
-#define SWIMAPDLG(rView) ( static_cast<SvxIMapDlg*>( rView.GetViewFrame()->GetChildWindow(        \
-                        SvxIMapDlgChildWindow::GetChildWindowId() )->   \
-                        GetWindow() ) )
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::frame;
@@ -919,7 +922,7 @@ void SwBaseShell::Execute(SfxRequest &rReq)
         break;
         case SID_IMAP_EXEC:
         {
-            SvxIMapDlg* pDlg = SWIMAPDLG(GetView());
+            SvxIMapDlg* pDlg = GetIMapDlg(GetView());
 
             // Check, if the allocation is useful or allowed at all.
             if ( rSh.IsFrmSelected() &&
@@ -1460,7 +1463,7 @@ void SwBaseShell::GetState( SfxItemSet &rSet )
                     }
                     else
                     {
-                        SvxIMapDlg *pDlg = SWIMAPDLG(GetView());
+                        SvxIMapDlg *pDlg = GetIMapDlg(GetView());
                         if( pDlg->GetEditingObject() != rSh.GetIMapInventor() )
                             lcl_UpdateIMapDlg( rSh );
                     }
commit 55a4c5d62974f0e50ac27b6d4215e8130d7604f3
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Feb 4 10:25:39 2015 +0000

    coverity#1266492 Untrusted value as argument
    
    Change-Id: Ie7fa1318660b1647639fe09d5b6fe97e901e483a

diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index 73b1a09..d7d9cf1 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -5282,14 +5282,16 @@ void PPTStyleTextPropReader::Init( SvStream& rIn, SdrPowerPointImport& rMan, con
                 }
                 else
                 {
-                    sal_uInt32 nStrLen = nCharCount;
-                    sal_uInt32 nMaxStrLen = aString.getLength();
-                    if (nCharAnzRead + nStrLen > nMaxStrLen)
-                        nStrLen = nMaxStrLen - nCharAnzRead;
                     if (nCharAnzRead > static_cast<sal_uInt32>(aString.getLength()))
                         aCharPropSet.maString = OUString();
                     else
+                    {
+                        sal_Int32 nStrLen = nCharCount;
+                        sal_Int32 nMaxStrLen = aString.getLength() - nCharAnzRead;
+                        if (nStrLen > nMaxStrLen)
+                            nStrLen = nMaxStrLen;
                         aCharPropSet.maString = aString.copy(nCharAnzRead, nStrLen);
+                    }
                     aCharPropList.push_back( new PPTCharPropSet( aCharPropSet, nCurrentPara ) );
                     nCharAnzRead += nCharCount;
                     bEmptyParaPossible = false;
commit 3899939d6c06a6b0b1eabe2218a036a8fad8225e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Feb 4 10:18:24 2015 +0000

    coverity#1242895 Untrusted loop bound
    
    Change-Id: I5d97849e46db5e4582387ade085134fdde6a0358

diff --git a/sc/source/filter/starcalc/scflt.cxx b/sc/source/filter/starcalc/scflt.cxx
index 92802a1..63c9b0e 100644
--- a/sc/source/filter/starcalc/scflt.cxx
+++ b/sc/source/filter/starcalc/scflt.cxx
@@ -1495,7 +1495,7 @@ void Sc10Import::LoadTables()
                 bool bPageBreak   = ((DataValue & crfSoftBreak) == crfSoftBreak);
                 bool bManualBreak = ((DataValue & crfHardBreak) == crfHardBreak);
                 bool bHidden = ((DataValue & crfHidden) == crfHidden);
-                for (SCCOL k = static_cast<SCCOL>(DataStart); k <= static_cast<SCCOL>(DataEnd); k++)
+                for (SCCOL k = SanitizeCol(static_cast<SCCOL>(DataStart)); k <= SanitizeCol(static_cast<SCCOL>(DataEnd)); k++)
                 {
                     pDoc->SetColHidden(k, k, static_cast<SCTAB>(TabNo), bHidden);
                     pDoc->SetColBreak(k, static_cast<SCTAB> (TabNo), bPageBreak, bManualBreak);
commit 9327373a02f498b13f2c0da1c7dc37b6de1005e6
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Feb 4 10:16:37 2015 +0000

    coverity#1242624 Untrusted loop bound
    
    Change-Id: I277e98156c9a9832d1f5e968e590356d14b91af6

diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 656c93f..3e60db1 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -2203,6 +2203,12 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt
                 sal_uInt16 nElemSizeSeg = 2;
                 rIn.ReadUInt16( nNumElemSeg ).ReadUInt16( nNumElemMemSeg ).ReadUInt16( nElemSizeSeg );
             }
+            sal_Size nMaxEntriesPossible = rIn.remainingSize() / sizeof(sal_uInt16);
+            if (nNumElemSeg > nMaxEntriesPossible)
+            {
+                SAL_WARN("filter.ms", "NumElem list is longer than remaining bytes, ppt or parser is wrong");
+                nNumElemSeg = nMaxEntriesPossible;
+            }
             if ( nNumElemSeg )
             {
                 sal_Int16 nCommand;
commit db4414db20fa346e97db82b2aeacbc2981425ca9
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Feb 4 10:11:21 2015 +0000

    coverity#1266450 Explicit null dereferenced
    
    Change-Id: Ie675dc47d6008aa3ce947f8969895f32eb20b8c4

diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 765a113..6ecf137 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -476,10 +476,13 @@ void ScInterpreter::ScChooseJump()
                     GetTokenMatrixMap().insert( ScTokenMatrixMap::value_type(
                                 pCur, xNew));
                 }
-                PushTempToken( xNew.get());
-                // set endpoint of path for main code line
-                aCode.Jump( pJump[ nJumpCount ], pJump[ nJumpCount ] );
-                bHaveJump = true;
+                if (xNew.get())
+                {
+                    PushTempToken( xNew.get());
+                    // set endpoint of path for main code line
+                    aCode.Jump( pJump[ nJumpCount ], pJump[ nJumpCount ] );
+                    bHaveJump = true;
+                }
             }
         }
         break;
commit e93b9dc3db1190f26dd70e5f446adabcdbe8de48
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Feb 4 10:07:23 2015 +0000

    coverity#735915 Dereference after null check
    
    Change-Id: Iaf27a27548c008b4c51a0e187570aa298fd56d7c

diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index cc22073..add339a 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -1114,9 +1114,9 @@ void SwTxtFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew )
                 nPos = static_cast<const SwFmtFld*>(pItem)->GetTxtFld()->GetStart();
                 if( IsIdxInside( nPos, 1 ) )
                 {
-                    const SfxPoolItem& rOldItem =
-                        static_cast<const SwAttrSetChg*>(pOld)->GetChgSet()->Get( RES_TXTATR_FIELD );
-                    if( pItem == &rOldItem )
+                    const SfxPoolItem* pOldItem = pOld ?
+                        &(static_cast<const SwAttrSetChg*>(pOld)->GetChgSet()->Get(RES_TXTATR_FIELD)) : NULL;
+                    if( pItem == pOldItem )
                     {
                         InvalidatePage();
                         SetCompletePaint();
commit 659b3b092ec2ff6cdee79a0490598a332b376a73
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Feb 4 10:03:53 2015 +0000

    coverity#708576 Uninitialized scalar field
    
    Change-Id: I8810389998fdcf43c55db7e6cd1acd8600e91e2b

diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx
index 3dc781b..545181a 100644
--- a/vcl/inc/sallayout.hxx
+++ b/vcl/inc/sallayout.hxx
@@ -290,6 +290,7 @@ public:
                 , mnOrigWidth(0)
                 , mnNewWidth(0)
                 , mnXOffset(0)
+                , mnYOffset(0)
                 , maGlyphId(0)
             {}
 
commit 6c17bda9fa4f1b76f4746332ff537c607d9cee3f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Feb 4 10:02:49 2015 +0000

    coverity#708922 Use after free
    
    Change-Id: Ied0f1dd16b7f681290c707f1aeb2d1d115612629

diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 73ed40e..2e63da7 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -2513,7 +2513,11 @@ void SwCrsrShell::_ParkPams( SwPaM* pDelRg, SwShellCrsr** ppDelRing )
             }
 
             if( bDelete )
+            {
+                if (pTmp == pTmpDel)
+                    pTmp = 0;
                 delete pTmpDel; // invalidate old area
+            }
             else
             {
                 pTmpDel->DeleteMark();
commit 3e8a695b588eff13155f8dd1f7c4afaba7954d0f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Feb 4 09:59:44 2015 +0000

    coverity#982431 Division or modulo by float zero
    
    Change-Id: Icb43cae170b8ca5dc3ef3379136d265869eb978e

diff --git a/vcl/source/filter/wmf/winwmf.cxx b/vcl/source/filter/wmf/winwmf.cxx
index 61cba73..21f3516 100644
--- a/vcl/source/filter/wmf/winwmf.cxx
+++ b/vcl/source/filter/wmf/winwmf.cxx
@@ -230,6 +230,11 @@ void WMFReader::ReadRecordParams( sal_uInt16 nFunc )
         {
             short nXNum = 0, nXDenom = 0, nYNum = 0, nYDenom = 0;
             pWMF->ReadInt16( nYDenom ).ReadInt16( nYNum ).ReadInt16( nXDenom ).ReadInt16( nXNum );
+            if (!nYDenom || !nXDenom)
+            {
+                pWMF->SetError( SVSTREAM_FILEFORMAT_ERROR );
+                break;
+            }
             pOut->ScaleWinExt( (double)nXNum / nXDenom, (double)nYNum / nYDenom );
         }
         break;
commit af6811b3d0aff8f2823b420e07218338dcb49911
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Feb 4 09:55:31 2015 +0000

    coverity#1267691 Uncaught exception
    
    and
    
    coverity#1267690 Uncaught exception
    
    Change-Id: I728fc0fb1c5e472ab40649e949499d98e3ee2b7f

diff --git a/filter/source/config/cache/filtercache.cxx b/filter/source/config/cache/filtercache.cxx
index 5b2a268..828e9f6 100644
--- a/filter/source/config/cache/filtercache.cxx
+++ b/filter/source/config/cache/filtercache.cxx
@@ -847,7 +847,7 @@ css::uno::Reference< css::uno::XInterface > FilterCache::impl_openConfig(EConfig
         }
         break;
 
-        default : throw css::uno::Exception("These configuration node is not supported here for open!", 0);
+        default : throw css::uno::RuntimeException("These configuration node is not supported here for open!", 0);
     }
 
     {
@@ -880,8 +880,6 @@ css::uno::Reference< css::uno::XInterface > FilterCache::impl_openConfig(EConfig
     return *pConfig;
 }
 
-
-
 css::uno::Any FilterCache::impl_getDirectCFGValue(const OUString& sDirectKey)
 {
     OUString sRoot;
commit c4fcc5986d0e80e8cefb76359ffde3c59017dda4
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Feb 4 09:54:20 2015 +0000

    coverity#1267692 Uncaught exception
    
    Change-Id: I62c05d2baf7f46263468e194a1e947000ef7a1e3

diff --git a/filter/source/config/cache/filtercache.cxx b/filter/source/config/cache/filtercache.cxx
index dddc603..5b2a268 100644
--- a/filter/source/config/cache/filtercache.cxx
+++ b/filter/source/config/cache/filtercache.cxx
@@ -1258,8 +1258,6 @@ void FilterCache::impl_validateAndOptimize()
     // <- SAFE
 }
 
-
-
 void FilterCache::impl_addItem2FlushList(      EItemType        eType,
                                          const OUString& sItem)
     throw(css::uno::Exception)
@@ -1283,7 +1281,7 @@ void FilterCache::impl_addItem2FlushList(      EItemType        eType,
                 pList = &m_lChangedContentHandlers;
                 break;
 
-        default : throw css::uno::Exception("unsupported item type", 0);
+        default : throw css::uno::RuntimeException("unsupported item type", 0);
     }
 
     OUStringList::const_iterator pItem = ::std::find(pList->begin(), pList->end(), sItem);
@@ -1291,8 +1289,6 @@ void FilterCache::impl_addItem2FlushList(      EItemType        eType,
         pList->push_back(sItem);
 }
 
-
-
 FilterCache::EItemFlushState FilterCache::impl_specifyFlushOperation(const css::uno::Reference< css::container::XNameAccess >& xSet ,
                                                                      const CacheItemList&                                      rList,
                                                                      const OUString&                                    sItem)
commit 55803acc19045f7c983ca65dd3e16024859d937a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Feb 4 09:52:18 2015 +0000

    coverity#1267696 Uncaught exception
    
    Change-Id: I3b4a1db77a5b9888e2ac5db32ba2cb8f904e663d

diff --git a/filter/source/config/cache/filtercache.cxx b/filter/source/config/cache/filtercache.cxx
index 1bbdfc6..dddc603 100644
--- a/filter/source/config/cache/filtercache.cxx
+++ b/filter/source/config/cache/filtercache.cxx
@@ -771,7 +771,7 @@ const CacheItemList& FilterCache::impl_getItemList(EItemType eType) const
 
     }
 
-    throw css::uno::Exception("unknown sub container requested.",
+    throw css::uno::RuntimeException("unknown sub container requested.",
                                             css::uno::Reference< css::uno::XInterface >());
     // <- SAFE ----------------------------------
 }
commit f22c19c0a47df4c848b40d78c2788da797f33d09
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Feb 4 09:50:19 2015 +0000

    coverity#1267694 Uncaught exception
    
    Change-Id: Idfa32d54ed8af7eda823da2223cbaaf2f396e8d9

diff --git a/filter/source/config/cache/filtercache.cxx b/filter/source/config/cache/filtercache.cxx
index c6da21f..1bbdfc6 100644
--- a/filter/source/config/cache/filtercache.cxx
+++ b/filter/source/config/cache/filtercache.cxx
@@ -2161,53 +2161,50 @@ void FilterCache::impl_interpretDataVal4Filter(const OUString& sValue,
          That would be useful to guarantee a consistent cache.
 -----------------------------------------------*/
 void FilterCache::impl_readOldFormat()
-    throw(css::uno::Exception)
 {
     // Attention: Opening/Reading of this old configuration format has to be handled gracefully.
     // Its optional and should not disturb our normal work!
     // E.g. we must check, if the package exists ...
-
-    css::uno::Reference< css::container::XNameAccess > xCfg;
     try
     {
         css::uno::Reference< css::uno::XInterface > xInt = impl_openConfig(E_PROVIDER_OLD);
-        xCfg = css::uno::Reference< css::container::XNameAccess >(xInt, css::uno::UNO_QUERY_THROW);
+        css::uno::Reference< css::container::XNameAccess > xCfg =
+            css::uno::Reference< css::container::XNameAccess >(xInt, css::uno::UNO_QUERY_THROW);
+
+        OUString TYPES_SET("Types");
+
+        // May be there is no type set ...
+        if (xCfg->hasByName(TYPES_SET))
+        {
+            css::uno::Reference< css::container::XNameAccess > xSet;
+            xCfg->getByName(TYPES_SET) >>= xSet;
+            const css::uno::Sequence< OUString > lItems = xSet->getElementNames();
+            const OUString*                      pItems = lItems.getConstArray();
+            for (sal_Int32 i=0; i<lItems.getLength(); ++i)
+                m_lTypes[pItems[i]] = impl_readOldItem(xSet, E_TYPE, pItems[i]);
+        }
+
+        OUString FILTER_SET("Filters");
+        // May be there is no filter set ...
+        if (xCfg->hasByName(FILTER_SET))
+        {
+            css::uno::Reference< css::container::XNameAccess > xSet;
+            xCfg->getByName(FILTER_SET) >>= xSet;
+            const css::uno::Sequence< OUString > lItems = xSet->getElementNames();
+            const OUString*                      pItems = lItems.getConstArray();
+            for (sal_Int32 i=0; i<lItems.getLength(); ++i)
+                m_lFilters[pItems[i]] = impl_readOldItem(xSet, E_FILTER, pItems[i]);
+        }
     }
     /* corrupt filter addon ? because it's external (optional) code .. we can ignore it. Addon wont work then ...
        but that seems to be acceptable.
        see #139088# for further information
     */
     catch(const css::uno::Exception&)
-        { return; }
-
-    OUString TYPES_SET("Types");
-
-    // May be there is no type set ...
-    if (xCfg->hasByName(TYPES_SET))
-    {
-        css::uno::Reference< css::container::XNameAccess > xSet;
-        xCfg->getByName(TYPES_SET) >>= xSet;
-        const css::uno::Sequence< OUString > lItems = xSet->getElementNames();
-        const OUString*                      pItems = lItems.getConstArray();
-        for (sal_Int32 i=0; i<lItems.getLength(); ++i)
-            m_lTypes[pItems[i]] = impl_readOldItem(xSet, E_TYPE, pItems[i]);
-    }
-
-    OUString FILTER_SET("Filters");
-    // May be there is no filter set ...
-    if (xCfg->hasByName(FILTER_SET))
     {
-        css::uno::Reference< css::container::XNameAccess > xSet;
-        xCfg->getByName(FILTER_SET) >>= xSet;
-        const css::uno::Sequence< OUString > lItems = xSet->getElementNames();
-        const OUString*                      pItems = lItems.getConstArray();
-        for (sal_Int32 i=0; i<lItems.getLength(); ++i)
-            m_lFilters[pItems[i]] = impl_readOldItem(xSet, E_FILTER, pItems[i]);
     }
 }
 
-
-
 CacheItem FilterCache::impl_readOldItem(const css::uno::Reference< css::container::XNameAccess >& xSet ,
                                               EItemType                                           eType,
                                         const OUString&                                    sItem)
diff --git a/filter/source/config/cache/filtercache.hxx b/filter/source/config/cache/filtercache.hxx
index 1c3d998..59339eb 100644
--- a/filter/source/config/cache/filtercache.hxx
+++ b/filter/source/config/cache/filtercache.hxx
@@ -905,13 +905,8 @@ class FilterCache : public BaseLock
                                    const CacheItem&                                           rItem)
             throw(css::uno::Exception);
 
-
-
         /** TODO */
-        void impl_readOldFormat()
-            throw(css::uno::Exception);
-
-
+        void impl_readOldFormat();
 
         /** TODO */
         CacheItem impl_readOldItem(const css::uno::Reference< css::container::XNameAccess >& xSet ,
commit bf831c231f92770d12f2f807dfe60dd2aa7f2f71
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Feb 4 09:42:02 2015 +0000

    coverity#1267665 Logically dead code
    
    inspection shows it can never be null
    
    Change-Id: I5160fc1e212996ddea89075d86c6f3a0d0c5da94

diff --git a/lotuswordpro/source/filter/lwpparastyle.cxx b/lotuswordpro/source/filter/lwpparastyle.cxx
index 244189f..0b0241b 100644
--- a/lotuswordpro/source/filter/lwpparastyle.cxx
+++ b/lotuswordpro/source/filter/lwpparastyle.cxx
@@ -158,8 +158,6 @@ void LwpParaStyle::Read()
 void LwpParaStyle::Apply(XFParaStyle *pParaStyle)
 {
     assert(pParaStyle);
-    if (!pParaStyle)
-        return;
 
     LwpVirtualPiece *pPiece = NULL;
     //alignment:
commit 1cc506626aa2173397e150835c1a2f08c5041490
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Feb 4 09:39:58 2015 +0000

    coverity#1267650 Logically dead code
    
    inspection shows they can never be null
    
    Change-Id: Idffbed313769b232e5476a10ed4df815719606ed

diff --git a/lotuswordpro/source/filter/xfilter/xfstylecont.cxx b/lotuswordpro/source/filter/xfilter/xfstylecont.cxx
index b5f4434..544402a 100644
--- a/lotuswordpro/source/filter/xfilter/xfstylecont.cxx
+++ b/lotuswordpro/source/filter/xfilter/xfstylecont.cxx
@@ -88,8 +88,7 @@ XFStyleContainer::~XFStyleContainer()
     for( it = m_aStyles.begin(); it != m_aStyles.end(); ++it )
     {
         IXFStyle *pStyle = *it;
-        if( pStyle )
-            delete pStyle;
+        delete pStyle;
     }
 }
 
@@ -100,8 +99,7 @@ void    XFStyleContainer::Reset()
     for( it = m_aStyles.begin(); it != m_aStyles.end(); ++it )
     {
         IXFStyle *pStyle = *it;
-        if( pStyle )
-            delete pStyle;
+        delete pStyle;
     }
     m_aStyles.clear();
 }
@@ -159,9 +157,7 @@ IXFStyle*   XFStyleContainer::FindSameStyle(IXFStyle *pStyle)
     for( it = m_aStyles.begin(); it != m_aStyles.end(); ++it )
     {
         IXFStyle *pConStyle = *it;
-        if( !pConStyle )
-            continue;
-
+        assert(pConStyle);
         if( pConStyle->Equal(pStyle) )
             return pConStyle;
     }
@@ -175,9 +171,7 @@ IXFStyle*   XFStyleContainer::FindStyle(const OUString& name)
     for( it = m_aStyles.begin(); it != m_aStyles.end(); ++it )
     {
         IXFStyle *pConStyle = *it;
-        if( !pConStyle )
-            continue;
-
+        assert(pConStyle);
         if( pConStyle->GetStyleName() == name )
             return pConStyle;
     }
@@ -202,11 +196,7 @@ void    XFStyleContainer::ToXml(IXFStream *pStrm)
     for( it = m_aStyles.begin(); it != m_aStyles.end(); ++it )
     {
         IXFStyle *pStyle = *it;
-
         assert(pStyle);
-        if( !pStyle )
-            continue;
-
         pStyle->ToXml(pStrm);
     }
 }
commit 0a205a7185e6d5d6cc277746e04f60278f80b859
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Feb 4 09:34:07 2015 +0000

    coverity#1267647 Logically dead code
    
    inspection shows its always non null
    
    Change-Id: Idc2e0f62a29b635381685f81d0f9f88b3eef659d

diff --git a/lotuswordpro/source/filter/xfilter/xftable.cxx b/lotuswordpro/source/filter/xfilter/xftable.cxx
index bc8c294..f9576f0 100644
--- a/lotuswordpro/source/filter/xfilter/xftable.cxx
+++ b/lotuswordpro/source/filter/xfilter/xftable.cxx
@@ -87,11 +87,9 @@ void    XFTable::SetColumnStyle(sal_Int32 col, const OUString& style)
     m_aColumns[col] = style;
 }
 
-void    XFTable::AddRow(XFRow *pRow)
+void XFTable::AddRow(XFRow *pRow)
 {
     assert(pRow);
-    if( !pRow )
-        return;
 
     int row = pRow->GetRow();
 
commit af88559697352ea527e6bba26ecaaf1ea8759841
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Feb 4 09:30:02 2015 +0000

    coverity#1268022 Logically dead code
    
    Change-Id: I49a058915f0fd7caaa3793e70784a30efcac15d3

diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx
index 06fcc41..05adec1 100644
--- a/vcl/workben/vcldemo.cxx
+++ b/vcl/workben/vcldemo.cxx
@@ -363,7 +363,7 @@ public:
 
             // To have more text displayed one after the other (overlapping, and in different colours), then
             // change this value
-            int nPrintNumCopies=1;
+            const int nPrintNumCopies=1;
 
             if (bArabicText)
                 aText = aArabicText;
commit 3f2427294e29b7035c7020ef6fc0d6c37cf4f375
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Feb 4 09:24:26 2015 +0000

    coverity#1268025 Uninitialized scalar field
    
    Change-Id: I36b72abc7021aa9a0f64f4a2ac71a7eedd75f6ec

diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx
index 8a3d1ff..3dc781b 100644
--- a/vcl/inc/sallayout.hxx
+++ b/vcl/inc/sallayout.hxx
@@ -298,6 +298,7 @@ public:
             :   mnFlags(nFlags), mnCharPos(nCharPos),
                 mnOrigWidth(nOrigWidth), mnNewWidth(nOrigWidth),
                 mnXOffset(0),
+                mnYOffset(0),
                 maGlyphId(aGlyphId), maLinearPos(rLinearPos)
             {}
 
commit b6749397651d3ae9440a3181878917313a73548f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Feb 4 09:15:58 2015 +0000

    coverity#1268025 mnOrigHeight and mnNewHeight is unused now
    
    Change-Id: I242a332adf9961881599ba048f8f63b2711e8b4d

diff --git a/vcl/generic/glyphs/gcach_layout.cxx b/vcl/generic/glyphs/gcach_layout.cxx
index a6f86ee..49f4608 100644
--- a/vcl/generic/glyphs/gcach_layout.cxx
+++ b/vcl/generic/glyphs/gcach_layout.cxx
@@ -514,7 +514,7 @@ bool HbLayoutEngine::Layout(ServerFontLayout& rLayout, ImplLayoutArgs& rArgs)
                 int32_t nYAdvance = pHbPositions[i].y_advance >> 6;
 
                 Point aNewPos = Point(aCurrPos.X() + nXOffset, -(aCurrPos.Y() + nYOffset));
-                const GlyphItem aGI(nCharPos, nGlyphIndex, aNewPos, nGlyphFlags, nXAdvance, nXOffset, nYAdvance, nYOffset);
+                const GlyphItem aGI(nCharPos, nGlyphIndex, aNewPos, nGlyphFlags, nXAdvance, nXOffset, nYOffset);
                 rLayout.AppendGlyph(aGI);
 
                 aCurrPos.X() += nXAdvance;
diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx
index f295c3e..8a3d1ff 100644
--- a/vcl/inc/sallayout.hxx
+++ b/vcl/inc/sallayout.hxx
@@ -278,8 +278,6 @@ struct GlyphItem
     int     mnNewWidth;     // width after adjustments
     int     mnXOffset;
 
-    int     mnOrigHeight;    // original glyph height
-    int     mnNewHeight;     // width after adjustments
     int     mnYOffset;
 
     sal_GlyphId maGlyphId;
@@ -304,11 +302,10 @@ public:
             {}
 
             GlyphItem( int nCharPos, sal_GlyphId aGlyphId, const Point& rLinearPos,
-                long nFlags, int nOrigWidth, int nXOffset, int nOrigHeight, int nYOffset )
+                long nFlags, int nOrigWidth, int nXOffset, int nYOffset )
             :   mnFlags(nFlags), mnCharPos(nCharPos),
                 mnOrigWidth(nOrigWidth), mnNewWidth(nOrigWidth),
                 mnXOffset(nXOffset),
-                mnOrigHeight(nOrigHeight), mnNewHeight(nOrigHeight),
                 mnYOffset(nYOffset),
                 maGlyphId(aGlyphId), maLinearPos(rLinearPos)
             {}


More information about the Libreoffice-commits mailing list