#include "os-proto.h"
#endif
-static inline int xdtoi(int);
static inline int skip_space(FILE *);
static inline int skip_line(FILE *);
/* Hex digit to integer. */
-static inline int
-xdtoi(int c)
+static inline u_char
+xdtoi(u_char c)
{
if (isdigit(c))
- return c - '0';
+ return (u_char)(c - '0');
else if (islower(c))
- return c - 'a' + 10;
+ return (u_char)(c - 'a' + 10);
else
- return c - 'A' + 10;
+ return (u_char)(c - 'A' + 10);
}
static inline int
struct pcap_etherent *
pcap_next_etherent(FILE *fp)
{
- register int c, d, i;
+ register int c, i;
+ u_char d;
char *bp;
+ size_t namesize;
static struct pcap_etherent e;
memset((char *)&e, 0, sizeof(e));
/* pick up name */
bp = e.name;
- /* Use 'd' to prevent buffer overflow. */
- d = sizeof(e.name) - 1;
+ /* Use 'namesize' to prevent buffer overflow. */
+ namesize = sizeof(e.name) - 1;
do {
*bp++ = c;
c = getc(fp);
if (c == EOF)
return (NULL);
- } while (!isspace(c) && --d > 0);
+ } while (!isspace(c) && --namesize != 0);
*bp = '\0';
/* Eat trailing junk */