Resolve compilation warnings: pointer-to-int-cast and int-to-pointer-cast

Signed-off-by: Jianhui Zhao <jianhuizhao329@gmail.com>
main
Jianhui Zhao 2018-03-12 10:52:45 +08:00
parent ace982c8c8
commit d2439b6f5c
2 changed files with 5 additions and 3 deletions

View File

@ -1,5 +1,5 @@
add_definitions(-O -Wall -Werror --std=gnu99 -D_GNU_SOURCE -Wno-misleading-indentation -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast)
add_definitions(-O -Wall -Werror --std=gnu99 -D_GNU_SOURCE -Wno-misleading-indentation)
# The version number.
set(UHTTPD_VERSION_MAJOR 2)

View File

@ -549,10 +549,12 @@ static int uh_lua_send(lua_State *L)
buf = luaL_checklstring(L, 1, &len);
if (len > 0) {
LUA_INTEGER p;
struct uh_client *cl;
lua_getglobal(L, "__cl");
cl = (struct uh_client *)lua_tointeger(L, -1);
p = lua_tointeger(L, -1);
cl = (struct uh_client *)(*(void **)&p);
cl->chunk_send(cl, buf, len);
}
@ -594,7 +596,7 @@ void uh_template(struct uh_client *cl)
lua_setglobal(L, "uh_send");
}
lua_pushinteger(L, (uint32_t)cl);
lua_pushinteger(L, (lua_Integer)(lua_Integer *)cl);
lua_setglobal(L, "__cl");
lua_newtable(L);