summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-05-06 15:02:24 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-05-06 15:07:46 +0100
commitfce56635998006570f63931101d07a00fdd7e20e (patch)
treee4c538546ea71a792ca1e23a030422d3b7626343
parentb6a927b93c25503f5c8ae2f69a0c2f5b575b4c0f (diff)
coverity#1403661 try to silence 'Mixing enum types'
and coverity#1403660 Mixing enum types Change-Id: I5b47384747e24139ac0531e5e373c4f88f30ea81
-rw-r--r--sc/source/core/data/dptabsrc.cxx5
-rw-r--r--sc/source/ui/unoobj/dapiuno.cxx3
2 files changed, 6 insertions, 2 deletions
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 );
}