* sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX.
*/
-static int inet_pton4(const char *src, u_char *dst);
-static int inet_pton6(const char *src, u_char *dst);
+static int inet_pton4(const char *src, unsigned char *dst);
+static int inet_pton6(const char *src, unsigned char *dst);
/* int
* inet_pton(af, src, dst)
* Paul Vixie, 1996.
*/
static int
-inet_pton4(const char *src, u_char *dst)
+inet_pton4(const char *src, unsigned char *dst)
{
static const char digits[] = "0123456789";
int saw_digit, octets, ch;
- u_char tmp[INADDRSZ], *tp;
+ unsigned char tmp[INADDRSZ], *tp;
saw_digit = 0;
octets = 0;
const char *pch;
if ((pch = strchr(digits, ch)) != NULL) {
- u_int new = *tp * 10 + (pch - digits);
+ unsigned int new = *tp * 10 + (pch - digits);
if (new > 255)
return (0);
return (0);
saw_digit = 1;
}
- *tp = new;
+ *tp = (unsigned char)new;
} else if (ch == '.' && saw_digit) {
if (octets == 4)
return (0);
* Paul Vixie, 1996.
*/
static int
-inet_pton6(const char *src, u_char *dst)
+inet_pton6(const char *src, unsigned char *dst)
{
static const char xdigits_l[] = "0123456789abcdef",
xdigits_u[] = "0123456789ABCDEF";
- u_char tmp[IN6ADDRSZ], *tp, *endp, *colonp;
+ unsigned char tmp[IN6ADDRSZ], *tp, *endp, *colonp;
const char *xdigits, *curtok;
int ch, saw_xdigit, count_xdigit;
- u_int val;
+ unsigned int val;
memset((tp = tmp), '\0', IN6ADDRSZ);
endp = tp + IN6ADDRSZ;
}
if (tp + sizeof(int16_t) > endp)
return (0);
- *tp++ = (u_char) (val >> 8) & 0xff;
- *tp++ = (u_char) val & 0xff;
+ *tp++ = (unsigned char) ((val >> 8) & 0xff);
+ *tp++ = (unsigned char) (val & 0xff);
saw_xdigit = 0;
count_xdigit = 0;
val = 0;
if (saw_xdigit) {
if (tp + sizeof(int16_t) > endp)
return (0);
- *tp++ = (u_char) (val >> 8) & 0xff;
- *tp++ = (u_char) val & 0xff;
+ *tp++ = (unsigned char) ((val >> 8) & 0xff);
+ *tp++ = (unsigned char) (val & 0xff);
}
if (colonp != NULL) {
/*