From: Marc-André Lureau <marcandre.lureau@redhat.com>
Date: Sat, 28 Jan 2012 12:23:31 +0000 (+0100)
Subject: accept4, fcntl, socket modules: Avoid warnings on x86_64 mingw64.
X-Git-Tag: v0.1~1200
X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=c47bb7060a7947d3c454a54f4b80b3c8283407d0;p=gnulib.git

accept4, fcntl, socket modules: Avoid warnings on x86_64 mingw64.

* lib/accept4.c (accept4): Use intptr_t to convert handle pointer to
an integer.
* lib/fcntl.c (dupfd): Likewise.
* lib/w32sock.h (SOCKET_TO_FD): Likewise.
---

diff --git a/ChangeLog b/ChangeLog
index ea0fc3deb6..f6ebd7a7e7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2012-01-28  Marc-André Lureau  <marcandre.lureau@redhat.com>  (tiny change)
+
+	accept4, fcntl, socket modules: Avoid warnings on x86_64 mingw64.
+	* lib/accept4.c (accept4): Use intptr_t to convert handle pointer to
+	an integer.
+	* lib/fcntl.c (dupfd): Likewise.
+	* lib/w32sock.h (SOCKET_TO_FD): Likewise.
+
 2012-01-28  Bruno Haible  <bruno@clisp.org>
 
 	fcntl: Avoid compilation error on native Windows.
diff --git a/lib/accept4.c b/lib/accept4.c
index 07dadb0e12..71637110d0 100644
--- a/lib/accept4.c
+++ b/lib/accept4.c
@@ -91,7 +91,7 @@ accept4 (int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags)
       /* Closing fd before allocating the new fd ensures that the new fd will
          have the minimum possible value.  */
       close (fd);
-      nfd = _open_osfhandle ((long) new_handle,
+      nfd = _open_osfhandle ((intptr_t) new_handle,
                              O_NOINHERIT | (flags & (O_TEXT | O_BINARY)));
       if (nfd < 0)
         {
diff --git a/lib/fcntl.c b/lib/fcntl.c
index e989d972d0..3dfb6b73a8 100644
--- a/lib/fcntl.c
+++ b/lib/fcntl.c
@@ -94,7 +94,7 @@ dupfd (int oldfd, int newfd, int flags)
           result = -1;
           break;
         }
-      duplicated_fd = _open_osfhandle ((long) new_handle, flags);
+      duplicated_fd = _open_osfhandle ((intptr_t) new_handle, flags);
       if (duplicated_fd < 0)
         {
           CloseHandle (new_handle);
diff --git a/lib/w32sock.h b/lib/w32sock.h
index 846c342756..9e38a7bebb 100644
--- a/lib/w32sock.h
+++ b/lib/w32sock.h
@@ -29,7 +29,7 @@
 #include "msvc-nothrow.h"
 
 #define FD_TO_SOCKET(fd)   ((SOCKET) _get_osfhandle ((fd)))
-#define SOCKET_TO_FD(fh)   (_open_osfhandle ((long) (fh), O_RDWR | O_BINARY))
+#define SOCKET_TO_FD(fh)   (_open_osfhandle ((intptr_t) (fh), O_RDWR | O_BINARY))
 
 static inline void
 set_winsock_errno (void)