[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Winsock or Winsock2 - Single Point Of Change
From: |
Conrad T. Pino |
Subject: |
Winsock or Winsock2 - Single Point Of Change |
Date: |
Sun, 25 Sep 2005 13:33:58 -0700 |
When I created "windows-NT/sys/socket.h" I included Winsock2 and
we're using Winsock elsewhere. The function calling convention
between them is different so they shouldn't be mixed.
This patch changes all <winsock.h> to <sys/socket.h> which includes
<winsock2.h> and "gethostname" prototype in "windows-NT/unistd.h"
is modified to match <winsock2.h> prototype.
IMO all <winsock.h> should be replaced with <sys/socket.h> which
will include the appropriate Windows header file.
I suggest moving to Winsock2 but IMO that is optional.
Index: src/buffer.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/buffer.c,v
retrieving revision 1.62
diff -u -p -r1.62 buffer.c
--- src/buffer.c 25 Sep 2005 15:06:48 -0000 1.62
+++ src/buffer.c 25 Sep 2005 20:24:56 -0000
@@ -20,11 +20,7 @@
#if defined (SERVER_SUPPORT) || defined (CLIENT_SUPPORT)
-# ifdef HAVE_WINSOCK_H
-# include <winsock.h>
-# else
-# include <sys/socket.h>
-# endif
+# include <sys/socket.h>
/* OS/2 doesn't have EIO. FIXME: this whole notion of turning
a different error into EIO strikes me as pretty dubious. */
Index: src/client.h
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/client.h,v
retrieving revision 1.59
diff -u -p -r1.59 client.h
--- src/client.h 25 Sep 2005 00:28:51 -0000 1.59
+++ src/client.h 25 Sep 2005 20:24:56 -0000
@@ -212,7 +212,7 @@ void client_notify (const char *, const
#if defined AUTH_CLIENT_SUPPORT || defined HAVE_KERBEROS || defined HAVE_GSSAPI
# ifdef HAVE_WINSOCK_H
-# include <winsock.h>
+# include <sys/socket.h>
# else /* No winsock.h */
# include <sys/socket.h>
# include <netinet/in.h>
Index: src/server.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/server.c,v
retrieving revision 1.447
diff -u -p -r1.447 server.c
--- src/server.c 23 Sep 2005 03:19:23 -0000 1.447
+++ src/server.c 25 Sep 2005 20:25:02 -0000
@@ -54,7 +54,7 @@ static int cvs_gssapi_wrapping;
extern char *server_hostname;
# ifdef HAVE_WINSOCK_H
-# include <winsock.h>
+# include <sys/socket.h>
# endif
# if defined (AUTH_SERVER_SUPPORT) || defined (HAVE_KERBEROS) || defined
(HAVE_GSSAPI)
Index: src/socket-client.h
===================================================================
RCS file: /cvsroot/cvs/ccvs/src/socket-client.h,v
retrieving revision 1.8
diff -u -p -r1.8 socket-client.h
--- src/socket-client.h 25 Sep 2005 00:31:51 -0000 1.8
+++ src/socket-client.h 25 Sep 2005 20:25:02 -0000
@@ -15,7 +15,7 @@
#if defined SOCK_ERRNO || defined SOCK_STRERROR
# ifdef HAVE_WINSOCK_H
-# include <winsock.h>
+# include <sys/socket.h>
# else /* No winsock.h */
# include <sys/socket.h>
# include <netinet/in.h>
Index: windows-NT/filesubr.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/windows-NT/filesubr.c,v
retrieving revision 1.61
diff -u -p -r1.61 filesubr.c
--- windows-NT/filesubr.c 25 Sep 2005 19:11:27 -0000 1.61
+++ windows-NT/filesubr.c 25 Sep 2005 20:25:03 -0000
@@ -19,7 +19,7 @@
#include <assert.h>
#include <io.h>
-#include <windows.h>
+#include <sys/socket.h> /* This does: #include <windows.h> */
#include "cvs.h"
Index: windows-NT/rcmd.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/windows-NT/rcmd.c,v
retrieving revision 1.10
diff -u -p -r1.10 rcmd.c
--- windows-NT/rcmd.c 9 Jul 1997 06:35:16 -0000 1.10
+++ windows-NT/rcmd.c 25 Sep 2005 20:25:03 -0000
@@ -21,7 +21,7 @@
#include <errno.h>
#ifdef HAVE_WINSOCK_H
- #include <winsock.h>
+ #include <sys/socket.h>
#else
#include <sys/types.h>
#include <sys/socket.h>
Index: windows-NT/sockerror.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/windows-NT/sockerror.c,v
retrieving revision 1.1
diff -u -p -r1.1 sockerror.c
--- windows-NT/sockerror.c 8 Apr 1997 16:15:00 -0000 1.1
+++ windows-NT/sockerror.c 25 Sep 2005 20:25:03 -0000
@@ -14,7 +14,7 @@
GNU General Public License for more details. */
#include <stdio.h>
-#include <winsock.h>
+#include <sys/socket.h>
struct err_strs {
char **strs;
Index: windows-NT/startserver.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/windows-NT/startserver.c,v
retrieving revision 1.11
diff -u -p -r1.11 startserver.c
--- windows-NT/startserver.c 13 Jul 2005 17:06:36 -0000 1.11
+++ windows-NT/startserver.c 25 Sep 2005 20:25:03 -0000
@@ -19,7 +19,7 @@
#include "rcmd.h"
#include <stdlib.h>
-#include <winsock.h>
+#include <sys/socket.h>
#include <malloc.h>
#include <io.h>
#include <errno.h>
Index: windows-NT/unistd.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/windows-NT/unistd.c,v
retrieving revision 1.2
diff -u -p -r1.2 unistd.c
--- windows-NT/unistd.c 31 May 2005 07:13:31 -0000 1.2
+++ windows-NT/unistd.c 25 Sep 2005 20:25:03 -0000
@@ -9,8 +9,7 @@
#include <stdio.h>
#include <conio.h>
-#define WIN32_LEAN_AND_MEAN
-#include <winsock.h> /* This does: #include <windows.h> */
+#include <sys/socket.h> /* This does: #include <windows.h> */
/* Please order functions by name if possible */
Index: windows-NT/unistd.h
===================================================================
RCS file: /cvsroot/cvs/ccvs/windows-NT/unistd.h,v
retrieving revision 1.9
diff -u -p -r1.9 unistd.h
--- windows-NT/unistd.h 25 Sep 2005 19:11:27 -0000 1.9
+++ windows-NT/unistd.h 25 Sep 2005 20:25:03 -0000
@@ -41,7 +41,7 @@ FIXME: gethostname prototype for lib/xge
Remove when GNULib folks provide a permenant fix.
Requested by Mark D. Baushke and committed by Conrad T. Pino
*/
-int __stdcall gethostname (char * name, int namelen);
+int __declspec(dllimport) __stdcall gethostname (char * name, int namelen);
#if 0 /* someday maybe these should be added here as well */
Index: windows-NT/woe32.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/windows-NT/woe32.c,v
retrieving revision 1.11
diff -u -p -r1.11 woe32.c
--- windows-NT/woe32.c 13 Jul 2005 17:06:36 -0000 1.11
+++ windows-NT/woe32.c 25 Sep 2005 20:25:04 -0000
@@ -25,8 +25,7 @@
#include <stdio.h>
#include <conio.h>
-#define WIN32_LEAN_AND_MEAN
-#include <winsock.h> /* This does: #include <windows.h> */
+#include <sys/socket.h> /* This does: #include <windows.h> */
#include <stdlib.h>
#include <unistd.h>
Index: windows-NT/sys/socket.h
===================================================================
RCS file: /cvsroot/cvs/ccvs/windows-NT/sys/socket.h,v
retrieving revision 1.1
diff -u -p -r1.1 socket.h
--- windows-NT/sys/socket.h 20 Sep 2005 16:36:47 -0000 1.1
+++ windows-NT/sys/socket.h 25 Sep 2005 20:25:05 -0000
@@ -1,4 +1,9 @@
-#define WIN32_LEAN_AND_MEAN 1
+#ifndef SYS_SOCKET_H
+#define SYS_SOCKET_H
+
+#define WIN32_LEAN_AND_MEAN
#include <winsock2.h>
typedef size_t socklen_t;
+
+#endif /* SYS_SOCKET_H */
- Winsock or Winsock2 - Single Point Of Change,
Conrad T. Pino <=