aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/scicore
diff options
context:
space:
mode:
authorMax Horn2009-02-18 19:14:40 +0000
committerMax Horn2009-02-18 19:14:40 +0000
commit766783b493b147076e434214a6aff6b3c2f8cd9b (patch)
treeca7d457035ef70e0bbe99abbfcb9310e06c8321b /engines/sci/scicore
parentc01b069b91c519b191f809d595e03967a04c118d (diff)
downloadscummvm-rg350-766783b493b147076e434214a6aff6b3c2f8cd9b.tar.gz
scummvm-rg350-766783b493b147076e434214a6aff6b3c2f8cd9b.tar.bz2
scummvm-rg350-766783b493b147076e434214a6aff6b3c2f8cd9b.zip
SCI: Some random cleanup
svn-id: r38497
Diffstat (limited to 'engines/sci/scicore')
-rw-r--r--engines/sci/scicore/tools.cpp43
1 files changed, 24 insertions, 19 deletions
diff --git a/engines/sci/scicore/tools.cpp b/engines/sci/scicore/tools.cpp
index 981234fa6a..9b192cbf24 100644
--- a/engines/sci/scicore/tools.cpp
+++ b/engines/sci/scicore/tools.cpp
@@ -64,6 +64,17 @@
#include "sci/include/engine.h"
+
+// FIXME: Get rid of G_DIR_SEPARATOR / G_DIR_SEPARATOR_S
+#if _MSC_VER
+# define G_DIR_SEPARATOR_S "\\"
+# define G_DIR_SEPARATOR '\\'
+#else
+# define G_DIR_SEPARATOR_S "/"
+# define G_DIR_SEPARATOR '/'
+#endif
+
+
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
@@ -389,7 +400,6 @@ sci_mkpath(const char *path) {
return 0;
}
-
/*-- Yielding to the scheduler --*/
#ifdef HAVE_SCHED_YIELD
@@ -423,13 +433,17 @@ sci_sched_yield() {
#endif /* !HAVE_SCHED_YIELD */
-char *
-_fcaseseek(const char *fname, sci_dir_t *dir)
+/* Returns the case-sensitive filename of a file.
+** Expects *dir to be uninitialized and the caller to free it afterwards.
+** Parameters: (const char *) fname: Name of file to get case-sensitive.
+** (sci_dir_t *) dir: Directory to find file within.
+** Returns : (char *) Case-sensitive filename of the file.
+*/
+char *_fcaseseek(const char *fname, sci_dir_t *dir) {
/* Expects *dir to be uninitialized and the caller to
** free it afterwards */
-{
- char *buf, *iterator;
- char _buf[14];
+
+ Common::String buf;
char *retval = NULL, *name;
#ifdef _MSC_VER
@@ -441,23 +455,17 @@ _fcaseseek(const char *fname, sci_dir_t *dir)
BREAKPOINT();
}
- if (strlen(fname) > 12) /* not a DOS file? */
- buf = (char*)sci_malloc(strlen(fname) + 1);
- else
- buf = _buf;
-
sci_init_dir(dir);
/* Replace all letters with '?' chars */
- strcpy(buf, fname);
- iterator = buf;
- while (*iterator) {
+ buf = fname;
+
+ for (Common::String::iterator iterator = buf.begin(); iterator != buf.end(); ++iterator) {
if (isalpha(*iterator))
*iterator = '?';
- iterator++;
}
- name = sci_find_first(dir, buf);
+ name = sci_find_first(dir, buf.c_str());
while (name && !retval) {
if (!scumm_stricmp(fname, name))
@@ -466,9 +474,6 @@ _fcaseseek(const char *fname, sci_dir_t *dir)
name = sci_find_next(dir);
}
- if (strlen(fname) > 12)
- free(buf);
-
return retval;
}