ares_process.c: fix compiler warning
authorYang Tse <yangsita@gmail.com>
Tue, 6 Sep 2011 00:20:43 +0000 (02:20 +0200)
committerYang Tse <yangsita@gmail.com>
Tue, 6 Sep 2011 00:20:43 +0000 (02:20 +0200)
ares_process.c

index e5efa5fb304b2870f5a161cac285c59222f11380..5de1ae62a72e6e8a6dde08cd99691d5854794485 100644 (file)
@@ -1,6 +1,6 @@
 
 /* Copyright 1998 by the Massachusetts Institute of Technology.
- * Copyright (C) 2004-2010 by Daniel Stenberg
+ * Copyright (C) 2004-2011 by Daniel Stenberg
  *
  * Permission to use, copy, modify, and distribute this
  * software and its documentation for any purpose and without
@@ -837,30 +837,29 @@ static int setsocknonblock(ares_socket_t sockfd,    /* operate on this */
 #elif defined(HAVE_IOCTL_FIONBIO)
 
   /* older unix versions */
-  int flags;
-  flags = nonblock;
+  int flags = nonblock ? 1 : 0;
   return ioctl(sockfd, FIONBIO, &flags);
 
 #elif defined(HAVE_IOCTLSOCKET_FIONBIO)
 
 #ifdef WATT32
-  char flags;
+  char flags = nonblock ? 1 : 0;
 #else
   /* Windows */
-  unsigned long flags;
+  unsigned long flags = nonblock ? 1UL : 0UL;
 #endif
-  flags = nonblock;
   return ioctlsocket(sockfd, FIONBIO, &flags);
 
 #elif defined(HAVE_IOCTLSOCKET_CAMEL_FIONBIO)
 
   /* Amiga */
-  return IoctlSocket(sockfd, FIONBIO, (long)nonblock);
+  long flags = nonblock ? 1L : 0L;
+  return IoctlSocket(sockfd, FIONBIO, flags);
 
 #elif defined(HAVE_SETSOCKOPT_SO_NONBLOCK)
 
   /* BeOS */
-  long b = nonblock ? 1 : 0;
+  long b = nonblock ? 1L : 0L;
   return setsockopt(sockfd, SOL_SOCKET, SO_NONBLOCK, &b, sizeof(b));
 
 #else