Throughout Cygwin, use u_intN_t or uintN_t
Don't use u_char, u_short, u_int or u_long in Cygwin, unless it refers to the Winsock types. Use u_intN_t in BSD-based sources, unsigned char where strings are concerned, uintN_t otherwise. Also: * net.cc: Fix comment, we're not using u_long anymore. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
parent
6ba2b53c53
commit
acc5f02ce8
|
@ -46,8 +46,8 @@ details. */
|
||||||
#define CALL_HANDLER_RETRY_INNER 10
|
#define CALL_HANDLER_RETRY_INNER 10
|
||||||
|
|
||||||
PWCHAR debugger_command;
|
PWCHAR debugger_command;
|
||||||
extern u_char _sigbe;
|
extern uint8_t _sigbe;
|
||||||
extern u_char _sigdelayed_end;
|
extern uint8_t _sigdelayed_end;
|
||||||
|
|
||||||
static BOOL WINAPI ctrl_c_handler (DWORD);
|
static BOOL WINAPI ctrl_c_handler (DWORD);
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,8 @@ details. */
|
||||||
#include <_bsd_types.h>
|
#include <_bsd_types.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern u_char etext asm ("etext");
|
extern uint8_t etext asm ("etext");
|
||||||
extern u_char eprol asm ("__eprol");
|
extern uint8_t eprol asm ("__eprol");
|
||||||
extern void _mcleanup (void);
|
extern void _mcleanup (void);
|
||||||
extern void monstartup (size_t, size_t);
|
extern void monstartup (size_t, size_t);
|
||||||
void _monstartup (void) __attribute__((__constructor__));
|
void _monstartup (void) __attribute__((__constructor__));
|
||||||
|
|
|
@ -117,9 +117,9 @@ monstartup (size_t lowpc, size_t highpc)
|
||||||
|
|
||||||
p->tos = (struct tostruct *)cp;
|
p->tos = (struct tostruct *)cp;
|
||||||
cp += p->tossize;
|
cp += p->tossize;
|
||||||
p->kcount = (u_short *)cp;
|
p->kcount = (u_int16_t *)cp;
|
||||||
cp += p->kcountsize;
|
cp += p->kcountsize;
|
||||||
p->froms = (u_short *)cp;
|
p->froms = (u_int16_t *)cp;
|
||||||
|
|
||||||
/* XXX minbrk needed? */
|
/* XXX minbrk needed? */
|
||||||
//minbrk = fake_sbrk(0);
|
//minbrk = fake_sbrk(0);
|
||||||
|
|
|
@ -130,10 +130,10 @@ struct gmonhdr {
|
||||||
#define MAXARCS ((1 << (8 * sizeof(HISTCOUNTER))) - 2)
|
#define MAXARCS ((1 << (8 * sizeof(HISTCOUNTER))) - 2)
|
||||||
|
|
||||||
struct tostruct {
|
struct tostruct {
|
||||||
size_t selfpc;
|
size_t selfpc;
|
||||||
long count;
|
long count;
|
||||||
u_short link;
|
u_int16_t link;
|
||||||
u_short pad;
|
u_int16_t pad;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -157,9 +157,9 @@ struct rawarc {
|
||||||
*/
|
*/
|
||||||
struct gmonparam {
|
struct gmonparam {
|
||||||
volatile LONG state;
|
volatile LONG state;
|
||||||
u_short *kcount;
|
u_int16_t *kcount;
|
||||||
size_t kcountsize;
|
size_t kcountsize;
|
||||||
u_short *froms;
|
u_int16_t *froms;
|
||||||
size_t fromssize;
|
size_t fromssize;
|
||||||
struct tostruct *tos;
|
struct tostruct *tos;
|
||||||
size_t tossize;
|
size_t tossize;
|
||||||
|
|
|
@ -19,6 +19,6 @@ arc4random_stir(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
arc4random_addrandom(u_char *dat, int datlen)
|
arc4random_addrandom(u_int8_t *dat, int datlen)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,10 +128,12 @@ static const char Pad64 = '=';
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
b64_ntop(u_char const *src, size_t srclength, char *target, size_t targsize) {
|
b64_ntop(unsigned char const *src, size_t srclength, char *target,
|
||||||
|
size_t targsize)
|
||||||
|
{
|
||||||
size_t datalength = 0;
|
size_t datalength = 0;
|
||||||
u_char input[3];
|
unsigned char input[3];
|
||||||
u_char output[4];
|
unsigned char output[4];
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
while (2 < srclength) {
|
while (2 < srclength) {
|
||||||
|
|
|
@ -100,7 +100,7 @@ __FBSDID("$FreeBSD$");
|
||||||
*/
|
*/
|
||||||
extern int
|
extern int
|
||||||
cygwin_inet_aton(const char *cp, struct in_addr *addr) {
|
cygwin_inet_aton(const char *cp, struct in_addr *addr) {
|
||||||
u_long val;
|
u_int32_t val;
|
||||||
int base, n;
|
int base, n;
|
||||||
char c;
|
char c;
|
||||||
u_int8_t parts[4];
|
u_int8_t parts[4];
|
||||||
|
|
|
@ -39,10 +39,12 @@ details. */
|
||||||
#define PUTDOMAIN(d,p)\
|
#define PUTDOMAIN(d,p)\
|
||||||
{int res = dn_comp(d, p, EndPtr - p, dnptrs, lastdnptr); p += res < 0 ? (int) strlen(d) : res; }
|
{int res = dn_comp(d, p, EndPtr - p, dnptrs, lastdnptr); p += res < 0 ? (int) strlen(d) : res; }
|
||||||
|
|
||||||
static u_char * write_record(unsigned char * ptr, PDNS_RECORD rr, unsigned char * EndPtr,
|
static unsigned char * write_record(unsigned char * ptr, PDNS_RECORD rr,
|
||||||
unsigned char ** dnptrs, unsigned char ** lastdnptr, int debug)
|
unsigned char * EndPtr,
|
||||||
|
unsigned char ** dnptrs,
|
||||||
|
unsigned char ** lastdnptr, int debug)
|
||||||
{
|
{
|
||||||
u_char * rd_length_ptr;
|
unsigned char * rd_length_ptr;
|
||||||
|
|
||||||
PUTDOMAIN(rr->pName, ptr);
|
PUTDOMAIN(rr->pName, ptr);
|
||||||
|
|
||||||
|
@ -70,7 +72,7 @@ static u_char * write_record(unsigned char * ptr, PDNS_RECORD rr, unsigned char
|
||||||
switch(rr->wType) {
|
switch(rr->wType) {
|
||||||
case DNS_TYPE_A:
|
case DNS_TYPE_A:
|
||||||
{
|
{
|
||||||
u_char * aptr = (u_char *) & rr->Data.A.IpAddress;
|
u_int8_t * aptr = (u_int8_t *) & rr->Data.A.IpAddress;
|
||||||
if (ptr + 4 <= EndPtr) {
|
if (ptr + 4 <= EndPtr) {
|
||||||
ptr[0] = aptr[0];
|
ptr[0] = aptr[0];
|
||||||
ptr[1] = aptr[1];
|
ptr[1] = aptr[1];
|
||||||
|
|
|
@ -375,7 +375,7 @@ static int get_tcp(struct sockaddr_in *CliAddr,
|
||||||
{
|
{
|
||||||
int fd, res = -1;
|
int fd, res = -1;
|
||||||
unsigned short ans_length;
|
unsigned short ans_length;
|
||||||
union {short len; u_char buf[sizeof(short)];} len_buf;
|
union {short len; u_int8_t buf[sizeof(short)];} len_buf;
|
||||||
|
|
||||||
DPRINTF(debug, "retrying with TCP\n");
|
DPRINTF(debug, "retrying with TCP\n");
|
||||||
|
|
||||||
|
@ -694,7 +694,7 @@ int res_mkquery (int op, const char * dnameptr, int qclass, int qtype,
|
||||||
int res_nquery( res_state statp, const char * DomName, int Class, int Type,
|
int res_nquery( res_state statp, const char * DomName, int Class, int Type,
|
||||||
unsigned char * AnsPtr, int AnsLength)
|
unsigned char * AnsPtr, int AnsLength)
|
||||||
{
|
{
|
||||||
u_char packet[PACKETSZ];
|
u_int8_t packet[PACKETSZ];
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
DPRINTF(statp->options & RES_DEBUG, "query \"%s\" type %d\n", DomName, Type);
|
DPRINTF(statp->options & RES_DEBUG, "query \"%s\" type %d\n", DomName, Type);
|
||||||
|
@ -880,12 +880,12 @@ expand_fail:
|
||||||
preserve the letter cases.
|
preserve the letter cases.
|
||||||
|
|
||||||
*****************************************************************/
|
*****************************************************************/
|
||||||
int dn_comp(const char * exp_dn, u_char * comp_dn, int length,
|
int dn_comp(const char * exp_dn, unsigned char * comp_dn, int length,
|
||||||
u_char ** dnptrs, u_char ** lastdnptr)
|
unsigned char ** dnptrs, unsigned char ** lastdnptr)
|
||||||
{
|
{
|
||||||
u_char *cptr = comp_dn, *dptr, *lptr, *rptr;
|
unsigned char *cptr = comp_dn, *dptr, *lptr, *rptr;
|
||||||
unsigned int i, len;
|
unsigned int i, len;
|
||||||
u_char * const eptr = comp_dn + length - 1; /* Last valid */
|
unsigned char * const eptr = comp_dn + length - 1; /* Last valid */
|
||||||
|
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
|
|
||||||
|
@ -904,7 +904,7 @@ int dn_comp(const char * exp_dn, u_char * comp_dn, int length,
|
||||||
dptr = dnptrs[i];
|
dptr = dnptrs[i];
|
||||||
if (dptr >= comp_dn) /* Handle name.name */
|
if (dptr >= comp_dn) /* Handle name.name */
|
||||||
continue;
|
continue;
|
||||||
rptr = (u_char *) exp_dn;
|
rptr = (unsigned char *) exp_dn;
|
||||||
len = *dptr++;
|
len = *dptr++;
|
||||||
while (1) {
|
while (1) {
|
||||||
do {
|
do {
|
||||||
|
@ -941,12 +941,12 @@ int dn_comp(const char * exp_dn, u_char * comp_dn, int length,
|
||||||
}
|
}
|
||||||
/* Write label */
|
/* Write label */
|
||||||
lptr = cptr++; /* Length byte */
|
lptr = cptr++; /* Length byte */
|
||||||
rptr = (u_char *) exp_dn;
|
rptr = (unsigned char *) exp_dn;
|
||||||
do {
|
do {
|
||||||
if (cptr <= eptr)
|
if (cptr <= eptr)
|
||||||
*cptr++ = *rptr;
|
*cptr++ = *rptr;
|
||||||
} while ((*++rptr != '.') && (*rptr != 0));
|
} while ((*++rptr != '.') && (*rptr != 0));
|
||||||
len = rptr - (u_char *) exp_dn;
|
len = rptr - (unsigned char *) exp_dn;
|
||||||
if (len > MAXLABEL)
|
if (len > MAXLABEL)
|
||||||
return -1;
|
return -1;
|
||||||
*lptr = len;
|
*lptr = len;
|
||||||
|
|
|
@ -363,7 +363,7 @@ cygwin_rresvport_af(int *alport, int family)
|
||||||
{
|
{
|
||||||
int s;
|
int s;
|
||||||
struct sockaddr_storage ss;
|
struct sockaddr_storage ss;
|
||||||
u_short *sport;
|
u_int16_t *sport;
|
||||||
|
|
||||||
memset(&ss, 0, sizeof(ss));
|
memset(&ss, 0, sizeof(ss));
|
||||||
ss.ss_family = family;
|
ss.ss_family = family;
|
||||||
|
|
|
@ -315,7 +315,7 @@ cygwin_rexec (char **ahost, unsigned short rport, char *name, char *pass,
|
||||||
{
|
{
|
||||||
struct sockaddr_in sin, sin2, from;
|
struct sockaddr_in sin, sin2, from;
|
||||||
struct hostent *hp;
|
struct hostent *hp;
|
||||||
u_short port = 0;
|
uint16_t port = 0;
|
||||||
int s, timo = 1, s3;
|
int s, timo = 1, s3;
|
||||||
char c;
|
char c;
|
||||||
static char ahostbuf[INTERNET_MAX_HOST_NAME_LENGTH + 1];
|
static char ahostbuf[INTERNET_MAX_HOST_NAME_LENGTH + 1];
|
||||||
|
@ -371,7 +371,7 @@ retry:
|
||||||
(void) close(s2);
|
(void) close(s2);
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
port = ntohs((u_short)sin2.sin_port);
|
port = ntohs((uint16_t)sin2.sin_port);
|
||||||
(void) sprintf(num, "%u", port);
|
(void) sprintf(num, "%u", port);
|
||||||
(void) write(s, num, strlen(num)+1);
|
(void) write(s, num, strlen(num)+1);
|
||||||
{ int len = sizeof (from);
|
{ int len = sizeof (from);
|
||||||
|
|
|
@ -301,10 +301,11 @@ first_day (int year)
|
||||||
/* This simplifies the calls to conv_num enormously. */
|
/* This simplifies the calls to conv_num enormously. */
|
||||||
#define ALT_DIGITS ((alt_format & ALT_O) ? *alt_digits : NULL)
|
#define ALT_DIGITS ((alt_format & ALT_O) ? *alt_digits : NULL)
|
||||||
|
|
||||||
static const u_char *conv_num(const unsigned char *, int *, uint, uint,
|
static const unsigned char *conv_num(const unsigned char *, int *, uint, uint,
|
||||||
alt_digits_t *);
|
alt_digits_t *);
|
||||||
static const u_char *find_string(const u_char *, int *, const char * const *,
|
static const unsigned char *find_string(const unsigned char *, int *,
|
||||||
const char * const *, int);
|
const char * const *,
|
||||||
|
const char * const *, int);
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
__strptime(const char *buf, const char *fmt, struct tm *tm,
|
__strptime(const char *buf, const char *fmt, struct tm *tm,
|
||||||
|
@ -321,7 +322,7 @@ __strptime(const char *buf, const char *fmt, struct tm *tm,
|
||||||
uint ulim;
|
uint ulim;
|
||||||
int ymd = 0;
|
int ymd = 0;
|
||||||
|
|
||||||
bp = (const u_char *)buf;
|
bp = (const unsigned char *)buf;
|
||||||
struct lc_time_T *_CurrentTimeLocale = __get_current_time_locale ();
|
struct lc_time_T *_CurrentTimeLocale = __get_current_time_locale ();
|
||||||
|
|
||||||
while (bp != NULL && (c = *fmt++) != '\0') {
|
while (bp != NULL && (c = *fmt++) != '\0') {
|
||||||
|
@ -442,9 +443,9 @@ literal:
|
||||||
LEGAL_ALT(ALT_E);
|
LEGAL_ALT(ALT_E);
|
||||||
ymd |= SET_YMD;
|
ymd |= SET_YMD;
|
||||||
recurse:
|
recurse:
|
||||||
bp = (const u_char *)__strptime((const char *)bp,
|
bp = (const unsigned char *)
|
||||||
new_fmt, tm,
|
__strptime((const char *)bp, new_fmt, tm,
|
||||||
era_info, alt_digits);
|
era_info, alt_digits);
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -787,7 +788,7 @@ strptime (const char *__restrict buf, const char *__restrict fmt,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const u_char *
|
static const unsigned char *
|
||||||
conv_num(const unsigned char *buf, int *dest, uint llim, uint ulim,
|
conv_num(const unsigned char *buf, int *dest, uint llim, uint ulim,
|
||||||
alt_digits_t *alt_digits)
|
alt_digits_t *alt_digits)
|
||||||
{
|
{
|
||||||
|
@ -820,9 +821,9 @@ conv_num(const unsigned char *buf, int *dest, uint llim, uint ulim,
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const u_char *
|
static const unsigned char *
|
||||||
find_string(const u_char *bp, int *tgt, const char * const *n1,
|
find_string(const unsigned char *bp, int *tgt, const char * const *n1,
|
||||||
const char * const *n2, int c)
|
const char * const *n2, int c)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
unsigned int len;
|
unsigned int len;
|
||||||
|
|
|
@ -63,7 +63,7 @@ _MCOUNT_DECL (size_t, size_t);
|
||||||
|
|
||||||
_MCOUNT_DECL (size_t frompc, size_t selfpc)
|
_MCOUNT_DECL (size_t frompc, size_t selfpc)
|
||||||
{
|
{
|
||||||
register u_short *frompcindex;
|
register u_int16_t *frompcindex;
|
||||||
register struct tostruct *top, *prevtop;
|
register struct tostruct *top, *prevtop;
|
||||||
register struct gmonparam *p;
|
register struct gmonparam *p;
|
||||||
register long toindex;
|
register long toindex;
|
||||||
|
|
|
@ -24,9 +24,7 @@ details. */
|
||||||
#ifdef __x86_64__
|
#ifdef __x86_64__
|
||||||
/* 2014-04-24: Current Mingw headers define sockaddr_in6 using u_long (8 byte)
|
/* 2014-04-24: Current Mingw headers define sockaddr_in6 using u_long (8 byte)
|
||||||
because a redefinition for LP64 systems is missing. This leads to a wrong
|
because a redefinition for LP64 systems is missing. This leads to a wrong
|
||||||
definition and size of sockaddr_in6 when building with winsock headers.
|
definition and size of sockaddr_in6 when building with winsock headers. */
|
||||||
This definition is also required to use the right u_long type in subsequent
|
|
||||||
function calls. */
|
|
||||||
#undef u_long
|
#undef u_long
|
||||||
#define u_long __ms_u_long
|
#define u_long __ms_u_long
|
||||||
#endif
|
#endif
|
||||||
|
@ -1183,7 +1181,7 @@ cygwin_gethostbyaddr (const char *addr, int len, int type)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
memcpy4to6 (char *dst, const u_char *src)
|
memcpy4to6 (char *dst, const u_int8_t *src)
|
||||||
{
|
{
|
||||||
const unsigned int h[] = {0, 0, htonl (0xFFFF)};
|
const unsigned int h[] = {0, 0, htonl (0xFFFF)};
|
||||||
memcpy (dst, h, 12);
|
memcpy (dst, h, 12);
|
||||||
|
@ -1206,7 +1204,7 @@ gethostby_specials (const char *name, const int af,
|
||||||
}
|
}
|
||||||
|
|
||||||
int res;
|
int res;
|
||||||
u_char address[NS_IN6ADDRSZ];
|
u_int8_t address[NS_IN6ADDRSZ];
|
||||||
/* Test for numerical addresses */
|
/* Test for numerical addresses */
|
||||||
res = cygwin_inet_pton(af, name, address);
|
res = cygwin_inet_pton(af, name, address);
|
||||||
/* Test for special domain names */
|
/* Test for special domain names */
|
||||||
|
@ -1295,7 +1293,7 @@ gethostby_helper (const char *name, const int af, const int type,
|
||||||
/* Get the data from the name server */
|
/* Get the data from the name server */
|
||||||
const int maxcount = 3;
|
const int maxcount = 3;
|
||||||
int old_errno, ancount = 0, anlen = 1024, msgsize = 0;
|
int old_errno, ancount = 0, anlen = 1024, msgsize = 0;
|
||||||
u_char *ptr, *msg = NULL;
|
unsigned char *ptr, *msg = NULL;
|
||||||
int sz;
|
int sz;
|
||||||
hostent *ret;
|
hostent *ret;
|
||||||
char *string_ptr;
|
char *string_ptr;
|
||||||
|
@ -1303,7 +1301,7 @@ gethostby_helper (const char *name, const int af, const int type,
|
||||||
while ((anlen > msgsize) && (ancount++ < maxcount))
|
while ((anlen > msgsize) && (ancount++ < maxcount))
|
||||||
{
|
{
|
||||||
msgsize = anlen;
|
msgsize = anlen;
|
||||||
ptr = (u_char *) realloc (msg, msgsize);
|
ptr = (unsigned char *) realloc (msg, msgsize);
|
||||||
if (ptr == NULL )
|
if (ptr == NULL )
|
||||||
{
|
{
|
||||||
old_errno = errno;
|
old_errno = errno;
|
||||||
|
@ -1329,7 +1327,7 @@ gethostby_helper (const char *name, const int af, const int type,
|
||||||
set_errno (old_errno);
|
set_errno (old_errno);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
u_char *eomsg = msg + anlen - 1;
|
unsigned char *eomsg = msg + anlen - 1;
|
||||||
|
|
||||||
/* We scan the answer records to determine the required memory size.
|
/* We scan the answer records to determine the required memory size.
|
||||||
They can be corrupted and we don't fully trust that the message
|
They can be corrupted and we don't fully trust that the message
|
||||||
|
@ -1349,10 +1347,11 @@ gethostby_helper (const char *name, const int af, const int type,
|
||||||
unsigned namelen1: 16; // expanded length (with final 0)
|
unsigned namelen1: 16; // expanded length (with final 0)
|
||||||
unsigned next_o: 16; // offset to next valid
|
unsigned next_o: 16; // offset to next valid
|
||||||
unsigned size: 16; // data size
|
unsigned size: 16; // data size
|
||||||
u_char data[]; // data
|
unsigned char data[]; // data
|
||||||
record * next () { return (record *) (((char *) this) + next_o); }
|
record * next () { return (record *) (((char *) this) + next_o); }
|
||||||
void set_next ( record * nxt) { next_o = ((char *) nxt) - ((char *) this); }
|
void set_next ( record * nxt) { next_o = ((char *) nxt) - ((char *) this); }
|
||||||
u_char * name () { return (u_char *) (((char *) this) - complen); }
|
unsigned char *name () { return (unsigned char *)
|
||||||
|
(((char *) this) - complen); }
|
||||||
};
|
};
|
||||||
|
|
||||||
record * anptr = NULL, * prevptr = NULL, * curptr;
|
record * anptr = NULL, * prevptr = NULL, * curptr;
|
||||||
|
@ -2971,11 +2970,11 @@ cygwin_sendmsg (int fd, const struct msghdr *msg, int flags)
|
||||||
* Paul Vixie, 1996.
|
* Paul Vixie, 1996.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
inet_pton4 (const char *src, u_char *dst)
|
inet_pton4 (const char *src, u_int8_t *dst)
|
||||||
{
|
{
|
||||||
static const char digits[] = "0123456789";
|
static const char digits[] = "0123456789";
|
||||||
int saw_digit, octets, ch;
|
int saw_digit, octets, ch;
|
||||||
u_char tmp[INADDRSZ], *tp;
|
u_int8_t tmp[INADDRSZ], *tp;
|
||||||
|
|
||||||
saw_digit = 0;
|
saw_digit = 0;
|
||||||
octets = 0;
|
octets = 0;
|
||||||
|
@ -2986,7 +2985,7 @@ inet_pton4 (const char *src, u_char *dst)
|
||||||
|
|
||||||
if ((pch = strchr(digits, ch)) != NULL)
|
if ((pch = strchr(digits, ch)) != NULL)
|
||||||
{
|
{
|
||||||
u_int ret = *tp * 10 + (pch - digits);
|
u_int32_t ret = *tp * 10 + (pch - digits);
|
||||||
|
|
||||||
if (ret > 255)
|
if (ret > 255)
|
||||||
return (0);
|
return (0);
|
||||||
|
@ -3029,14 +3028,14 @@ inet_pton4 (const char *src, u_char *dst)
|
||||||
* Paul Vixie, 1996.
|
* Paul Vixie, 1996.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
inet_pton6 (const char *src, u_char *dst)
|
inet_pton6 (const char *src, u_int8_t *dst)
|
||||||
{
|
{
|
||||||
static const char xdigits_l[] = "0123456789abcdef",
|
static const char xdigits_l[] = "0123456789abcdef",
|
||||||
xdigits_u[] = "0123456789ABCDEF";
|
xdigits_u[] = "0123456789ABCDEF";
|
||||||
u_char tmp[IN6ADDRSZ], *tp, *endp, *colonp;
|
u_int8_t tmp[IN6ADDRSZ], *tp, *endp, *colonp;
|
||||||
const char *xdigits, *curtok;
|
const char *xdigits, *curtok;
|
||||||
int ch, saw_xdigit;
|
int ch, saw_xdigit;
|
||||||
u_int val;
|
u_int32_t val;
|
||||||
|
|
||||||
memset((tp = tmp), 0, IN6ADDRSZ);
|
memset((tp = tmp), 0, IN6ADDRSZ);
|
||||||
endp = tp + IN6ADDRSZ;
|
endp = tp + IN6ADDRSZ;
|
||||||
|
@ -3075,8 +3074,8 @@ inet_pton6 (const char *src, u_char *dst)
|
||||||
}
|
}
|
||||||
if (tp + INT16SZ > endp)
|
if (tp + INT16SZ > endp)
|
||||||
return (0);
|
return (0);
|
||||||
*tp++ = (u_char) (val >> 8) & 0xff;
|
*tp++ = (u_int8_t) (val >> 8) & 0xff;
|
||||||
*tp++ = (u_char) val & 0xff;
|
*tp++ = (u_int8_t) val & 0xff;
|
||||||
saw_xdigit = 0;
|
saw_xdigit = 0;
|
||||||
val = 0;
|
val = 0;
|
||||||
continue;
|
continue;
|
||||||
|
@ -3093,8 +3092,8 @@ inet_pton6 (const char *src, u_char *dst)
|
||||||
{
|
{
|
||||||
if (tp + INT16SZ > endp)
|
if (tp + INT16SZ > endp)
|
||||||
return (0);
|
return (0);
|
||||||
*tp++ = (u_char) (val >> 8) & 0xff;
|
*tp++ = (u_int8_t) (val >> 8) & 0xff;
|
||||||
*tp++ = (u_char) val & 0xff;
|
*tp++ = (u_int8_t) val & 0xff;
|
||||||
}
|
}
|
||||||
if (colonp != NULL)
|
if (colonp != NULL)
|
||||||
{
|
{
|
||||||
|
@ -3136,9 +3135,9 @@ cygwin_inet_pton (int af, const char *src, void *dst)
|
||||||
switch (af)
|
switch (af)
|
||||||
{
|
{
|
||||||
case AF_INET:
|
case AF_INET:
|
||||||
return (inet_pton4(src, (u_char *) dst));
|
return (inet_pton4(src, (u_int8_t *) dst));
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
return (inet_pton6(src, (u_char *) dst));
|
return (inet_pton6(src, (u_int8_t *) dst));
|
||||||
default:
|
default:
|
||||||
errno = EAFNOSUPPORT;
|
errno = EAFNOSUPPORT;
|
||||||
return (-1);
|
return (-1);
|
||||||
|
@ -3153,12 +3152,12 @@ cygwin_inet_pton (int af, const char *src, void *dst)
|
||||||
* `dst' (as a const)
|
* `dst' (as a const)
|
||||||
* notes:
|
* notes:
|
||||||
* (1) uses no statics
|
* (1) uses no statics
|
||||||
* (2) takes a u_char* not an in_addr as input
|
* (2) takes a u_int8_t* not an in_addr as input
|
||||||
* author:
|
* author:
|
||||||
* Paul Vixie, 1996.
|
* Paul Vixie, 1996.
|
||||||
*/
|
*/
|
||||||
static const char *
|
static const char *
|
||||||
inet_ntop4 (const u_char *src, char *dst, size_t size)
|
inet_ntop4 (const u_int8_t *src, char *dst, size_t size)
|
||||||
{
|
{
|
||||||
static const char fmt[] = "%u.%u.%u.%u";
|
static const char fmt[] = "%u.%u.%u.%u";
|
||||||
char tmp[sizeof "255.255.255.255"];
|
char tmp[sizeof "255.255.255.255"];
|
||||||
|
@ -3180,7 +3179,7 @@ inet_ntop4 (const u_char *src, char *dst, size_t size)
|
||||||
* Paul Vixie, 1996.
|
* Paul Vixie, 1996.
|
||||||
*/
|
*/
|
||||||
static const char *
|
static const char *
|
||||||
inet_ntop6 (const u_char *src, char *dst, size_t size)
|
inet_ntop6 (const u_int8_t *src, char *dst, size_t size)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Note that int32_t and int16_t need only be "at least" large enough
|
* Note that int32_t and int16_t need only be "at least" large enough
|
||||||
|
@ -3191,7 +3190,7 @@ inet_ntop6 (const u_char *src, char *dst, size_t size)
|
||||||
*/
|
*/
|
||||||
char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"], *tp;
|
char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"], *tp;
|
||||||
struct { int base, len; } best, cur;
|
struct { int base, len; } best, cur;
|
||||||
u_int words[IN6ADDRSZ / INT16SZ];
|
u_int32_t words[IN6ADDRSZ / INT16SZ];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -3297,9 +3296,9 @@ cygwin_inet_ntop (int af, const void *src, char *dst, socklen_t size)
|
||||||
switch (af)
|
switch (af)
|
||||||
{
|
{
|
||||||
case AF_INET:
|
case AF_INET:
|
||||||
return (inet_ntop4((const u_char *) src, dst, size));
|
return (inet_ntop4((const u_int8_t *) src, dst, size));
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
return (inet_ntop6((const u_char *) src, dst, size));
|
return (inet_ntop6((const u_int8_t *) src, dst, size));
|
||||||
default:
|
default:
|
||||||
errno = EAFNOSUPPORT;
|
errno = EAFNOSUPPORT;
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
|
@ -205,7 +205,7 @@ profile_child (void)
|
||||||
* Start or stop profiling.
|
* Start or stop profiling.
|
||||||
*
|
*
|
||||||
* Profiling data goes into the SAMPLES buffer of size SIZE (which is treated
|
* Profiling data goes into the SAMPLES buffer of size SIZE (which is treated
|
||||||
* as an array of u_shorts of size SIZE/2).
|
* as an array of uint16_t of size SIZE/2).
|
||||||
*
|
*
|
||||||
* Each bin represents a range of pc addresses from OFFSET. The number
|
* Each bin represents a range of pc addresses from OFFSET. The number
|
||||||
* of pc addresses in a bin depends on SCALE. (A scale of 65536 maps
|
* of pc addresses in a bin depends on SCALE. (A scale of 65536 maps
|
||||||
|
@ -215,7 +215,7 @@ profile_child (void)
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
profile_ctl (struct profinfo * p, char *samples, size_t size,
|
profile_ctl (struct profinfo * p, char *samples, size_t size,
|
||||||
size_t offset, u_int scale)
|
size_t offset, uint32_t scale)
|
||||||
{
|
{
|
||||||
size_t maxbin;
|
size_t maxbin;
|
||||||
|
|
||||||
|
@ -231,7 +231,7 @@ profile_ctl (struct profinfo * p, char *samples, size_t size,
|
||||||
memset (samples, 0, size);
|
memset (samples, 0, size);
|
||||||
memset (p, 0, sizeof *p);
|
memset (p, 0, sizeof *p);
|
||||||
maxbin = size >> 1;
|
maxbin = size >> 1;
|
||||||
prof.counter = (u_short *) samples;
|
prof.counter = (uint16_t *) samples;
|
||||||
prof.lowpc = offset;
|
prof.lowpc = offset;
|
||||||
prof.highpc = PROFADDR (maxbin, offset, scale);
|
prof.highpc = PROFADDR (maxbin, offset, scale);
|
||||||
prof.scale = scale;
|
prof.scale = scale;
|
||||||
|
@ -250,7 +250,7 @@ profile_ctl (struct profinfo * p, char *samples, size_t size,
|
||||||
The word pointed to by this address is incremented. Buf is unused. */
|
The word pointed to by this address is incremented. Buf is unused. */
|
||||||
|
|
||||||
int
|
int
|
||||||
profil (char *samples, size_t size, size_t offset, u_int scale)
|
profil (char *samples, size_t size, size_t offset, uint32_t scale)
|
||||||
{
|
{
|
||||||
return profile_ctl (&prof, samples, size, offset, scale);
|
return profile_ctl (&prof, samples, size, offset, scale);
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,11 +45,11 @@ struct profinfo {
|
||||||
_WINHANDLE targthr; /* thread to profile */
|
_WINHANDLE targthr; /* thread to profile */
|
||||||
_WINHANDLE profthr; /* profiling thread */
|
_WINHANDLE profthr; /* profiling thread */
|
||||||
_WINHANDLE quitevt; /* quit event */
|
_WINHANDLE quitevt; /* quit event */
|
||||||
u_short *counter; /* profiling counters */
|
uint16_t *counter; /* profiling counters */
|
||||||
size_t lowpc, highpc; /* range to be profiled */
|
size_t lowpc, highpc; /* range to be profiled */
|
||||||
u_int scale; /* scale value of bins */
|
uint32_t scale; /* scale value of bins */
|
||||||
};
|
};
|
||||||
|
|
||||||
int profile_ctl(struct profinfo *, char *, size_t, size_t, u_int);
|
int profile_ctl(struct profinfo *, char *, size_t, size_t, uint32_t);
|
||||||
int profil(char *, size_t, size_t, u_int);
|
int profil(char *, size_t, size_t, uint32_t);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue