diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2015-05-12 00:32:14 +0200 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2015-05-12 10:46:57 +0200 |
commit | 7e1c0e75ed6a7833a8a653936b8897f64bd0006d (patch) | |
tree | c20d5cb0cf4e9f1a1cd786e9ffdb80d21e02704a /deps/cares/src/ares_nowarn.c | |
parent | 36cdc7c8acda2a81a9e38df4978876659dc48bc3 (diff) | |
download | android-node-v8-7e1c0e75ed6a7833a8a653936b8897f64bd0006d.tar.gz android-node-v8-7e1c0e75ed6a7833a8a653936b8897f64bd0006d.tar.bz2 android-node-v8-7e1c0e75ed6a7833a8a653936b8897f64bd0006d.zip |
deps: sync with upstream bagder/c-ares@bba4dc5
Fixes: https://github.com/iojs/io.js/issues/1676
PR-URL: https://github.com/iojs/io.js/pull/1678
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Diffstat (limited to 'deps/cares/src/ares_nowarn.c')
-rw-r--r-- | deps/cares/src/ares_nowarn.c | 48 |
1 files changed, 41 insertions, 7 deletions
diff --git a/deps/cares/src/ares_nowarn.c b/deps/cares/src/ares_nowarn.c index 397e70b018..d4bd272c6d 100644 --- a/deps/cares/src/ares_nowarn.c +++ b/deps/cares/src/ares_nowarn.c @@ -1,5 +1,5 @@ -/* Copyright (C) 2010-2012 by Daniel Stenberg +/* Copyright (C) 2010-2013 by Daniel Stenberg * * Permission to use, copy, modify, and distribute this * software and its documentation for any purpose and without @@ -21,6 +21,10 @@ # include <assert.h> #endif +#ifdef HAVE_LIMITS_H +#include <limits.h> +#endif + #if defined(__INTEL_COMPILER) && defined(__unix__) #ifdef HAVE_NETINET_IN_H @@ -36,13 +40,43 @@ #include "ares_nowarn.h" -#define CARES_MASK_USHORT (~(unsigned short) 0) -#define CARES_MASK_UINT (~(unsigned int) 0) -#define CARES_MASK_ULONG (~(unsigned long) 0) +#if (SIZEOF_SHORT == 2) +# define CARES_MASK_SSHORT 0x7FFF +# define CARES_MASK_USHORT 0xFFFF +#elif (SIZEOF_SHORT == 4) +# define CARES_MASK_SSHORT 0x7FFFFFFF +# define CARES_MASK_USHORT 0xFFFFFFFF +#elif (SIZEOF_SHORT == 8) +# define CARES_MASK_SSHORT 0x7FFFFFFFFFFFFFFF +# define CARES_MASK_USHORT 0xFFFFFFFFFFFFFFFF +#else +# error "SIZEOF_SHORT not defined" +#endif -#define CARES_MASK_SSHORT (CARES_MASK_USHORT >> 1) -#define CARES_MASK_SINT (CARES_MASK_UINT >> 1) -#define CARES_MASK_SLONG (CARES_MASK_ULONG >> 1) +#if (SIZEOF_INT == 2) +# define CARES_MASK_SINT 0x7FFF +# define CARES_MASK_UINT 0xFFFF +#elif (SIZEOF_INT == 4) +# define CARES_MASK_SINT 0x7FFFFFFF +# define CARES_MASK_UINT 0xFFFFFFFF +#elif (SIZEOF_INT == 8) +# define CARES_MASK_SINT 0x7FFFFFFFFFFFFFFF +# define CARES_MASK_UINT 0xFFFFFFFFFFFFFFFF +#elif (SIZEOF_INT == 16) +# define CARES_MASK_SINT 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +# define CARES_MASK_UINT 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +#else +# error "SIZEOF_INT not defined" +#endif + +#ifndef HAVE_LIMITS_H +/* systems without <limits.h> we guess have 32 bit longs */ +#define CARES_MASK_SLONG 0x7FFFFFFFL +#define CARES_MASK_ULONG 0xFFFFFFFFUL +#else +#define CARES_MASK_ULONG ULONG_MAX +#define CARES_MASK_SLONG LONG_MAX +#endif /* ** unsigned size_t to signed long |