diff options
| author | ruki <[email protected]> | 2025-11-10 23:20:11 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-11-10 23:20:11 +0800 |
| commit | ef701a4dce8b7d9a663e084d1fc0b243ddae9397 (patch) | |
| tree | 45fd20851dd3480bd042dd14af77286c4289d190 /core/src/xmake/io | |
| parent | 6db4c62a474e380071625fa5cb7743972a562940 (diff) | |
format core code again
Diffstat (limited to 'core/src/xmake/io')
| -rw-r--r-- | core/src/xmake/io/file_close.c | 2 | ||||
| -rw-r--r-- | core/src/xmake/io/file_flush.c | 2 | ||||
| -rw-r--r-- | core/src/xmake/io/file_open.c | 46 | ||||
| -rw-r--r-- | core/src/xmake/io/file_read.c | 40 | ||||
| -rw-r--r-- | core/src/xmake/io/file_seek.c | 2 | ||||
| -rw-r--r-- | core/src/xmake/io/file_write.c | 10 | ||||
| -rw-r--r-- | core/src/xmake/io/filelock_open.c | 2 | ||||
| -rw-r--r-- | core/src/xmake/io/iscygpty.c | 18 | ||||
| -rw-r--r-- | core/src/xmake/io/pipe_write.c | 2 | ||||
| -rw-r--r-- | core/src/xmake/io/poller.h | 2 | ||||
| -rw-r--r-- | core/src/xmake/io/poller_insert.c | 2 | ||||
| -rw-r--r-- | core/src/xmake/io/poller_modify.c | 2 | ||||
| -rw-r--r-- | core/src/xmake/io/poller_wait.c | 8 | ||||
| -rw-r--r-- | core/src/xmake/io/prefix.h | 12 | ||||
| -rw-r--r-- | core/src/xmake/io/socket_peeraddr.c | 4 | ||||
| -rw-r--r-- | core/src/xmake/io/socket_recvfrom.c | 4 | ||||
| -rw-r--r-- | core/src/xmake/io/socket_send.c | 2 | ||||
| -rw-r--r-- | core/src/xmake/io/socket_sendto.c | 4 | ||||
| -rw-r--r-- | core/src/xmake/io/stdfile.c | 4 |
19 files changed, 84 insertions, 84 deletions
diff --git a/core/src/xmake/io/file_close.c b/core/src/xmake/io/file_close.c index cbcb237af..bb5cf1060 100644 --- a/core/src/xmake/io/file_close.c +++ b/core/src/xmake/io/file_close.c @@ -53,7 +53,7 @@ tb_int_t xm_io_file_close(lua_State *lua) { #ifdef TB_CONFIG_OS_WINDOWS // write cached data first tb_byte_t const *odata = tb_buffer_data(&file->wcache); - tb_size_t osize = tb_buffer_size(&file->wcache); + tb_size_t osize = tb_buffer_size(&file->wcache); if (odata && osize) { if (!tb_stream_bwrit(file->u.file_ref, odata, osize)) return tb_false; diff --git a/core/src/xmake/io/file_flush.c b/core/src/xmake/io/file_flush.c index 73652ce20..ffeb890f9 100644 --- a/core/src/xmake/io/file_flush.c +++ b/core/src/xmake/io/file_flush.c @@ -44,7 +44,7 @@ static tb_bool_t xm_io_file_flush_impl(xm_io_file_t *file) { #ifdef TB_CONFIG_OS_WINDOWS // write cached data first tb_byte_t const *odata = tb_buffer_data(&file->wcache); - tb_size_t osize = tb_buffer_size(&file->wcache); + tb_size_t osize = tb_buffer_size(&file->wcache); if (odata && osize) { if (!tb_stream_bwrit(file->u.file_ref, odata, osize)) return tb_false; diff --git a/core/src/xmake/io/file_open.c b/core/src/xmake/io/file_open.c index 901a3f86d..f11b9feb3 100644 --- a/core/src/xmake/io/file_open.c +++ b/core/src/xmake/io/file_open.c @@ -46,8 +46,8 @@ static tb_size_t xm_io_file_detect_charset(tb_byte_t const **data_ptr, tb_long_t size) { tb_assert(data_ptr && *data_ptr); - tb_byte_t const *data = *data_ptr; - tb_size_t charset = XM_IO_FILE_ENCODING_BINARY; + tb_byte_t const *data = *data_ptr; + tb_size_t charset = XM_IO_FILE_ENCODING_BINARY; do { // is luajit bitcode? open as binary if (size >= 3 && data[0] == 27 && data[1] == 'L' && data[2] == 'J') { @@ -77,9 +77,9 @@ static tb_size_t xm_io_file_detect_charset(tb_byte_t const **data_ptr, tb_long_t tb_sint16_t utf16be_conf = 0; tb_sint16_t utf16le_conf = 0; - tb_sint16_t utf8_conf = 0; - tb_sint16_t ascii_conf = 0; - tb_sint16_t zero_count = 0; + tb_sint16_t utf8_conf = 0; + tb_sint16_t ascii_conf = 0; + tb_sint16_t zero_count = 0; for (tb_long_t i = 0; i < (size - 4) && i < CHECK_SIZE; i++) { if (data[i] == 0) { zero_count++; @@ -150,13 +150,13 @@ static tb_size_t xm_io_file_detect_encoding(tb_stream_ref_t stream, tb_long_t *p tb_assert_and_check_return_val(stream && pbomoff, XM_IO_FILE_ENCODING_BINARY); // detect encoding - tb_byte_t *data = tb_null; - tb_size_t encoding = XM_IO_FILE_ENCODING_BINARY; - tb_long_t size = tb_stream_peek(stream, &data, CHECK_SIZE); + tb_byte_t *data = tb_null; + tb_size_t encoding = XM_IO_FILE_ENCODING_BINARY; + tb_long_t size = tb_stream_peek(stream, &data, CHECK_SIZE); if (size > 0) { tb_byte_t const *p = data; - encoding = xm_io_file_detect_charset(&p, size); - *pbomoff = p - data; + encoding = xm_io_file_detect_charset(&p, size); + *pbomoff = p - data; } return encoding; } @@ -170,7 +170,7 @@ tb_int_t xm_io_file_open(lua_State *lua) { tb_assert_and_check_return_val(lua, 0); // get file path and mode - tb_char_t const *path = luaL_checkstring(lua, 1); + tb_char_t const *path = luaL_checkstring(lua, 1); tb_char_t const *modestr = luaL_optstring(lua, 2, "r"); tb_assert_and_check_return_val(path && modestr, 0); @@ -190,10 +190,10 @@ tb_int_t xm_io_file_open(lua_State *lua) { } // get file encoding - tb_long_t bomoff = 0; - tb_stream_ref_t stream = tb_null; - tb_bool_t update = !!tb_strchr(modestr, '+'); - tb_size_t encoding = XM_IO_FILE_ENCODING_UNKNOWN; + tb_long_t bomoff = 0; + tb_stream_ref_t stream = tb_null; + tb_bool_t update = !!tb_strchr(modestr, '+'); + tb_size_t encoding = XM_IO_FILE_ENCODING_UNKNOWN; if (modestr[1] == 'b' || (update && modestr[2] == 'b')) { encoding = XM_IO_FILE_ENCODING_BINARY; } else if (tb_strstr(modestr, "utf8") || tb_strstr(modestr, "utf-8")) { @@ -236,9 +236,9 @@ tb_int_t xm_io_file_open(lua_State *lua) { } // open file - tb_bool_t open_ok = tb_false; + tb_bool_t open_ok = tb_false; tb_stream_ref_t file_ref = tb_null; - tb_stream_ref_t fstream = tb_null; + tb_stream_ref_t fstream = tb_null; do { // init stream from file stream = stream ? stream : tb_stream_init_from_file(path, mode); @@ -298,12 +298,12 @@ tb_int_t xm_io_file_open(lua_State *lua) { // init file file->u.file_ref = file_ref; - file->stream = stream; - file->fstream = fstream; - file->mode = mode; - file->type = XM_IO_FILE_TYPE_FILE; - file->encoding = encoding; - file->utfbom = utfbom; + file->stream = stream; + file->fstream = fstream; + file->mode = mode; + file->type = XM_IO_FILE_TYPE_FILE; + file->encoding = encoding; + file->utfbom = utfbom; // init the read/write line cache buffer tb_buffer_init(&file->rcache); diff --git a/core/src/xmake/io/file_read.c b/core/src/xmake/io/file_read.c index 0b255f4c1..6b7e560ce 100644 --- a/core/src/xmake/io/file_read.c +++ b/core/src/xmake/io/file_read.c @@ -47,10 +47,10 @@ static tb_long_t xm_io_file_buffer_readline(tb_stream_ref_t stream, tb_buffer_re tb_assert_and_check_return_val(stream && line, -1); // read line and reserve crlf - tb_bool_t eof = tb_false; - tb_hize_t offset = 0; - tb_byte_t *data = tb_null; - tb_hong_t size = tb_stream_size(stream); + tb_bool_t eof = tb_false; + tb_hize_t offset = 0; + tb_byte_t *data = tb_null; + tb_hong_t size = tb_stream_size(stream); while (size < 0 || (offset = tb_stream_offset(stream)) < size) { tb_long_t real = tb_stream_peek(stream, &data, XM_IO_BLOCK_MAXN); if (real > 0) { @@ -85,17 +85,17 @@ static tb_long_t xm_io_file_buffer_readline(tb_stream_ref_t stream, tb_buffer_re return (eof || tb_stream_beof(stream)) ? -1 : 0; } } -static tb_int_t xm_io_file_buffer_pushline(tb_buffer_ref_t buf, - xm_io_file_t *file, +static tb_int_t xm_io_file_buffer_pushline(tb_buffer_ref_t buf, + xm_io_file_t *file, tb_char_t const *continuation, - tb_bool_t keep_crlf) { + tb_bool_t keep_crlf) { tb_assert(buf && file && continuation && xm_io_file_is_file(file) && file->u.file_ref); // is binary? tb_bool_t is_binary = file->encoding == XM_IO_FILE_ENCODING_BINARY; if (is_binary) { continuation = ""; - keep_crlf = tb_true; + keep_crlf = tb_true; } // clear line buffer @@ -105,9 +105,9 @@ static tb_int_t xm_io_file_buffer_pushline(tb_buffer_ref_t buf, tb_long_t size = xm_io_file_buffer_readline(file->u.file_ref, &file->rcache); // translate line data - tb_int_t result = PL_FAIL; - tb_char_t *data = tb_null; - tb_size_t conlen = tb_strlen(continuation); + tb_int_t result = PL_FAIL; + tb_char_t *data = tb_null; + tb_size_t conlen = tb_strlen(continuation); do { // eof? if (size < 0) { @@ -244,10 +244,10 @@ static tb_int_t xm_io_file_read_all(lua_State *lua, xm_io_file_t *file, tb_char_ } } -static tb_int_t xm_io_file_read_line(lua_State *lua, - xm_io_file_t *file, +static tb_int_t xm_io_file_read_line(lua_State *lua, + xm_io_file_t *file, tb_char_t const *continuation, - tb_bool_t keep_crlf) { + tb_bool_t keep_crlf) { tb_assert(lua && file && continuation && xm_io_file_is_file(file) && file->u.file_ref); // init buffer @@ -319,10 +319,10 @@ static tb_int_t xm_io_file_read_n(lua_State *lua, xm_io_file_t *file, tb_char_t return 1; } -static tb_size_t xm_io_file_std_buffer_pushline(tb_buffer_ref_t buf, - xm_io_file_t *file, +static tb_size_t xm_io_file_std_buffer_pushline(tb_buffer_ref_t buf, + xm_io_file_t *file, tb_char_t const *continuation, - tb_bool_t keep_crlf) { + tb_bool_t keep_crlf) { tb_assert(buf && file && continuation && xm_io_file_is_std(file)); // get input buffer @@ -376,10 +376,10 @@ static tb_size_t xm_io_file_std_buffer_pushline(tb_buffer_ref_t buf, return result; } -static tb_int_t xm_io_file_std_read_line(lua_State *lua, - xm_io_file_t *file, +static tb_int_t xm_io_file_std_read_line(lua_State *lua, + xm_io_file_t *file, tb_char_t const *continuation, - tb_bool_t keep_crlf) { + tb_bool_t keep_crlf) { tb_assert(lua && file && continuation && xm_io_file_is_std(file)); // init buffer diff --git a/core/src/xmake/io/file_seek.c b/core/src/xmake/io/file_seek.c index c7c043e7a..4c2d17b71 100644 --- a/core/src/xmake/io/file_seek.c +++ b/core/src/xmake/io/file_seek.c @@ -49,7 +49,7 @@ tb_int_t xm_io_file_seek(lua_State *lua) { // get whence and offset tb_char_t const *whence = luaL_optstring(lua, 2, "cur"); - tb_hong_t offset = (tb_hong_t)luaL_optnumber(lua, 3, 0); + tb_hong_t offset = (tb_hong_t)luaL_optnumber(lua, 3, 0); tb_assert_and_check_return_val(whence, 0); // seek file diff --git a/core/src/xmake/io/file_write.c b/core/src/xmake/io/file_write.c index 08655379a..fdfd5afe7 100644 --- a/core/src/xmake/io/file_write.c +++ b/core/src/xmake/io/file_write.c @@ -65,7 +65,7 @@ static tb_void_t xm_io_file_write_file_transcrlf(xm_io_file_t *file, tb_byte_t c // write cached data first tb_byte_t const *odata = tb_buffer_data(&file->wcache); - tb_size_t osize = tb_buffer_size(&file->wcache); + tb_size_t osize = tb_buffer_size(&file->wcache); if (odata && osize) { if (!tb_stream_bwrit(file->u.file_ref, odata, osize)) return; @@ -73,8 +73,8 @@ static tb_void_t xm_io_file_write_file_transcrlf(xm_io_file_t *file, tb_byte_t c } // write data by lines - tb_char_t const *p = (tb_char_t const *)data; - tb_char_t const *e = p + size; + tb_char_t const *p = (tb_char_t const *)data; + tb_char_t const *e = p + size; tb_char_t const *lf = tb_null; while (p < e) { lf = tb_strnchr(p, e - p, '\n'); @@ -135,8 +135,8 @@ tb_int_t xm_io_file_write(lua_State *lua) { tb_bool_t is_binary = file->encoding == XM_IO_FILE_ENCODING_BINARY; for (tb_int_t i = 2; i <= narg; i++) { // get data - size_t datasize = 0; - tb_byte_t const *data = tb_null; + size_t datasize = 0; + tb_byte_t const *data = tb_null; if (lua_isstring(lua, i)) { data = (tb_byte_t const *)luaL_checklstring(lua, i, &datasize); } else if (lua_istable(lua, i)) { diff --git a/core/src/xmake/io/filelock_open.c b/core/src/xmake/io/filelock_open.c index 2afb173d3..85df2bba7 100644 --- a/core/src/xmake/io/filelock_open.c +++ b/core/src/xmake/io/filelock_open.c @@ -45,7 +45,7 @@ tb_int_t xm_io_filelock_open(lua_State *lua) { tb_assert_and_check_return_val(path, 0); // init file lock - tb_long_t tryn = 2; + tb_long_t tryn = 2; tb_filelock_ref_t lock = tb_null; while (!lock && tryn-- > 0) { lock = tb_filelock_init_from_path(path, diff --git a/core/src/xmake/io/iscygpty.c b/core/src/xmake/io/iscygpty.c index 656e86fe7..e46d8c41f 100644 --- a/core/src/xmake/io/iscygpty.c +++ b/core/src/xmake/io/iscygpty.c @@ -60,17 +60,17 @@ #define USE_DYNFILEID // we need to enable it for supporting xp #endif #ifdef USE_DYNFILEID -typedef BOOL(WINAPI *pfnGetFileInformationByHandleEx)(HANDLE hFile, +typedef BOOL(WINAPI *pfnGetFileInformationByHandleEx)(HANDLE hFile, FILE_INFO_BY_HANDLE_CLASS FileInformationClass, - LPVOID lpFileInformation, - DWORD dwBufferSize); + LPVOID lpFileInformation, + DWORD dwBufferSize); static pfnGetFileInformationByHandleEx pGetFileInformationByHandleEx = NULL; #ifndef USE_FILEEXTD -static BOOL WINAPI stub_GetFileInformationByHandleEx(HANDLE hFile, +static BOOL WINAPI stub_GetFileInformationByHandleEx(HANDLE hFile, FILE_INFO_BY_HANDLE_CLASS FileInformationClass, - LPVOID lpFileInformation, - DWORD dwBufferSize) { + LPVOID lpFileInformation, + DWORD dwBufferSize) { return FALSE; } #endif @@ -101,9 +101,9 @@ int is_cygpty(HANDLE h) { #if defined(STUB_IMPL) return 0; #elif _WIN32_WINNT >= 0x0600 - int size = sizeof(FILE_NAME_INFO) + sizeof(WCHAR) * (MAX_PATH - 1); + int size = sizeof(FILE_NAME_INFO) + sizeof(WCHAR) * (MAX_PATH - 1); FILE_NAME_INFO *nameinfo; - WCHAR *p = NULL; + WCHAR *p = NULL; setup_fileid_api(); @@ -122,7 +122,7 @@ int is_cygpty(HANDLE h) { * '\{cygwin,msys}-XXXXXXXXXXXXXXXX-ptyN-{from,to}-master' */ if (pGetFileInformationByHandleEx(h, FileNameInfo, nameinfo, size)) { nameinfo->FileName[nameinfo->FileNameLength / sizeof(WCHAR)] = L'\0'; - p = nameinfo->FileName; + p = nameinfo->FileName; if (is_wprefix(p, L"\\cygwin-")) { /* Cygwin */ p += 8; } else if (is_wprefix(p, L"\\msys-")) { /* MSYS and MSYS2 */ diff --git a/core/src/xmake/io/pipe_write.c b/core/src/xmake/io/pipe_write.c index d3098dd60..9ca1417a1 100644 --- a/core/src/xmake/io/pipe_write.c +++ b/core/src/xmake/io/pipe_write.c @@ -50,7 +50,7 @@ tb_int_t xm_io_pipe_write(lua_State *lua) { tb_check_return_val(pipefile, 0); // get data and size - tb_size_t size = 0; + tb_size_t size = 0; tb_byte_t const *data = tb_null; if (xm_lua_isinteger(lua, 2)) { data = (tb_byte_t const *)(tb_size_t)(tb_long_t)lua_tointeger(lua, 2); diff --git a/core/src/xmake/io/poller.h b/core/src/xmake/io/poller.h index 3c5937a68..4e7313691 100644 --- a/core/src/xmake/io/poller.h +++ b/core/src/xmake/io/poller.h @@ -33,7 +33,7 @@ // the poller state in wait events typedef struct __xm_poller_state_t { lua_State *lua; - tb_int_t events_count; + tb_int_t events_count; } xm_poller_state_t; /* ////////////////////////////////////////////////////////////////////////////////////// diff --git a/core/src/xmake/io/poller_insert.c b/core/src/xmake/io/poller_insert.c index 81f66cce9..38fb4097a 100644 --- a/core/src/xmake/io/poller_insert.c +++ b/core/src/xmake/io/poller_insert.c @@ -51,7 +51,7 @@ tb_int_t xm_io_poller_insert(lua_State *lua) { // get cdata tb_char_t const *cdata_str = tb_null; - tb_pointer_t cdata = (tb_pointer_t)xm_lua_topointer2(lua, 2, &cdata_str); + tb_pointer_t cdata = (tb_pointer_t)xm_lua_topointer2(lua, 2, &cdata_str); tb_check_return_val(cdata, 0); // get events diff --git a/core/src/xmake/io/poller_modify.c b/core/src/xmake/io/poller_modify.c index f9283aecb..fc99a9352 100644 --- a/core/src/xmake/io/poller_modify.c +++ b/core/src/xmake/io/poller_modify.c @@ -51,7 +51,7 @@ tb_int_t xm_io_poller_modify(lua_State *lua) { // get cdata tb_char_t const *cdata_str = tb_null; - tb_pointer_t cdata = (tb_pointer_t)xm_lua_topointer2(lua, 2, &cdata_str); + tb_pointer_t cdata = (tb_pointer_t)xm_lua_topointer2(lua, 2, &cdata_str); tb_check_return_val(cdata, 0); // get events diff --git a/core/src/xmake/io/poller_wait.c b/core/src/xmake/io/poller_wait.c index dc1418a03..b704e3cf4 100644 --- a/core/src/xmake/io/poller_wait.c +++ b/core/src/xmake/io/poller_wait.c @@ -34,10 +34,10 @@ /* ////////////////////////////////////////////////////////////////////////////////////// * private implementation */ -static tb_void_t xm_io_poller_event(tb_poller_ref_t poller, +static tb_void_t xm_io_poller_event(tb_poller_ref_t poller, tb_poller_object_ref_t object, - tb_long_t events, - tb_cpointer_t priv) { + tb_long_t events, + tb_cpointer_t priv) { xm_poller_state_t *state = (xm_poller_state_t *)tb_poller_priv(poller); tb_assert_and_check_return(state && state->lua); @@ -85,7 +85,7 @@ tb_int_t xm_io_poller_wait(lua_State *lua) { // reset events count xm_poller_state_t *state = (xm_poller_state_t *)tb_poller_priv(poller); - state->events_count = 0; + state->events_count = 0; // wait it lua_newtable(lua); diff --git a/core/src/xmake/io/prefix.h b/core/src/xmake/io/prefix.h index 4d312583c..7c339cf36 100644 --- a/core/src/xmake/io/prefix.h +++ b/core/src/xmake/io/prefix.h @@ -82,12 +82,12 @@ typedef struct __xm_io_file_t { tb_stream_ref_t stream; // the file stream for XM_IO_FILE_TYPE_FILE tb_stream_ref_t fstream; // the file charset stream filter - tb_size_t mode; // tb_file_mode_t - tb_size_t type; // xm_io_file_type_e - tb_size_t encoding; // value of xm_io_file_encoding_e or tb_charset_type_e - tb_bool_t utfbom; // write utf-bom for utf encoding? - tb_buffer_t rcache; // the read line cache buffer - tb_buffer_t wcache; // the write line cache buffer + tb_size_t mode; // tb_file_mode_t + tb_size_t type; // xm_io_file_type_e + tb_size_t encoding; // value of xm_io_file_encoding_e or tb_charset_type_e + tb_bool_t utfbom; // write utf-bom for utf encoding? + tb_buffer_t rcache; // the read line cache buffer + tb_buffer_t wcache; // the write line cache buffer } xm_io_file_t; // check pipe file diff --git a/core/src/xmake/io/socket_peeraddr.c b/core/src/xmake/io/socket_peeraddr.c index 686d46799..f28f84bb1 100644 --- a/core/src/xmake/io/socket_peeraddr.c +++ b/core/src/xmake/io/socket_peeraddr.c @@ -56,8 +56,8 @@ tb_int_t xm_io_socket_peeraddr(lua_State *lua) { tb_check_return_val(sock, 0); // get peer address - tb_ipaddr_t addr; - tb_char_t data[256]; + tb_ipaddr_t addr; + tb_char_t data[256]; tb_char_t const *cstr = tb_null; if (tb_socket_peer(sock, &addr) && (cstr = tb_ipaddr_cstr(&addr, data, sizeof(data)))) { lua_pushstring(lua, cstr); diff --git a/core/src/xmake/io/socket_recvfrom.c b/core/src/xmake/io/socket_recvfrom.c index 5e212bed8..ff4315f1e 100644 --- a/core/src/xmake/io/socket_recvfrom.c +++ b/core/src/xmake/io/socket_recvfrom.c @@ -75,14 +75,14 @@ tb_int_t xm_io_socket_recvfrom(lua_State *lua) { // recv data tb_ipaddr_t ipaddr; tb_ipaddr_clear(&ipaddr); - tb_int_t retn = 1; + tb_int_t retn = 1; tb_long_t real = tb_socket_urecv(sock, &ipaddr, data, size); lua_pushinteger(lua, (tb_int_t)real); if (real > 0) { retn = 2; lua_pushnil(lua); if (!tb_ipaddr_is_empty(&ipaddr)) { - tb_char_t buffer[256]; + tb_char_t buffer[256]; tb_char_t const *ipstr = tb_ipaddr_ip_cstr(&ipaddr, buffer, sizeof(buffer)); if (ipstr) { lua_pushstring(lua, ipstr); diff --git a/core/src/xmake/io/socket_send.c b/core/src/xmake/io/socket_send.c index 3a11d0d43..4de7023ab 100644 --- a/core/src/xmake/io/socket_send.c +++ b/core/src/xmake/io/socket_send.c @@ -50,7 +50,7 @@ tb_int_t xm_io_socket_send(lua_State *lua) { tb_check_return_val(sock, 0); // get data and size - tb_size_t size = 0; + tb_size_t size = 0; tb_byte_t const *data = tb_null; if (xm_lua_isinteger(lua, 2)) { data = (tb_byte_t const *)(tb_size_t)(tb_long_t)lua_tointeger(lua, 2); diff --git a/core/src/xmake/io/socket_sendto.c b/core/src/xmake/io/socket_sendto.c index ccbbb1cc2..17f7e4ca2 100644 --- a/core/src/xmake/io/socket_sendto.c +++ b/core/src/xmake/io/socket_sendto.c @@ -50,7 +50,7 @@ tb_int_t xm_io_socket_sendto(lua_State *lua) { tb_check_return_val(sock, 0); // get data and size - tb_size_t size = 0; + tb_size_t size = 0; tb_byte_t const *data = tb_null; if (xm_lua_isinteger(lua, 2)) { data = (tb_byte_t const *)(tb_size_t)(tb_long_t)lua_tointeger(lua, 2); @@ -67,7 +67,7 @@ tb_int_t xm_io_socket_sendto(lua_State *lua) { // get address tb_char_t const *addr = lua_tostring(lua, 4); - tb_uint16_t port = (tb_uint16_t)luaL_checknumber(lua, 5); + tb_uint16_t port = (tb_uint16_t)luaL_checknumber(lua, 5); if (!addr || !port) { lua_pushinteger(lua, -1); lua_pushliteral(lua, "invalid address!"); diff --git a/core/src/xmake/io/stdfile.c b/core/src/xmake/io/stdfile.c index ac77b272d..db420d41b 100644 --- a/core/src/xmake/io/stdfile.c +++ b/core/src/xmake/io/stdfile.c @@ -54,7 +54,7 @@ static tb_size_t xm_io_stdfile_isatty(tb_size_t type) { tb_bool_t answer = tb_false; #if defined(TB_CONFIG_OS_WINDOWS) - DWORD mode; + DWORD mode; HANDLE console_handle = tb_null; switch (type) { case XM_IO_FILE_TYPE_STDIN: @@ -98,7 +98,7 @@ static tb_size_t xm_io_stdfile_isatty(tb_size_t type) { static tb_void_t xm_io_stdfile_init_buffer(tb_size_t type) { #if !defined(TB_CONFIG_OS_WINDOWS) struct stat stats; - tb_int_t size = BUFSIZ; + tb_int_t size = BUFSIZ; if (fstat(fileno(stdout), &stats) != -1) { size = stats.st_blksize; } |
