aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorMax Horn2006-04-14 01:48:51 +0000
committerMax Horn2006-04-14 01:48:51 +0000
commit1470dadb1de3250dfceeaa246604ca0f26889bbf (patch)
tree3bd75cabff52222dba1fc1f408e4f21917749aed /common
parent507281610935fb2adcbae0c5f0d6239defdd8ffa (diff)
downloadscummvm-rg350-1470dadb1de3250dfceeaa246604ca0f26889bbf.tar.gz
scummvm-rg350-1470dadb1de3250dfceeaa246604ca0f26889bbf.tar.bz2
scummvm-rg350-1470dadb1de3250dfceeaa246604ca0f26889bbf.zip
Changed File::open to take a Common::String as file name parameter
svn-id: r21867
Diffstat (limited to 'common')
-rw-r--r--common/config-file.cpp4
-rw-r--r--common/config-manager.cpp2
-rw-r--r--common/file.cpp10
-rw-r--r--common/file.h4
4 files changed, 9 insertions, 11 deletions
diff --git a/common/config-file.cpp b/common/config-file.cpp
index 568b5f554f..4baeb0e816 100644
--- a/common/config-file.cpp
+++ b/common/config-file.cpp
@@ -68,7 +68,7 @@ void ConfigFile::clear() {
bool ConfigFile::loadFromFile(const String &filename) {
File file;
- if (file.open(filename.c_str(), File::kFileReadMode))
+ if (file.open(filename, File::kFileReadMode))
return loadFromStream(file);
else
return false;
@@ -170,7 +170,7 @@ bool ConfigFile::loadFromStream(SeekableReadStream &stream) {
bool ConfigFile::saveToFile(const String &filename) {
File file;
- if (file.open(filename.c_str(), File::kFileWriteMode))
+ if (file.open(filename, File::kFileWriteMode))
return saveToStream(file);
else
return false;
diff --git a/common/config-manager.cpp b/common/config-manager.cpp
index 1c9089a025..bf87fb3b71 100644
--- a/common/config-manager.cpp
+++ b/common/config-manager.cpp
@@ -137,7 +137,7 @@ void ConfigManager::loadConfigFile(const String &filename) {
void ConfigManager::loadFile(const String &filename) {
File cfg_file;
- if (!cfg_file.open(filename.c_str())) {
+ if (!cfg_file.open(filename)) {
printf("Creating configuration file: %s\n", filename.c_str());
} else {
char buf[MAXLINELEN];
diff --git a/common/file.cpp b/common/file.cpp
index 038e7e3fd2..00707c4f7e 100644
--- a/common/file.cpp
+++ b/common/file.cpp
@@ -67,7 +67,6 @@ static FILE *fopenNoCase(const String &filename, const String &directory, const
// Try again, with file name converted to upper case
//
if (!file) {
-
for (i = offsetToFileName; i < buf.size(); ++i) {
buf[i] = toupper(buf[i]);
}
@@ -185,20 +184,19 @@ void File::decRef() {
}
-bool File::open(const char *f, AccessMode mode, const char *directory) {
+bool File::open(const String &filename, AccessMode mode, const char *directory) {
assert(mode == kFileReadMode || mode == kFileWriteMode);
- if (f == NULL || *f == 0) {
+ if (filename.empty()) {
error("File::open: No filename was specified!");
}
if (_handle) {
- error("File::open: This file object already is opened (%s), won't open '%s'", _name.c_str(), f);
+ error("File::open: This file object already is opened (%s), won't open '%s'", _name.c_str(), filename.c_str());
}
clearIOFailed();
- String filename(f);
String fname(filename);
fname.toLowercase();
@@ -265,7 +263,7 @@ bool File::open(const char *f, AccessMode mode, const char *directory) {
return true;
}
-bool File::exists(const char *filename, const char *directory) {
+bool File::exists(const String &filename, const char *directory) {
// FIXME: Ugly ugly hack!
File tmp;
return tmp.open(filename, kFileReadMode, directory);
diff --git a/common/file.h b/common/file.h
index 567292c440..27d062a41d 100644
--- a/common/file.h
+++ b/common/file.h
@@ -60,8 +60,8 @@ public:
void incRef();
void decRef();
- virtual bool open(const char *filename, AccessMode mode = kFileReadMode, const char *directory = NULL);
- static bool exists(const char *filename, const char *directory = NULL);
+ virtual bool open(const String &filename, AccessMode mode = kFileReadMode, const char *directory = NULL);
+ static bool exists(const String &filename, const char *directory = NULL);
virtual void close();
bool isOpen() const;