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

Caolán McNamara caolanm at redhat.com
Sat May 6 14:19:24 UTC 2017


 sc/source/core/data/dptabsrc.cxx |    5 ++++-
 sc/source/ui/unoobj/dapiuno.cxx  |    3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)

New commits:
commit fce56635998006570f63931101d07a00fdd7e20e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat May 6 15:02:24 2017 +0100

    coverity#1403661 try to silence 'Mixing enum types'
    
    and
    
    coverity#1403660 Mixing enum types
    
    Change-Id: I5b47384747e24139ac0531e5e373c4f88f30ea81

diff --git a/sc/source/core/data/dptabsrc.cxx b/sc/source/core/data/dptabsrc.cxx
index bf1bad34664c..e289ec995822 100644
--- a/sc/source/core/data/dptabsrc.cxx
+++ b/sc/source/core/data/dptabsrc.cxx
@@ -1560,7 +1560,10 @@ uno::Any SAL_CALL ScDPDimension::getPropertyValue( const OUString& aPropertyName
         ScGeneralFunction nVal = getFunction();
         if (nVal == ScGeneralFunction::MEDIAN)
             nVal = ScGeneralFunction::NONE;
-        aRet <<= (sheet::GeneralFunction)nVal;
+        const int nValAsInt = static_cast<int>(nVal);
+        assert(nValAsInt >= (int)css::sheet::GeneralFunction_NONE &&
+               nValAsInt <= (int)css::sheet::GeneralFunction_VARP);
+        aRet <<= (sheet::GeneralFunction)nValAsInt;
     }
     else if ( aPropertyName == SC_UNO_DP_FUNCTION2 )
     {
diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx
index 9ab239548c38..99d8add7102b 100644
--- a/sc/source/ui/unoobj/dapiuno.cxx
+++ b/sc/source/ui/unoobj/dapiuno.cxx
@@ -1832,7 +1832,8 @@ void SAL_CALL ScDataPilotFieldObj::setPropertyValue( const OUString& aPropertyNa
             std::vector< ScGeneralFunction > aSubTotals(aSeq.getLength());
             for (sal_Int32 nIndex = 0; nIndex < aSeq.getLength(); nIndex++)
             {
-                aSubTotals[nIndex] = static_cast<ScGeneralFunction>(aSeq[nIndex]);
+                const int nValAsInt = static_cast<int>(aSeq[nIndex]);
+                aSubTotals[nIndex] = static_cast<ScGeneralFunction>(nValAsInt);
             }
             setSubtotals( aSubTotals );
         }


More information about the Libreoffice-commits mailing list