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 /sfx2/source | |
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 'sfx2/source')
-rw-r--r-- | sfx2/source/appl/appuno.cxx | 8 | ||||
-rw-r--r-- | sfx2/source/config/evntconf.cxx | 8 | ||||
-rw-r--r-- | sfx2/source/control/ctrlitem.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/control/dispatch.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/control/unoctitm.cxx | 10 | ||||
-rw-r--r-- | sfx2/source/dialog/mgetempl.cxx | 10 |
6 files changed, 21 insertions, 21 deletions
diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx index 4b184618c87d..d2d4f64a0836 100644 --- a/sfx2/source/appl/appuno.cxx +++ b/sfx2/source/appl/appuno.cxx @@ -205,7 +205,7 @@ void TransformParameters( sal_uInt16 nSlotId, const uno::Sequence<beans::Propert } sal_uInt16 nWhich = rSet.GetPool()->GetWhich(nSlotId); - bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == SFX_MAPUNIT_TWIP ); + bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == MAP_TWIP ); pItem->SetWhich( nWhich ); sal_uInt16 nSubCount = pType->nAttribs; @@ -322,7 +322,7 @@ void TransformParameters( sal_uInt16 nSlotId, const uno::Sequence<beans::Propert } sal_uInt16 nWhich = rSet.GetPool()->GetWhich(rArg.nSlotId); - bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == SFX_MAPUNIT_TWIP ); + bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == MAP_TWIP ); pItem->SetWhich( nWhich ); const SfxType* pType = rArg.pType; sal_uInt16 nSubCount = pType->nAttribs; @@ -1273,7 +1273,7 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, uno::Sequence<b { // slot is a property sal_uInt16 nWhich = rSet.GetPool()->GetWhich(nSlotId); - bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == SFX_MAPUNIT_TWIP ); + bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == MAP_TWIP ); const SfxPoolItem* pItem = rSet.GetItem<SfxPoolItem>(nWhich, false); if ( pItem ) //??? { @@ -1325,7 +1325,7 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, uno::Sequence<b { const SfxFormalArgument &rArg = pSlot->GetFormalArgument( nArg ); sal_uInt16 nWhich = rSet.GetPool()->GetWhich( rArg.nSlotId ); - bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == SFX_MAPUNIT_TWIP ); + bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == MAP_TWIP ); const SfxPoolItem* pItem = rSet.GetItem<SfxPoolItem>(nWhich, false); if ( pItem ) //??? { diff --git a/sfx2/source/config/evntconf.cxx b/sfx2/source/config/evntconf.cxx index f68d77cac509..e7bea262ed20 100644 --- a/sfx2/source/config/evntconf.cxx +++ b/sfx2/source/config/evntconf.cxx @@ -94,10 +94,10 @@ bool SfxEventNamesItem::operator==( const SfxPoolItem& rAttr ) const } bool SfxEventNamesItem::GetPresentation( SfxItemPresentation, - SfxMapUnit, - SfxMapUnit, - OUString &rText, - const IntlWrapper* ) const + MapUnit, + MapUnit, + OUString &rText, + const IntlWrapper* ) const { rText.clear(); return false; diff --git a/sfx2/source/control/ctrlitem.cxx b/sfx2/source/control/ctrlitem.cxx index aee8676a5225..29e6eaf28d6a 100644 --- a/sfx2/source/control/ctrlitem.cxx +++ b/sfx2/source/control/ctrlitem.cxx @@ -302,7 +302,7 @@ SfxItemState SfxControllerItem::GetItemState } -SfxMapUnit SfxControllerItem::GetCoreMetric() const +MapUnit SfxControllerItem::GetCoreMetric() const /* [Description] @@ -341,7 +341,7 @@ SfxMapUnit SfxControllerItem::GetCoreMetric() const } SAL_INFO( "sfx.control", "W1: Can not find ItemPool!" ); - return SFX_MAPUNIT_100TH_MM; + return MAP_100TH_MM; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index c464fba861a0..c959816ed449 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -2139,7 +2139,7 @@ SfxItemState SfxDispatcher::QueryState( sal_uInt16 nSID, css::uno::Any& rAny ) sal_uInt16 nSubId( 0 ); SfxItemPool& rPool = pShell->GetPool(); sal_uInt16 nWhich = rPool.GetWhich( nSID ); - if ( rPool.GetMetric( nWhich ) == SFX_MAPUNIT_TWIP ) + if ( rPool.GetMetric( nWhich ) == MAP_TWIP ) nSubId |= CONVERT_TWIPS; pItem->QueryValue( aState, (sal_uInt8)nSubId ); } diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index c7d4a88ea236..9c3ed15f5dd4 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -426,7 +426,7 @@ void SfxDispatchController_Impl::addParametersToArgs( const css::util::URL& aURL } } -SfxMapUnit SfxDispatchController_Impl::GetCoreMetric( SfxItemPool& rPool, sal_uInt16 nSlotId ) +MapUnit SfxDispatchController_Impl::GetCoreMetric( SfxItemPool& rPool, sal_uInt16 nSlotId ) { sal_uInt16 nWhich = rPool.GetWhich( nSlotId ); return rPool.GetMetric( nWhich ); @@ -665,7 +665,7 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const css::util::URL& aURL, bool bSuccess = false; const SfxPoolItem* pItem = nullptr; - SfxMapUnit eMapUnit( SFX_MAPUNIT_100TH_MM ); + MapUnit eMapUnit( MAP_100TH_MM ); // Extra scope so that aInternalSet is destroyed before // rListener->dispatchFinished potentially calls @@ -775,7 +775,7 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const css::util::URL& aURL, if ( bSuccess && pItem && dynamic_cast< const SfxVoidItem *>( pItem ) == nullptr ) { sal_uInt16 nSubId( 0 ); - if ( eMapUnit == SFX_MAPUNIT_TWIP ) + if ( eMapUnit == MAP_TWIP ) nSubId |= CONVERT_TWIPS; pItem->QueryValue( aEvent.Result, (sal_uInt8)nSubId ); } @@ -892,7 +892,7 @@ void SfxDispatchController_Impl::StateChanged( sal_uInt16 nSID, SfxItemState eSt { // Retrieve metric from pool to have correct sub ID when calling QueryValue sal_uInt16 nSubId( 0 ); - SfxMapUnit eMapUnit( SFX_MAPUNIT_100TH_MM ); + MapUnit eMapUnit( MAP_100TH_MM ); // retrieve the core metric // it's enough to check the objectshell, the only shell that does not use the pool of the document @@ -906,7 +906,7 @@ void SfxDispatchController_Impl::StateChanged( sal_uInt16 nSID, SfxItemState eSt eMapUnit = GetCoreMetric( pShell->GetPool(), nSID ); } - if ( eMapUnit == SFX_MAPUNIT_TWIP ) + if ( eMapUnit == MAP_TWIP ) nSubId |= CONVERT_TWIPS; pState->QueryValue( aState, (sal_uInt8)nSubId ); diff --git a/sfx2/source/dialog/mgetempl.cxx b/sfx2/source/dialog/mgetempl.cxx index fb99cd388d5e..60476b8ca155 100644 --- a/sfx2/source/dialog/mgetempl.cxx +++ b/sfx2/source/dialog/mgetempl.cxx @@ -311,7 +311,7 @@ void SfxManageStyleSheetPage::SetDescriptionText_Impl() */ { - SfxMapUnit eUnit = SFX_MAPUNIT_CM; + MapUnit eUnit = MAP_CM; FieldUnit eFieldUnit( FUNIT_CM ); SfxModule* pModule = SfxModule::GetActiveModule(); if ( pModule ) @@ -323,15 +323,15 @@ void SfxManageStyleSheetPage::SetDescriptionText_Impl() switch ( eFieldUnit ) { - case FUNIT_MM: eUnit = SFX_MAPUNIT_MM; break; + case FUNIT_MM: eUnit = MAP_MM; break; case FUNIT_CM: case FUNIT_M: - case FUNIT_KM: eUnit = SFX_MAPUNIT_CM; break; + case FUNIT_KM: eUnit = MAP_CM; break; case FUNIT_POINT: - case FUNIT_PICA: eUnit = SFX_MAPUNIT_POINT; break; + case FUNIT_PICA: eUnit = MAP_POINT; break; case FUNIT_INCH: case FUNIT_FOOT: - case FUNIT_MILE: eUnit = SFX_MAPUNIT_INCH; break; + case FUNIT_MILE: eUnit = MAP_INCH; break; default: OSL_FAIL( "non supported field unit" ); |