[Scummvm-cvs-logs] SF.net SVN: scummvm:[34198] scummvm/trunk/common
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Wed Aug 27 22:41:29 CEST 2008
Revision: 34198
http://scummvm.svn.sourceforge.net/scummvm/?rev=34198&view=rev
Author: fingolfin
Date: 2008-08-27 20:41:28 +0000 (Wed, 27 Aug 2008)
Log Message:
-----------
Removed various uses of scumm_stricmp by the more readable String::equalsIgnoreCase and String:: compareToIgnoreCase
Modified Paths:
--------------
scummvm/trunk/common/advancedDetector.cpp
scummvm/trunk/common/config-file.cpp
scummvm/trunk/common/fs.cpp
scummvm/trunk/common/hash-str.h
scummvm/trunk/common/util.cpp
Modified: scummvm/trunk/common/advancedDetector.cpp
===================================================================
--- scummvm/trunk/common/advancedDetector.cpp 2008-08-27 20:31:22 UTC (rev 34197)
+++ scummvm/trunk/common/advancedDetector.cpp 2008-08-27 20:41:28 UTC (rev 34198)
@@ -82,12 +82,12 @@
if (params.obsoleteList == 0)
return;
- const char *gameid = ConfMan.get("gameid").c_str();
+ String gameid = ConfMan.get("gameid");
for (const Common::ADObsoleteGameID *o = params.obsoleteList; o->from; ++o) {
- if (!scumm_stricmp(gameid, o->from)) {
+ if (gameid.equalsIgnoreCase(o->from)) {
gameid = o->to;
- ConfMan.set("gameid", o->to);
+ ConfMan.set("gameid", gameid);
if (o->platform != Common::kPlatformUnknown)
ConfMan.set("platform", Common::getPlatformCode(o->platform));
Modified: scummvm/trunk/common/config-file.cpp
===================================================================
--- scummvm/trunk/common/config-file.cpp 2008-08-27 20:31:22 UTC (rev 34197)
+++ scummvm/trunk/common/config-file.cpp 2008-08-27 20:41:28 UTC (rev 34198)
@@ -225,7 +225,7 @@
void ConfigFile::removeSection(const String §ion) {
assert(isValidName(section));
for (List<Section>::iterator i = _sections.begin(); i != _sections.end(); ++i) {
- if (!scumm_stricmp(section.c_str(), i->name.c_str())) {
+ if (section.equalsIgnoreCase(i->name)) {
_sections.erase(i);
return;
}
@@ -318,7 +318,7 @@
ConfigFile::Section *ConfigFile::getSection(const String §ion) {
for (List<Section>::iterator i = _sections.begin(); i != _sections.end(); ++i) {
- if (!scumm_stricmp(section.c_str(), i->name.c_str())) {
+ if (section.equalsIgnoreCase(i->name)) {
return &(*i);
}
}
@@ -327,7 +327,7 @@
const ConfigFile::Section *ConfigFile::getSection(const String §ion) const {
for (List<Section>::const_iterator i = _sections.begin(); i != _sections.end(); ++i) {
- if (!scumm_stricmp(section.c_str(), i->name.c_str())) {
+ if (section.equalsIgnoreCase(i->name)) {
return &(*i);
}
}
@@ -340,7 +340,7 @@
const ConfigFile::KeyValue* ConfigFile::Section::getKey(const String &key) const {
for (List<KeyValue>::const_iterator i = keys.begin(); i != keys.end(); ++i) {
- if (!scumm_stricmp(key.c_str(), i->key.c_str())) {
+ if (key.equalsIgnoreCase(i->key)) {
return &(*i);
}
}
@@ -349,7 +349,7 @@
void ConfigFile::Section::setKey(const String &key, const String &value) {
for (List<KeyValue>::iterator i = keys.begin(); i != keys.end(); ++i) {
- if (!scumm_stricmp(key.c_str(), i->key.c_str())) {
+ if (key.equalsIgnoreCase(i->key)) {
i->value = value;
return;
}
@@ -363,7 +363,7 @@
void ConfigFile::Section::removeKey(const String &key) {
for (List<KeyValue>::iterator i = keys.begin(); i != keys.end(); ++i) {
- if (!scumm_stricmp(key.c_str(), i->key.c_str())) {
+ if (key.equalsIgnoreCase(i->key)) {
keys.erase(i);
return;
}
Modified: scummvm/trunk/common/fs.cpp
===================================================================
--- scummvm/trunk/common/fs.cpp 2008-08-27 20:31:22 UTC (rev 34197)
+++ scummvm/trunk/common/fs.cpp 2008-08-27 20:41:28 UTC (rev 34198)
@@ -52,7 +52,7 @@
if (isDirectory() != node.isDirectory())
return isDirectory();
- return scumm_stricmp(getDisplayName().c_str(), node.getDisplayName().c_str()) < 0;
+ return getDisplayName().compareToIgnoreCase(node.getDisplayName()) < 0;
}
bool FilesystemNode::exists() const {
Modified: scummvm/trunk/common/hash-str.h
===================================================================
--- scummvm/trunk/common/hash-str.h 2008-08-27 20:31:22 UTC (rev 34197)
+++ scummvm/trunk/common/hash-str.h 2008-08-27 20:41:28 UTC (rev 34198)
@@ -39,7 +39,7 @@
// FIXME: The following functors obviously are not consistently named
struct CaseSensitiveString_EqualTo {
- bool operator()(const String& x, const String& y) const { return strcmp(x.c_str(), y.c_str()) == 0; }
+ bool operator()(const String& x, const String& y) const { return x.equals(y); }
};
struct CaseSensitiveString_Hash {
@@ -48,7 +48,7 @@
struct IgnoreCase_EqualTo {
- bool operator()(const String& x, const String& y) const { return scumm_stricmp(x.c_str(), y.c_str()) == 0; }
+ bool operator()(const String& x, const String& y) const { return x.equalsIgnoreCase(y); }
};
struct IgnoreCase_Hash {
Modified: scummvm/trunk/common/util.cpp
===================================================================
--- scummvm/trunk/common/util.cpp 2008-08-27 20:31:22 UTC (rev 34197)
+++ scummvm/trunk/common/util.cpp 2008-08-27 20:41:28 UTC (rev 34198)
@@ -237,10 +237,9 @@
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 @@
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 @@
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;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list