From ce9deff347ebdb1ab6faced894e8de9979eabb0e Mon Sep 17 00:00:00 2001 From: Werner Koerner Date: Sat, 29 Dec 2012 12:56:02 +0100 Subject: [PATCH] Change if-statements to switch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The bit-values do overlap, 3rd and 4th case were never reached. Change-Id: Iaaf39a11811c4e28c34260a7eab7fa0476165d1b Reviewed-on: https://gerrit.libreoffice.org/1497 Reviewed-by: Tomáš Chvátal Tested-by: Tomáš Chvátal --- svx/source/items/pageitem.cxx | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/svx/source/items/pageitem.cxx b/svx/source/items/pageitem.cxx index e7062eee8452..67d491dedb58 100644 --- a/svx/source/items/pageitem.cxx +++ b/svx/source/items/pageitem.cxx @@ -84,15 +84,14 @@ int SvxPageItem::operator==( const SfxPoolItem& rAttr ) const inline XubString GetUsageText( const sal_uInt16 eU ) { - if ( eU & SVX_PAGE_LEFT ) - return SVX_RESSTR(RID_SVXITEMS_PAGE_USAGE_LEFT); - if ( eU & SVX_PAGE_RIGHT ) - return SVX_RESSTR(RID_SVXITEMS_PAGE_USAGE_RIGHT); - if ( eU & SVX_PAGE_ALL ) - return SVX_RESSTR(RID_SVXITEMS_PAGE_USAGE_ALL); - if ( eU & SVX_PAGE_MIRROR ) - return SVX_RESSTR(RID_SVXITEMS_PAGE_USAGE_MIRROR); - return String(); + switch( eU & 0x000f ) + { + case SVX_PAGE_LEFT : return SVX_RESSTR(RID_SVXITEMS_PAGE_USAGE_LEFT); + case SVX_PAGE_RIGHT : return SVX_RESSTR(RID_SVXITEMS_PAGE_USAGE_RIGHT); + case SVX_PAGE_ALL : return SVX_RESSTR(RID_SVXITEMS_PAGE_USAGE_ALL); + case SVX_PAGE_MIRROR: return SVX_RESSTR(RID_SVXITEMS_PAGE_USAGE_MIRROR); + default: return String(); + } } //------------------------------------------------------------------------