summaryrefslogtreecommitdiff
path: root/apps/plugins/lua/lstrlib.c
diff options
context:
space:
mode:
authorWilliam Wilgus <me.theuser@yahoo.com>2018-11-08 11:32:45 -0500
committerWilliam Wilgus <me.theuser@yahoo.com>2018-11-11 19:42:30 -0500
commitb69faf0bcc5ddca1d88b1a7ab47bcbbc6dbb9af1 (patch)
tree191277cab3ef773238c1e91dafaaea04ddca1949 /apps/plugins/lua/lstrlib.c
parentde6618a2713ef26f888762cbe6539cc65a393c7c (diff)
downloadrockbox-b69faf0bcc5ddca1d88b1a7ab47bcbbc6dbb9af1.zip
rockbox-b69faf0bcc5ddca1d88b1a7ab47bcbbc6dbb9af1.tar.gz
rockbox-b69faf0bcc5ddca1d88b1a7ab47bcbbc6dbb9af1.tar.bz2
rockbox-b69faf0bcc5ddca1d88b1a7ab47bcbbc6dbb9af1.tar.xz
lua update to 5.1.5
Modify Rocklua towards upstream 5.1.5 Clean up some of the Rocklua implementation Change-Id: Iac722e827899cf84f5ca004ef7ae7ddce5f7fbbe
Diffstat (limited to 'apps/plugins/lua/lstrlib.c')
-rw-r--r--apps/plugins/lua/lstrlib.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/apps/plugins/lua/lstrlib.c b/apps/plugins/lua/lstrlib.c
index 3d61036..8b39314 100644
--- a/apps/plugins/lua/lstrlib.c
+++ b/apps/plugins/lua/lstrlib.c
@@ -1,5 +1,5 @@
/*
-** $Id: lstrlib.c,v 1.132.1.4 2008/07/11 17:27:21 roberto Exp $
+** $Id: lstrlib.c,v 1.132.1.5 2010/05/14 15:34:19 roberto Exp $
** Standard library for string operations and pattern-matching
** See Copyright Notice in lua.h
*/
@@ -754,6 +754,7 @@ static void addintlen (char *form) {
static int str_format (lua_State *L) {
+ int top = lua_gettop(L);
int arg = 1;
size_t sfl;
const char *strfrmt = luaL_checklstring(L, arg, &sfl);
@@ -768,7 +769,8 @@ static int str_format (lua_State *L) {
else { /* format item */
char form[MAX_FORMAT]; /* to store the format (`%...') */
char buff[MAX_ITEM]; /* to store the formatted item */
- arg++;
+ if (++arg > top)
+ luaL_argerror(L, arg, "no value");
strfrmt = scanformat(L, strfrmt, form);
switch (*strfrmt++) {
case 'c': {
@@ -785,11 +787,13 @@ static int str_format (lua_State *L) {
snprintf(buff, MAX_ITEM, form, (unsigned LUA_INTFRM_T)luaL_checknumber(L, arg));
break;
}
+#if 0 /* ROCKLUA NO FLOATING POINT */
case 'e': case 'E': case 'f':
case 'g': case 'G': {
snprintf(buff, MAX_ITEM, form, (double)luaL_checknumber(L, arg));
break;
}
+#endif
case 'q': {
addquoted(L, &b, arg);
continue; /* skip the 'addsize' at the end */