summaryrefslogtreecommitdiff
path: root/src/script/squirrel_std.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2014-09-06 18:10:36 +0000
committerrubidium <rubidium@openttd.org>2014-09-06 18:10:36 +0000
commite63ca12ab815e0cd4d5cc7fd129cde04f7c4404a (patch)
treee4fdbec2bc1b60a37442d882cfe3df8f8d85a6e8 /src/script/squirrel_std.cpp
parent33ab50556760a84d6754235e553c68ada2f35a63 (diff)
downloadopenttd-e63ca12ab815e0cd4d5cc7fd129cde04f7c4404a.tar.xz
(svn r26775) -Cleanup [Squirrel]: "resolve" several of the unicode wrapper defines
Diffstat (limited to 'src/script/squirrel_std.cpp')
-rw-r--r--src/script/squirrel_std.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/script/squirrel_std.cpp b/src/script/squirrel_std.cpp
index ccd8affc1..ccebe2015 100644
--- a/src/script/squirrel_std.cpp
+++ b/src/script/squirrel_std.cpp
@@ -19,7 +19,8 @@
#include "../string_func.h"
/* Due to the different characters for Squirrel, the scstrcat might be a simple
- * strcat which triggers the safeguard. But it isn't always a simple strcat. */
+ * strcat which triggers the safeguard. But it isn't always a simple strcat.
+ * TODO: use properly safe functions now that Squirrel uses chars exclusively. */
#include "../safeguards.h"
#undef strcat
#undef strdup
@@ -60,9 +61,9 @@ SQInteger SquirrelStd::require(HSQUIRRELVM vm)
DEBUG(misc, 0, "[squirrel] Couldn't detect the script-name of the 'require'-caller; this should never happen!");
return SQ_ERROR;
}
- real_filename = scstrdup(si.source);
+ real_filename = strdup(si.source);
/* Keep the dir, remove the rest */
- SQChar *s = scstrrchr(real_filename, PATHSEPCHAR);
+ SQChar *s = strrchr(real_filename, PATHSEPCHAR);
if (s != NULL) {
/* Keep the PATHSEPCHAR there, remove the rest */
s++;
@@ -70,8 +71,8 @@ SQInteger SquirrelStd::require(HSQUIRRELVM vm)
}
/* And now we concat, so we are relative from the current script
* First, we have to make sure we have enough space for the full path */
- real_filename = ReallocT(real_filename, scstrlen(real_filename) + scstrlen(filename) + 1);
- scstrcat(real_filename, filename);
+ real_filename = ReallocT(real_filename, strlen(real_filename) + strlen(filename) + 1);
+ strcat(real_filename, filename);
/* Tars dislike opening files with '/' on Windows.. so convert it to '\\' ;) */
char *filen = stredup(real_filename);
#if (PATHSEPCHAR != '/')