summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2011-05-26 16:06:40 +0200
committerYang Tse <yangsita@gmail.com>2011-05-26 16:06:40 +0200
commitf413fce8233c4e6f2e89bed177a9de42b3718d1e (patch)
tree8c01bc40ec490efb9f4c04f569fe664386fef348
parent5ef8f5ead2478defca69e303a47d00d21b16d838 (diff)
downloadc-ares-f413fce8233c4e6f2e89bed177a9de42b3718d1e.tar.gz
c-ares-f413fce8233c4e6f2e89bed177a9de42b3718d1e.tar.bz2
c-ares-f413fce8233c4e6f2e89bed177a9de42b3718d1e.zip
compiler warning: fix
Fix compiler warning: conversion may lose significant bits
-rw-r--r--ares_getnameinfo.c1
-rw-r--r--ares_nowarn.c18
-rw-r--r--ares_nowarn.h8
-rw-r--r--ares_platform.c1
4 files changed, 27 insertions, 1 deletions
diff --git a/ares_getnameinfo.c b/ares_getnameinfo.c
index b623686..c0d2e18 100644
--- a/ares_getnameinfo.c
+++ b/ares_getnameinfo.c
@@ -58,6 +58,7 @@
#include "ares.h"
#include "ares_ipv6.h"
#include "inet_ntop.h"
+#include "ares_nowarn.h"
#include "ares_private.h"
struct nameinfo_query {
diff --git a/ares_nowarn.c b/ares_nowarn.c
index bc2c5da..719bec1 100644
--- a/ares_nowarn.c
+++ b/ares_nowarn.c
@@ -1,5 +1,5 @@
-/* Copyright (C) 2010 by Daniel Stenberg
+/* Copyright (C) 2010-2011 by Daniel Stenberg
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
@@ -140,4 +140,20 @@ void aresx_FD_ZERO(fd_set *fdset)
#pragma warning(pop)
}
+unsigned short aresx_htons(unsigned short usnum)
+{
+ #pragma warning(push)
+ #pragma warning(disable:810) /* conversion may lose significant bits */
+ return htons(usnum);
+ #pragma warning(pop)
+}
+
+unsigned short aresx_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/ares_nowarn.h b/ares_nowarn.h
index 0cc204c..bcaa227 100644
--- a/ares_nowarn.h
+++ b/ares_nowarn.h
@@ -33,6 +33,10 @@ void aresx_FD_SET(int fd, fd_set *fdset);
void aresx_FD_ZERO(fd_set *fdset);
+unsigned short aresx_htons(unsigned short usnum);
+
+unsigned short aresx_ntohs(unsigned short usnum);
+
#ifndef BUILDING_ARES_NOWARN_C
# undef FD_ISSET
# define FD_ISSET(a,b) aresx_FD_ISSET((a),(b))
@@ -40,6 +44,10 @@ void aresx_FD_ZERO(fd_set *fdset);
# define FD_SET(a,b) aresx_FD_SET((a),(b))
# undef FD_ZERO
# define FD_ZERO(a) aresx_FD_ZERO((a))
+# undef htons
+# define htons(a) aresx_htons((a))
+# undef ntohs
+# define ntohs(a) aresx_ntohs((a))
#endif
#endif /* __INTEL_COMPILER && __unix__ */
diff --git a/ares_platform.c b/ares_platform.c
index 807d58e..c200615 100644
--- a/ares_platform.c
+++ b/ares_platform.c
@@ -20,6 +20,7 @@
#include "ares.h"
#include "ares_platform.h"
+#include "ares_nowarn.h"
#include "ares_private.h"
#if defined(WIN32) && !defined(MSDOS)