use ARRAYSIZE macro

This commit is contained in:
Chris Danford
2003-08-02 20:05:46 +00:00
parent f8e4fc2d9c
commit e892ecc027
6 changed files with 7 additions and 10 deletions
+1 -2
View File
@@ -225,7 +225,6 @@ const AutoJoyMapping g_AutoJoyMappings[] =
}
},
};
const int NUM_AUTO_JOY_MAPPINGS = ARRAYSIZE(g_AutoJoyMappings);
void InputMapper::AutoMapJoysticksForCurrentGame()
{
@@ -240,7 +239,7 @@ void InputMapper::AutoMapJoysticksForCurrentGame()
{
InputDevice device = vDevices[i];
CString sDescription = vDescriptions[i];
for( int j=0; j<NUM_AUTO_JOY_MAPPINGS; j++ )
for( int j=0; j<ARRAYSIZE(g_AutoJoyMappings); j++ )
{
const AutoJoyMapping& mapping = g_AutoJoyMappings[j];
+2 -2
View File
@@ -13,8 +13,8 @@ bool NotesLoader::Loadable( CString sPath )
void NotesLoader::GetMainAndSubTitlesFromFullTitle( const CString sFullTitle, CString &sMainTitleOut, CString &sSubTitleOut )
{
const CString sLeftSeps[] = { " -", " ~", " (", " [" };
int iNumSeps = sizeof(sLeftSeps)/sizeof(CString);
for( int i=0; i<iNumSeps; i++ )
for( int i=0; i<ARRAYSIZE(sLeftSeps); i++ )
{
int iBeginIndex = sFullTitle.Find( sLeftSeps[i] );
if( iBeginIndex == -1 )
+1 -2
View File
@@ -41,9 +41,8 @@ OptionIcon::OptionIcon()
void OptionIcon::Load( PlayerNumber pn, CString sText, bool bHeader )
{
static CString sStopWords[] = { "OFF", "VISIBLE", "VIVID", "STANDARD", "X1", "HOLDS", "DEFAULT", "OVERHEAD" };
const int iNumStopWords = sizeof(sStopWords)/sizeof(sStopWords[0]);
for( int i=0; i<iNumStopWords; i++ )
for( int i=0; i<ARRAYSIZE(sStopWords); i++ )
if( 0==stricmp(sText,sStopWords[i]) )
sText = "";
+1 -2
View File
@@ -68,7 +68,6 @@ const OptionColumnEntry g_OptionColumnEntries[] =
{"TimingAssist",-1},
};
const int NUM_OPTION_COL_ENTRIES = sizeof(g_OptionColumnEntries)/sizeof(OptionColumnEntry);
int OptionToPreferredColumn( CString sOptionText )
{
@@ -79,7 +78,7 @@ int OptionToPreferredColumn( CString sOptionText )
return 0;
}
for( int i=0; i<NUM_OPTION_COL_ENTRIES; i++ )
for( int i=0; i<ARRAYSIZE(g_OptionColumnEntries); i++ )
if( g_OptionColumnEntries[i].szString == sOptionText )
return g_OptionColumnEntries[i].iSlotIndex;
+1 -1
View File
@@ -23,7 +23,7 @@
#define SAFE_RELEASE(p) { if(p) { (p)->Release(); (p)=NULL; } }
#define ZERO(x) memset(&x, 0, sizeof(x))
#define COPY(a,b) { ASSERT(sizeof(a)==sizeof(b)); memcpy(&a, &b, sizeof(a)); }
#define COPY(a,b) { ASSERT(sizeof(a)==sizeof(b)); memcpy(&(a), &(b), sizeof(a)); }
#define ARRAYSIZE(a) (sizeof(a) / sizeof((a)[0]))
/* Common harmless mismatches. All min(T,T) and max(T,T) cases are handled
+1 -1
View File
@@ -60,7 +60,7 @@ const char NAME_CHARS[] =
{
' ',' ',' ',' ','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'
};
#define NUM_NAME_CHARS (sizeof(NAME_CHARS)/sizeof(char))
#define NUM_NAME_CHARS (ARRAYSIZE(NAME_CHARS))
#define HEIGHT_OF_ALL_CHARS (NUM_NAME_CHARS * g_fCharsSpacingY)