Merge pull request #1065 from tvandijck/fix-luasocket

Fixes a few luasocket compile warnings.
This commit is contained in:
Tom van Dijck 2018-04-22 15:58:18 +02:00 committed by GitHub
commit 8d0dce9c65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 4 deletions

View File

@ -30,6 +30,7 @@ project "luasocket"
}
links { 'ws2_32' }
characterset "MBCS"
defines { "LUASOCKET_API=__declspec(dllexport)" }

View File

@ -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;
}

View File

@ -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;

View File

@ -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;