diff options
Diffstat (limited to 'src/script/squirrel_std.cpp')
-rw-r--r-- | src/script/squirrel_std.cpp | 11 |
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 != '/') |