summaryrefslogtreecommitdiff
path: root/core/src/xmake/io/socket_sendfile.c
diff options
context:
space:
mode:
authorruki <[email protected]>2025-11-09 22:34:50 +0800
committerruki <[email protected]>2025-11-09 22:34:50 +0800
commitbf2da8a3d7f04bf5ffcdce8fd4c334d5421d3494 (patch)
tree054a98d5d2b875f9bb552c6848a31877e5afde4c /core/src/xmake/io/socket_sendfile.c
parentf2f3821a0248b24941566c90e7aabcc0e7d95e77 (diff)
format core
Diffstat (limited to 'core/src/xmake/io/socket_sendfile.c')
-rw-r--r--core/src/xmake/io/socket_sendfile.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/core/src/xmake/io/socket_sendfile.c b/core/src/xmake/io/socket_sendfile.c
index 0d4be4219..e12e574d7 100644
--- a/core/src/xmake/io/socket_sendfile.c
+++ b/core/src/xmake/io/socket_sendfile.c
@@ -85,8 +85,9 @@ tb_int_t xm_io_socket_sendfile(lua_State *lua) {
// get start
tb_long_t start = 1;
- if (lua_isnumber(lua, 3))
+ if (lua_isnumber(lua, 3)) {
start = (tb_long_t)lua_tonumber(lua, 3);
+ }
if (start < 1 || start > filesize) {
lua_pushinteger(lua, -1);
lua_pushfstring(lua, "invalid start position(%d)!", (tb_int_t)start);
@@ -95,8 +96,9 @@ tb_int_t xm_io_socket_sendfile(lua_State *lua) {
// get last
tb_long_t last = (tb_long_t)filesize;
- if (lua_isnumber(lua, 4))
+ if (lua_isnumber(lua, 4)) {
last = (tb_long_t)lua_tonumber(lua, 4);
+ }
if (last < start - 1 || last > filesize + start - 1) {
lua_pushinteger(lua, -1);
lua_pushfstring(lua, "invalid last position(%d)!", (tb_int_t)last);