summaryrefslogtreecommitdiff
path: root/ares_expand_name.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2004-10-06 07:50:18 +0000
committerDaniel Stenberg <daniel@haxx.se>2004-10-06 07:50:18 +0000
commit3e748f4b50224e43b916dda5de438c785bdcd49d (patch)
tree53bbfe3dae88be1fd482d3fc392cd1465214f4f3 /ares_expand_name.c
parent47bd7d7548103c44b466fceb1dbda425ce8774bc (diff)
downloadc-ares-3e748f4b50224e43b916dda5de438c785bdcd49d.tar.gz
c-ares-3e748f4b50224e43b916dda5de438c785bdcd49d.tar.bz2
c-ares-3e748f4b50224e43b916dda5de438c785bdcd49d.zip
removed tabs and trailing whitespace from source
Diffstat (limited to 'ares_expand_name.c')
-rw-r--r--ares_expand_name.c100
1 files changed, 50 insertions, 50 deletions
diff --git a/ares_expand_name.c b/ares_expand_name.c
index 0f95c07..0942bfa 100644
--- a/ares_expand_name.c
+++ b/ares_expand_name.c
@@ -28,7 +28,7 @@
#include "ares_private.h" /* for the memdebug */
static int name_length(const unsigned char *encoded, const unsigned char *abuf,
- int alen);
+ int alen);
/* Expand an RFC1035-encoded domain name given by encoded. The
* containing message is given by abuf and alen. The result given by
@@ -55,7 +55,7 @@ static int name_length(const unsigned char *encoded, const unsigned char *abuf,
*/
int ares_expand_name(const unsigned char *encoded, const unsigned char *abuf,
- int alen, char **s, long *enclen)
+ int alen, char **s, long *enclen)
{
int len, indir = 0;
char *q;
@@ -75,27 +75,27 @@ int ares_expand_name(const unsigned char *encoded, const unsigned char *abuf,
while (*p)
{
if ((*p & INDIR_MASK) == INDIR_MASK)
- {
- if (!indir)
- {
- *enclen = p + 2 - encoded;
- indir = 1;
- }
- p = abuf + ((*p & ~INDIR_MASK) << 8 | *(p + 1));
- }
+ {
+ if (!indir)
+ {
+ *enclen = p + 2 - encoded;
+ indir = 1;
+ }
+ p = abuf + ((*p & ~INDIR_MASK) << 8 | *(p + 1));
+ }
else
- {
- len = *p;
- p++;
- while (len--)
- {
- if (*p == '.' || *p == '\\')
- *q++ = '\\';
- *q++ = *p;
- p++;
- }
- *q++ = '.';
- }
+ {
+ len = *p;
+ p++;
+ while (len--)
+ {
+ if (*p == '.' || *p == '\\')
+ *q++ = '\\';
+ *q++ = *p;
+ p++;
+ }
+ *q++ = '.';
+ }
}
if (!indir)
*enclen = p + 1 - encoded;
@@ -111,7 +111,7 @@ int ares_expand_name(const unsigned char *encoded, const unsigned char *abuf,
* -1 if the encoding is invalid.
*/
static int name_length(const unsigned char *encoded, const unsigned char *abuf,
- int alen)
+ int alen)
{
int n = 0, offset, indir = 0;
@@ -122,34 +122,34 @@ static int name_length(const unsigned char *encoded, const unsigned char *abuf,
while (*encoded)
{
if ((*encoded & INDIR_MASK) == INDIR_MASK)
- {
- /* Check the offset and go there. */
- if (encoded + 1 >= abuf + alen)
- return -1;
- offset = (*encoded & ~INDIR_MASK) << 8 | *(encoded + 1);
- if (offset >= alen)
- return -1;
- encoded = abuf + offset;
-
- /* If we've seen more indirects than the message length,
- * then there's a loop.
- */
- if (++indir > alen)
- return -1;
- }
+ {
+ /* Check the offset and go there. */
+ if (encoded + 1 >= abuf + alen)
+ return -1;
+ offset = (*encoded & ~INDIR_MASK) << 8 | *(encoded + 1);
+ if (offset >= alen)
+ return -1;
+ encoded = abuf + offset;
+
+ /* If we've seen more indirects than the message length,
+ * then there's a loop.
+ */
+ if (++indir > alen)
+ return -1;
+ }
else
- {
- offset = *encoded;
- if (encoded + offset + 1 >= abuf + alen)
- return -1;
- encoded++;
- while (offset--)
- {
- n += (*encoded == '.' || *encoded == '\\') ? 2 : 1;
- encoded++;
- }
- n++;
- }
+ {
+ offset = *encoded;
+ if (encoded + offset + 1 >= abuf + alen)
+ return -1;
+ encoded++;
+ while (offset--)
+ {
+ n += (*encoded == '.' || *encoded == '\\') ? 2 : 1;
+ encoded++;
+ }
+ n++;
+ }
}
/* If there were any labels at all, then the number of dots is one