mirror of
https://github.com/lunarmodules/luasocket.git
synced 2024-12-26 04:28:20 +01:00
style: Use C-style comment syntax throughout (#309)
Co-authored-by: Denise Cullassnekuff <19711487+BlackCutpoint@users.noreply.github.com>
This commit is contained in:
parent
d9cc531e3b
commit
6952262e6a
@ -27,12 +27,12 @@ static int mime_global_eol(lua_State *L);
|
||||
static int mime_global_dot(lua_State *L);
|
||||
|
||||
static size_t dot(int c, size_t state, luaL_Buffer *buffer);
|
||||
//static void b64setup(UC *base);
|
||||
/*static void b64setup(UC *base);*/
|
||||
static size_t b64encode(UC c, UC *input, size_t size, luaL_Buffer *buffer);
|
||||
static size_t b64pad(const UC *input, size_t size, luaL_Buffer *buffer);
|
||||
static size_t b64decode(UC c, UC *input, size_t size, luaL_Buffer *buffer);
|
||||
|
||||
//static void qpsetup(UC *class, UC *unbase);
|
||||
/*static void qpsetup(UC *class, UC *unbase);*/
|
||||
static void qpquote(UC c, luaL_Buffer *buffer);
|
||||
static size_t qpdecode(UC c, UC *input, size_t size, luaL_Buffer *buffer);
|
||||
static size_t qpencode(UC c, UC *input, size_t size,
|
||||
@ -176,8 +176,8 @@ LUASOCKET_API int luaopen_mime_core(lua_State *L)
|
||||
lua_pushstring(L, MIME_VERSION);
|
||||
lua_rawset(L, -3);
|
||||
/* initialize lookup tables */
|
||||
// qpsetup(qpclass, qpunbase);
|
||||
// b64setup(b64unbase);
|
||||
/*qpsetup(qpclass, qpunbase);*/
|
||||
/*b64setup(b64unbase);*/
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ int opt_meth_getoption(lua_State *L, p_opt opt, p_socket ps)
|
||||
return opt->func(L, ps);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------
|
||||
/*------------------------------------------------------*/
|
||||
/* enables reuse of local address */
|
||||
int opt_set_reuseaddr(lua_State *L, p_socket ps)
|
||||
{
|
||||
@ -66,7 +66,7 @@ int opt_get_reuseaddr(lua_State *L, p_socket ps)
|
||||
return opt_getboolean(L, ps, SOL_SOCKET, SO_REUSEADDR);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------
|
||||
/*------------------------------------------------------*/
|
||||
/* enables reuse of local port */
|
||||
int opt_set_reuseport(lua_State *L, p_socket ps)
|
||||
{
|
||||
@ -78,7 +78,7 @@ int opt_get_reuseport(lua_State *L, p_socket ps)
|
||||
return opt_getboolean(L, ps, SOL_SOCKET, SO_REUSEPORT);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------
|
||||
/*------------------------------------------------------*/
|
||||
/* disables the Nagle algorithm */
|
||||
int opt_set_tcp_nodelay(lua_State *L, p_socket ps)
|
||||
{
|
||||
@ -90,7 +90,7 @@ int opt_get_tcp_nodelay(lua_State *L, p_socket ps)
|
||||
return opt_getboolean(L, ps, IPPROTO_TCP, TCP_NODELAY);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------
|
||||
/*------------------------------------------------------*/
|
||||
#ifdef TCP_KEEPIDLE
|
||||
|
||||
int opt_get_tcp_keepidle(lua_State *L, p_socket ps)
|
||||
@ -105,7 +105,7 @@ int opt_set_tcp_keepidle(lua_State *L, p_socket ps)
|
||||
|
||||
#endif
|
||||
|
||||
// -------------------------------------------------------
|
||||
/*------------------------------------------------------*/
|
||||
#ifdef TCP_KEEPCNT
|
||||
|
||||
int opt_get_tcp_keepcnt(lua_State *L, p_socket ps)
|
||||
@ -120,7 +120,7 @@ int opt_set_tcp_keepcnt(lua_State *L, p_socket ps)
|
||||
|
||||
#endif
|
||||
|
||||
// -------------------------------------------------------
|
||||
/*------------------------------------------------------*/
|
||||
#ifdef TCP_KEEPINTVL
|
||||
|
||||
int opt_get_tcp_keepintvl(lua_State *L, p_socket ps)
|
||||
@ -135,7 +135,7 @@ int opt_set_tcp_keepintvl(lua_State *L, p_socket ps)
|
||||
|
||||
#endif
|
||||
|
||||
// -------------------------------------------------------
|
||||
/*------------------------------------------------------*/
|
||||
int opt_set_keepalive(lua_State *L, p_socket ps)
|
||||
{
|
||||
return opt_setboolean(L, ps, SOL_SOCKET, SO_KEEPALIVE);
|
||||
@ -146,7 +146,7 @@ int opt_get_keepalive(lua_State *L, p_socket ps)
|
||||
return opt_getboolean(L, ps, SOL_SOCKET, SO_KEEPALIVE);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------
|
||||
/*------------------------------------------------------*/
|
||||
int opt_set_dontroute(lua_State *L, p_socket ps)
|
||||
{
|
||||
return opt_setboolean(L, ps, SOL_SOCKET, SO_DONTROUTE);
|
||||
@ -157,7 +157,7 @@ int opt_get_dontroute(lua_State *L, p_socket ps)
|
||||
return opt_getboolean(L, ps, SOL_SOCKET, SO_DONTROUTE);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------
|
||||
/*------------------------------------------------------*/
|
||||
int opt_set_broadcast(lua_State *L, p_socket ps)
|
||||
{
|
||||
return opt_setboolean(L, ps, SOL_SOCKET, SO_BROADCAST);
|
||||
@ -168,7 +168,7 @@ int opt_get_broadcast(lua_State *L, p_socket ps)
|
||||
return opt_getboolean(L, ps, SOL_SOCKET, SO_BROADCAST);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------
|
||||
/*------------------------------------------------------*/
|
||||
int opt_set_recv_buf_size(lua_State *L, p_socket ps)
|
||||
{
|
||||
return opt_setint(L, ps, SOL_SOCKET, SO_RCVBUF);
|
||||
@ -179,7 +179,7 @@ int opt_get_recv_buf_size(lua_State *L, p_socket ps)
|
||||
return opt_getint(L, ps, SOL_SOCKET, SO_RCVBUF);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------
|
||||
/*------------------------------------------------------*/
|
||||
int opt_get_send_buf_size(lua_State *L, p_socket ps)
|
||||
{
|
||||
return opt_getint(L, ps, SOL_SOCKET, SO_SNDBUF);
|
||||
@ -190,7 +190,7 @@ int opt_set_send_buf_size(lua_State *L, p_socket ps)
|
||||
return opt_setint(L, ps, SOL_SOCKET, SO_SNDBUF);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------
|
||||
/*------------------------------------------------------*/
|
||||
int opt_set_ip6_unicast_hops(lua_State *L, p_socket ps)
|
||||
{
|
||||
return opt_setint(L, ps, IPPROTO_IPV6, IPV6_UNICAST_HOPS);
|
||||
@ -201,7 +201,7 @@ int opt_get_ip6_unicast_hops(lua_State *L, p_socket ps)
|
||||
return opt_getint(L, ps, IPPROTO_IPV6, IPV6_UNICAST_HOPS);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------
|
||||
/*------------------------------------------------------*/
|
||||
int opt_set_ip6_multicast_hops(lua_State *L, p_socket ps)
|
||||
{
|
||||
return opt_setint(L, ps, IPPROTO_IPV6, IPV6_MULTICAST_HOPS);
|
||||
@ -212,7 +212,7 @@ int opt_get_ip6_multicast_hops(lua_State *L, p_socket ps)
|
||||
return opt_getint(L, ps, IPPROTO_IPV6, IPV6_MULTICAST_HOPS);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------
|
||||
/*------------------------------------------------------*/
|
||||
int opt_set_ip_multicast_loop(lua_State *L, p_socket ps)
|
||||
{
|
||||
return opt_setboolean(L, ps, IPPROTO_IP, IP_MULTICAST_LOOP);
|
||||
@ -223,7 +223,7 @@ int opt_get_ip_multicast_loop(lua_State *L, p_socket ps)
|
||||
return opt_getboolean(L, ps, IPPROTO_IP, IP_MULTICAST_LOOP);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------
|
||||
/*------------------------------------------------------*/
|
||||
int opt_set_ip6_multicast_loop(lua_State *L, p_socket ps)
|
||||
{
|
||||
return opt_setboolean(L, ps, IPPROTO_IPV6, IPV6_MULTICAST_LOOP);
|
||||
@ -234,7 +234,7 @@ int opt_get_ip6_multicast_loop(lua_State *L, p_socket ps)
|
||||
return opt_getboolean(L, ps, IPPROTO_IPV6, IPV6_MULTICAST_LOOP);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------
|
||||
/*------------------------------------------------------*/
|
||||
int opt_set_linger(lua_State *L, p_socket ps)
|
||||
{
|
||||
struct linger li; /* obj, name, table */
|
||||
@ -267,13 +267,13 @@ int opt_get_linger(lua_State *L, p_socket ps)
|
||||
return 1;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------
|
||||
/*------------------------------------------------------*/
|
||||
int opt_set_ip_multicast_ttl(lua_State *L, p_socket ps)
|
||||
{
|
||||
return opt_setint(L, ps, IPPROTO_IP, IP_MULTICAST_TTL);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------
|
||||
/*------------------------------------------------------*/
|
||||
int opt_set_ip_multicast_if(lua_State *L, p_socket ps)
|
||||
{
|
||||
const char *address = luaL_checkstring(L, 3); /* obj, name, ip */
|
||||
@ -298,7 +298,7 @@ int opt_get_ip_multicast_if(lua_State *L, p_socket ps)
|
||||
return 1;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------
|
||||
/*------------------------------------------------------*/
|
||||
int opt_set_ip_add_membership(lua_State *L, p_socket ps)
|
||||
{
|
||||
return opt_setmembership(L, ps, IPPROTO_IP, IP_ADD_MEMBERSHIP);
|
||||
@ -309,7 +309,7 @@ int opt_set_ip_drop_membersip(lua_State *L, p_socket ps)
|
||||
return opt_setmembership(L, ps, IPPROTO_IP, IP_DROP_MEMBERSHIP);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------
|
||||
/*------------------------------------------------------*/
|
||||
int opt_set_ip6_add_membership(lua_State *L, p_socket ps)
|
||||
{
|
||||
return opt_ip6_setmembership(L, ps, IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP);
|
||||
@ -319,7 +319,8 @@ int opt_set_ip6_drop_membersip(lua_State *L, p_socket ps)
|
||||
{
|
||||
return opt_ip6_setmembership(L, ps, IPPROTO_IPV6, IPV6_DROP_MEMBERSHIP);
|
||||
}
|
||||
// -------------------------------------------------------
|
||||
|
||||
/*------------------------------------------------------*/
|
||||
int opt_get_ip6_v6only(lua_State *L, p_socket ps)
|
||||
{
|
||||
return opt_getboolean(L, ps, IPPROTO_IPV6, IPV6_V6ONLY);
|
||||
@ -330,7 +331,7 @@ int opt_set_ip6_v6only(lua_State *L, p_socket ps)
|
||||
return opt_setboolean(L, ps, IPPROTO_IPV6, IPV6_V6ONLY);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------
|
||||
/*------------------------------------------------------*/
|
||||
int opt_get_error(lua_State *L, p_socket ps)
|
||||
{
|
||||
int val = 0;
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#define UNIXDGRAM_DATAGRAMSIZE 8192
|
||||
|
||||
// provide a SUN_LEN macro if sys/un.h doesn't (e.g. Android)
|
||||
/* provide a SUN_LEN macro if sys/un.h doesn't (e.g. Android) */
|
||||
#ifndef SUN_LEN
|
||||
#define SUN_LEN(ptr) \
|
||||
((size_t) (((struct sockaddr_un *) 0)->sun_path) \
|
||||
|
@ -360,7 +360,7 @@ const char *socket_ioerror(p_socket ps, int err) {
|
||||
static const char *wstrerror(int err) {
|
||||
switch (err) {
|
||||
case WSAEINTR: return "Interrupted function call";
|
||||
case WSAEACCES: return PIE_ACCESS; // "Permission denied";
|
||||
case WSAEACCES: return PIE_ACCESS; /* "Permission denied"; */
|
||||
case WSAEFAULT: return "Bad address";
|
||||
case WSAEINVAL: return "Invalid argument";
|
||||
case WSAEMFILE: return "Too many open files";
|
||||
@ -373,23 +373,23 @@ static const char *wstrerror(int err) {
|
||||
case WSAEPROTOTYPE: return "Protocol wrong type for socket";
|
||||
case WSAENOPROTOOPT: return "Bad protocol option";
|
||||
case WSAEPROTONOSUPPORT: return "Protocol not supported";
|
||||
case WSAESOCKTNOSUPPORT: return PIE_SOCKTYPE; // "Socket type not supported";
|
||||
case WSAESOCKTNOSUPPORT: return PIE_SOCKTYPE; /* "Socket type not supported"; */
|
||||
case WSAEOPNOTSUPP: return "Operation not supported";
|
||||
case WSAEPFNOSUPPORT: return "Protocol family not supported";
|
||||
case WSAEAFNOSUPPORT: return PIE_FAMILY; // "Address family not supported by protocol family";
|
||||
case WSAEADDRINUSE: return PIE_ADDRINUSE; // "Address already in use";
|
||||
case WSAEAFNOSUPPORT: return PIE_FAMILY; /* "Address family not supported by protocol family"; */
|
||||
case WSAEADDRINUSE: return PIE_ADDRINUSE; /* "Address already in use"; */
|
||||
case WSAEADDRNOTAVAIL: return "Cannot assign requested address";
|
||||
case WSAENETDOWN: return "Network is down";
|
||||
case WSAENETUNREACH: return "Network is unreachable";
|
||||
case WSAENETRESET: return "Network dropped connection on reset";
|
||||
case WSAECONNABORTED: return "Software caused connection abort";
|
||||
case WSAECONNRESET: return PIE_CONNRESET; // "Connection reset by peer";
|
||||
case WSAECONNRESET: return PIE_CONNRESET; /* "Connection reset by peer"; */
|
||||
case WSAENOBUFS: return "No buffer space available";
|
||||
case WSAEISCONN: return PIE_ISCONN; // "Socket is already connected";
|
||||
case WSAEISCONN: return PIE_ISCONN; /* "Socket is already connected"; */
|
||||
case WSAENOTCONN: return "Socket is not connected";
|
||||
case WSAESHUTDOWN: return "Cannot send after socket shutdown";
|
||||
case WSAETIMEDOUT: return PIE_TIMEDOUT; // "Connection timed out";
|
||||
case WSAECONNREFUSED: return PIE_CONNREFUSED; // "Connection refused";
|
||||
case WSAETIMEDOUT: return PIE_TIMEDOUT; /* "Connection timed out"; */
|
||||
case WSAECONNREFUSED: return PIE_CONNREFUSED; /* "Connection refused"; */
|
||||
case WSAEHOSTDOWN: return "Host is down";
|
||||
case WSAEHOSTUNREACH: return "No route to host";
|
||||
case WSAEPROCLIM: return "Too many processes";
|
||||
@ -398,9 +398,9 @@ static const char *wstrerror(int err) {
|
||||
case WSANOTINITIALISED:
|
||||
return "Successful WSAStartup not yet performed";
|
||||
case WSAEDISCON: return "Graceful shutdown in progress";
|
||||
case WSAHOST_NOT_FOUND: return PIE_HOST_NOT_FOUND; // "Host not found";
|
||||
case WSAHOST_NOT_FOUND: return PIE_HOST_NOT_FOUND; /* "Host not found"; */
|
||||
case WSATRY_AGAIN: return "Nonauthoritative host not found";
|
||||
case WSANO_RECOVERY: return PIE_FAIL; // "Nonrecoverable name lookup error";
|
||||
case WSANO_RECOVERY: return PIE_FAIL; /* "Nonrecoverable name lookup error"; */
|
||||
case WSANO_DATA: return "Valid name, no data record of requested type";
|
||||
default: return "Unknown error";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user