Replaced stricmp() by strcasecmp().
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2976 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
Changes towards version 0.7:
|
Changes towards version 0.7:
|
||||||
|
- Replaced stricmp() by the POSIX compatible strcasecmp() - SvdB
|
||||||
- Split STRTAB further into STRTAB and CONVERSATION - Michael
|
- Split STRTAB further into STRTAB and CONVERSATION - Michael
|
||||||
- INT32, BOOLEAN, and STRING resource types - Michael
|
- INT32, BOOLEAN, and STRING resource types - Michael
|
||||||
- UNKNOWNRES is now safe to load, and "loads" as its resvalue - Michael
|
- UNKNOWNRES is now safe to load, and "loads" as its resvalue - Michael
|
||||||
|
|||||||
@@ -277,7 +277,7 @@ cdp_GetInterfaceReg (const char* name, cdp_ApiVersion api_ver)
|
|||||||
cdp_ItfReg* itf;
|
cdp_ItfReg* itf;
|
||||||
|
|
||||||
for (itf = cdp_itfs; itf->used &&
|
for (itf = cdp_itfs; itf->used &&
|
||||||
(!itf->name || stricmp(itf->name, name) != 0 ||
|
(!itf->name || strcasecmp(itf->name, name) != 0 ||
|
||||||
api_ver < itf->ver_from || api_ver > itf->ver_to);
|
api_ver < itf->ver_from || api_ver > itf->ver_to);
|
||||||
itf++)
|
itf++)
|
||||||
;
|
;
|
||||||
@@ -390,7 +390,7 @@ cdp_Host_RegisterItf (const char* name, cdp_ApiVersion ver_from,
|
|||||||
|
|
||||||
// check if interface already registered
|
// check if interface already registered
|
||||||
for (itfreg = cdp_itfs; itfreg->used &&
|
for (itfreg = cdp_itfs; itfreg->used &&
|
||||||
(!itfreg->name || stricmp(itfreg->name, id_name) != 0 ||
|
(!itfreg->name || strcasecmp(itfreg->name, id_name) != 0 ||
|
||||||
ver_from < itfreg->ver_from || ver_to > itfreg->ver_to);
|
ver_from < itfreg->ver_from || ver_to > itfreg->ver_to);
|
||||||
++itfreg)
|
++itfreg)
|
||||||
{
|
{
|
||||||
@@ -502,7 +502,7 @@ cdp_GetEventReg (const char* name)
|
|||||||
cdp_EventReg* evt;
|
cdp_EventReg* evt;
|
||||||
|
|
||||||
for (evt = cdp_evts; evt->used &&
|
for (evt = cdp_evts; evt->used &&
|
||||||
(!evt->name || stricmp(evt->name, name) != 0);
|
(!evt->name || strcasecmp(evt->name, name) != 0);
|
||||||
evt++)
|
evt++)
|
||||||
;
|
;
|
||||||
if (!evt->name)
|
if (!evt->name)
|
||||||
@@ -626,7 +626,7 @@ cdp_Host_RegisterEvent (const char* name, cdp_Module* owner)
|
|||||||
|
|
||||||
// check if event already registered
|
// check if event already registered
|
||||||
for (evtreg = cdp_evts; evtreg->used &&
|
for (evtreg = cdp_evts; evtreg->used &&
|
||||||
(!evtreg->name || stricmp(evtreg->name, id_name) != 0);
|
(!evtreg->name || strcasecmp(evtreg->name, id_name) != 0);
|
||||||
++evtreg)
|
++evtreg)
|
||||||
{
|
{
|
||||||
// and pick up an empty slot (where available)
|
// and pick up an empty slot (where available)
|
||||||
|
|||||||
@@ -205,7 +205,7 @@ VControl_name2code (char *name)
|
|||||||
{
|
{
|
||||||
char *test = keynames[i].name;
|
char *test = keynames[i].name;
|
||||||
int code = keynames[i].code;
|
int code = keynames[i].code;
|
||||||
if (!stricmp(test, name) || !code)
|
if (!strcasecmp(test, name) || !code)
|
||||||
{
|
{
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1086,7 +1086,7 @@ expected_error (parse_state *state, char *expected)
|
|||||||
static void
|
static void
|
||||||
consume (parse_state *state, char *expected)
|
consume (parse_state *state, char *expected)
|
||||||
{
|
{
|
||||||
if (stricmp (expected, state->token))
|
if (strcasecmp (expected, state->token))
|
||||||
{
|
{
|
||||||
expected_error (state, expected);
|
expected_error (state, expected);
|
||||||
}
|
}
|
||||||
@@ -1126,11 +1126,11 @@ static int
|
|||||||
consume_polarity (parse_state *state)
|
consume_polarity (parse_state *state)
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
if (!stricmp (state->token, "positive"))
|
if (!strcasecmp (state->token, "positive"))
|
||||||
{
|
{
|
||||||
result = 1;
|
result = 1;
|
||||||
}
|
}
|
||||||
else if (!stricmp (state->token, "negative"))
|
else if (!strcasecmp (state->token, "negative"))
|
||||||
{
|
{
|
||||||
result = -1;
|
result = -1;
|
||||||
}
|
}
|
||||||
@@ -1146,19 +1146,19 @@ static Uint8
|
|||||||
consume_dir (parse_state *state)
|
consume_dir (parse_state *state)
|
||||||
{
|
{
|
||||||
Uint8 result = 0;
|
Uint8 result = 0;
|
||||||
if (!stricmp (state->token, "left"))
|
if (!strcasecmp (state->token, "left"))
|
||||||
{
|
{
|
||||||
result = SDL_HAT_LEFT;
|
result = SDL_HAT_LEFT;
|
||||||
}
|
}
|
||||||
else if (!stricmp (state->token, "right"))
|
else if (!strcasecmp (state->token, "right"))
|
||||||
{
|
{
|
||||||
result = SDL_HAT_RIGHT;
|
result = SDL_HAT_RIGHT;
|
||||||
}
|
}
|
||||||
else if (!stricmp (state->token, "up"))
|
else if (!strcasecmp (state->token, "up"))
|
||||||
{
|
{
|
||||||
result = SDL_HAT_UP;
|
result = SDL_HAT_UP;
|
||||||
}
|
}
|
||||||
else if (!stricmp (state->token, "down"))
|
else if (!strcasecmp (state->token, "down"))
|
||||||
{
|
{
|
||||||
result = SDL_HAT_DOWN;
|
result = SDL_HAT_DOWN;
|
||||||
}
|
}
|
||||||
@@ -1178,7 +1178,7 @@ parse_joybinding (parse_state *state, VCONTROL_GESTURE *gesture)
|
|||||||
sticknum = consume_num (state);
|
sticknum = consume_num (state);
|
||||||
if (!state->error)
|
if (!state->error)
|
||||||
{
|
{
|
||||||
if (!stricmp (state->token, "axis"))
|
if (!strcasecmp (state->token, "axis"))
|
||||||
{
|
{
|
||||||
int axisnum;
|
int axisnum;
|
||||||
consume (state, "axis");
|
consume (state, "axis");
|
||||||
@@ -1195,7 +1195,7 @@ parse_joybinding (parse_state *state, VCONTROL_GESTURE *gesture)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!stricmp (state->token, "button"))
|
else if (!strcasecmp (state->token, "button"))
|
||||||
{
|
{
|
||||||
int buttonnum;
|
int buttonnum;
|
||||||
consume (state, "button");
|
consume (state, "button");
|
||||||
@@ -1207,7 +1207,7 @@ parse_joybinding (parse_state *state, VCONTROL_GESTURE *gesture)
|
|||||||
gesture->gesture.button.index = buttonnum;
|
gesture->gesture.button.index = buttonnum;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!stricmp (state->token, "hat"))
|
else if (!strcasecmp (state->token, "hat"))
|
||||||
{
|
{
|
||||||
int hatnum;
|
int hatnum;
|
||||||
consume (state, "hat");
|
consume (state, "hat");
|
||||||
@@ -1235,7 +1235,7 @@ static void
|
|||||||
parse_gesture (parse_state *state, VCONTROL_GESTURE *gesture)
|
parse_gesture (parse_state *state, VCONTROL_GESTURE *gesture)
|
||||||
{
|
{
|
||||||
gesture->type = VCONTROL_NONE; /* Default to error */
|
gesture->type = VCONTROL_NONE; /* Default to error */
|
||||||
if (!stricmp (state->token, "key"))
|
if (!strcasecmp (state->token, "key"))
|
||||||
{
|
{
|
||||||
/* Parse key binding */
|
/* Parse key binding */
|
||||||
int keysym;
|
int keysym;
|
||||||
@@ -1247,7 +1247,7 @@ parse_gesture (parse_state *state, VCONTROL_GESTURE *gesture)
|
|||||||
gesture->gesture.key = keysym;
|
gesture->gesture.key = keysym;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!stricmp (state->token, "joystick"))
|
else if (!strcasecmp (state->token, "joystick"))
|
||||||
{
|
{
|
||||||
parse_joybinding (state, gesture);
|
parse_joybinding (state, gesture);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,9 +82,9 @@ str2int (const char *s) {
|
|||||||
|
|
||||||
static BOOLEAN
|
static BOOLEAN
|
||||||
str2bool (const char *s) {
|
str2bool (const char *s) {
|
||||||
if (!stricmp (s, "yes") ||
|
if (!strcasecmp (s, "yes") ||
|
||||||
!stricmp (s, "true") ||
|
!strcasecmp (s, "true") ||
|
||||||
!stricmp (s, "1") )
|
!strcasecmp (s, "1") )
|
||||||
return TRUE;
|
return TRUE;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -98,13 +98,13 @@ res_IsBoolean (const char *key)
|
|||||||
d = res_GetString (key);
|
d = res_GetString (key);
|
||||||
if (!d) return 0;
|
if (!d) return 0;
|
||||||
|
|
||||||
return !stricmp (d, "yes") ||
|
return !strcasecmp (d, "yes") ||
|
||||||
!stricmp (d, "no") ||
|
!strcasecmp (d, "no") ||
|
||||||
!stricmp (d, "true") ||
|
!strcasecmp (d, "true") ||
|
||||||
!stricmp (d, "false") ||
|
!strcasecmp (d, "false") ||
|
||||||
!stricmp (d, "0") ||
|
!strcasecmp (d, "0") ||
|
||||||
!stricmp (d, "1") ||
|
!strcasecmp (d, "1") ||
|
||||||
!stricmp (d, "");
|
!strcasecmp (d, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ DescriptorToInt (const char *descriptor, RESOURCE_DATA *resdata)
|
|||||||
void
|
void
|
||||||
DescriptorToBoolean (const char *descriptor, RESOURCE_DATA *resdata)
|
DescriptorToBoolean (const char *descriptor, RESOURCE_DATA *resdata)
|
||||||
{
|
{
|
||||||
if (!stricmp (descriptor, "true"))
|
if (!strcasecmp (descriptor, "true"))
|
||||||
{
|
{
|
||||||
resdata->num = TRUE;
|
resdata->num = TRUE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ GetFleetIndexByFileName (MELEE_STATE *pMS, const char *fileName)
|
|||||||
pMS->load.entryIndices[index]);
|
pMS->load.entryIndices[index]);
|
||||||
const BYTE *entryName = GetDirEntryAddress (entry);
|
const BYTE *entryName = GetDirEntryAddress (entry);
|
||||||
|
|
||||||
if (stricmp ((const char *) entryName, fileName) == 0)
|
if (strcasecmp ((const char *) entryName, fileName) == 0)
|
||||||
return pMS->load.preBuiltCount + index;
|
return pMS->load.preBuiltCount + index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user