Use socklen_t in the native Windows replacements prototypes.
authorBruno Haible <bruno@clisp.org>
Sun, 1 Mar 2009 19:45:42 +0000 (20:45 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 1 Mar 2009 19:45:42 +0000 (20:45 +0100)
ChangeLog
lib/getsockopt.c
lib/setsockopt.c
lib/sys_socket.in.h
modules/getsockopt
modules/setsockopt

index d98c592..2dc9bd7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 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
        least 4.2.
 
index 3da37a9..128edd6 100644 (file)
@@ -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 @@ rpl_getsockopt (int fd, int level, int optname, void *optval, int *optlen)
       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;
     }
index 64f4a81..96a00cc 100644 (file)
@@ -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);
index 63c80ff..6508bf7 100644 (file)
@@ -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 @@ extern int rpl_getsockname (int, struct sockaddr *, int *);
 #  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 @@ extern int rpl_sendto (int, const void *, int, int, struct sockaddr *, int);
 #  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
index 40ff649..85b04c0 100644 (file)
@@ -8,6 +8,7 @@ lib/w32sock.h
 Depends-on:
 sys_socket
 sys_time
+socklen
 errno
 
 configure.ac:
index b429510..5702aae 100644 (file)
@@ -8,6 +8,7 @@ lib/w32sock.h
 Depends-on:
 sys_socket
 sys_time
+socklen
 errno
 
 configure.ac: