Don't allow XToString for *_INVALID values. Nothing uses this and it makes the range assert not fire if the string array has one fewer entry than the enum.

This commit is contained in:
Chris Danford
2005-04-09 09:51:42 +00:00
parent dc7f16ed32
commit 7d31a0b2bb
-4
View File
@@ -35,13 +35,9 @@ static inline void enum_add( T &val, int iAmt )
#define FOREACH_ENUM( e, max, var ) for( e var=(e)0; var<max; enum_add<e>( var, +1 ) )
static const CString EMPTY_STRING;
#define XToString(X, CNT) \
const CString& X##ToString( X x ) \
{ \
if( x == ARRAYSIZE(X##Names)+1 ) \
return EMPTY_STRING; \
ASSERT(unsigned(x) < CNT); \
return X##Names[x]; \
}