[Libreoffice-commits] core.git: 3 commits - basegfx/source basegfx/test include/basegfx sw/source

Caolán McNamara caolanm at redhat.com
Sat Jan 7 00:05:22 UTC 2017


 basegfx/source/color/bcolortools.cxx  |   11 -----------
 basegfx/test/basegfx2d.cxx            |   13 -------------
 include/basegfx/color/bcolortools.hxx |    4 ----
 sw/source/core/draw/dcontact.cxx      |    6 +++---
 4 files changed, 3 insertions(+), 31 deletions(-)

New commits:
commit 6af9609284e33c9a8501cbda9ef4c82f30a16b41
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jan 6 20:31:49 2017 +0000

    coverity#1398369 Unchecked dynamic_cast
    
    Change-Id: I33b5a2343eb7701a478c8d039d818e679471d4c0

diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index 06e9f66..c0755c0 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -587,7 +587,7 @@ void SwFlyDrawContact::SwClientNotify(const SwModify& rMod, const SfxHint& rHint
         // This also needs to work when no layout exists. Thus, for
         // FlyFrames an alternative method is used now in that case.
         auto pFormat(dynamic_cast<const SwFrameFormat*>(&rMod));
-        if(pFormat->Which() == RES_FLYFRMFMT && !pFormat->getIDocumentLayoutAccess().GetCurrentViewShell())
+        if (pFormat && pFormat->Which() == RES_FLYFRMFMT && !pFormat->getIDocumentLayoutAccess().GetCurrentViewShell())
             pGetZOrdnerHint->m_rnZOrder = GetMaster()->GetOrdNum();
     }
 }
@@ -598,9 +598,9 @@ bool CheckControlLayer( const SdrObject *pObj )
 {
     if ( SdrInventor::FmForm == pObj->GetObjInventor() )
         return true;
-    if (const SdrObjList *pObjLst = dynamic_cast<const SdrObjGroup*>(pObj))
+    if (const SdrObjGroup *pObjGroup = dynamic_cast<const SdrObjGroup*>(pObj))
     {
-        const SdrObjList *pLst = pObjLst->GetSubList();
+        const SdrObjList *pLst = pObjGroup->GetSubList();
         for ( size_t i = 0; i < pLst->GetObjCount(); ++i )
         {
             if ( ::CheckControlLayer( pLst->GetObj( i ) ) )
commit fb92ec82caa96f2ddf4ab4bca8c51503ae9fba82
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jan 6 20:28:49 2017 +0000

    dynamic cast followed by static cast
    
    Change-Id: I425692130bd7ef6b8a9ebce3592c1976fa44dafc

diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index 977841b..06e9f66 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -598,9 +598,9 @@ bool CheckControlLayer( const SdrObject *pObj )
 {
     if ( SdrInventor::FmForm == pObj->GetObjInventor() )
         return true;
-    if ( dynamic_cast<const SdrObjGroup*>( pObj) !=  nullptr )
+    if (const SdrObjList *pObjLst = dynamic_cast<const SdrObjGroup*>(pObj))
     {
-        const SdrObjList *pLst = static_cast<const SdrObjGroup*>(pObj)->GetSubList();
+        const SdrObjList *pLst = pObjLst->GetSubList();
         for ( size_t i = 0; i < pLst->GetObjCount(); ++i )
         {
             if ( ::CheckControlLayer( pLst->GetObj( i ) ) )
commit 9e7ff6a7e4415ce18b7a68c857bdb86f142a8e5d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jan 6 20:36:56 2017 +0000

    coverity#1398371 Useless call
    
    Change-Id: I3614bb162cec889ee102e0284b6a3a33a98df470

diff --git a/basegfx/source/color/bcolortools.cxx b/basegfx/source/color/bcolortools.cxx
index 7e139ac..095ea50 100644
--- a/basegfx/source/color/bcolortools.cxx
+++ b/basegfx/source/color/bcolortools.cxx
@@ -189,17 +189,6 @@ namespace basegfx { namespace tools
         }
     }
 
-    BColor rgb2ciexyz( const BColor& rRGBColor )
-    {
-        // from Poynton color faq, and SMPTE RP 177-1993, Derivation
-        // of Basic Television Color Equations
-        const double r=rRGBColor.getRed(), g=rRGBColor.getGreen(), b=rRGBColor.getBlue();
-        return BColor(
-            0.412453*r + 0.35758*g  + 0.180423*b,
-            0.212671*r + 0.71516*g  + 0.072169*b,
-            0.019334*r + 0.119193*g + 0.950227*b);
-    }
-
 } } // end of namespace basegfx
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basegfx/test/basegfx2d.cxx b/basegfx/test/basegfx2d.cxx
index 502f784..b0b27ef 100644
--- a/basegfx/test/basegfx2d.cxx
+++ b/basegfx/test/basegfx2d.cxx
@@ -1211,18 +1211,6 @@ public:
                                tools::rgb2hsv(BColor(.5,.25,.25)) == BColor(0,.5,.5));
     }
 
-    void ciexyzTest()
-    {
-        tools::rgb2ciexyz(maWhite);
-        tools::rgb2ciexyz(maBlack);
-        tools::rgb2ciexyz(maRed);
-        tools::rgb2ciexyz(maGreen);
-        tools::rgb2ciexyz(maBlue);
-        tools::rgb2ciexyz(maYellow);
-        tools::rgb2ciexyz(maMagenta);
-        tools::rgb2ciexyz(maCyan);
-    }
-
     // Change the following lines only, if you add, remove or rename
     // member functions of the current class,
     // because these macros are need by auto register mechanism.
@@ -1230,7 +1218,6 @@ public:
     CPPUNIT_TEST_SUITE(bcolor);
     CPPUNIT_TEST(hslTest);
     CPPUNIT_TEST(hsvTest);
-    CPPUNIT_TEST(ciexyzTest);
     CPPUNIT_TEST_SUITE_END();
 }; // class b2dvector
 
diff --git a/include/basegfx/color/bcolortools.hxx b/include/basegfx/color/bcolortools.hxx
index 2f4222f..64cdc95 100644
--- a/include/basegfx/color/bcolortools.hxx
+++ b/include/basegfx/color/bcolortools.hxx
@@ -39,10 +39,6 @@ namespace basegfx
         BASEGFX_DLLPUBLIC BColor rgb2hsv(const BColor& rRGBColor);
         /// Transform from HSV to RGB
         BASEGFX_DLLPUBLIC BColor hsv2rgb(const BColor& rHSVColor);
-
-        /// Transform from Rec. 709 RGB (D65 white point) into CIE XYZ
-        BASEGFX_DLLPUBLIC BColor rgb2ciexyz( const BColor& rRGBColor );
-
     }
 } // end of namespace basegfx
 


More information about the Libreoffice-commits mailing list