summaryrefslogtreecommitdiff
path: root/com32/lua/src/lstrlib.c
diff options
context:
space:
mode:
authorErwan Velu <erwanaliasr1@gmail.com>2011-02-07 21:57:20 +0100
committerErwan Velu <erwanaliasr1@gmail.com>2011-02-07 21:57:20 +0100
commitbfcd7b7305c5465eb33acca86109ca96cb37403a (patch)
tree082568fb50331c3ed6e83714f12084d3bae4d525 /com32/lua/src/lstrlib.c
parent04053040997dfb22e104cb4c1ff3048d87994ad4 (diff)
downloadsyslinux-bfcd7b7305c5465eb33acca86109ca96cb37403a.tar.gz
lua: Updating to 5.1.4
Updating base code to 5.1.4 Adding -DSYSLINUX build flag Moving #if 0 to ifndef SYSLINUX
Diffstat (limited to 'com32/lua/src/lstrlib.c')
-rw-r--r--com32/lua/src/lstrlib.c7
1 files changed, 3 insertions, 4 deletions
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 */