Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
compiler warning: fix
Fix compiler warning: conversion may lose significant bits
  • Loading branch information
yangtse committed May 26, 2011
1 parent 5ef8f5e commit f413fce
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
1 change: 1 addition & 0 deletions ares_getnameinfo.c
Expand Up @@ -58,6 +58,7 @@
#include "ares.h" #include "ares.h"
#include "ares_ipv6.h" #include "ares_ipv6.h"
#include "inet_ntop.h" #include "inet_ntop.h"
#include "ares_nowarn.h"
#include "ares_private.h" #include "ares_private.h"


struct nameinfo_query { struct nameinfo_query {
Expand Down
18 changes: 17 additions & 1 deletion 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 * Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without * software and its documentation for any purpose and without
Expand Down Expand Up @@ -140,4 +140,20 @@ void aresx_FD_ZERO(fd_set *fdset)
#pragma warning(pop) #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__ */ #endif /* __INTEL_COMPILER && __unix__ */
8 changes: 8 additions & 0 deletions ares_nowarn.h
Expand Up @@ -33,13 +33,21 @@ void aresx_FD_SET(int fd, fd_set *fdset);


void aresx_FD_ZERO(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 #ifndef BUILDING_ARES_NOWARN_C
# undef FD_ISSET # undef FD_ISSET
# define FD_ISSET(a,b) aresx_FD_ISSET((a),(b)) # define FD_ISSET(a,b) aresx_FD_ISSET((a),(b))
# undef FD_SET # undef FD_SET
# define FD_SET(a,b) aresx_FD_SET((a),(b)) # define FD_SET(a,b) aresx_FD_SET((a),(b))
# undef FD_ZERO # undef FD_ZERO
# define FD_ZERO(a) aresx_FD_ZERO((a)) # 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


#endif /* __INTEL_COMPILER && __unix__ */ #endif /* __INTEL_COMPILER && __unix__ */
Expand Down
1 change: 1 addition & 0 deletions ares_platform.c
Expand Up @@ -20,6 +20,7 @@


#include "ares.h" #include "ares.h"
#include "ares_platform.h" #include "ares_platform.h"
#include "ares_nowarn.h"
#include "ares_private.h" #include "ares_private.h"


#if defined(WIN32) && !defined(MSDOS) #if defined(WIN32) && !defined(MSDOS)
Expand Down

0 comments on commit f413fce

Please sign in to comment.