aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2011-05-26 15:44:53 +0200
committerYang Tse <yangsita@gmail.com>2011-05-26 15:44:53 +0200
commit3c9ff41a1fef4b03571f5a7f905e5016cae55208 (patch)
treedbdc9b5ca8fccf532a35763a4acc71869e1e3aa3
parentc8c8816a97d0214184ee1d4dfaf2775edf28ff53 (diff)
compiler warning: fix
Fix compiler warning: conversion may lose significant bits
-rw-r--r--lib/connect.c1
-rw-r--r--lib/curl_addrinfo.c1
-rw-r--r--lib/socks_gssapi.c5
-rw-r--r--lib/socks_sspi.c1
-rw-r--r--lib/warnless.c16
-rw-r--r--lib/warnless.h8
6 files changed, 30 insertions, 2 deletions
diff --git a/lib/connect.c b/lib/connect.c
index 2dcf122c1..369ba053e 100644
--- a/lib/connect.c
+++ b/lib/connect.c
@@ -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"
diff --git a/lib/curl_addrinfo.c b/lib/curl_addrinfo.c
index 023a00678..074bf17dc 100644
--- a/lib/curl_addrinfo.c
+++ b/lib/curl_addrinfo.c
@@ -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>
diff --git a/lib/socks_gssapi.c b/lib/socks_gssapi.c
index f0d503c91..653306cce 100644
--- a/lib/socks_gssapi.c
+++ b/lib/socks_gssapi.c
@@ -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.
*/
diff --git a/lib/socks_sspi.c b/lib/socks_sspi.c
index 2532eda23..6d42af3a5 100644
--- a/lib/socks_sspi.c
+++ b/lib/socks_sspi.c
@@ -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>
diff --git a/lib/warnless.c b/lib/warnless.c
index 89abd14bc..0f7814b27 100644
--- a/lib/warnless.c
+++ b/lib/warnless.c
@@ -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__ */
diff --git a/lib/warnless.h b/lib/warnless.h
index dfa16ef29..9ac59ac29 100644
--- a/lib/warnless.h
+++ b/lib/warnless.h
@@ -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__ */