Do not use magic number instead of the size of objects.

This commit is contained in:
Norbert Thiebaud 2010-10-05 07:56:37 -05:00 committed by Michael Meeks
parent b9c4b92230
commit 6af890e2af

View file

@ -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() )