From bfcd7b7305c5465eb33acca86109ca96cb37403a Mon Sep 17 00:00:00 2001 From: Erwan Velu Date: Mon, 7 Feb 2011 21:57:20 +0100 Subject: lua: Updating to 5.1.4 Updating base code to 5.1.4 Adding -DSYSLINUX build flag Moving #if 0 to ifndef SYSLINUX --- com32/lua/src/lstrlib.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'com32/lua/src/lstrlib.c') diff --git a/com32/lua/src/lstrlib.c b/com32/lua/src/lstrlib.c index 1613cc92..1b4763d4 100644 --- a/com32/lua/src/lstrlib.c +++ b/com32/lua/src/lstrlib.c @@ -1,5 +1,5 @@ /* -** $Id: lstrlib.c,v 1.132.1.3 2007/12/28 15:32:23 roberto Exp $ +** $Id: lstrlib.c,v 1.132.1.4 2008/07/11 17:27:21 roberto Exp $ ** Standard library for string operations and pattern-matching ** See Copyright Notice in lua.h */ @@ -35,7 +35,8 @@ static int str_len (lua_State *L) { static ptrdiff_t posrelat (ptrdiff_t pos, size_t len) { /* relative string position: negative means back from end */ - return (pos>=0) ? pos : (ptrdiff_t)len+pos+1; + if (pos < 0) pos += (ptrdiff_t)len + 1; + return (pos >= 0) ? pos : 0; } @@ -784,13 +785,11 @@ static int str_format (lua_State *L) { sprintf(buff, form, (unsigned LUA_INTFRM_T)luaL_checknumber(L, arg)); break; } -#if !defined LUA_NUMBER_INTEGRAL case 'e': case 'E': case 'f': case 'g': case 'G': { sprintf(buff, form, (double)luaL_checknumber(L, arg)); break; } -#endif case 'q': { addquoted(L, &b, arg); continue; /* skip the 'addsize' at the end */ -- cgit v1.2.1