From 92abe28899a37a85a734d52787226afe900fcf1a Mon Sep 17 00:00:00 2001 From: Tom van Dijck Date: Sat, 21 Apr 2018 12:17:51 +0200 Subject: [PATCH] Fixes a few luasocket compile warnings. --- binmodules/luasocket/premake5.lua | 1 + binmodules/luasocket/src/luasocket.c | 2 +- binmodules/luasocket/src/mime.c | 2 +- binmodules/luasocket/src/wsocket.c | 4 ++-- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/binmodules/luasocket/premake5.lua b/binmodules/luasocket/premake5.lua index ff08f256..b60be72f 100644 --- a/binmodules/luasocket/premake5.lua +++ b/binmodules/luasocket/premake5.lua @@ -30,6 +30,7 @@ project "luasocket" } links { 'ws2_32' } + characterset "MBCS" defines { "LUASOCKET_API=__declspec(dllexport)" } diff --git a/binmodules/luasocket/src/luasocket.c b/binmodules/luasocket/src/luasocket.c index 7d9c8023..031cc67f 100644 --- a/binmodules/luasocket/src/luasocket.c +++ b/binmodules/luasocket/src/luasocket.c @@ -64,7 +64,7 @@ static luaL_Reg func[] = { * Skip a few arguments \*-------------------------------------------------------------------------*/ static int global_skip(lua_State *L) { - int amount = luaL_checkinteger(L, 1); + int amount = (int)luaL_checkinteger(L, 1); int ret = lua_gettop(L) - amount - 1; return ret >= 0 ? ret : 0; } diff --git a/binmodules/luasocket/src/mime.c b/binmodules/luasocket/src/mime.c index ed441046..84c3e75c 100644 --- a/binmodules/luasocket/src/mime.c +++ b/binmodules/luasocket/src/mime.c @@ -654,7 +654,7 @@ static int eolprocess(int c, int last, const char *marker, \*-------------------------------------------------------------------------*/ static int mime_global_eol(lua_State *L) { - int ctx = luaL_checkinteger(L, 1); + int ctx = (int)luaL_checkinteger(L, 1); size_t isize = 0; const char *input = luaL_optlstring(L, 2, NULL, &isize); const char *last = input + isize; diff --git a/binmodules/luasocket/src/wsocket.c b/binmodules/luasocket/src/wsocket.c index 8ecb0fc7..16901863 100644 --- a/binmodules/luasocket/src/wsocket.c +++ b/binmodules/luasocket/src/wsocket.c @@ -131,11 +131,11 @@ int socket_connect(p_socket ps, SA *addr, socklen_t len, p_timeout tm) { /* we wait until something happens */ err = socket_waitfd(ps, WAITFD_C, tm); if (err == IO_CLOSED) { - int len = sizeof(err); + int err_len = sizeof(err); /* give windows time to set the error (yes, disgusting) */ Sleep(10); /* find out why we failed */ - getsockopt(*ps, SOL_SOCKET, SO_ERROR, (char *)&err, &len); + getsockopt(*ps, SOL_SOCKET, SO_ERROR, (char *)&err, &err_len); /* we KNOW there was an error. if 'why' is 0, we will return * "unknown error", but it's not really our fault */ return err > 0? err: IO_UNKNOWN;