summaryrefslogtreecommitdiff
path: root/ares_expand_name.c
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2011-08-21 19:56:06 +0200
committerYang Tse <yangsita@gmail.com>2011-08-21 19:56:06 +0200
commitc8d8ca26060299258182bdee388011fcc53f23cc (patch)
tree8d2039258fd9637c5543931f591f0d3f10571788 /ares_expand_name.c
parent1089cf6052dc90998d1d7b6dd3b8770fd1b273ce (diff)
downloadc-ares-c8d8ca26060299258182bdee388011fcc53f23cc.tar.gz
c-ares-c8d8ca26060299258182bdee388011fcc53f23cc.tar.bz2
c-ares-c8d8ca26060299258182bdee388011fcc53f23cc.zip
warnings: fix another 'conversion may lose significant bits' compiler warning
Diffstat (limited to 'ares_expand_name.c')
-rw-r--r--ares_expand_name.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/ares_expand_name.c b/ares_expand_name.c
index e3eccd2..71ff0da 100644
--- a/ares_expand_name.c
+++ b/ares_expand_name.c
@@ -1,5 +1,5 @@
-/* Copyright 1998 by the Massachusetts Institute of Technology.
+/* Copyright 1998, 2011 by the Massachusetts Institute of Technology.
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
@@ -33,6 +33,7 @@
#include <stdlib.h>
#include "ares.h"
+#include "ares_nowarn.h"
#include "ares_private.h" /* for the memdebug */
static int name_length(const unsigned char *encoded, const unsigned char *abuf,
@@ -91,9 +92,9 @@ int ares_expand_name(const unsigned char *encoded, const unsigned char *abuf,
/* indirect root label (like 0xc0 0x0c) is 2 bytes long (stupid, but
valid) */
if ((*encoded & INDIR_MASK) == INDIR_MASK)
- *enclen = 2;
+ *enclen = 2L;
else
- *enclen = 1; /* the caller should move one byte to get past this */
+ *enclen = 1L; /* the caller should move one byte to get past this */
return ARES_SUCCESS;
}
@@ -106,7 +107,7 @@ int ares_expand_name(const unsigned char *encoded, const unsigned char *abuf,
{
if (!indir)
{
- *enclen = p + 2 - encoded;
+ *enclen = aresx_uztosl(p + 2U - encoded);
indir = 1;
}
p = abuf + ((*p & ~INDIR_MASK) << 8 | *(p + 1));
@@ -126,7 +127,7 @@ int ares_expand_name(const unsigned char *encoded, const unsigned char *abuf,
}
}
if (!indir)
- *enclen = p + 1 - encoded;
+ *enclen = aresx_uztosl(p + 1U - encoded);
/* Nuke the trailing period if we wrote one. */
if (q > *s)