diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-08-19 09:31:35 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-08-19 11:25:18 +0000 |
commit | 396138a6bc7192abe0837b419283860d3331f607 (patch) | |
tree | f80818ba86220abb8db205b402429e3d45aa62d1 /editeng/source/uno | |
parent | 8b4705e0e0c76503b1ca61cb567d222f49466fc5 (diff) |
Resolves: coverity#705366 Mixing enum types
and
coverity#705367 Mixing enum types
coverity#705371 Mixing enum types
coverity#982694 Mixing enum types
coverity#1027717 Mixing enum types
coverity#1371228 Mixing enum types
coverity#1371242 Mixing enum types
coverity#1371280 Mixing enum types
coverity#1371310 Mixing enum types
MapUnit and SfxMapUnit share the same values and
are freely cast from one to the other.
Now that
commit d30a4298bdb5ba53cd1fe659f2b742f218a2e527
Date: Thu Aug 11 15:02:19 2016 +0200
loplugin:unusedenumconstants in package..svtools
removed the SfxMapUnit entries that were directly unused, they
don't match anymore and casting from one to the other is dangerous.
Why there was two of these anyway escapes me, get rid of SfxMapUnit
and just use MapUnit universally
Change-Id: I4db5dcd04b59be2f85b62b728f96c90afe00c57e
Reviewed-on: https://gerrit.libreoffice.org/28234
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'editeng/source/uno')
-rw-r--r-- | editeng/source/uno/unoipset.cxx | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/editeng/source/uno/unoipset.cxx b/editeng/source/uno/unoipset.cxx index 02c5d9d20618..31f7e48ea8e1 100644 --- a/editeng/source/uno/unoipset.cxx +++ b/editeng/source/uno/unoipset.cxx @@ -103,9 +103,9 @@ uno::Any SvxItemPropertySet::getPropertyValue( const SfxItemPropertySimpleEntry* if( nullptr == pItem && pPool ) pItem = &(pPool->GetDefaultItem( pMap->nWID )); - const SfxMapUnit eMapUnit = pPool ? pPool->GetMetric((sal_uInt16)pMap->nWID) : SFX_MAPUNIT_100TH_MM; + const MapUnit eMapUnit = pPool ? pPool->GetMetric((sal_uInt16)pMap->nWID) : MAP_100TH_MM; sal_uInt8 nMemberId = pMap->nMemberId & (~SFX_METRIC_ITEM); - if( eMapUnit == SFX_MAPUNIT_100TH_MM ) + if( eMapUnit == MAP_100TH_MM ) nMemberId &= (~CONVERT_TWIPS); if(pItem) @@ -113,7 +113,7 @@ uno::Any SvxItemPropertySet::getPropertyValue( const SfxItemPropertySimpleEntry* pItem->QueryValue( aVal, nMemberId ); if( pMap->nMemberId & SFX_METRIC_ITEM ) { - if( eMapUnit != SFX_MAPUNIT_100TH_MM ) + if( eMapUnit != MAP_100TH_MM ) { if ( !bDontConvertNegativeValues || SvxUnoCheckForPositiveValue( aVal ) ) SvxUnoConvertToMM( eMapUnit, aVal ); @@ -164,10 +164,10 @@ void SvxItemPropertySet::setPropertyValue( const SfxItemPropertySimpleEntry* pMa { uno::Any aValue( rVal ); - const SfxMapUnit eMapUnit = pPool ? pPool->GetMetric((sal_uInt16)pMap->nWID) : SFX_MAPUNIT_100TH_MM; + const MapUnit eMapUnit = pPool ? pPool->GetMetric((sal_uInt16)pMap->nWID) : MAP_100TH_MM; // check for needed metric translation - if( (pMap->nMemberId & SFX_METRIC_ITEM) && eMapUnit != SFX_MAPUNIT_100TH_MM ) + if( (pMap->nMemberId & SFX_METRIC_ITEM) && eMapUnit != MAP_100TH_MM ) { if ( !bDontConvertNegativeValues || SvxUnoCheckForPositiveValue( aValue ) ) SvxUnoConvertFromMM( eMapUnit, aValue ); @@ -176,7 +176,7 @@ void SvxItemPropertySet::setPropertyValue( const SfxItemPropertySimpleEntry* pMa SfxPoolItem *pNewItem = pItem->Clone(); sal_uInt8 nMemberId = pMap->nMemberId & (~SFX_METRIC_ITEM); - if( eMapUnit == SFX_MAPUNIT_100TH_MM ) + if( eMapUnit == MAP_100TH_MM ) nMemberId &= (~CONVERT_TWIPS); if( pNewItem->PutValue( aValue, nMemberId ) ) @@ -198,9 +198,9 @@ uno::Any SvxItemPropertySet::getPropertyValue( const SfxItemPropertySimpleEntry* return *pUsrAny; // No UsrAny detected yet, generate Default entry and return this - const SfxMapUnit eMapUnit = mrItemPool.GetMetric((sal_uInt16)pMap->nWID); + const MapUnit eMapUnit = mrItemPool.GetMetric((sal_uInt16)pMap->nWID); sal_uInt8 nMemberId = pMap->nMemberId & (~SFX_METRIC_ITEM); - if( eMapUnit == SFX_MAPUNIT_100TH_MM ) + if( eMapUnit == MAP_100TH_MM ) nMemberId &= (~CONVERT_TWIPS); uno::Any aVal; SfxItemSet aSet( mrItemPool, pMap->nWID, pMap->nWID); @@ -226,7 +226,7 @@ uno::Any SvxItemPropertySet::getPropertyValue( const SfxItemPropertySimpleEntry* if( pMap->nMemberId & SFX_METRIC_ITEM ) { // check for needed metric translation - if(pMap->nMemberId & SFX_METRIC_ITEM && eMapUnit != SFX_MAPUNIT_100TH_MM) + if(pMap->nMemberId & SFX_METRIC_ITEM && eMapUnit != MAP_100TH_MM) { SvxUnoConvertToMM( eMapUnit, aVal ); } @@ -277,12 +277,12 @@ uno::Reference< beans::XPropertySetInfo > const & SvxItemPropertySet::getProper #endif /** converts the given any with a metric to 100th/mm if needed */ -void SvxUnoConvertToMM( const SfxMapUnit eSourceMapUnit, uno::Any & rMetric ) throw() +void SvxUnoConvertToMM( const MapUnit eSourceMapUnit, uno::Any & rMetric ) throw() { // map the metric of the itempool to 100th mm switch(eSourceMapUnit) { - case SFX_MAPUNIT_TWIP : + case MAP_TWIP : { switch( rMetric.getValueTypeClass() ) { @@ -315,11 +315,11 @@ void SvxUnoConvertToMM( const SfxMapUnit eSourceMapUnit, uno::Any & rMetric ) th /** converts the given any with a metric from 100th/mm to the given metric if needed */ -void SvxUnoConvertFromMM( const SfxMapUnit eDestinationMapUnit, uno::Any & rMetric ) throw() +void SvxUnoConvertFromMM( const MapUnit eDestinationMapUnit, uno::Any & rMetric ) throw() { switch(eDestinationMapUnit) { - case SFX_MAPUNIT_TWIP : + case MAP_TWIP : { switch( rMetric.getValueTypeClass() ) { |