diff options
Diffstat (limited to 'lstrlib.c')
| -rw-r--r-- | lstrlib.c | 6 |
1 files changed, 3 insertions, 3 deletions
| @@ -91,7 +91,7 @@ static int str_byte (lua_State *L) { | |||
| 91 | size_t l; | 91 | size_t l; |
| 92 | const l_char *s = luaL_check_lstr(L, 1, &l); | 92 | const l_char *s = luaL_check_lstr(L, 1, &l); |
| 93 | sint32 pos = posrelat(luaL_opt_long(L, 2, 1), l); | 93 | sint32 pos = posrelat(luaL_opt_long(L, 2, 1), l); |
| 94 | luaL_arg_check(L, 0<pos && (size_t)pos<=l, 2, l_s("out of range")); | 94 | luaL_arg_check(L, 0 < pos && (size_t)(pos) <= l, 2, l_s("out of range")); |
| 95 | lua_pushnumber(L, uchar(s[pos-1])); | 95 | lua_pushnumber(L, uchar(s[pos-1])); |
| 96 | return 1; | 96 | return 1; |
| 97 | } | 97 | } |
| @@ -424,7 +424,7 @@ static int str_find (lua_State *L) { | |||
| 424 | const l_char *s = luaL_check_lstr(L, 1, &l1); | 424 | const l_char *s = luaL_check_lstr(L, 1, &l1); |
| 425 | const l_char *p = luaL_check_lstr(L, 2, &l2); | 425 | const l_char *p = luaL_check_lstr(L, 2, &l2); |
| 426 | sint32 init = posrelat(luaL_opt_long(L, 3, 1), l1) - 1; | 426 | sint32 init = posrelat(luaL_opt_long(L, 3, 1), l1) - 1; |
| 427 | luaL_arg_check(L, 0 <= init && (size_t)init <= l1, 3, l_s("out of range")); | 427 | luaL_arg_check(L, 0 <= init && (size_t)(init) <= l1, 3, l_s("out of range")); |
| 428 | if (lua_gettop(L) > 3 || /* extra argument? */ | 428 | if (lua_gettop(L) > 3 || /* extra argument? */ |
| 429 | strpbrk(p, SPECIALS) == NULL) { /* or no special characters? */ | 429 | strpbrk(p, SPECIALS) == NULL) { /* or no special characters? */ |
| 430 | const l_char *s2 = lmemfind(s+init, l1-init, p, l2); | 430 | const l_char *s2 = lmemfind(s+init, l1-init, p, l2); |
| @@ -603,7 +603,7 @@ static int str_format (lua_State *L) { | |||
| 603 | sprintf(buff, form, luaL_check_int(L, arg)); | 603 | sprintf(buff, form, luaL_check_int(L, arg)); |
| 604 | break; | 604 | break; |
| 605 | case l_c('o'): case l_c('u'): case l_c('x'): case l_c('X'): | 605 | case l_c('o'): case l_c('u'): case l_c('x'): case l_c('X'): |
| 606 | sprintf(buff, form, (unsigned int)luaL_check_number(L, arg)); | 606 | sprintf(buff, form, (unsigned int)(luaL_check_number(L, arg))); |
| 607 | break; | 607 | break; |
| 608 | case l_c('e'): case l_c('E'): case l_c('f'): | 608 | case l_c('e'): case l_c('E'): case l_c('f'): |
| 609 | case l_c('g'): case l_c('G'): | 609 | case l_c('g'): case l_c('G'): |
