/ Check-in [576fa59f01]
DEMO | DOWNLOAD | DEPLOY | SEARCH
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix erroneous error for String.fromCharCode. [33ca23183f]
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:576fa59f01d9516ff47367c2b54ce610b7dbc7fc
User & Date: pmacdona 2019-07-27 14:46:39
Original Comment: Fix erroneous error for String.fromCharCode. [forumpost/33ca23183f]
Context
2019-08-11
00:49
Change format %c to not use utf, adding %C for utf. check-in: dc5b1f0ba1 user: pmacdona tags: trunk
2019-07-27
14:46
Fix erroneous error for String.fromCharCode. [33ca23183f] check-in: 576fa59f01 user: pmacdona tags: trunk
2019-07-23
14:23
Release "2.8.39". check-in: 7abe7b66d3 user: pmacdona tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/jsiString.c.

270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
    /* TODO: differentiate from re.exec() */
    return jsi_RegExpMatches(interp, seq, v, bLen, *ret, NULL, 1);
}

static Jsi_RC StringFromCharCodeCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,
    Jsi_Value **ret, Jsi_Func *funcPtr)
{
    if (!(_this->vt == JSI_VT_OBJECT && _this->d.obj->ot == JSI_OT_FUNCTION &&
       _this->d.obj->__proto__ == interp->String_prototype->d.obj->__proto__ ))
        return Jsi_LogError("must be called as String.fromCharCode");
    
    Jsi_DString dStr = {};
    int n, i, len, argc = Jsi_ValueGetLength(interp, args);
    for (i=0; i<argc; i++) {
        Jsi_Value *v = Jsi_ValueArrayIndex(interp, args, i);
        if (!Jsi_ValueIsNumber(interp, v) || Jsi_GetIntFromValue(interp, v, &n) != JSI_OK) {
            Jsi_DSFree(&dStr);







|
|
<







270
271
272
273
274
275
276
277
278

279
280
281
282
283
284
285
    /* TODO: differentiate from re.exec() */
    return jsi_RegExpMatches(interp, seq, v, bLen, *ret, NULL, 1);
}

static Jsi_RC StringFromCharCodeCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,
    Jsi_Value **ret, Jsi_Func *funcPtr)
{
    if (_this->vt != JSI_VT_OBJECT || _this->d.obj->ot == JSI_OT_STRING)
        return Jsi_LogError("should be called via String.fromCharCode");

    
    Jsi_DString dStr = {};
    int n, i, len, argc = Jsi_ValueGetLength(interp, args);
    for (i=0; i<argc; i++) {
        Jsi_Value *v = Jsi_ValueArrayIndex(interp, args, i);
        if (!Jsi_ValueIsNumber(interp, v) || Jsi_GetIntFromValue(interp, v, &n) != JSI_OK) {
            Jsi_DSFree(&dStr);