diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2016-03-24 18:39:15 +0300 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2016-03-24 18:39:15 +0300 |
commit | acc5f02ce8637bb6b395292fa259d20c296d8aa8 (patch) | |
tree | 318ee689b36a0decbd28f2a715b2c61ed3ab9bea | |
parent | 6ba2b53c53260323039d7f872034991e6706a20b (diff) |
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>
-rw-r--r-- | winsup/cygwin/exceptions.cc | 4 | ||||
-rw-r--r-- | winsup/cygwin/gcrt0.c | 4 | ||||
-rw-r--r-- | winsup/cygwin/gmon.c | 4 | ||||
-rw-r--r-- | winsup/cygwin/gmon.h | 12 | ||||
-rw-r--r-- | winsup/cygwin/libc/arc4random_stir.c | 2 | ||||
-rw-r--r-- | winsup/cygwin/libc/base64.c | 8 | ||||
-rw-r--r-- | winsup/cygwin/libc/inet_addr.c | 2 | ||||
-rw-r--r-- | winsup/cygwin/libc/minires-os-if.c | 10 | ||||
-rw-r--r-- | winsup/cygwin/libc/minires.c | 18 | ||||
-rw-r--r-- | winsup/cygwin/libc/rcmd.cc | 2 | ||||
-rw-r--r-- | winsup/cygwin/libc/rexec.cc | 4 | ||||
-rw-r--r-- | winsup/cygwin/libc/strptime.cc | 25 | ||||
-rw-r--r-- | winsup/cygwin/mcount.c | 2 | ||||
-rw-r--r-- | winsup/cygwin/net.cc | 55 | ||||
-rw-r--r-- | winsup/cygwin/profil.c | 8 | ||||
-rw-r--r-- | winsup/cygwin/profil.h | 8 |
16 files changed, 86 insertions, 82 deletions
diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index 1627d435d..fc9834cc0 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -46,8 +46,8 @@ details. */ #define CALL_HANDLER_RETRY_INNER 10 PWCHAR debugger_command; -extern u_char _sigbe; -extern u_char _sigdelayed_end; +extern uint8_t _sigbe; +extern uint8_t _sigdelayed_end; static BOOL WINAPI ctrl_c_handler (DWORD); diff --git a/winsup/cygwin/gcrt0.c b/winsup/cygwin/gcrt0.c index 87c7d36ad..62b06f25c 100644 --- a/winsup/cygwin/gcrt0.c +++ b/winsup/cygwin/gcrt0.c @@ -20,8 +20,8 @@ details. */ #include <_bsd_types.h> #endif -extern u_char etext asm ("etext"); -extern u_char eprol asm ("__eprol"); +extern uint8_t etext asm ("etext"); +extern uint8_t eprol asm ("__eprol"); extern void _mcleanup (void); extern void monstartup (size_t, size_t); void _monstartup (void) __attribute__((__constructor__)); diff --git a/winsup/cygwin/gmon.c b/winsup/cygwin/gmon.c index 3baf93563..b31842cd9 100644 --- a/winsup/cygwin/gmon.c +++ b/winsup/cygwin/gmon.c @@ -117,9 +117,9 @@ monstartup (size_t lowpc, size_t highpc) p->tos = (struct tostruct *)cp; cp += p->tossize; - p->kcount = (u_short *)cp; + p->kcount = (u_int16_t *)cp; cp += p->kcountsize; - p->froms = (u_short *)cp; + p->froms = (u_int16_t *)cp; /* XXX minbrk needed? */ //minbrk = fake_sbrk(0); diff --git a/winsup/cygwin/gmon.h b/winsup/cygwin/gmon.h index fa648a236..38070d3c7 100644 --- a/winsup/cygwin/gmon.h +++ b/winsup/cygwin/gmon.h @@ -130,10 +130,10 @@ struct gmonhdr { #define MAXARCS ((1 << (8 * sizeof(HISTCOUNTER))) - 2) struct tostruct { - size_t selfpc; - long count; - u_short link; - u_short pad; + size_t selfpc; + long count; + u_int16_t link; + u_int16_t pad; }; /* @@ -157,9 +157,9 @@ struct rawarc { */ struct gmonparam { volatile LONG state; - u_short *kcount; + u_int16_t *kcount; size_t kcountsize; - u_short *froms; + u_int16_t *froms; size_t fromssize; struct tostruct *tos; size_t tossize; diff --git a/winsup/cygwin/libc/arc4random_stir.c b/winsup/cygwin/libc/arc4random_stir.c index 16481303e..851c4e68f 100644 --- a/winsup/cygwin/libc/arc4random_stir.c +++ b/winsup/cygwin/libc/arc4random_stir.c @@ -19,6 +19,6 @@ arc4random_stir(void) } void -arc4random_addrandom(u_char *dat, int datlen) +arc4random_addrandom(u_int8_t *dat, int datlen) { } diff --git a/winsup/cygwin/libc/base64.c b/winsup/cygwin/libc/base64.c index f6bdb872e..a067fe2eb 100644 --- a/winsup/cygwin/libc/base64.c +++ b/winsup/cygwin/libc/base64.c @@ -128,10 +128,12 @@ static const char Pad64 = '='; */ 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; - u_char input[3]; - u_char output[4]; + unsigned char input[3]; + unsigned char output[4]; size_t i; while (2 < srclength) { diff --git a/winsup/cygwin/libc/inet_addr.c b/winsup/cygwin/libc/inet_addr.c index 465e86ed3..9e464e67a 100644 --- a/winsup/cygwin/libc/inet_addr.c +++ b/winsup/cygwin/libc/inet_addr.c @@ -100,7 +100,7 @@ __FBSDID("$FreeBSD$"); */ extern int cygwin_inet_aton(const char *cp, struct in_addr *addr) { - u_long val; + u_int32_t val; int base, n; char c; u_int8_t parts[4]; diff --git a/winsup/cygwin/libc/minires-os-if.c b/winsup/cygwin/libc/minires-os-if.c index 5142e3032..0c6299dd2 100644 --- a/winsup/cygwin/libc/minires-os-if.c +++ b/winsup/cygwin/libc/minires-os-if.c @@ -39,10 +39,12 @@ details. */ #define PUTDOMAIN(d,p)\ {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, - unsigned char ** dnptrs, unsigned char ** lastdnptr, int debug) +static unsigned char * write_record(unsigned char * ptr, PDNS_RECORD rr, + 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); @@ -70,7 +72,7 @@ static u_char * write_record(unsigned char * ptr, PDNS_RECORD rr, unsigned char switch(rr->wType) { 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) { ptr[0] = aptr[0]; ptr[1] = aptr[1]; diff --git a/winsup/cygwin/libc/minires.c b/winsup/cygwin/libc/minires.c index acd493e38..6a059e8bb 100644 --- a/winsup/cygwin/libc/minires.c +++ b/winsup/cygwin/libc/minires.c @@ -375,7 +375,7 @@ static int get_tcp(struct sockaddr_in *CliAddr, { int fd, res = -1; 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"); @@ -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, unsigned char * AnsPtr, int AnsLength) { - u_char packet[PACKETSZ]; + u_int8_t packet[PACKETSZ]; int len; DPRINTF(statp->options & RES_DEBUG, "query \"%s\" type %d\n", DomName, Type); @@ -880,12 +880,12 @@ expand_fail: preserve the letter cases. *****************************************************************/ -int dn_comp(const char * exp_dn, u_char * comp_dn, int length, - u_char ** dnptrs, u_char ** lastdnptr) +int dn_comp(const char * exp_dn, unsigned char * comp_dn, int length, + 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; - u_char * const eptr = comp_dn + length - 1; /* Last valid */ + unsigned char * const eptr = comp_dn + length - 1; /* Last valid */ errno = EINVAL; @@ -904,7 +904,7 @@ int dn_comp(const char * exp_dn, u_char * comp_dn, int length, dptr = dnptrs[i]; if (dptr >= comp_dn) /* Handle name.name */ continue; - rptr = (u_char *) exp_dn; + rptr = (unsigned char *) exp_dn; len = *dptr++; while (1) { do { @@ -941,12 +941,12 @@ int dn_comp(const char * exp_dn, u_char * comp_dn, int length, } /* Write label */ lptr = cptr++; /* Length byte */ - rptr = (u_char *) exp_dn; + rptr = (unsigned char *) exp_dn; do { if (cptr <= eptr) *cptr++ = *rptr; } while ((*++rptr != '.') && (*rptr != 0)); - len = rptr - (u_char *) exp_dn; + len = rptr - (unsigned char *) exp_dn; if (len > MAXLABEL) return -1; *lptr = len; diff --git a/winsup/cygwin/libc/rcmd.cc b/winsup/cygwin/libc/rcmd.cc index 4ebdd062a..0e6efa47a 100644 --- a/winsup/cygwin/libc/rcmd.cc +++ b/winsup/cygwin/libc/rcmd.cc @@ -363,7 +363,7 @@ cygwin_rresvport_af(int *alport, int family) { int s; struct sockaddr_storage ss; - u_short *sport; + u_int16_t *sport; memset(&ss, 0, sizeof(ss)); ss.ss_family = family; diff --git a/winsup/cygwin/libc/rexec.cc b/winsup/cygwin/libc/rexec.cc index a796e9762..a9d0048d3 100644 --- a/winsup/cygwin/libc/rexec.cc +++ b/winsup/cygwin/libc/rexec.cc @@ -315,7 +315,7 @@ cygwin_rexec (char **ahost, unsigned short rport, char *name, char *pass, { struct sockaddr_in sin, sin2, from; struct hostent *hp; - u_short port = 0; + uint16_t port = 0; int s, timo = 1, s3; char c; static char ahostbuf[INTERNET_MAX_HOST_NAME_LENGTH + 1]; @@ -371,7 +371,7 @@ retry: (void) close(s2); goto bad; } - port = ntohs((u_short)sin2.sin_port); + port = ntohs((uint16_t)sin2.sin_port); (void) sprintf(num, "%u", port); (void) write(s, num, strlen(num)+1); { int len = sizeof (from); diff --git a/winsup/cygwin/libc/strptime.cc b/winsup/cygwin/libc/strptime.cc index 1f14818a2..ad4d66150 100644 --- a/winsup/cygwin/libc/strptime.cc +++ b/winsup/cygwin/libc/strptime.cc @@ -301,10 +301,11 @@ first_day (int year) /* This simplifies the calls to conv_num enormously. */ #define ALT_DIGITS ((alt_format & ALT_O) ? *alt_digits : NULL) -static const u_char *conv_num(const unsigned char *, int *, uint, uint, - alt_digits_t *); -static const u_char *find_string(const u_char *, int *, const char * const *, - const char * const *, int); +static const unsigned char *conv_num(const unsigned char *, int *, uint, uint, + alt_digits_t *); +static const unsigned char *find_string(const unsigned char *, int *, + const char * const *, + const char * const *, int); static char * __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; int ymd = 0; - bp = (const u_char *)buf; + bp = (const unsigned char *)buf; struct lc_time_T *_CurrentTimeLocale = __get_current_time_locale (); while (bp != NULL && (c = *fmt++) != '\0') { @@ -442,9 +443,9 @@ literal: LEGAL_ALT(ALT_E); ymd |= SET_YMD; recurse: - bp = (const u_char *)__strptime((const char *)bp, - new_fmt, tm, - era_info, alt_digits); + bp = (const unsigned char *) + __strptime((const char *)bp, new_fmt, tm, + era_info, alt_digits); continue; /* @@ -787,7 +788,7 @@ strptime (const char *__restrict buf, const char *__restrict fmt, return ret; } -static const u_char * +static const unsigned char * conv_num(const unsigned char *buf, int *dest, uint llim, uint ulim, alt_digits_t *alt_digits) { @@ -820,9 +821,9 @@ conv_num(const unsigned char *buf, int *dest, uint llim, uint ulim, return buf; } -static const u_char * -find_string(const u_char *bp, int *tgt, const char * const *n1, - const char * const *n2, int c) +static const unsigned char * +find_string(const unsigned char *bp, int *tgt, const char * const *n1, + const char * const *n2, int c) { int i; unsigned int len; diff --git a/winsup/cygwin/mcount.c b/winsup/cygwin/mcount.c index 6111b355a..08d79b598 100644 --- a/winsup/cygwin/mcount.c +++ b/winsup/cygwin/mcount.c @@ -63,7 +63,7 @@ _MCOUNT_DECL (size_t, size_t); _MCOUNT_DECL (size_t frompc, size_t selfpc) { - register u_short *frompcindex; + register u_int16_t *frompcindex; register struct tostruct *top, *prevtop; register struct gmonparam *p; register long toindex; diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index 8ef621c21..da5308352 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -24,9 +24,7 @@ details. */ #ifdef __x86_64__ /* 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 - 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. */ + definition and size of sockaddr_in6 when building with winsock headers. */ #undef u_long #define u_long __ms_u_long #endif @@ -1183,7 +1181,7 @@ cygwin_gethostbyaddr (const char *addr, int len, int type) } 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)}; memcpy (dst, h, 12); @@ -1206,7 +1204,7 @@ gethostby_specials (const char *name, const int af, } int res; - u_char address[NS_IN6ADDRSZ]; + u_int8_t address[NS_IN6ADDRSZ]; /* Test for numerical addresses */ res = cygwin_inet_pton(af, name, address); /* 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 */ const int maxcount = 3; int old_errno, ancount = 0, anlen = 1024, msgsize = 0; - u_char *ptr, *msg = NULL; + unsigned char *ptr, *msg = NULL; int sz; hostent *ret; char *string_ptr; @@ -1303,7 +1301,7 @@ gethostby_helper (const char *name, const int af, const int type, while ((anlen > msgsize) && (ancount++ < maxcount)) { msgsize = anlen; - ptr = (u_char *) realloc (msg, msgsize); + ptr = (unsigned char *) realloc (msg, msgsize); if (ptr == NULL ) { old_errno = errno; @@ -1329,7 +1327,7 @@ gethostby_helper (const char *name, const int af, const int type, set_errno (old_errno); 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. 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 next_o: 16; // offset to next valid unsigned size: 16; // data size - u_char data[]; // data + unsigned char data[]; // data record * next () { return (record *) (((char *) this) + next_o); } 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; @@ -2971,11 +2970,11 @@ cygwin_sendmsg (int fd, const struct msghdr *msg, int flags) * Paul Vixie, 1996. */ static int -inet_pton4 (const char *src, u_char *dst) +inet_pton4 (const char *src, u_int8_t *dst) { static const char digits[] = "0123456789"; int saw_digit, octets, ch; - u_char tmp[INADDRSZ], *tp; + u_int8_t tmp[INADDRSZ], *tp; saw_digit = 0; octets = 0; @@ -2986,7 +2985,7 @@ inet_pton4 (const char *src, u_char *dst) if ((pch = strchr(digits, ch)) != NULL) { - u_int ret = *tp * 10 + (pch - digits); + u_int32_t ret = *tp * 10 + (pch - digits); if (ret > 255) return (0); @@ -3029,14 +3028,14 @@ inet_pton4 (const char *src, u_char *dst) * Paul Vixie, 1996. */ 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", xdigits_u[] = "0123456789ABCDEF"; - u_char tmp[IN6ADDRSZ], *tp, *endp, *colonp; + u_int8_t tmp[IN6ADDRSZ], *tp, *endp, *colonp; const char *xdigits, *curtok; int ch, saw_xdigit; - u_int val; + u_int32_t val; memset((tp = tmp), 0, IN6ADDRSZ); endp = tp + IN6ADDRSZ; @@ -3075,8 +3074,8 @@ inet_pton6 (const char *src, u_char *dst) } if (tp + INT16SZ > endp) return (0); - *tp++ = (u_char) (val >> 8) & 0xff; - *tp++ = (u_char) val & 0xff; + *tp++ = (u_int8_t) (val >> 8) & 0xff; + *tp++ = (u_int8_t) val & 0xff; saw_xdigit = 0; val = 0; continue; @@ -3093,8 +3092,8 @@ inet_pton6 (const char *src, u_char *dst) { if (tp + INT16SZ > endp) return (0); - *tp++ = (u_char) (val >> 8) & 0xff; - *tp++ = (u_char) val & 0xff; + *tp++ = (u_int8_t) (val >> 8) & 0xff; + *tp++ = (u_int8_t) val & 0xff; } if (colonp != NULL) { @@ -3136,9 +3135,9 @@ cygwin_inet_pton (int af, const char *src, void *dst) switch (af) { case AF_INET: - return (inet_pton4(src, (u_char *) dst)); + return (inet_pton4(src, (u_int8_t *) dst)); case AF_INET6: - return (inet_pton6(src, (u_char *) dst)); + return (inet_pton6(src, (u_int8_t *) dst)); default: errno = EAFNOSUPPORT; return (-1); @@ -3153,12 +3152,12 @@ cygwin_inet_pton (int af, const char *src, void *dst) * `dst' (as a const) * notes: * (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: * Paul Vixie, 1996. */ 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"; 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. */ 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 @@ -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; struct { int base, len; } best, cur; - u_int words[IN6ADDRSZ / INT16SZ]; + u_int32_t words[IN6ADDRSZ / INT16SZ]; int i; /* @@ -3297,9 +3296,9 @@ cygwin_inet_ntop (int af, const void *src, char *dst, socklen_t size) switch (af) { 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: - return (inet_ntop6((const u_char *) src, dst, size)); + return (inet_ntop6((const u_int8_t *) src, dst, size)); default: errno = EAFNOSUPPORT; return (NULL); diff --git a/winsup/cygwin/profil.c b/winsup/cygwin/profil.c index 2d7d6e394..2d8fdc0ff 100644 --- a/winsup/cygwin/profil.c +++ b/winsup/cygwin/profil.c @@ -205,7 +205,7 @@ profile_child (void) * Start or stop profiling. * * 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 * of pc addresses in a bin depends on SCALE. (A scale of 65536 maps @@ -215,7 +215,7 @@ profile_child (void) */ int 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; @@ -231,7 +231,7 @@ profile_ctl (struct profinfo * p, char *samples, size_t size, memset (samples, 0, size); memset (p, 0, sizeof *p); maxbin = size >> 1; - prof.counter = (u_short *) samples; + prof.counter = (uint16_t *) samples; prof.lowpc = offset; prof.highpc = PROFADDR (maxbin, offset, 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. */ 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); } diff --git a/winsup/cygwin/profil.h b/winsup/cygwin/profil.h index f33591d09..a3090c56b 100644 --- a/winsup/cygwin/profil.h +++ b/winsup/cygwin/profil.h @@ -45,11 +45,11 @@ struct profinfo { _WINHANDLE targthr; /* thread to profile */ _WINHANDLE profthr; /* profiling thread */ _WINHANDLE quitevt; /* quit event */ - u_short *counter; /* profiling counters */ + uint16_t *counter; /* profiling counters */ 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 profil(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, uint32_t); |