[Libreoffice-commits] core.git: 9 commits - cui/source filter/source sc/source svx/source sw/source

Caolán McNamara caolanm at redhat.com
Fri May 26 11:23:54 UTC 2017


 cui/source/options/optjava.cxx              |    8 ++++----
 filter/source/svg/svgfilter.hxx             |   12 ++++++++++++
 sc/source/core/tool/compiler.cxx            |    4 ++--
 sc/source/core/tool/interpr1.cxx            |    4 +---
 sc/source/ui/docshell/docsh4.cxx            |    2 +-
 svx/source/form/datanavi.cxx                |    2 +-
 sw/source/core/edit/edfcol.cxx              |    8 ++++++--
 sw/source/uibase/app/docst.cxx              |    4 ++--
 sw/source/uibase/dialog/watermarkdialog.cxx |    8 ++++++--
 9 files changed, 35 insertions(+), 17 deletions(-)

New commits:
commit dd55370d637a2f5d397a0a24ccfbc107b64a4ad1
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri May 26 11:22:02 2017 +0100

    coverity#707857 Uninitialized scalar field
    
    Change-Id: I2d51a2e9b56dd0dc57613f305e0834ffb1732de5

diff --git a/filter/source/svg/svgfilter.hxx b/filter/source/svg/svgfilter.hxx
index b4cbac6bf346..5d692a578b32 100644
--- a/filter/source/svg/svgfilter.hxx
+++ b/filter/source/svg/svgfilter.hxx
@@ -133,6 +133,18 @@ struct PagePropertySet
     sal_Int32          nPageNumberingType;
     bool               bIsDateTimeFieldFixed;
     sal_Int32          nDateTimeFormat;
+    PagePropertySet()
+        : bIsBackgroundVisible(false)
+        , bAreBackgroundObjectsVisible(false)
+        , bIsPageNumberFieldVisible(false)
+        , bIsDateTimeFieldVisible(false)
+        , bIsFooterFieldVisible(false)
+        , bIsHeaderFieldVisible(false)
+        , nPageNumberingType(0)
+        , bIsDateTimeFieldFixed(false)
+        , nDateTimeFormat(0)
+    {
+    }
 };
 
 struct HashReferenceXInterface
commit f76b927cc53f677128925e1353e3ecc44f105a77
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri May 26 11:11:14 2017 +0100

    coverity#1409894 Dereference after null check
    
    Change-Id: If475a0415c9faf98c978576743dbfdaa79d16d3f

diff --git a/svx/source/form/datanavi.cxx b/svx/source/form/datanavi.cxx
index 5a382dbe6fd1..34ef5f81b31b 100644
--- a/svx/source/form/datanavi.cxx
+++ b/svx/source/form/datanavi.cxx
@@ -736,7 +736,7 @@ namespace svxform
                                 SAL_WARN( "svx.form", "XFormsPage::DoToolboxAction(): exception caught" );
                             }
                         }
-                        else
+                        else if (pNode)
                         {
                             try
                             {
commit bc28dde1891fd6e3b7ded3f2603aaf63a9111106
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri May 26 10:39:47 2017 +0100

    coverity#1409893 Division or modulo by float zero
    
    Change-Id: I697e9c7772792b02257ed1f40666dd70bb70300c

diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index ec94e4b88a4e..16b2dcaf7689 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -404,8 +404,12 @@ void SwEditShell::SetWatermark(const SfxWatermarkItem& rWatermark)
             OutputDevice* pOut = Application::GetDefaultDevice();
             vcl::Font aFont(pOut->GetFont());
             aFont.SetFamilyName(sFont);
-            fRatio = aFont.GetFontSize().Height();
-            fRatio /= pOut->GetTextWidth(rWatermark.GetText());
+            auto nTextWidth = pOut->GetTextWidth(rWatermark.GetText());
+            if (nTextWidth)
+            {
+                fRatio = aFont.GetFontSize().Height();
+                fRatio /= nTextWidth;
+            }
 
             // Calc the size.
             sal_Int32 nWidth = 0;
commit a74c796865f434f6e7a8806667381d325491092b
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri May 26 11:17:18 2017 +0100

    coverity#1242834 Unused value
    
    and
    
    coverity#1242871 Unused value
    coverity#1242900 Unused value
    
    Change-Id: Ic8c9afa5ac9ea9de661f15403646424486901696

diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx
index 93e38013d35c..0c5d3877bf20 100644
--- a/cui/source/options/optjava.cxx
+++ b/cui/source/options/optjava.cxx
@@ -597,7 +597,7 @@ bool SvxJavaOptionsPage::FillItemSet( SfxItemSet* /*rCoreSet*/ )
     if ( m_pParamDlg )
     {
         eErr = jfw_setVMParameters( m_pParamDlg->GetParameters() );
-        SAL_WARN_IF(JFW_E_NONE != eErr, "cui.options", "SvxJavaOptionsPage::FillItemSet(): error in jfw_setVMParameters");
+        SAL_WARN_IF(JFW_E_NONE != eErr, "cui.options", "SvxJavaOptionsPage::FillItemSet(): error in jfw_setVMParameters"); (void)eErr;
         bModified = true;
     }
 
@@ -607,7 +607,7 @@ bool SvxJavaOptionsPage::FillItemSet( SfxItemSet* /*rCoreSet*/ )
         if ( m_pPathDlg->GetOldPath() != sPath )
         {
             eErr = jfw_setUserClassPath( sPath );
-            SAL_WARN_IF(JFW_E_NONE != eErr, "cui.options", "SvxJavaOptionsPage::FillItemSet(): error in jfw_setUserClassPath");
+            SAL_WARN_IF(JFW_E_NONE != eErr, "cui.options", "SvxJavaOptionsPage::FillItemSet(): error in jfw_setUserClassPath"); (void)eErr;
             bModified = true;
         }
     }
@@ -638,7 +638,7 @@ bool SvxJavaOptionsPage::FillItemSet( SfxItemSet* /*rCoreSet*/ )
                     }
 
                     eErr = jfw_setSelectedJRE( pInfo );
-                    SAL_WARN_IF(JFW_E_NONE != eErr, "cui.options", "SvxJavaOptionsPage::FillItemSet(): error in jfw_setSelectedJRE");
+                    SAL_WARN_IF(JFW_E_NONE != eErr, "cui.options", "SvxJavaOptionsPage::FillItemSet(): error in jfw_setSelectedJRE"); (void)eErr;
                     bModified = true;
                 }
             }
@@ -649,7 +649,7 @@ bool SvxJavaOptionsPage::FillItemSet( SfxItemSet* /*rCoreSet*/ )
     bool bEnabled = false;
     eErr = jfw_getEnabled( &bEnabled );
     DBG_ASSERT( JFW_E_NONE == eErr,
-                "SvxJavaOptionsPage::FillItemSet(): error in jfw_getEnabled" );
+                "SvxJavaOptionsPage::FillItemSet(): error in jfw_getEnabled" ); (void)eErr;
     if ( bool(bEnabled) != m_pJavaEnableCB->IsChecked() )
     {
         eErr = jfw_setEnabled( m_pJavaEnableCB->IsChecked() );
commit 6ee4b68ce5bd52b31713fc5213594e54b2412737
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri May 26 10:35:57 2017 +0100

    coverity#1409896 Dereference before null check
    
    should this be pShell instead of pSh ?
    
    Change-Id: Ie653dbbdee8cebc402c9ee9e78630353ba977921

diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx
index 8193e0416964..147212a01181 100644
--- a/sw/source/uibase/app/docst.cxx
+++ b/sw/source/uibase/app/docst.cxx
@@ -275,10 +275,10 @@ void  SwDocShell::StateStyleSheet(SfxItemSet& rSet, SwWrtShell* pSh)
             case SID_STYLE_EDIT:
                 break;
             case SID_WATERMARK:
+                if (pSh)
                 {
                     SfxWatermarkItem aItem = pSh->GetWatermark();
-                    if( pSh )
-                        rSet.Put(aItem);
+                    rSet.Put(aItem);
                 }
                 break;
             default:
commit ac2ea8ab2cda18b9fb01cb0f6a9d510f7d143e4d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri May 26 10:33:20 2017 +0100

    coverity#1409897 Dereference before null check
    
    Change-Id: I9ce73a4836df502267ec9b247432dd86b6ac1b62

diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index e27e7484608a..c7f3d076bfca 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -2241,7 +2241,7 @@ void ScDocShell::LOKCommentNotify(LOKCommentNotificationType nType, const ScDocu
     aAnnotation.put("id", pNote->GetId());
     aAnnotation.put("tab", rPos.Tab());
 
-    if (nType != LOKCommentNotificationType::Remove && pNote)
+    if (nType != LOKCommentNotificationType::Remove)
     {
         aAnnotation.put("author", pNote->GetAuthor());
         aAnnotation.put("dateTime", pNote->GetDate());
commit 7be3b5b8bac080a8762279531bbe758b3675cc38
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri May 26 10:31:17 2017 +0100

    coverity#1409898 Dereference before null check
    
    Change-Id: I44b5ab0c66b4050c2ee47684af7526e2543945ca

diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 78d4f37afa35..a83e13f33a7a 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -1774,8 +1774,8 @@ ScCompiler::ScCompiler( ScDocument* pDocument, const ScAddress& rPos, ScTokenArr
         mbRewind( false )
 {
     SetGrammar( ((eGrammar == formula::FormulaGrammar::GRAM_UNSPECIFIED) ?
-                (pDocument ? pDocument->GetGrammar() : formula::FormulaGrammar::GRAM_DEFAULT) :
-                eGrammar));
+                pDocument->GetGrammar() :
+                eGrammar) );
     nMaxTab = pDoc->GetTableCount() - 1;
 }
 
commit e805881d74392969746d34756b035850c67883e6
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri May 26 10:27:48 2017 +0100

    coverity#1409895 Resource leak
    
    Change-Id: I1430ac41bf11bf3ae5c4cba3406a24148acd728e

diff --git a/sw/source/uibase/dialog/watermarkdialog.cxx b/sw/source/uibase/dialog/watermarkdialog.cxx
index 6b993d22caf1..29131215a72b 100644
--- a/sw/source/uibase/dialog/watermarkdialog.cxx
+++ b/sw/source/uibase/dialog/watermarkdialog.cxx
@@ -57,12 +57,16 @@ void SwWatermarkDialog::InitFields()
     SfxObjectShell* pDocSh = SfxObjectShell::Current();
     const SfxPoolItem* pFontItem;
     const FontList* pFontList = nullptr;
+    std::unique_ptr<FontList> xFontList;
 
     if ( pDocSh && ( ( pFontItem = pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST ) ) != nullptr ) )
         pFontList = static_cast<const SvxFontListItem*>( pFontItem )->GetFontList();
 
-    if(!pFontList)
-        pFontList = new FontList(Application::GetDefaultDevice(), nullptr);
+    if (!pFontList)
+    {
+        xFontList.reset(new FontList(Application::GetDefaultDevice(), nullptr));
+        pFontList = xFontList.get();
+    }
 
     m_pFont->Fill( pFontList );
 
commit 21944eb7395e365cae01c14790f8069ac5933306
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri May 26 10:24:49 2017 +0100

    coverity#1409901 Unused value
    
    Change-Id: I1a363ed385ba251ece29f7bd1eaa151c0657f14e

diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 85d9ddb4259b..845be4b5e523 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -3794,7 +3794,6 @@ void ScInterpreter::GetStVarParams( bool bTextAsZero, double(*VarResult)( double
         ArrayRefListValue() : mfSum(0.0) {}
     };
     std::vector<ArrayRefListValue> vArrayValues;
-    size_t nRefArrayPos = std::numeric_limits<size_t>::max();
 
     std::vector<double> values;
     double fSum    = 0.0;
@@ -3840,7 +3839,7 @@ void ScInterpreter::GetStVarParams( bool bTextAsZero, double(*VarResult)( double
                 const ScRefListToken* p = dynamic_cast<const ScRefListToken*>(pStack[sp-1]);
                 if (p && p->IsArrayResult())
                 {
-                    nRefArrayPos = nRefInList;
+                    size_t nRefArrayPos = nRefInList;
                     if (vArrayValues.empty())
                     {
                         // Create and init all elements with current value.
@@ -3882,7 +3881,6 @@ void ScInterpreter::GetStVarParams( bool bTextAsZero, double(*VarResult)( double
                     // Reset.
                     std::vector<double>().swap(values);
                     fSum = 0.0;
-                    nRefArrayPos = std::numeric_limits<size_t>::max();
                     break;
                 }
             }


More information about the Libreoffice-commits mailing list