Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/1497

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/97/1497/1

Change if-statements to switch

The bit-values do overlap, 3rd and 4th case were never reached.

Change-Id: Iaaf39a11811c4e28c34260a7eab7fa0476165d1b
---
M svx/source/items/pageitem.cxx
1 file changed, 8 insertions(+), 9 deletions(-)



diff --git a/svx/source/items/pageitem.cxx b/svx/source/items/pageitem.cxx
index e7062ee..67d491d 100644
--- a/svx/source/items/pageitem.cxx
+++ b/svx/source/items/pageitem.cxx
@@ -84,15 +84,14 @@
 
 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();
+    }
 }
 
 //------------------------------------------------------------------------

-- 
To view, visit https://gerrit.libreoffice.org/1497
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaaf39a11811c4e28c34260a7eab7fa0476165d1b
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Werner Körner <wk661lo@gmail.com>


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.