Branch: Tag:

2016-11-05

2016-11-05 13:47:09 by Martin Nilsson <nilsson@fastmail.com>

Return -1 when failing to find a hit with search(String.Buffer). Fix so that the result isn't affected by the starting point argument.

3489:    len -= start->u.integer;    }    if (len <= 0) { -  push_undefined(); +  push_int(-1);    return;    }    if (UNLIKELY(THIS->str.s->size_shift == thirtytwobit)) {   #if SIZEOF_INT_TYPE > 4    if (UNLIKELY((0x7fffffff < character) || (character < -0x80000000))) { -  push_undefined(); +  push_int(-1);    return;    }   #endif    } else if (UNLIKELY((1L<<(8<<THIS->str.s->size_shift)) <= character) ||    UNLIKELY(character < 0)) { -  push_undefined(); +  push_int(-1);    return;    }    for (i = 0; i < len; i++) {    p_wchar2 c = INDEX_PCHARP(buf, i);    if (c == character) { -  +  if(start) +  i += start->u.integer;    push_int64(i);    return;    }    } -  push_undefined(); +  push_int(-1);    }       INIT