changeset 11250:c02a0fe7bcc4

Use socklen_t in the native Windows replacements prototypes.
author Bruno Haible <bruno@clisp.org>
date Sun, 01 Mar 2009 20:45:42 +0100
parents 0a95b8deac2e
children 744c2c4f9309
files ChangeLog lib/getsockopt.c lib/setsockopt.c lib/sys_socket.in.h modules/getsockopt modules/setsockopt
diffstat 6 files changed, 20 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2009-03-01  Bruno Haible  <bruno@clisp.org>
+
+	Use socklen_t in the native Windows replacements prototypes.
+	* lib/sys_socket.in.h (rpl_getsockopt, rpl_setsockopt): Use socklen_t
+	instead of 'int'.
+	* lib/getsockopt.c (rpl_getsockopt): Likewise.
+	* lib/setsockopt.c (rpl_setsockopt): Likewise.
+	* modules/getsockopt (Depends-on): Add socklen.
+	* modules/setsockopt (Depends-on): Add socklen.
+
 2009-03-01  Bruno Haible  <bruno@clisp.org>
 
 	* gnulib-tool (sed): Do alias as "sed --posix" if sed's version is at
--- a/lib/getsockopt.c
+++ b/lib/getsockopt.c
@@ -1,6 +1,6 @@
 /* getsockopt.c --- wrappers for Windows getsockopt function
 
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008-2009 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -35,7 +35,7 @@
 #undef getsockopt
 
 int
-rpl_getsockopt (int fd, int level, int optname, void *optval, int *optlen)
+rpl_getsockopt (int fd, int level, int optname, void *optval, socklen_t *optlen)
 {
   int r;
   SOCKET sock = FD_TO_SOCKET (fd);
@@ -51,7 +51,7 @@
       tv.tv_usec = (milliseconds - 1000 * tv.tv_sec) * 1000;
       n = sizeof (struct timeval);
       if (n > *optlen)
-	  n = *optlen;
+	n = *optlen;
       memcpy (optval, &tv, n);
       *optlen = n;
     }
--- a/lib/setsockopt.c
+++ b/lib/setsockopt.c
@@ -1,6 +1,6 @@
 /* setsockopt.c --- wrappers for Windows setsockopt function
 
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008-2009 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -32,7 +32,7 @@
 #undef setsockopt
 
 int
-rpl_setsockopt (int fd, int level, int optname, const void *optval, int optlen)
+rpl_setsockopt (int fd, int level, int optname, const void *optval, socklen_t optlen)
 {
   int r;
   SOCKET sock = FD_TO_SOCKET (fd);
--- a/lib/sys_socket.in.h
+++ b/lib/sys_socket.in.h
@@ -1,6 +1,6 @@
 /* Provide a sys/socket header file for systems lacking it (read: MinGW)
    and for systems where it is incomplete.
-   Copyright (C) 2005-2008 Free Software Foundation, Inc.
+   Copyright (C) 2005-2009 Free Software Foundation, Inc.
    Written by Simon Josefsson.
 
    This program is free software; you can redistribute it and/or modify
@@ -256,7 +256,7 @@
 #  if @HAVE_WINSOCK2_H@
 #   undef getsockopt
 #   define getsockopt		rpl_getsockopt
-extern int rpl_getsockopt (int, int, int, void *, int *);
+extern int rpl_getsockopt (int, int, int, void *, socklen_t *);
 #  endif
 # elif @HAVE_WINSOCK2_H@
 #  undef getsockopt
@@ -358,7 +358,7 @@
 #  if @HAVE_WINSOCK2_H@
 #   undef setsockopt
 #   define setsockopt		rpl_setsockopt
-extern int rpl_setsockopt (int, int, int, const void *, int);
+extern int rpl_setsockopt (int, int, int, const void *, socklen_t);
 #  endif
 # elif @HAVE_WINSOCK2_H@
 #  undef setsockopt
--- a/modules/getsockopt
+++ b/modules/getsockopt
@@ -8,6 +8,7 @@
 Depends-on:
 sys_socket
 sys_time
+socklen
 errno
 
 configure.ac:
--- a/modules/setsockopt
+++ b/modules/setsockopt
@@ -8,6 +8,7 @@
 Depends-on:
 sys_socket
 sys_time
+socklen
 errno
 
 configure.ac: