diff options
author | Guido van Rossum <guido@python.org> | 2000-04-24 15:16:03 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2000-04-24 15:16:03 (GMT) |
commit | ff3ab42c04905f3a7050ab4be1eb421779576e8a (patch) | |
tree | 5f150f04d9f11d8fa325fe964259d28f34c36044 /Modules | |
parent | ddc3b63bf679d9a633e2d92b433dfc8696eb86a5 (diff) | |
download | cpython-ff3ab42c04905f3a7050ab4be1eb421779576e8a.zip cpython-ff3ab42c04905f3a7050ab4be1eb421779576e8a.tar.gz cpython-ff3ab42c04905f3a7050ab4be1eb421779576e8a.tar.bz2 |
Jack Jansen: The GUSI 2.0 I/O library used on the Mac uses the
socklen_t (unsigned int) for most size parameters. Apparently this is
part of the UNIX 98 standard.
[GvR: the changes to configure.in etc. that I just checked in make
sure that socklen_t is defined everywhere, so I deleted the little
part of Jack's mod to define socklen_t if not in GUSI2. I suppose I
will have to add it to the Windows config.h in a minute.]
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/socketmodule.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index f23a3be..2b7eb8d 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -172,7 +172,7 @@ int shutdown( int, int ); #ifdef __BEOS__ #include <net/netdb.h> #else -#ifndef macintosh +#ifndef USE_GUSI1 #include <arpa/inet.h> #endif #endif @@ -192,7 +192,7 @@ int shutdown( int, int ); #define O_NDELAY O_NONBLOCK /* For QNX only? */ #endif -#ifdef USE_GUSI +#ifdef USE_GUSI1 /* fdopen() isn't declared in stdio.h (sigh) */ #include <GUSI.h> #endif @@ -664,7 +664,8 @@ static PyObject * BUILD_FUNC_DEF_2(PySocketSock_accept,PySocketSockObject *,s, PyObject *,args) { char addrbuf[256]; - int addrlen, newfd; + int newfd; + socklen_t addrlen; PyObject *sock = NULL; PyObject *addr = NULL; PyObject *res = NULL; @@ -808,7 +809,7 @@ BUILD_FUNC_DEF_2(PySocketSock_getsockopt,PySocketSockObject *,s, PyObject *,args int optname; int res; PyObject *buf; - int buflen = 0; + socklen_t buflen = 0; #ifdef __BEOS__ /* We have incomplete socket support. */ @@ -822,7 +823,7 @@ BUILD_FUNC_DEF_2(PySocketSock_getsockopt,PySocketSockObject *,s, PyObject *,args if (buflen == 0) { int flag = 0; - int flagsize = sizeof flag; + socklen_t flagsize = sizeof flag; res = getsockopt(s->sock_fd, level, optname, (ANY *)&flag, &flagsize); if (res < 0) @@ -1010,7 +1011,9 @@ static PyObject * BUILD_FUNC_DEF_2(PySocketSock_getsockname,PySocketSockObject *,s, PyObject *,args) { char addrbuf[256]; - int addrlen, res; + int res; + socklen_t addrlen; + if (!PyArg_ParseTuple(args, ":getsockname")) return NULL; if (!getsockaddrlen(s, &addrlen)) @@ -1038,7 +1041,9 @@ static PyObject * BUILD_FUNC_DEF_2(PySocketSock_getpeername,PySocketSockObject *,s, PyObject *,args) { char addrbuf[256]; - int addrlen, res; + int res; + socklen_t addrlen; + if (!PyArg_ParseTuple(args, ":getpeername")) return NULL; if (!getsockaddrlen(s, &addrlen)) @@ -1177,7 +1182,8 @@ BUILD_FUNC_DEF_2(PySocketSock_recvfrom,PySocketSockObject *,s, PyObject *,args) PyObject *addr = NULL; PyObject *ret = NULL; - int addrlen, len, n, flags = 0; + int len, n, flags = 0; + socklen_t addrlen; if (!PyArg_ParseTuple(args, "i|i:recvfrom", &len, &flags)) return NULL; if (!getsockaddrlen(s, &addrlen)) @@ -1882,7 +1888,7 @@ BUILD_FUNC_DEF_2(PySocket_inet_aton, PyObject *, self, PyObject *, args) if (!PyArg_ParseTuple(args, "s:inet_aton", &ip_addr)) { return NULL; } -#ifdef macintosh +#ifdef USE_GUSI1 packed_addr = (long)inet_addr(ip_addr).s_addr; #else packed_addr = inet_addr(ip_addr); |