(svn r26775) -Cleanup [Squirrel]: "resolve" several of the unicode wrapper defines

This commit is contained in:
rubidium
2014-09-06 18:10:36 +00:00
parent 33ab505567
commit e63ca12ab8
17 changed files with 130 additions and 152 deletions

View File

@@ -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 != '/')