compiler warning: fix
authorYang Tse <yangsita@gmail.com>
Thu, 26 May 2011 13:44:53 +0000 (15:44 +0200)
committerYang Tse <yangsita@gmail.com>
Thu, 26 May 2011 13:44:53 +0000 (15:44 +0200)
Fix compiler warning: conversion may lose significant bits

lib/connect.c
lib/curl_addrinfo.c
lib/socks_gssapi.c
lib/socks_sspi.c
lib/warnless.c
lib/warnless.h

index 2dcf122..369ba05 100644 (file)
@@ -89,6 +89,7 @@
 #include "inet_pton.h"
 #include "sslgen.h" /* for Curl_ssl_check_cxn() */
 #include "progress.h"
+#include "warnless.h"
 
 /* The last #include file should be: */
 #include "memdebug.h"
index 023a006..074bf17 100644 (file)
@@ -50,6 +50,7 @@
 
 #include "curl_addrinfo.h"
 #include "inet_pton.h"
+#include "warnless.h"
 
 #define _MPRINTF_REPLACE /* use our functions only */
 #include <curl/mprintf.h>
index f0d503c..653306c 100644 (file)
@@ -42,8 +42,7 @@
 #include "connect.h"
 #include "timeval.h"
 #include "socks.h"
-
-static gss_ctx_id_t     gss_context = GSS_C_NO_CONTEXT;
+#include "warnless.h"
 
 #define _MPRINTF_REPLACE /* use our functions only */
 #include <curl/mprintf.h>
@@ -52,6 +51,8 @@ static gss_ctx_id_t     gss_context = GSS_C_NO_CONTEXT;
 /* The last #include file should be: */
 #include "memdebug.h"
 
+static gss_ctx_id_t gss_context = GSS_C_NO_CONTEXT;
+
 /*
  * Helper gssapi error functions.
  */
index 2532eda..6d42af3 100644 (file)
@@ -37,6 +37,7 @@
 #include "timeval.h"
 #include "socks.h"
 #include "curl_sspi.h"
+#include "warnless.h"
 
 #define _MPRINTF_REPLACE /* use the internal *printf() functions */
 #include <curl/mprintf.h>
index 89abd14..0f7814b 100644 (file)
@@ -280,4 +280,20 @@ void curlx_FD_ZERO(fd_set *fdset)
   #pragma warning(pop)
 }
 
+unsigned short curlx_htons(unsigned short usnum)
+{
+  #pragma warning(push)
+  #pragma warning(disable:810) /* conversion may lose significant bits */
+  return htons(usnum);
+  #pragma warning(pop)
+}
+
+unsigned short curlx_ntohs(unsigned short usnum)
+{
+  #pragma warning(push)
+  #pragma warning(disable:810) /* conversion may lose significant bits */
+  return ntohs(usnum);
+  #pragma warning(pop)
+}
+
 #endif /* __INTEL_COMPILER && __unix__ */
index dfa16ef..9ac59ac 100644 (file)
@@ -46,6 +46,10 @@ void curlx_FD_SET(int fd, fd_set *fdset);
 
 void curlx_FD_ZERO(fd_set *fdset);
 
+unsigned short curlx_htons(unsigned short usnum);
+
+unsigned short curlx_ntohs(unsigned short usnum);
+
 #ifndef BUILDING_WARNLESS_C
 #  undef  FD_ISSET
 #  define FD_ISSET(a,b) curlx_FD_ISSET((a),(b))
@@ -53,6 +57,10 @@ void curlx_FD_ZERO(fd_set *fdset);
 #  define FD_SET(a,b)   curlx_FD_SET((a),(b))
 #  undef  FD_ZERO
 #  define FD_ZERO(a)    curlx_FD_ZERO((a))
+#  undef  htons
+#  define htons(a)      curlx_htons((a))
+#  undef  ntohs
+#  define ntohs(a)      curlx_ntohs((a))
 #endif
 
 #endif /* __INTEL_COMPILER && __unix__ */