[Libreoffice-commits] core.git: 9 commits - cui/source sw/source vcl/source writerfilter/source

Caolán McNamara caolanm at redhat.com
Fri Mar 21 08:52:58 PDT 2014


 cui/source/options/treeopt.cxx                        |    3 ++
 sw/source/core/uibase/shells/annotsh.cxx              |   23 +++++++-----------
 sw/source/core/uibase/uno/SwXDocumentSettings.cxx     |   10 +++++--
 sw/source/ui/index/cnttab.cxx                         |   11 +++-----
 vcl/source/fontsubset/sft.cxx                         |    2 -
 vcl/source/gdi/outdev3.cxx                            |    5 +--
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |   21 ++++------------
 7 files changed, 32 insertions(+), 43 deletions(-)

New commits:
commit 87d1e5c27d33f79f45fff3a1c9d05f0d3662cfaa
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Mar 21 15:48:11 2014 +0000

    coverity#705459 Dereference null return value
    
    Change-Id: Ib49e23529e34dfc4afda45f26eec15af67e9da68

diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx
index 057f014..1a23f7d 100644
--- a/cui/source/options/treeopt.cxx
+++ b/cui/source/options/treeopt.cxx
@@ -877,6 +877,9 @@ void OfaTreeOptionsDialog::ActivateLastSelection()
         pEntry = aTreeLB.Next(pEntry);
     }
 
+    if ( !pEntry )
+        return;
+
     SvTreeListEntry* pParent = aTreeLB.GetParent(pEntry);
     aTreeLB.Expand(pParent);
     aTreeLB.MakeVisible(pParent);
commit 292ba61eae3318edd86ec0af4d8726189bc2affd
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Mar 21 15:46:37 2014 +0000

    coverity#1000766 Dereference before null check
    
    Change-Id: I539cb91511fe95d004044a98736b4a6b99f24a5b

diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index 7de3d81..093da2f 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -4212,9 +4212,8 @@ SalLayout* OutputDevice::ImplLayout(const OUString& rOrigStr,
 
     // do glyph fallback if needed
     // #105768# avoid fallback for very small font sizes
-    if( aLayoutArgs.NeedFallback() )
-        if( mpFontEntry && (mpFontEntry->maFontSelData.mnHeight >= 3) )
-            pSalLayout = ImplGlyphFallbackLayout( pSalLayout, aLayoutArgs );
+    if (aLayoutArgs.NeedFallback() && mpFontEntry->maFontSelData.mnHeight >= 3)
+        pSalLayout = ImplGlyphFallbackLayout(pSalLayout, aLayoutArgs);
 
     // position, justify, etc. the layout
     pSalLayout->AdjustLayout( aLayoutArgs );
commit 85771a44ccc6404bbafbd5f70eff3c39ae85e507
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Mar 21 15:41:49 2014 +0000

    coverity#705975 Dereference before null check
    
    Change-Id: I5499cba6f72c9bcf4b47363da7003fa9bc94dfa6

diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index 4615286..14e0c3c 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -2232,12 +2232,9 @@ OOXMLFastContextHandlerWrapper::OOXMLFastContextHandlerWrapper
  uno::Reference<XFastContextHandler> xContext)
 : OOXMLFastContextHandler(pParent), mxContext(xContext)
 {
-    if (pParent != NULL)
-    {
-        setId(pParent->getId());
-        setToken(pParent->getToken());
-        setPropertySet(pParent->getPropertySet());
-    }
+    setId(pParent->getId());
+    setToken(pParent->getToken());
+    setPropertySet(pParent->getPropertySet());
 }
 
 OOXMLFastContextHandlerWrapper::~OOXMLFastContextHandlerWrapper()
commit ba811903a6eb12ec599ca8e84c97d2e6cfc48cb4
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Mar 21 15:40:42 2014 +0000

    coverity#705974 Dereference before null check
    
    Change-Id: I6286888f85214a82ad232dd26b7b23e175de39d4

diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index 667646b..4615286 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -147,8 +147,8 @@ OOXMLFastContextHandler::OOXMLFastContextHandler
   mId(0),
   mnDefine(0),
   mnToken(OOXML_FAST_TOKENS_END),
-  mpStream(NULL),
-  mnTableDepth(0),
+  mpStream(pContext->mpStream),
+  mnTableDepth(pContext->mnTableDepth),
   mnInstanceNumber(mnInstanceCount),
   mnRefCount(0),
   inPositionV(pContext->inPositionV),
@@ -157,13 +157,7 @@ OOXMLFastContextHandler::OOXMLFastContextHandler
   m_bTookChoice(pContext->m_bTookChoice),
   m_aSavedAlternateStates(pContext->m_aSavedAlternateStates)
 {
-    if (pContext != NULL)
-    {
-        mpStream = pContext->mpStream;
-        mpParserState = pContext->mpParserState;
-        mnTableDepth = pContext->mnTableDepth;
-        m_xContext = pContext->m_xContext;
-    }
+    mpParserState = pContext->mpParserState;
 
     if (mpParserState.get() == NULL)
         mpParserState.reset(new OOXMLParserState());
commit 94319e31f08310266280307be08f78311385ca6d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Mar 21 15:38:08 2014 +0000

    coverity#705953 Dereference before null check
    
    Change-Id: Ia9d6af4d601b76dfb9e950fdb4bdaf283f3e985c

diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx
index 54437b4..dcb8bc6 100644
--- a/sw/source/ui/index/cnttab.cxx
+++ b/sw/source/ui/index/cnttab.cxx
@@ -3201,14 +3201,11 @@ void SwTokenWindow::AdjustScrolling()
         }
         else
         {
-            if(pFirstCtrl)
-            {
-                //if the control fits into the space then the first control must be at postion 0
-                long nFirstPos = pFirstCtrl->GetPosPixel().X();
+            //if the control fits into the space then the first control must be at postion 0
+            long nFirstPos = pFirstCtrl->GetPosPixel().X();
 
-                if(nFirstPos != 0)
-                    MoveControls(-nFirstPos);
-            }
+            if(nFirstPos != 0)
+                MoveControls(-nFirstPos);
 
             m_pRightScrollWin->Enable(false);
             m_pLeftScrollWin->Enable(false);
commit 899da0c87348cc298fe8ab43c905eaaab977f781
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Mar 21 15:36:42 2014 +0000

    coverity#705956 Dereference before null check
    
    Change-Id: I2058c5ab31763b0df483737e79ead6c980b966c7

diff --git a/sw/source/core/uibase/shells/annotsh.cxx b/sw/source/core/uibase/shells/annotsh.cxx
index f2602b7..beddafa 100644
--- a/sw/source/core/uibase/shells/annotsh.cxx
+++ b/sw/source/core/uibase/shells/annotsh.cxx
@@ -665,20 +665,15 @@ void SwAnnotationShell::GetState(SfxItemSet& rSet)
             case SID_ATTR_CHAR_WEIGHT:
             case SID_ATTR_CHAR_POSTURE:
                 {
-                    if ( pOLV )
-                    {
-                        sal_uInt16 nScriptType = pOLV->GetSelectedScriptType();
-                        SfxItemPool* pSecondPool = aEditAttr.GetPool()->GetSecondaryPool();
-                        if( !pSecondPool )
-                            pSecondPool = aEditAttr.GetPool();
-                        SvxScriptSetItem aSetItem( nSlotId, *pSecondPool );
-                        aSetItem.GetItemSet().Put( aEditAttr, false );
-                        const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScriptType );
-                        if( pI )
-                            rSet.Put( *pI, nWhich );
-                        else
-                            rSet.InvalidateItem( nWhich );
-                    }
+                    sal_uInt16 nScriptType = pOLV->GetSelectedScriptType();
+                    SfxItemPool* pSecondPool = aEditAttr.GetPool()->GetSecondaryPool();
+                    if( !pSecondPool )
+                        pSecondPool = aEditAttr.GetPool();
+                    SvxScriptSetItem aSetItem( nSlotId, *pSecondPool );
+                    aSetItem.GetItemSet().Put( aEditAttr, false );
+                    const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScriptType );
+                    if( pI )
+                        rSet.Put( *pI, nWhich );
                     else
                         rSet.InvalidateItem( nWhich );
                 }
commit 511d8bbbec6bc95d92a3ac6bbac4c68622738706
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Mar 21 15:33:53 2014 +0000

    coverity#705966 Dereference before null check
    
    Change-Id: I74507ce67f928bdeb626d4070dbd2a45cc126521

diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index b439477..d957159 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -2332,7 +2332,7 @@ bool GetSfntTable( TrueTypeFont* ttf, int nSubtableIndex,
         return false;
     *pRawLength = ttf->tlens[ nSubtableIndex ];
     *ppRawBytes = ttf->tables[ nSubtableIndex ];
-    bool bOk = (*pRawLength > 0) && (ppRawBytes != NULL);
+    bool bOk = (*pRawLength > 0) && (*ppRawBytes != NULL);
     return bOk;
 }
 
commit d34bcb1053540a858958db8551bb2b4797caaf09
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Mar 21 15:32:04 2014 +0000

    coverity#705961 Dereference before null check
    
    Change-Id: I0737bbc738779a4ef282c7eea1406a796e0d663d

diff --git a/sw/source/core/uibase/uno/SwXDocumentSettings.cxx b/sw/source/core/uibase/uno/SwXDocumentSettings.cxx
index c8f6849..0f4a840 100644
--- a/sw/source/core/uibase/uno/SwXDocumentSettings.cxx
+++ b/sw/source/core/uibase/uno/SwXDocumentSettings.cxx
@@ -293,9 +293,11 @@ void SwXDocumentSettings::_preSetValues ()
         throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException )
 {
     mpDocSh = mpModel->GetDocShell();
-    mpDoc = mpDocSh->GetDoc();
+    if (NULL == mpDocSh)
+        throw UnknownPropertyException();
 
-    if( NULL == mpDoc || NULL == mpDocSh )
+    mpDoc = mpDocSh->GetDoc();
+    if (NULL == mpDoc)
         throw UnknownPropertyException();
 }
 
commit 813a1ea12da7f588c22cf40bd1d6b227bf01a539
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Mar 21 15:22:26 2014 +0000

    coverity#705960 Dereference before null check
    
    Change-Id: I39253ca1e50c57564b594401f69cef4b661dbd2a

diff --git a/sw/source/core/uibase/uno/SwXDocumentSettings.cxx b/sw/source/core/uibase/uno/SwXDocumentSettings.cxx
index 877e805..c8f6849 100644
--- a/sw/source/core/uibase/uno/SwXDocumentSettings.cxx
+++ b/sw/source/core/uibase/uno/SwXDocumentSettings.cxx
@@ -822,8 +822,10 @@ void SwXDocumentSettings::_preGetValues ()
         throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException )
 {
     mpDocSh = mpModel->GetDocShell();
+    if (NULL == mpDocSh)
+        throw UnknownPropertyException();
     mpDoc = mpDocSh->GetDoc();
-    if( NULL == mpDoc || NULL == mpDocSh )
+    if (NULL == mpDoc)
         throw UnknownPropertyException();
 }
 


More information about the Libreoffice-commits mailing list