From e5f58ef5bff297cb6172d30725a5e7d63c5be0d2 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 27 Aug 2008 20:41:28 +0000 Subject: Removed various uses of scumm_stricmp by the more readable String::equalsIgnoreCase and String:: compareToIgnoreCase svn-id: r34198 --- common/util.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'common/util.cpp') diff --git a/common/util.cpp b/common/util.cpp index 6f0fdcb233..316f2e39c3 100644 --- a/common/util.cpp +++ b/common/util.cpp @@ -237,10 +237,9 @@ Language parseLanguage(const String &str) { if (str.empty()) return UNK_LANG; - const char *s = str.c_str(); const LanguageDescription *l = g_languages; for (; l->code; ++l) { - if (!scumm_stricmp(l->code, s)) + if (str.equalsIgnoreCase(l->code)) return l->id; } @@ -299,20 +298,18 @@ Platform parsePlatform(const String &str) { if (str.empty()) return kPlatformUnknown; - const char *s = str.c_str(); - // Handle some special case separately, for compatibility with old config // files. - if (!strcmp(s, "1")) + if (str == "1") return kPlatformAmiga; - else if (!strcmp(s, "2")) + else if (str == "2") return kPlatformAtariST; - else if (!strcmp(s, "3")) + else if (str == "3") return kPlatformMacintosh; const PlatformDescription *l = g_platforms; for (; l->code; ++l) { - if (!scumm_stricmp(l->code, s) || !scumm_stricmp(l->code2, s) || !scumm_stricmp(l->abbrev, s)) + if (str.equalsIgnoreCase(l->code) || str.equalsIgnoreCase(l->code2) || str.equalsIgnoreCase(l->abbrev)) return l->id; } @@ -364,10 +361,9 @@ RenderMode parseRenderMode(const String &str) { if (str.empty()) return kRenderDefault; - const char *s = str.c_str(); const RenderModeDescription *l = g_renderModes; for (; l->code; ++l) { - if (!scumm_stricmp(l->code, s)) + if (str.equalsIgnoreCase(l->code)) return l->id; } -- cgit v1.2.3 From b0a4658038cb30f49d58d819cfa9e6d554a1d84b Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Wed, 3 Sep 2008 01:47:01 +0000 Subject: Add Nintendo Wii versions of Freddi Fish 1 and Pajama Sam 1. svn-id: r34290 --- common/util.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'common/util.cpp') diff --git a/common/util.cpp b/common/util.cpp index 316f2e39c3..f23a0ee6d6 100644 --- a/common/util.cpp +++ b/common/util.cpp @@ -277,6 +277,7 @@ const PlatformDescription g_platforms[] = { {"c64", "c64", "c64", "Commodore 64", kPlatformC64}, {"pc", "dos", "ibm", "DOS", kPlatformPC}, {"pc98", "pc98", "pc98", "PC-98", kPlatformPC98}, + {"wii", "wii", "wii", "Nintendo Wii", kPlatformWii}, // The 'official' spelling seems to be "FM-TOWNS" (e.g. in the Indy4 demo). // However, on the net many variations can be seen, like "FMTOWNS", -- cgit v1.2.3 From 9bf7aa308e4a5cc46e27a8ca9421cc42815c2833 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 5 Sep 2008 20:07:34 +0000 Subject: Moved matchString from util.* to str.*; added new String::matchString method; fixed matchString doxygen comment (it confused pattern & string); added unit tests for matchString svn-id: r34364 --- common/util.cpp | 33 --------------------------------- 1 file changed, 33 deletions(-) (limited to 'common/util.cpp') diff --git a/common/util.cpp b/common/util.cpp index f23a0ee6d6..f68d253ec3 100644 --- a/common/util.cpp +++ b/common/util.cpp @@ -63,39 +63,6 @@ extern bool isSmartphone(void); namespace Common { -bool matchString(const char *str, const char *pat) { - const char *p = 0; - const char *q = 0; - - for (;;) { - switch (*pat) { - case '*': - p = ++pat; - q = str; - break; - - default: - if (*pat != *str) { - if (p) { - pat = p; - str = ++q; - if (!*str) - return !*pat; - break; - } - else - return false; - } - // fallthrough - case '?': - if (!*str) - return !*pat; - pat++; - str++; - } - } -} - StringTokenizer::StringTokenizer(const String &str, const String &delimiters) : _str(str), _delimiters(delimiters) { reset(); } -- cgit v1.2.3