summaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorruki <[email protected]>2026-01-21 22:31:49 +0800
committerruki <[email protected]>2026-01-21 22:31:49 +0800
commite53ded7330b1ad6941bfa70b6b8d232410a813a5 (patch)
treed2f528b9c4661e7eba88c00ec606ebb0f4f34a48 /core/src
parente36eec65251b48fb5188691e86006ea8266ebe9a (diff)
fix compile error
Diffstat (limited to 'core/src')
-rw-r--r--core/src/xmake/utf8/byte.c2
-rw-r--r--core/src/xmake/utf8/find.c10
-rw-r--r--core/src/xmake/utf8/len.c2
-rw-r--r--core/src/xmake/utf8/sub.c2
4 files changed, 8 insertions, 8 deletions
diff --git a/core/src/xmake/utf8/byte.c b/core/src/xmake/utf8/byte.c
index 036f04334..18cd5d7c9 100644
--- a/core/src/xmake/utf8/byte.c
+++ b/core/src/xmake/utf8/byte.c
@@ -48,5 +48,5 @@ tb_int_t xm_utf8_byte(lua_State* lua) {
lua_Integer i = luaL_optinteger(lua, 2, 1);
lua_Integer j = luaL_optinteger(lua, 3, i);
- return (tb_int_t)xm_utf8_byte_impl(s, len, i, j, xm_utf8_byte_cb, lua);
+ return (tb_int_t)xm_utf8_byte_impl(s, len, (tb_long_t)i, (tb_long_t)j, xm_utf8_byte_cb, lua);
}
diff --git a/core/src/xmake/utf8/find.c b/core/src/xmake/utf8/find.c
index cc57f1e69..f2268f9b4 100644
--- a/core/src/xmake/utf8/find.c
+++ b/core/src/xmake/utf8/find.c
@@ -30,7 +30,7 @@
static tb_int_t xm_utf8_find_impl_plain(lua_State* lua, tb_char_t const* s, size_t len, tb_char_t const* sub, size_t sublen, lua_Integer init) {
tb_long_t char_end = 0;
- tb_long_t char_start = xm_utf8_find_impl(s, len, sub, sublen, init, &char_end);
+ tb_long_t char_start = xm_utf8_find_impl(s, len, sub, sublen, (tb_long_t)init, &char_end);
if (char_start > 0) {
lua_pushinteger(lua, char_start);
lua_pushinteger(lua, char_end);
@@ -45,14 +45,14 @@ static tb_int_t xm_utf8_find_impl_pattern(lua_State* lua, tb_char_t const* s, si
tb_long_t byte_init = 1;
if (init > 0) {
if (init > 1) {
- byte_init = xm_utf8_offset_impl(s, len, init, 1);
+ byte_init = xm_utf8_offset_impl(s, len, (tb_long_t)init, 1);
if (byte_init <= 0) {
lua_pushnil(lua);
return 1;
}
}
} else if (init < 0) {
- byte_init = xm_utf8_offset_impl(s, len, init, len + 1);
+ byte_init = xm_utf8_offset_impl(s, len, (tb_long_t)init, len + 1);
if (byte_init <= 0) {
lua_pushnil(lua);
return 1;
@@ -81,7 +81,7 @@ static tb_int_t xm_utf8_find_impl_pattern(lua_State* lua, tb_char_t const* s, si
tb_long_t char_start = 1;
if (b_start > 1) {
- tb_long_t count = xm_utf8_len_impl(s, len, 1, b_start - 1, tb_true, tb_null);
+ tb_long_t count = xm_utf8_len_impl(s, len, 1, (tb_long_t)b_start - 1, tb_true, tb_null);
if (count < 0) {
lua_pushnil(lua);
lua_remove(lua, base + 1);
@@ -92,7 +92,7 @@ static tb_int_t xm_utf8_find_impl_pattern(lua_State* lua, tb_char_t const* s, si
tb_long_t match_char_len = 0;
if (b_end >= b_start) {
- match_char_len = xm_utf8_len_impl(s, len, b_start, b_end, tb_true, tb_null);
+ match_char_len = xm_utf8_len_impl(s, len, (tb_long_t)b_start, (tb_long_t)b_end, tb_true, tb_null);
if (match_char_len < 0) {
lua_pushnil(lua);
lua_remove(lua, base + 1);
diff --git a/core/src/xmake/utf8/len.c b/core/src/xmake/utf8/len.c
index 50fa8e37a..f9819ec3b 100644
--- a/core/src/xmake/utf8/len.c
+++ b/core/src/xmake/utf8/len.c
@@ -44,7 +44,7 @@ tb_int_t xm_utf8_len(lua_State *lua) {
luaL_argcheck(lua, --posj < (lua_Integer)len, 3, "final position out of bounds");
tb_size_t errpos = 0;
- tb_long_t n = xm_utf8_len_impl(s, len, posi + 1, posj + 1, !lax, &errpos);
+ tb_long_t n = xm_utf8_len_impl(s, len, (tb_long_t)posi + 1, (tb_long_t)posj + 1, !lax, &errpos);
if (n < 0) {
lua_pushnil(lua);
lua_pushinteger(lua, errpos);
diff --git a/core/src/xmake/utf8/sub.c b/core/src/xmake/utf8/sub.c
index 2268708c6..e1561f0f7 100644
--- a/core/src/xmake/utf8/sub.c
+++ b/core/src/xmake/utf8/sub.c
@@ -37,7 +37,7 @@ tb_int_t xm_utf8_sub(lua_State *lua) {
lua_Integer j = luaL_optinteger(lua, 3, -1);
tb_size_t sublen = 0;
- tb_char_t const* sub = xm_utf8_sub_impl(s, len, i, j, &sublen);
+ tb_char_t const* sub = xm_utf8_sub_impl(s, len, (tb_long_t)i, (tb_long_t)j, &sublen);
if (sub) {
lua_pushlstring(lua, sub, sublen);
} else {