diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2024-07-27 15:13:21 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2024-07-27 15:13:21 -0300 |
commit | f2206b2abe848f65956fa48da338c2bfac599e4a (patch) | |
tree | 94c1a856ec06846ad7485648ccafb429b5ca1b9b /lstrlib.c | |
parent | 0acd55898d0aaae8dbc14c8a1bc1e3bdffc8701b (diff) | |
download | lua-f2206b2abe848f65956fa48da338c2bfac599e4a.tar.gz lua-f2206b2abe848f65956fa48da338c2bfac599e4a.tar.bz2 lua-f2206b2abe848f65956fa48da338c2bfac599e4a.zip |
'-Wconversion' extended to all options of Lua numbers
Diffstat (limited to 'lstrlib.c')
-rw-r--r-- | lstrlib.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -704,7 +704,8 @@ static ptrdiff_t get_onecapture (MatchState *ms, int i, const char *s, | |||
704 | if (l_unlikely(capl == CAP_UNFINISHED)) | 704 | if (l_unlikely(capl == CAP_UNFINISHED)) |
705 | luaL_error(ms->L, "unfinished capture"); | 705 | luaL_error(ms->L, "unfinished capture"); |
706 | else if (capl == CAP_POSITION) | 706 | else if (capl == CAP_POSITION) |
707 | lua_pushinteger(ms->L, (ms->capture[i].init - ms->src_init) + 1); | 707 | lua_pushinteger(ms->L, |
708 | ct_diff2S(ms->capture[i].init - ms->src_init) + 1); | ||
708 | return capl; | 709 | return capl; |
709 | } | 710 | } |
710 | } | 711 | } |
@@ -775,7 +776,7 @@ static int str_find_aux (lua_State *L, int find) { | |||
775 | /* do a plain search */ | 776 | /* do a plain search */ |
776 | const char *s2 = lmemfind(s + init, ls - init, p, lp); | 777 | const char *s2 = lmemfind(s + init, ls - init, p, lp); |
777 | if (s2) { | 778 | if (s2) { |
778 | lua_pushinteger(L, (s2 - s) + 1); | 779 | lua_pushinteger(L, ct_diff2S(s2 - s) + 1); |
779 | lua_pushinteger(L, cast_st2S(ct_diff2sz(s2 - s) + lp)); | 780 | lua_pushinteger(L, cast_st2S(ct_diff2sz(s2 - s) + lp)); |
780 | return 2; | 781 | return 2; |
781 | } | 782 | } |
@@ -793,8 +794,8 @@ static int str_find_aux (lua_State *L, int find) { | |||
793 | reprepstate(&ms); | 794 | reprepstate(&ms); |
794 | if ((res=match(&ms, s1, p)) != NULL) { | 795 | if ((res=match(&ms, s1, p)) != NULL) { |
795 | if (find) { | 796 | if (find) { |
796 | lua_pushinteger(L, (s1 - s) + 1); /* start */ | 797 | lua_pushinteger(L, ct_diff2S(s1 - s) + 1); /* start */ |
797 | lua_pushinteger(L, res - s); /* end */ | 798 | lua_pushinteger(L, ct_diff2S(res - s)); /* end */ |
798 | return push_captures(&ms, NULL, 0) + 2; | 799 | return push_captures(&ms, NULL, 0) + 2; |
799 | } | 800 | } |
800 | else | 801 | else |