summaryrefslogtreecommitdiff
path: root/usr/src/lib/libresolv2/common/isc/base64.c
diff options
context:
space:
mode:
authorRao Shoaib <Rao.Shoaib@Sun.COM>2009-11-11 08:45:41 -0800
committerRao Shoaib <Rao.Shoaib@Sun.COM>2009-11-11 08:45:41 -0800
commit9525b14bcdeb5b5f6f95ab27c2f48f18bd2ec829 (patch)
treedf51891a276edf456c1481f49653a76cdfedee53 /usr/src/lib/libresolv2/common/isc/base64.c
parent0324f02a004039d6377111191fdd7134452d7817 (diff)
downloadillumos-gate-9525b14bcdeb5b5f6f95ab27c2f48f18bd2ec829.tar.gz
6289479 libresolv2 clean up and alignment with libbind.6.0
Diffstat (limited to 'usr/src/lib/libresolv2/common/isc/base64.c')
-rw-r--r--usr/src/lib/libresolv2/common/isc/base64.c58
1 files changed, 29 insertions, 29 deletions
diff --git a/usr/src/lib/libresolv2/common/isc/base64.c b/usr/src/lib/libresolv2/common/isc/base64.c
index 3e55d161ce..97a6876e4e 100644
--- a/usr/src/lib/libresolv2/common/isc/base64.c
+++ b/usr/src/lib/libresolv2/common/isc/base64.c
@@ -1,27 +1,26 @@
/*
- * Copyright (c) 1997-2000 by Sun Microsystems, Inc.
- * All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
*/
+
/*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1996-1999 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* Portions Copyright (c) 1995 by International Business Machines, Inc.
*
@@ -48,7 +47,7 @@
*/
#if !defined(LINT) && !defined(CODECENTER)
-static const char rcsid[] = "$Id: base64.c,v 8.7 1999/10/13 16:39:33 vixie Exp $";
+static const char rcsid[] = "$Id: base64.c,v 1.4 2005/04/27 04:56:34 sra Exp $";
#endif /* not lint */
#include "port_before.h"
@@ -69,8 +68,7 @@ static const char rcsid[] = "$Id: base64.c,v 8.7 1999/10/13 16:39:33 vixie Exp $
#include "port_after.h"
-#ifdef ORIGINAL_ISC_CODE
-#else
+#ifndef ORIGINAL_ISC_CODE
#pragma weak __b64_ntop = b64_ntop
#pragma weak __b64_pton = b64_pton
#endif /* ORIGINAL_ISC_CODE */
@@ -82,7 +80,7 @@ static const char Base64[] =
static const char Pad64 = '=';
/* (From RFC1521 and draft-ietf-dnssec-secext-03.txt)
- The following encoding technique is taken from RFC 1521 by Borenstein
+ The following encoding technique is taken from RFC1521 by Borenstein
and Freed. It is reproduced here in a slightly edited form for
convenience.
@@ -151,7 +149,7 @@ b64_ntop(u_char const *src, size_t srclength, char *target, size_t targsize) {
u_char output[4];
size_t i;
- while (2 < srclength) {
+ while (2U < srclength) {
input[0] = *src++;
input[1] = *src++;
input[2] = *src++;
@@ -175,7 +173,7 @@ b64_ntop(u_char const *src, size_t srclength, char *target, size_t targsize) {
}
/* Now we worry about padding. */
- if (0 != srclength) {
+ if (0U != srclength) {
/* Get what's left. */
input[0] = input[1] = input[2] = '\0';
for (i = 0; i < srclength; i++)
@@ -192,7 +190,7 @@ b64_ntop(u_char const *src, size_t srclength, char *target, size_t targsize) {
return (-1);
target[datalength++] = Base64[output[0]];
target[datalength++] = Base64[output[1]];
- if (srclength == 1)
+ if (srclength == 1U)
target[datalength++] = Pad64;
else
target[datalength++] = Base64[output[2]];
@@ -200,7 +198,7 @@ b64_ntop(u_char const *src, size_t srclength, char *target, size_t targsize) {
}
if (datalength >= targsize)
return (-1);
- target[datalength] = '\0'; /* Returned value doesn't count \0. */
+ target[datalength] = '\0'; /*%< Returned value doesn't count \\0. */
return (datalength);
}
@@ -223,14 +221,14 @@ b64_pton(src, target, targsize)
tarindex = 0;
while ((ch = *src++) != '\0') {
- if (isspace(ch)) /* Skip whitespace anywhere. */
+ if (isspace(ch)) /*%< Skip whitespace anywhere. */
continue;
if (ch == Pad64)
break;
pos = strchr(Base64, ch);
- if (pos == 0) /* A non-base64 character. */
+ if (pos == 0) /*%< A non-base64 character. */
return (-1);
switch (state) {
@@ -283,14 +281,14 @@ b64_pton(src, target, targsize)
* on a byte boundary, and/or with erroneous trailing characters.
*/
- if (ch == Pad64) { /* We got a pad char. */
- ch = *src++; /* Skip it, get next. */
+ if (ch == Pad64) { /*%< We got a pad char. */
+ ch = *src++; /*%< Skip it, get next. */
switch (state) {
- case 0: /* Invalid = in first position */
- case 1: /* Invalid = in second position */
+ case 0: /*%< Invalid = in first position */
+ case 1: /*%< Invalid = in second position */
return (-1);
- case 2: /* Valid, means one byte of info */
+ case 2: /*%< Valid, means one byte of info */
/* Skip any number of spaces. */
for ((void)NULL; ch != '\0'; ch = *src++)
if (!isspace(ch))
@@ -298,11 +296,11 @@ b64_pton(src, target, targsize)
/* Make sure there is another trailing = sign. */
if (ch != Pad64)
return (-1);
- ch = *src++; /* Skip the = */
+ ch = *src++; /*%< Skip the = */
/* Fall through to "single trailing =" case. */
/* FALLTHROUGH */
- case 3: /* Valid, means two bytes of info */
+ case 3: /*%< Valid, means two bytes of info */
/*
* We know this char is an =. Is there anything but
* whitespace after it?
@@ -331,3 +329,5 @@ b64_pton(src, target, targsize)
return (tarindex);
}
+
+/*! \file */