bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH gnulib 2/4] accept4, fcntl, w32sock: Avoid warnings on x86_64 min


From: Marc-André Lureau
Subject: [PATCH gnulib 2/4] accept4, fcntl, w32sock: Avoid warnings on x86_64 mingw64.
Date: Wed, 25 Jan 2012 19:35:07 +0100

* lib/accept4.c (accept4): _open_osfhandle() expect a
intptr_t.
* lib/fcntl.c (dupfd): Likewise.
* lib/w32sock.h (SOCKET_TO_FD): Likewise.
---
 ChangeLog     |    8 ++++++++
 lib/accept4.c |    2 +-
 lib/fcntl.c   |    2 +-
 lib/w32sock.h |    2 +-
 4 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 575fee3..eb08519 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2012-01-24  Marc-André Lureau  <address@hidden>
 
+       accept4, fcntl, w32sock: Avoid warnings on x86_64 mingw64.
+       * lib/accept4.c (accept4): _open_osfhandle() expect a
+       intptr_t.
+       * lib/fcntl.c (dupfd): Likewise.
+       * lib/w32sock.h (SOCKET_TO_FD): Likewise.
+
+2012-01-24  Marc-André Lureau  <address@hidden>
+
        malloca: Avoid warnings on x86_64 mingw64.
        * lib/malloca.c: Include <stdint.h>.
        (mmalloca, freea): Use uintptr_t to convert pointers to integers.
diff --git a/lib/accept4.c b/lib/accept4.c
index 07dadb0..7163711 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 e989d97..3dfb6b7 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 846c342..9e38a7b 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)
-- 
1.7.7.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]