(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

@@ -27,8 +27,8 @@ void sqstd_printcallstack(HSQUIRRELVM v)
* Since the path only reaches NoAI code in a formatted string we have
* to strip it here. Let's hope nobody installs openttd in a subdirectory
* of a directory named /ai/. */
src = scstrstr(si.source, "\\ai\\");
if (!src) src = scstrstr(si.source, "/ai/");
src = strstr(si.source, "\\ai\\");
if (!src) src = strstr(si.source, "/ai/");
if (src) {
src += 4;
} else {

View File

@@ -526,7 +526,7 @@ SQRex *sqstd_rex_compile(const SQChar *pattern,const SQChar **error)
SQRex *exp = (SQRex *)sq_malloc(sizeof(SQRex));
exp->_eol = exp->_bol = NULL;
exp->_p = pattern;
exp->_nallocated = (SQInteger)scstrlen(pattern) * sizeof(SQChar);
exp->_nallocated = (SQInteger)strlen(pattern) * sizeof(SQChar);
exp->_nodes = (SQRexNode *)sq_malloc(exp->_nallocated * sizeof(SQRexNode));
exp->_nsize = 0;
exp->_matches = 0;
@@ -544,16 +544,16 @@ SQRex *sqstd_rex_compile(const SQChar *pattern,const SQChar **error)
SQRexNode *t;
nsize = exp->_nsize;
t = &exp->_nodes[0];
scprintf("\n");
printf("\n");
/* XXX -- The (int) casts are needed to silent warnings on 64bit systems (SQInteger is 64bit, %d assumes 32bit, (int) is 32bit) */
for(i = 0;i < nsize; i++) {
if(exp->_nodes[i].type>MAX_CHAR)
scprintf("[%02d] %10s ",(int)i,g_nnames[exp->_nodes[i].type-MAX_CHAR]);
printf("[%02d] %10s ",(int)i,g_nnames[exp->_nodes[i].type-MAX_CHAR]);
else
scprintf("[%02d] %10c ",(int)i,exp->_nodes[i].type);
scprintf("left %02d right %02d next %02d\n",(int)exp->_nodes[i].left,(int)exp->_nodes[i].right,(int)exp->_nodes[i].next);
printf("[%02d] %10c ",(int)i,exp->_nodes[i].type);
printf("left %02d right %02d next %02d\n",(int)exp->_nodes[i].left,(int)exp->_nodes[i].right,(int)exp->_nodes[i].next);
}
scprintf("\n");
printf("\n");
}
#endif
exp->_matches = (SQRexMatch *) sq_malloc(exp->_nsubexpr * sizeof(SQRexMatch));
@@ -579,7 +579,7 @@ SQBool sqstd_rex_match(SQRex* exp,const SQChar* text)
{
const SQChar* res = NULL;
exp->_bol = text;
exp->_eol = text + scstrlen(text);
exp->_eol = text + strlen(text);
exp->_currsubexp = 0;
res = sqstd_rex_matchnode(exp,exp->_nodes,text,NULL);
if(res == NULL || res != exp->_eol)
@@ -618,7 +618,7 @@ SQBool sqstd_rex_searchrange(SQRex* exp,const SQChar* text_begin,const SQChar* t
SQBool sqstd_rex_search(SQRex* exp,const SQChar* text, const SQChar** out_begin, const SQChar** out_end)
{
return sqstd_rex_searchrange(exp,text,text + scstrlen(text),out_begin,out_end);
return sqstd_rex_searchrange(exp,text,text + strlen(text),out_begin,out_end);
}
SQInteger sqstd_rex_getsubexpcount(SQRex* exp)

View File

@@ -22,7 +22,7 @@ static SQInteger validate_format(HSQUIRRELVM v, SQChar *fmt, const SQChar *src,
SQInteger start = n;
fmt[0] = '%';
while (scstrchr("-+ #0", src[n])) n++;
while (scisdigit(src[n])) {
while (isdigit(src[n])) {
swidth[wc] = src[n];
n++;
wc++;
@@ -31,7 +31,7 @@ static SQInteger validate_format(HSQUIRRELVM v, SQChar *fmt, const SQChar *src,
}
swidth[wc] = '\0';
if(wc > 0) {
width = scatoi(swidth);
width = atoi(swidth);
}
else
width = 0;
@@ -39,7 +39,7 @@ static SQInteger validate_format(HSQUIRRELVM v, SQChar *fmt, const SQChar *src,
n++;
wc = 0;
while (scisdigit(src[n])) {
while (isdigit(src[n])) {
swidth[wc] = src[n];
n++;
wc++;
@@ -48,7 +48,7 @@ static SQInteger validate_format(HSQUIRRELVM v, SQChar *fmt, const SQChar *src,
}
swidth[wc] = '\0';
if(wc > 0) {
width += scatoi(swidth);
width += atoi(swidth);
}
}
if (n-start > MAX_FORMAT_LEN )
@@ -69,7 +69,7 @@ static void _append_string(SQInteger &i, SQChar *dest, SQInteger allocated, cons
{
va_list va;
va_start(va, fmt);
i += scvsnprintf(&dest[i],allocated-i,fmt,va);
i += vsnprintf(&dest[i],allocated-i,fmt,va);
va_end(va);
}
@@ -156,7 +156,7 @@ static SQInteger _string_format(HSQUIRRELVM v)
static void __strip_l(const SQChar *str,const SQChar **start)
{
const SQChar *t = str;
while(((*t) != '\0') && scisspace(*t)){ t++; }
while(((*t) != '\0') && isspace(*t)){ t++; }
*start = t;
}
@@ -167,7 +167,7 @@ static void __strip_r(const SQChar *str,SQInteger len,const SQChar **end)
return;
}
const SQChar *t = &str[len-1];
while(t != str && scisspace(*t)) { t--; }
while(t != str && isspace(*t)) { t--; }
*end = t+1;
}