mirror of https://github.com/rusefi/lua.git
BUG: `strfind' gets wrong subject length when there is an offset
This commit is contained in:
parent
c31f02948f
commit
fe5c37ae95
5
bugs
5
bugs
|
@ -170,3 +170,8 @@ in the following platforms:
|
||||||
* IRIX - cc, cc-purify
|
* IRIX - cc, cc-purify
|
||||||
* Windows - Visual C++ (.c e .cpp, warning level=4)
|
* Windows - Visual C++ (.c e .cpp, warning level=4)
|
||||||
|
|
||||||
|
|
||||||
|
** lstrlib.c
|
||||||
|
Tue May 2 15:27:58 EST 2000
|
||||||
|
>> `strfind' gets wrong subject length when there is an offset
|
||||||
|
(by Jon Kleiser; since 4.0a)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
** $Id: lstrlib.c,v 1.40 2000/02/08 16:34:31 roberto Exp roberto $
|
** $Id: lstrlib.c,v 1.41 2000/03/03 14:58:26 roberto Exp roberto $
|
||||||
** Standard library for string operations and pattern-matching
|
** Standard library for string operations and pattern-matching
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
|
@ -405,7 +405,7 @@ static void str_find (lua_State *L) {
|
||||||
luaL_arg_check(L, 0 <= init && init <= l1, 3, "out of range");
|
luaL_arg_check(L, 0 <= init && init <= l1, 3, "out of range");
|
||||||
if (lua_getparam(L, 4) != LUA_NOOBJECT ||
|
if (lua_getparam(L, 4) != LUA_NOOBJECT ||
|
||||||
strpbrk(p, SPECIALS) == NULL) { /* no special characters? */
|
strpbrk(p, SPECIALS) == NULL) { /* no special characters? */
|
||||||
const char *s2 = memfind(s+init, l1, p, l2);
|
const char *s2 = memfind(s+init, l1-init, p, l2);
|
||||||
if (s2) {
|
if (s2) {
|
||||||
lua_pushnumber(L, s2-s+1);
|
lua_pushnumber(L, s2-s+1);
|
||||||
lua_pushnumber(L, s2-s+l2);
|
lua_pushnumber(L, s2-s+l2);
|
||||||
|
|
Loading…
Reference in New Issue