Add kludge for sprintf -> npf_snprintf in mujs
This commit is contained in:
parent
a25b25984f
commit
f1fe3a6a97
4 changed files with 9 additions and 18 deletions
|
@ -241,7 +241,6 @@ U0 strcmp()
|
|||
{
|
||||
PUSH_SYSV_REGS
|
||||
GET_SYSV_ARGS
|
||||
//"strcmp: '%s', '%s'\n", p0, p1;
|
||||
StrCmp(p0, p1);
|
||||
POP_SYSV_REGS
|
||||
}
|
||||
|
@ -385,11 +384,3 @@ U0 strstr()
|
|||
POP_SYSV_REGS
|
||||
|
||||
}
|
||||
|
||||
U0 sprintf()
|
||||
{
|
||||
PUSH_SYSV_REGS
|
||||
GET_SYSV_ARGS
|
||||
StrPrint(p0, p1, p2, p3, p4, p5);
|
||||
POP_SYSV_REGS
|
||||
}
|
||||
|
|
|
@ -323,7 +323,7 @@ static char *fmtdate(char *buf, double t)
|
|||
int d = DateFromTime(t);
|
||||
if (!isfinite(t))
|
||||
return "Invalid Date";
|
||||
sprintf(buf, "%04d-%02d-%02d", y, m+1, d);
|
||||
npf_snprintf(buf, 1024, "%04d-%02d-%02d", y, m+1, d);
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
@ -338,11 +338,11 @@ static char *fmttime(char *buf, double t, double tza)
|
|||
if (!isfinite(t))
|
||||
return "Invalid Date";
|
||||
if (tza == 0)
|
||||
sprintf(buf, "%02d:%02d:%02d.%03dZ", H, M, S, ms);
|
||||
npf_snprintf(buf, 1024, "%02d:%02d:%02d.%03dZ", H, M, S, ms);
|
||||
else if (tza < 0)
|
||||
sprintf(buf, "%02d:%02d:%02d.%03d-%02d:%02d", H, M, S, ms, tzh, tzm);
|
||||
npf_snprintf(buf, 1024, "%02d:%02d:%02d.%03d-%02d:%02d", H, M, S, ms, tzh, tzm);
|
||||
else
|
||||
sprintf(buf, "%02d:%02d:%02d.%03d+%02d:%02d", H, M, S, ms, tzh, tzm);
|
||||
npf_snprintf(buf, 1024, "%02d:%02d:%02d.%03d+%02d:%02d", H, M, S, ms, tzh, tzm);
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
@ -353,7 +353,7 @@ static char *fmtdatetime(char *buf, double t, double tza)
|
|||
return "Invalid Date";
|
||||
fmtdate(dbuf, t);
|
||||
fmttime(tbuf, t, tza);
|
||||
sprintf(buf, "%sT%s", dbuf, tbuf);
|
||||
npf_snprintf(buf, 1024, "%sT%s", dbuf, tbuf);
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
|
|
@ -116,11 +116,11 @@ static void numtostr(js_State *J, const char *fmt, int w, double n)
|
|||
{
|
||||
/* buf needs to fit printf("%.20f", 1e20) */
|
||||
char buf[50], *e;
|
||||
sprintf(buf, fmt, w, n);
|
||||
npf_snprintf(buf, 1024, fmt, w, n);
|
||||
e = strchr(buf, 'e');
|
||||
if (e) {
|
||||
int exp = atoi(e+1);
|
||||
sprintf(e, "e%+d", exp);
|
||||
npf_snprintf(e, 1024, "e%+d", exp);
|
||||
}
|
||||
js_pushstring(J, buf);
|
||||
}
|
||||
|
|
|
@ -919,11 +919,11 @@ const char *js_ref(js_State *J)
|
|||
s = v->u.boolean ? "_True" : "_False";
|
||||
break;
|
||||
case JS_TOBJECT:
|
||||
sprintf(buf, "%p", (void*)v->u.object);
|
||||
npf_snprintf(buf, 1024, "%p", (void*)v->u.object);
|
||||
s = js_intern(J, buf);
|
||||
break;
|
||||
default:
|
||||
sprintf(buf, "%d", J->nextref++);
|
||||
npf_snprintf(buf, 1024, "%d", J->nextref++);
|
||||
s = js_intern(J, buf);
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue