summaryrefslogtreecommitdiff
path: root/editeng/source/items/itemtype.cxx
diff options
context:
space:
mode:
authorNorbert Thiebaud <nthiebaud@gmail.com>2010-10-05 07:56:37 -0500
committerMichael Meeks <michael.meeks@novell.com>2010-10-08 14:28:47 +0100
commit6af890e2af327ff31db15a780223b8bfeadadae6 (patch)
treef0b6063faf5b33c8df72c6a59ba59a46c0fae63d /editeng/source/items/itemtype.cxx
parentb9c4b922302e97f535015be609b7a1efb04ee014 (diff)
Do not use magic number instead of the size of objects.
Diffstat (limited to 'editeng/source/items/itemtype.cxx')
-rw-r--r--editeng/source/items/itemtype.cxx13
1 files changed, 5 insertions, 8 deletions
diff --git a/editeng/source/items/itemtype.cxx b/editeng/source/items/itemtype.cxx
index 4b0e89424774..8a1a82ed1e64 100644
--- a/editeng/source/items/itemtype.cxx
+++ b/editeng/source/items/itemtype.cxx
@@ -155,10 +155,9 @@ XubString GetColorString( const Color& rCol )
{
XubString sStr;
- FASTBOOL bFound = sal_False;
ColorData nColData =
RGB_COLORDATA( rCol.GetRed(), rCol.GetGreen(), rCol.GetBlue() );
- sal_uInt16 nColor = 0, nColCount = 16;
+ sal_uInt16 nColor = 0;
static ColorData aColAry[] = {
COL_BLACK, COL_BLUE, COL_GREEN, COL_CYAN,
@@ -166,15 +165,13 @@ XubString GetColorString( const Color& rCol )
COL_LIGHTGRAY, COL_LIGHTBLUE, COL_LIGHTGREEN, COL_LIGHTCYAN,
COL_LIGHTRED, COL_LIGHTMAGENTA, COL_YELLOW, COL_WHITE };
- while ( !bFound && nColor < nColCount )
+ while ( nColor < sizeof(aColAry)/sizeof(ColorData) &&
+ aColAry[nColor] != nColData )
{
- if ( aColAry[nColor] == nColData )
- bFound = sal_True;
- else
- nColor++;
+ nColor += 1;
}
- if ( nColor < nColCount )
+ if ( nColor < sizeof(aColAry)/sizeof(ColorData) )
sStr = EE_RESSTR( RID_SVXITEMS_COLOR_BEGIN + nColor + 1 );
if ( !sStr.Len() )