Skip to content

Commit

Permalink
resolve #31: trim trying to use utf lengths
Browse files Browse the repository at this point in the history
FossilOrigin-Name: c929266615627f49ec121c2a4b21b5c0d35a9b05b2efa5f00385c3cc84b84ebc
  • Loading branch information
pmacdona committed Oct 31, 2020
1 parent bba2cfa commit 3c98229
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/jsiString.c
Original file line number Diff line number Diff line change
Expand Up @@ -354,10 +354,10 @@ static Jsi_RC _StringTrimCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_th
if (tstr[n] == *vstr) break;
if (n>=tlen) break;
vstr++;
clen--;
bLen--;
}
}
vend = clen-1;
vend = bLen-1;
if (ends&2) {
for (; vend>=0; vend--) {
for (n=0; n<tlen; n++)
Expand All @@ -367,7 +367,7 @@ static Jsi_RC _StringTrimCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_th
}
Jsi_DString dStr;
Jsi_DSInit(&dStr);
Jsi_UtfSubstr(vstr, bLen, 0, vend+1, &dStr);
Jsi_DSAppendLen(&dStr, vstr, vend+1);
Jsi_ValueFromDS(interp, &dStr, ret);
return JSI_OK;
}
Expand Down

0 comments on commit 3c98229

Please sign in to comment.