diff options
| author | ruki <[email protected]> | 2019-10-28 22:37:55 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-10-28 09:47:33 +0800 |
| commit | a6e3140520f31c756cc8982d3ab20eff95b75160 (patch) | |
| tree | 0d4102953350e00bfd2252546062c32f95080a19 /core/src/xmake/io/socket_bind.c | |
| parent | da73a6e5c04c70fd4c49d7502fafd225d9a13ab5 (diff) | |
fix some compiler errors
Diffstat (limited to 'core/src/xmake/io/socket_bind.c')
| -rw-r--r-- | core/src/xmake/io/socket_bind.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/core/src/xmake/io/socket_bind.c b/core/src/xmake/io/socket_bind.c index 7a14040a6..9676d0600 100644 --- a/core/src/xmake/io/socket_bind.c +++ b/core/src/xmake/io/socket_bind.c @@ -40,9 +40,13 @@ tb_int_t xm_io_socket_bind(lua_State* lua) // check tb_assert_and_check_return_val(lua, 0); - // is user data? + // check socket if (!lua_isuserdata(lua, 1)) - return 0; + { + lua_pushboolean(lua, false); + lua_pushliteral(lua, "invalid socket!"); + return 2; + } // get socket tb_socket_ref_t sock = (tb_socket_ref_t)lua_touserdata(lua, 1); @@ -53,10 +57,10 @@ tb_int_t xm_io_socket_bind(lua_State* lua) tb_assert_and_check_return_val(address, 0); // get port - tb_size_t port = (tb_size_t)luaL_checknumber(lua, 3); + tb_uint16_t port = (tb_uint16_t)luaL_checknumber(lua, 3); // get family - tb_size_t family = (tb_size_t)luaL_checknumber(lua, 4); + tb_uint8_t family = (tb_uint8_t)luaL_checknumber(lua, 4); // init address tb_ipaddr_t addr; |
