[xiph-cvs] cvs commit: net resolver.c sock.c sock.h
Jack Moffitt
jack at xiph.org
Fri Oct 19 22:57:29 PDT 2001
jack 01/10/19 22:57:29
Modified: . resolver.c sock.c sock.h
Log:
Win32 updates. Mostly header fixes and defines for windows. Apparently
interface is a reserved word, so we've renamed one variable. There's
also no sethostent on win32, and Oddsock seems to think we need
DeleteCriticalSection instead of DestroyCriticalSection. I was unable
to figure out from msdn.microsoft.com why this was, but I'll trust
Oddsock's judgement.
Revision Changes Path
1.2 +7 -4 net/resolver.c
Index: resolver.c
===================================================================
RCS file: /usr/local/cvsroot/net/resolver.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- resolver.c 2001/09/10 02:27:20 1.1
+++ resolver.c 2001/10/20 05:57:28 1.2
@@ -7,15 +7,18 @@
#include <stdio.h>
#include <sys/types.h>
-#include <sys/socket.h>
#include <stdlib.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
#include <netdb.h>
#include <string.h>
#ifndef _WIN32
+#include <sys/socket.h>
#include <pthread.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#else
+#include <winsock.h>
+#define sethostent(x)
#endif
#include "resolver.h"
@@ -156,7 +159,7 @@
#ifndef _WIN32
pthread_mutex_destroy(&_resolver_mutex);
#else
- DestroyCriticalSection(&_resolver_mutex);
+ DeleteCriticalSection(&_resolver_mutex);
#endif
_initialized = 0;
1.2 +7 -6 net/sock.c
Index: sock.c
===================================================================
RCS file: /usr/local/cvsroot/net/sock.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sock.c 2001/09/10 02:27:19 1.1
+++ sock.c 2001/10/20 05:57:28 1.2
@@ -23,24 +23,25 @@
#include <stdlib.h>
#include <stdarg.h>
#include <sys/types.h>
-#include <sys/poll.h>
#include <ctype.h>
#include <string.h>
#include <fcntl.h>
+#include <errno.h>
#ifndef _WIN32
-#include <errno.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/time.h>
#include <netdb.h>
+#include <sys/poll.h>
#else
-#include <winsock.h>
+#include <winsock2.h>
#define vsnprintf _vsnprintf
#define EINPROGRESS WSAEINPROGRESS
#define ENOTSOCK WSAENOTSOCK
+#define EWOULDBLOCK WSAEWOULDBLOCK
#endif
#include "sock.h"
@@ -415,7 +416,7 @@
** interface. if interface is null, listen on all interfaces.
** returns the socket, or SOCK_ERROR on failure
*/
-sock_t sock_get_server_socket(const int port, char *interface)
+sock_t sock_get_server_socket(const int port, char *sinterface)
{
#ifdef HAVE_IPV6
struct sockaddr_storage sa;
@@ -435,8 +436,8 @@
sa_len = sizeof (struct sockaddr_in);
/* set the interface to bind to if specified */
- if (interface != NULL) {
- if (!resolver_getip(interface, ip, sizeof (ip)))
+ if (sinterface != NULL) {
+ if (!resolver_getip(sinterface, ip, sizeof (ip)))
return SOCK_ERROR;
#ifdef HAVE_IPV6
1.2 +2 -2 net/sock.h
Index: sock.h
===================================================================
RCS file: /usr/local/cvsroot/net/sock.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sock.h 2001/09/10 02:27:20 1.1
+++ sock.h 2001/10/20 05:57:28 1.2
@@ -23,7 +23,7 @@
#define __SOCK_H
#ifdef _WIN32
-#include <winsock.h>
+#include <winsock2.h>
typedef SOCKET sock_t
#else
typedef int sock_t;
@@ -59,7 +59,7 @@
int sock_read_line(sock_t sock, char *string, const int len);
/* server socket functions */
-sock_t sock_get_server_socket(const int port, char *interface);
+sock_t sock_get_server_socket(const int port, char *sinterface);
int sock_listen(sock_t serversock, int backlog);
int sock_accept(sock_t serversock, char *ip, int len);
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list