From c952996ad744ab864132c0dca47e5c2bf3d59971 Mon Sep 17 00:00:00 2001 From: Meep-Eep Date: Sat, 17 May 2008 10:54:10 +0000 Subject: [PATCH] Replaced stricmp() by strcasecmp(). git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2976 8092fc87-c524-0410-9efc-e669fe64eaf9 --- sc2/ChangeLog | 1 + sc2/src/sc2code/libs/cdp/cdpapi.c | 8 ++++---- sc2/src/sc2code/libs/input/sdl/keynames.c | 2 +- sc2/src/sc2code/libs/input/sdl/vcontrol.c | 24 +++++++++++------------ sc2/src/sc2code/libs/resource/mapres.c | 20 +++++++++---------- sc2/src/sc2code/libs/resource/resinit.c | 2 +- sc2/src/sc2code/loadmele.c | 2 +- 7 files changed, 30 insertions(+), 29 deletions(-) diff --git a/sc2/ChangeLog b/sc2/ChangeLog index e31b0e177..df7a3c461 100644 --- a/sc2/ChangeLog +++ b/sc2/ChangeLog @@ -1,4 +1,5 @@ Changes towards version 0.7: +- Replaced stricmp() by the POSIX compatible strcasecmp() - SvdB - Split STRTAB further into STRTAB and CONVERSATION - Michael - INT32, BOOLEAN, and STRING resource types - Michael - UNKNOWNRES is now safe to load, and "loads" as its resvalue - Michael diff --git a/sc2/src/sc2code/libs/cdp/cdpapi.c b/sc2/src/sc2code/libs/cdp/cdpapi.c index a512b1694..e50e39dfe 100644 --- a/sc2/src/sc2code/libs/cdp/cdpapi.c +++ b/sc2/src/sc2code/libs/cdp/cdpapi.c @@ -277,7 +277,7 @@ cdp_GetInterfaceReg (const char* name, cdp_ApiVersion api_ver) cdp_ItfReg* itf; 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); itf++) ; @@ -390,7 +390,7 @@ cdp_Host_RegisterItf (const char* name, cdp_ApiVersion ver_from, // check if interface already registered 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); ++itfreg) { @@ -502,7 +502,7 @@ cdp_GetEventReg (const char* name) cdp_EventReg* evt; for (evt = cdp_evts; evt->used && - (!evt->name || stricmp(evt->name, name) != 0); + (!evt->name || strcasecmp(evt->name, name) != 0); evt++) ; if (!evt->name) @@ -626,7 +626,7 @@ cdp_Host_RegisterEvent (const char* name, cdp_Module* owner) // check if event already registered for (evtreg = cdp_evts; evtreg->used && - (!evtreg->name || stricmp(evtreg->name, id_name) != 0); + (!evtreg->name || strcasecmp(evtreg->name, id_name) != 0); ++evtreg) { // and pick up an empty slot (where available) diff --git a/sc2/src/sc2code/libs/input/sdl/keynames.c b/sc2/src/sc2code/libs/input/sdl/keynames.c index 062ab01bd..c33338cd8 100644 --- a/sc2/src/sc2code/libs/input/sdl/keynames.c +++ b/sc2/src/sc2code/libs/input/sdl/keynames.c @@ -205,7 +205,7 @@ VControl_name2code (char *name) { char *test = keynames[i].name; int code = keynames[i].code; - if (!stricmp(test, name) || !code) + if (!strcasecmp(test, name) || !code) { return code; } diff --git a/sc2/src/sc2code/libs/input/sdl/vcontrol.c b/sc2/src/sc2code/libs/input/sdl/vcontrol.c index 80da9be4e..95fb9a13f 100644 --- a/sc2/src/sc2code/libs/input/sdl/vcontrol.c +++ b/sc2/src/sc2code/libs/input/sdl/vcontrol.c @@ -1086,7 +1086,7 @@ expected_error (parse_state *state, char *expected) static void consume (parse_state *state, char *expected) { - if (stricmp (expected, state->token)) + if (strcasecmp (expected, state->token)) { expected_error (state, expected); } @@ -1126,11 +1126,11 @@ static int consume_polarity (parse_state *state) { int result = 0; - if (!stricmp (state->token, "positive")) + if (!strcasecmp (state->token, "positive")) { result = 1; } - else if (!stricmp (state->token, "negative")) + else if (!strcasecmp (state->token, "negative")) { result = -1; } @@ -1146,19 +1146,19 @@ static Uint8 consume_dir (parse_state *state) { Uint8 result = 0; - if (!stricmp (state->token, "left")) + if (!strcasecmp (state->token, "left")) { result = SDL_HAT_LEFT; } - else if (!stricmp (state->token, "right")) + else if (!strcasecmp (state->token, "right")) { result = SDL_HAT_RIGHT; } - else if (!stricmp (state->token, "up")) + else if (!strcasecmp (state->token, "up")) { result = SDL_HAT_UP; } - else if (!stricmp (state->token, "down")) + else if (!strcasecmp (state->token, "down")) { result = SDL_HAT_DOWN; } @@ -1178,7 +1178,7 @@ parse_joybinding (parse_state *state, VCONTROL_GESTURE *gesture) sticknum = consume_num (state); if (!state->error) { - if (!stricmp (state->token, "axis")) + if (!strcasecmp (state->token, "axis")) { int axisnum; 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; consume (state, "button"); @@ -1207,7 +1207,7 @@ parse_joybinding (parse_state *state, VCONTROL_GESTURE *gesture) gesture->gesture.button.index = buttonnum; } } - else if (!stricmp (state->token, "hat")) + else if (!strcasecmp (state->token, "hat")) { int hatnum; consume (state, "hat"); @@ -1235,7 +1235,7 @@ static void parse_gesture (parse_state *state, VCONTROL_GESTURE *gesture) { gesture->type = VCONTROL_NONE; /* Default to error */ - if (!stricmp (state->token, "key")) + if (!strcasecmp (state->token, "key")) { /* Parse key binding */ int keysym; @@ -1247,7 +1247,7 @@ parse_gesture (parse_state *state, VCONTROL_GESTURE *gesture) gesture->gesture.key = keysym; } } - else if (!stricmp (state->token, "joystick")) + else if (!strcasecmp (state->token, "joystick")) { parse_joybinding (state, gesture); } diff --git a/sc2/src/sc2code/libs/resource/mapres.c b/sc2/src/sc2code/libs/resource/mapres.c index 043f4301e..abd66ba9a 100644 --- a/sc2/src/sc2code/libs/resource/mapres.c +++ b/sc2/src/sc2code/libs/resource/mapres.c @@ -82,9 +82,9 @@ str2int (const char *s) { static BOOLEAN str2bool (const char *s) { - if (!stricmp (s, "yes") || - !stricmp (s, "true") || - !stricmp (s, "1") ) + if (!strcasecmp (s, "yes") || + !strcasecmp (s, "true") || + !strcasecmp (s, "1") ) return TRUE; return FALSE; } @@ -98,13 +98,13 @@ res_IsBoolean (const char *key) d = res_GetString (key); if (!d) return 0; - return !stricmp (d, "yes") || - !stricmp (d, "no") || - !stricmp (d, "true") || - !stricmp (d, "false") || - !stricmp (d, "0") || - !stricmp (d, "1") || - !stricmp (d, ""); + return !strcasecmp (d, "yes") || + !strcasecmp (d, "no") || + !strcasecmp (d, "true") || + !strcasecmp (d, "false") || + !strcasecmp (d, "0") || + !strcasecmp (d, "1") || + !strcasecmp (d, ""); } BOOLEAN diff --git a/sc2/src/sc2code/libs/resource/resinit.c b/sc2/src/sc2code/libs/resource/resinit.c index 5888b57e7..0901bcb5f 100644 --- a/sc2/src/sc2code/libs/resource/resinit.c +++ b/sc2/src/sc2code/libs/resource/resinit.c @@ -155,7 +155,7 @@ DescriptorToInt (const char *descriptor, RESOURCE_DATA *resdata) void DescriptorToBoolean (const char *descriptor, RESOURCE_DATA *resdata) { - if (!stricmp (descriptor, "true")) + if (!strcasecmp (descriptor, "true")) { resdata->num = TRUE; } diff --git a/sc2/src/sc2code/loadmele.c b/sc2/src/sc2code/loadmele.c index 52cc90b06..3c04e4899 100644 --- a/sc2/src/sc2code/loadmele.c +++ b/sc2/src/sc2code/loadmele.c @@ -169,7 +169,7 @@ GetFleetIndexByFileName (MELEE_STATE *pMS, const char *fileName) pMS->load.entryIndices[index]); const BYTE *entryName = GetDirEntryAddress (entry); - if (stricmp ((const char *) entryName, fileName) == 0) + if (strcasecmp ((const char *) entryName, fileName) == 0) return pMS->load.preBuiltCount + index; }