[Libreoffice-commits] core.git: 4 commits - sc/source test/source vcl/source

Caolán McNamara caolanm at redhat.com
Sun Feb 14 20:59:53 UTC 2016


 sc/source/core/data/dociter.cxx       |    4 +-
 sc/source/ui/vba/vbaformat.cxx        |    4 +-
 sc/source/ui/vba/vbaformat.hxx        |    4 +-
 sc/source/ui/vba/vbarange.cxx         |    4 +-
 sc/source/ui/vba/vbarange.hxx         |    4 +-
 test/source/primitive2dxmldump.cxx    |   52 +++++++++++++++++-----------------
 vcl/source/glyphs/graphite_layout.cxx |    1 
 7 files changed, 36 insertions(+), 37 deletions(-)

New commits:
commit 30a36fa3a6451cf27cdec039aba480357d6f1613
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Feb 14 20:59:16 2016 +0000

    WaE: unreachable code
    
    Change-Id: I700168b0484e86caa8df4a579ef51bcd40b6f66f

diff --git a/vcl/source/glyphs/graphite_layout.cxx b/vcl/source/glyphs/graphite_layout.cxx
index 2038a24..8226c9c 100644
--- a/vcl/source/glyphs/graphite_layout.cxx
+++ b/vcl/source/glyphs/graphite_layout.cxx
@@ -687,7 +687,6 @@ unsigned int GraphiteLayout::ScanFwdForChar(int &findChar, bool fallback) const
             ++findChar;
             return 0;
         }
-        fallback = !fallback;
     }
     return unsigned(res);
 }
commit 9ac4a3426a63178607536e4ec85ac2984b775c62
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Feb 14 20:54:04 2016 +0000

    coverity#1352321 Dereference null return value
    
    and
    
    coverity#1352322 Dereference null return value
    
    Change-Id: I0482ed95e8fbce5d7f9a827588a66ebd0f9d69c7

diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index c174d99..4ea2d54 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -789,7 +789,7 @@ ScFormulaGroupIterator::ScFormulaGroupIterator( ScDocument* pDoc ) :
     mnIndex(0)
 {
     ScTable *pTab = mpDoc->FetchTable(mnTab);
-    ScColumn *pCol = pTab->FetchColumn(mnCol);
+    ScColumn *pCol = pTab ? pTab->FetchColumn(mnCol) : nullptr;
     if (pCol)
     {
         mbNullCol = false;
@@ -820,7 +820,7 @@ sc::FormulaGroupEntry* ScFormulaGroupIterator::next()
                     return nullptr;
             }
             ScTable *pTab = mpDoc->FetchTable(mnTab);
-            ScColumn *pCol = pTab->FetchColumn(mnCol);
+            ScColumn *pCol = pTab ? pTab->FetchColumn(mnCol) : nullptr;
             if (pCol)
             {
                 mbNullCol = false;
commit 5969fc79cf2d67d8a7c1483f0cc2cf42c863efb4
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Feb 14 20:52:08 2016 +0000

    coverity#1352306 Unchecked dynamic_cast
    
    and
    
    coverity#1352307 Unchecked dynamic_cast
    
    Change-Id: I0b072e432fe5d510a2a55ad33628ec93b706c860

diff --git a/test/source/primitive2dxmldump.cxx b/test/source/primitive2dxmldump.cxx
index dd1546f..d1b2fcb 100644
--- a/test/source/primitive2dxmldump.cxx
+++ b/test/source/primitive2dxmldump.cxx
@@ -102,31 +102,31 @@ void Primitive2dXmlDump::decomposeAndWrite(
         {
             case PRIMITIVE2D_ID_HIDDENGEOMETRYPRIMITIVE2D:
             {
-                const HiddenGeometryPrimitive2D* pHiddenGeometryPrimitive2D = dynamic_cast<const HiddenGeometryPrimitive2D*>(pBasePrimitive);
+                const HiddenGeometryPrimitive2D& rHiddenGeometryPrimitive2D = dynamic_cast<const HiddenGeometryPrimitive2D&>(*pBasePrimitive);
                 rWriter.startElement("hiddengeometry");
-                decomposeAndWrite(pHiddenGeometryPrimitive2D->getChildren(), rWriter);
+                decomposeAndWrite(rHiddenGeometryPrimitive2D.getChildren(), rWriter);
                 rWriter.endElement();
             }
             break;
 
             case PRIMITIVE2D_ID_TRANSFORMPRIMITIVE2D:
             {
-                const TransformPrimitive2D* pTransformPrimitive2D = dynamic_cast<const TransformPrimitive2D*>(pBasePrimitive);
+                const TransformPrimitive2D& rTransformPrimitive2D = dynamic_cast<const TransformPrimitive2D&>(*pBasePrimitive);
                 rWriter.startElement("transform");
                 //pTransformPrimitive2D->getTransformation()
-                decomposeAndWrite(pTransformPrimitive2D->getChildren(), rWriter);
+                decomposeAndWrite(rTransformPrimitive2D.getChildren(), rWriter);
                 rWriter.endElement();
             }
             break;
 
             case PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D:
             {
-                const PolyPolygonColorPrimitive2D* pPolyPolygonColorPrimitive2D = dynamic_cast<const PolyPolygonColorPrimitive2D*>(pBasePrimitive);
+                const PolyPolygonColorPrimitive2D& rPolyPolygonColorPrimitive2D = dynamic_cast<const PolyPolygonColorPrimitive2D&>(*pBasePrimitive);
 
                 rWriter.startElement("polypolygoncolor");
-                rWriter.attribute("color", convertColorToString(pPolyPolygonColorPrimitive2D->getBColor()));
+                rWriter.attribute("color", convertColorToString(rPolyPolygonColorPrimitive2D.getBColor()));
                 rWriter.startElement("polypolygon");
-                rWriter.content(basegfx::tools::exportToSvgD(pPolyPolygonColorPrimitive2D->getB2DPolyPolygon(), true, true, false));
+                rWriter.content(basegfx::tools::exportToSvgD(rPolyPolygonColorPrimitive2D.getB2DPolyPolygon(), true, true, false));
                 rWriter.endElement();
                 rWriter.endElement();
             }
@@ -134,11 +134,11 @@ void Primitive2dXmlDump::decomposeAndWrite(
 
             case PRIMITIVE2D_ID_POLYPOLYGONSTROKEPRIMITIVE2D:
             {
-                const PolyPolygonStrokePrimitive2D* pPolyPolygonStrokePrimitive2D = dynamic_cast<const PolyPolygonStrokePrimitive2D*>(pBasePrimitive);
+                const PolyPolygonStrokePrimitive2D& rPolyPolygonStrokePrimitive2D = dynamic_cast<const PolyPolygonStrokePrimitive2D&>(*pBasePrimitive);
                 rWriter.startElement("polypolygonstroke");
 
                 rWriter.startElement("line");
-                drawinglayer::attribute::LineAttribute aLineAttribute = pPolyPolygonStrokePrimitive2D->getLineAttribute();
+                drawinglayer::attribute::LineAttribute aLineAttribute = rPolyPolygonStrokePrimitive2D.getLineAttribute();
                 rWriter.attribute("color", convertColorToString(aLineAttribute.getColor()));
                 rWriter.attribute("width", aLineAttribute.getWidth());
                 //rWriter.attribute("linejoin", aLineAttribute.getLineJoin());
@@ -148,7 +148,7 @@ void Primitive2dXmlDump::decomposeAndWrite(
                 //getStrokeAttribute()
 
                 rWriter.startElement("polypolygon");
-                rWriter.content(basegfx::tools::exportToSvgD(pPolyPolygonStrokePrimitive2D->getB2DPolyPolygon(), true, true, false));
+                rWriter.content(basegfx::tools::exportToSvgD(rPolyPolygonStrokePrimitive2D.getB2DPolyPolygon(), true, true, false));
                 rWriter.endElement();
 
                 rWriter.endElement();
@@ -157,13 +157,13 @@ void Primitive2dXmlDump::decomposeAndWrite(
 
             case PRIMITIVE2D_ID_POLYGONHAIRLINEPRIMITIVE2D:
             {
-                const PolygonHairlinePrimitive2D* pPolygonHairlinePrimitive2D = dynamic_cast<const PolygonHairlinePrimitive2D*>(pBasePrimitive);
+                const PolygonHairlinePrimitive2D& rPolygonHairlinePrimitive2D = dynamic_cast<const PolygonHairlinePrimitive2D&>(*pBasePrimitive);
                 rWriter.startElement("polygonhairline");
 
-                rWriter.attribute("color", convertColorToString(pPolygonHairlinePrimitive2D->getBColor()));
+                rWriter.attribute("color", convertColorToString(rPolygonHairlinePrimitive2D.getBColor()));
 
                 rWriter.startElement("polygon");
-                rWriter.content(basegfx::tools::exportToSvgPoints(pPolygonHairlinePrimitive2D->getB2DPolygon()));
+                rWriter.content(basegfx::tools::exportToSvgPoints(rPolygonHairlinePrimitive2D.getB2DPolygon()));
                 rWriter.endElement();
 
 
@@ -173,37 +173,37 @@ void Primitive2dXmlDump::decomposeAndWrite(
 
             case PRIMITIVE2D_ID_TEXTSIMPLEPORTIONPRIMITIVE2D:
             {
-                const TextSimplePortionPrimitive2D* pTextSimplePortionPrimitive2D = dynamic_cast<const TextSimplePortionPrimitive2D*>(pBasePrimitive);
+                const TextSimplePortionPrimitive2D& rTextSimplePortionPrimitive2D = dynamic_cast<const TextSimplePortionPrimitive2D&>(*pBasePrimitive);
                 rWriter.startElement("textsimpleportion");
 
                 basegfx::B2DVector aScale, aTranslate;
                 double fRotate, fShearX;
-                if(pTextSimplePortionPrimitive2D->getTextTransform().decompose(aScale, aTranslate, fRotate, fShearX))
+                if(rTextSimplePortionPrimitive2D.getTextTransform().decompose(aScale, aTranslate, fRotate, fShearX))
                 {
                     rWriter.attribute("height", aScale.getY());
                 }
-                rWriter.attribute("text", pTextSimplePortionPrimitive2D->getText());
-                rWriter.attribute("fontcolor", convertColorToString(pTextSimplePortionPrimitive2D->getFontColor()));
+                rWriter.attribute("text", rTextSimplePortionPrimitive2D.getText());
+                rWriter.attribute("fontcolor", convertColorToString(rTextSimplePortionPrimitive2D.getFontColor()));
                 rWriter.endElement();
             }
             break;
 
             case PRIMITIVE2D_ID_MASKPRIMITIVE2D:
             {
-                const MaskPrimitive2D* pMaskPrimitive2D = dynamic_cast<const MaskPrimitive2D*>(pBasePrimitive);
+                const MaskPrimitive2D& rMaskPrimitive2D = dynamic_cast<const MaskPrimitive2D&>(*pBasePrimitive);
                 rWriter.startElement("mask");
 
-                decomposeAndWrite(pMaskPrimitive2D->getChildren(), rWriter);
+                decomposeAndWrite(rMaskPrimitive2D.getChildren(), rWriter);
                 rWriter.endElement();
             }
             break;
 
             case PRIMITIVE2D_ID_UNIFIEDTRANSPARENCEPRIMITIVE2D:
             {
-                const UnifiedTransparencePrimitive2D* pUnifiedTransparencePrimitive2D = dynamic_cast<const UnifiedTransparencePrimitive2D*>(pBasePrimitive);
+                const UnifiedTransparencePrimitive2D& rUnifiedTransparencePrimitive2D = dynamic_cast<const UnifiedTransparencePrimitive2D&>(*pBasePrimitive);
                 rWriter.startElement("unifiedtransparence");
 
-                rWriter.attribute("transparence", pUnifiedTransparencePrimitive2D->getTransparence());
+                rWriter.attribute("transparence", rUnifiedTransparencePrimitive2D.getTransparence());
 
                 rWriter.endElement();
             }
@@ -211,21 +211,21 @@ void Primitive2dXmlDump::decomposeAndWrite(
 
             case PRIMITIVE2D_ID_OBJECTINFOPRIMITIVE2D:
             {
-                const ObjectInfoPrimitive2D* pObjectInfoPrimitive2D = dynamic_cast<const ObjectInfoPrimitive2D*>(pBasePrimitive);
+                const ObjectInfoPrimitive2D& rObjectInfoPrimitive2D = dynamic_cast<const ObjectInfoPrimitive2D&>(*pBasePrimitive);
                 rWriter.startElement("objectinfo");
 
-                decomposeAndWrite(pObjectInfoPrimitive2D->getChildren(), rWriter);
+                decomposeAndWrite(rObjectInfoPrimitive2D.getChildren(), rWriter);
                 rWriter.endElement();
             }
             break;
 
             case PRIMITIVE2D_ID_SVGRADIALGRADIENTPRIMITIVE2D:
             {
-                const SvgRadialGradientPrimitive2D* pSvgRadialGradientPrimitive2D = dynamic_cast<const SvgRadialGradientPrimitive2D*>(pBasePrimitive);
+                const SvgRadialGradientPrimitive2D& rSvgRadialGradientPrimitive2D = dynamic_cast<const SvgRadialGradientPrimitive2D&>(*pBasePrimitive);
                 rWriter.startElement("svgradialgradient");
-                basegfx::B2DPoint aFocusAttribute = pSvgRadialGradientPrimitive2D->getFocal();
+                basegfx::B2DPoint aFocusAttribute = rSvgRadialGradientPrimitive2D.getFocal();
 
-                rWriter.attribute("radius", pSvgRadialGradientPrimitive2D->getRadius());
+                rWriter.attribute("radius", rSvgRadialGradientPrimitive2D.getRadius());
                 rWriter.attribute("x", aFocusAttribute.getX());
                 rWriter.attribute("y", aFocusAttribute.getY());
 
commit 1ef5733c155df0151f78f226797af5e26b7b1513
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Feb 14 20:38:12 2016 +0000

    coverity#1352451 Uncaught exception
    
    and
    
    coverity#1352452 Uncaught exception
    coverity#1352453 Uncaught exception
    
    Change-Id: I100aa7ebf729bfe2e379e28891f5cd217d4187cc

diff --git a/sc/source/ui/vba/vbaformat.cxx b/sc/source/ui/vba/vbaformat.cxx
index 8c14d40..c511304 100644
--- a/sc/source/ui/vba/vbaformat.cxx
+++ b/sc/source/ui/vba/vbaformat.cxx
@@ -717,7 +717,7 @@ ScVbaFormat< Ifc... >::getReadingOrder(  ) throw (script::BasicErrorException, u
 
 template< typename... Ifc >
 uno::Any SAL_CALL
-ScVbaFormat< Ifc... >::getNumberFormat(  ) throw (script::BasicErrorException, uno::RuntimeException)
+ScVbaFormat< Ifc... >::getNumberFormat(  ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
 {
     uno::Any aFormat = aNULL();
     try
@@ -789,7 +789,7 @@ ScVbaFormat< Ifc... >::getCellRangesBase() throw ( ::uno::RuntimeException )
 
 template< typename... Ifc >
 SfxItemSet*
-ScVbaFormat< Ifc... >::getCurrentDataSet( ) throw ( uno::RuntimeException )
+ScVbaFormat< Ifc... >::getCurrentDataSet() throw (uno::RuntimeException, std::exception)
 {
     SfxItemSet* pDataSet = excel::ScVbaCellRangeAccess::GetDataSet( getCellRangesBase() );
     if ( !pDataSet )
diff --git a/sc/source/ui/vba/vbaformat.hxx b/sc/source/ui/vba/vbaformat.hxx
index 5c96d61..15aba86 100644
--- a/sc/source/ui/vba/vbaformat.hxx
+++ b/sc/source/ui/vba/vbaformat.hxx
@@ -50,7 +50,7 @@ protected:
     bool isAmbiguous(const OUString& _sPropertyName) throw ( css::script::BasicErrorException );
     css::uno::Reference< css::beans::XPropertyState > getXPropertyState() throw ( css::uno::RuntimeException );
     void initializeNumberFormats() throw ( css::script::BasicErrorException, css::uno::RuntimeException );
-    SfxItemSet*  getCurrentDataSet( ) throw ( css::uno::RuntimeException );
+    SfxItemSet*  getCurrentDataSet( ) throw (css::uno::RuntimeException, std::exception);
 protected:
     virtual ScCellRangesBase* getCellRangesBase() throw ( css::uno::RuntimeException );
 public:
@@ -64,7 +64,7 @@ public:
     virtual css::uno::Reference< ::ooo::vba::excel::XFont > SAL_CALL Font(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
     virtual css::uno::Reference< ::ooo::vba::excel::XInterior > SAL_CALL Interior(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
     virtual void SAL_CALL setNumberFormat( const css::uno::Any& NumberFormat ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
-    virtual css::uno::Any SAL_CALL getNumberFormat(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
+    virtual css::uno::Any SAL_CALL getNumberFormat(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException, std::exception);
     virtual void SAL_CALL setNumberFormatLocal( const css::uno::Any& NumberFormatLocal ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
     virtual css::uno::Any SAL_CALL getNumberFormatLocal(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
     virtual void SAL_CALL setIndentLevel( const css::uno::Any& IndentLevel ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index 661b2ad..578eda4 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -263,7 +263,7 @@ ScCellRangeObj* ScVbaRange::getCellRangeObj() throw ( uno::RuntimeException )
     return dynamic_cast< ScCellRangeObj* >( getCellRangesBase() );
 }
 
-SfxItemSet*  ScVbaRange::getCurrentDataSet( ) throw ( uno::RuntimeException )
+SfxItemSet*  ScVbaRange::getCurrentDataSet( ) throw (uno::RuntimeException, std::exception)
 {
     SfxItemSet* pDataSet = excel::ScVbaCellRangeAccess::GetDataSet( getCellRangesBase() );
     if ( !pDataSet )
@@ -2560,7 +2560,7 @@ ScVbaRange::setNumberFormat( const uno::Any& aFormat ) throw ( script::BasicErro
 }
 
 uno::Any
-ScVbaRange::getNumberFormat() throw ( script::BasicErrorException, uno::RuntimeException)
+ScVbaRange::getNumberFormat() throw (script::BasicErrorException, uno::RuntimeException, std::exception)
 {
 
     if ( m_Areas->getCount() > 1 )
diff --git a/sc/source/ui/vba/vbarange.hxx b/sc/source/ui/vba/vbarange.hxx
index 4dfa72b..ba964dea 100644
--- a/sc/source/ui/vba/vbarange.hxx
+++ b/sc/source/ui/vba/vbarange.hxx
@@ -115,7 +115,7 @@ class ScVbaRange : public ScVbaRange_BASE
 
 protected:
     virtual ScCellRangesBase* getCellRangesBase() throw ( css::uno::RuntimeException ) override;
-    SfxItemSet* getCurrentDataSet( )  throw ( css::uno::RuntimeException );
+    SfxItemSet* getCurrentDataSet() throw (css::uno::RuntimeException, std::exception);
 public:
     ScVbaRange( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::table::XCellRange >& xRange, bool bIsRows = false, bool bIsColumns = false ) throw ( css::lang::IllegalArgumentException );
     ScVbaRange( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::sheet::XSheetCellRangeContainer >& xRanges, bool bIsRows = false, bool bIsColumns = false ) throw ( css::lang::IllegalArgumentException, css::uno::RuntimeException );
@@ -163,7 +163,7 @@ public:
     virtual OUString SAL_CALL getText() throw (css::uno::RuntimeException, std::exception) override;
     using ScVbaRange_BASE::setNumberFormat;
     virtual void SAL_CALL setNumberFormat( const css::uno::Any& rNumberFormat ) throw ( css::script::BasicErrorException, css::uno::RuntimeException) override;
-    virtual css::uno::Any SAL_CALL getNumberFormat() throw (css::script::BasicErrorException, css::uno::RuntimeException) override;
+    virtual css::uno::Any SAL_CALL getNumberFormat() throw (css::script::BasicErrorException, css::uno::RuntimeException, std::exception) override;
     virtual void SAL_CALL setMergeCells( const css::uno::Any& bMerge ) throw (css::script::BasicErrorException, css::uno::RuntimeException) override;
     virtual css::uno::Any SAL_CALL getMergeCells() throw (css::script::BasicErrorException, css::uno::RuntimeException) override;
     virtual void SAL_CALL setWrapText( const css::uno::Any& bIsWrapped ) throw (css::script::BasicErrorException, css::uno::RuntimeException) override;


More information about the Libreoffice-commits mailing list