From 197aef23ce36844e86e732f26af1df9fc5f149da Mon Sep 17 00:00:00 2001 From: Diego Nehab Date: Thu, 1 Jul 2004 05:35:35 +0000 Subject: [PATCH] Compiles with g++. --- TODO | 6 ++++-- etc/lp.lua | 10 ++++++++-- src/except.c | 9 +++++---- src/tcp.c | 4 ++-- src/unix.c | 4 ++-- 5 files changed, 21 insertions(+), 12 deletions(-) diff --git a/TODO b/TODO index c74e525..9d736d0 100644 --- a/TODO +++ b/TODO @@ -16,7 +16,6 @@ optmize aux_getgroupudata use one upvalue per string name of class/group make aux_checkgroup by upvalue (faster) -fix local domain socket kludge of name size make sure all modules that can use it actually use socket.newtry adicionar exemplos de expansão: pipe, local, named pipe @@ -27,4 +26,7 @@ testar os options! - proteger get*by*.* com um mutex GLOBAL! - proteger ou atomizar o conjunto (timedout, receive), (timedout, send) - inet_ntoa também é uma merda. -- SSL + + +*fix local domain socket kludge of name size +*use TLS diff --git a/etc/lp.lua b/etc/lp.lua index 5230957..e112ab4 100644 --- a/etc/lp.lua +++ b/etc/lp.lua @@ -1,6 +1,12 @@ - +----------------------------------------------------------------------------- +-- LPD support for the Lua language +-- LuaSocket toolkit. +-- Author: David Burgess +-- Modified by Diego Nehab, but David is in charge +-- RCS ID: $Id$ +----------------------------------------------------------------------------- --[[ - if you have any questions RFC 1179 + if you have any questions: RFC 1179 ]] -- make sure LuaSocket is loaded local socket = require("socket") diff --git a/src/except.c b/src/except.c index ad03817..80d7e5d 100644 --- a/src/except.c +++ b/src/except.c @@ -4,8 +4,9 @@ * * RCS ID: $Id$ \*=========================================================================*/ -#include #include +#include +#include #include "except.h" @@ -14,7 +15,7 @@ \*=========================================================================*/ static int global_protect(lua_State *L); static int global_newtry(lua_State *L); -static int protected(lua_State *L); +static int protected_(lua_State *L); static int finalize(lua_State *L); static int do_nothing(lua_State *L); @@ -53,7 +54,7 @@ static int global_newtry(lua_State *L) { /*-------------------------------------------------------------------------*\ * Protect factory \*-------------------------------------------------------------------------*/ -static int protected(lua_State *L) { +static int protected_(lua_State *L) { lua_pushvalue(L, lua_upvalueindex(1)); lua_insert(L, 1); if (lua_pcall(L, lua_gettop(L) - 1, LUA_MULTRET, 0) != 0) { @@ -64,7 +65,7 @@ static int protected(lua_State *L) { } static int global_protect(lua_State *L) { - lua_pushcclosure(L, protected, 1); + lua_pushcclosure(L, protected_, 1); return 1; } diff --git a/src/tcp.c b/src/tcp.c index 8ab7d62..037a23a 100644 --- a/src/tcp.c +++ b/src/tcp.c @@ -117,7 +117,7 @@ static int meth_receive(lua_State *L) \*-------------------------------------------------------------------------*/ static int meth_setoption(lua_State *L) { - p_tcp tcp = aux_checkgroup(L, "tcp{any}", 1); + p_tcp tcp = (p_tcp) aux_checkgroup(L, "tcp{any}", 1); return opt_meth_setoption(L, opt, &tcp->sock); } @@ -158,7 +158,7 @@ static int meth_accept(lua_State *L) const char *err = sock_accept(&server->sock, &sock, NULL, NULL, tm); /* if successful, push client socket */ if (!err) { - p_tcp clnt = lua_newuserdata(L, sizeof(t_tcp)); + p_tcp clnt = (p_tcp) lua_newuserdata(L, sizeof(t_tcp)); aux_setclass(L, "tcp{client}", -1); /* initialize structure fields */ sock_setnonblocking(&sock); diff --git a/src/unix.c b/src/unix.c index 34d2da1..407f85d 100644 --- a/src/unix.c +++ b/src/unix.c @@ -111,7 +111,7 @@ static int meth_receive(lua_State *L) { * Just call option handler \*-------------------------------------------------------------------------*/ static int meth_setoption(lua_State *L) { - p_unix unix = aux_checkgroup(L, "unix{any}", 1); + p_unix unix = (p_unix) aux_checkgroup(L, "unix{any}", 1); return opt_meth_setoption(L, opt, &unix->sock); } @@ -148,7 +148,7 @@ static int meth_accept(lua_State *L) { const char *err = sock_accept(&server->sock, &sock, NULL, NULL, tm); /* if successful, push client socket */ if (!err) { - p_unix clnt = lua_newuserdata(L, sizeof(t_unix)); + p_unix clnt = (p_unix) lua_newuserdata(L, sizeof(t_unix)); aux_setclass(L, "unix{client}", -1); /* initialize structure fields */ sock_setnonblocking(&sock);