From: Bleep Date: Sun, 19 Mar 2000 05:49:05 +0000 (+0000) Subject: Author: Bleep X-Git-Url: http://git.pk910.de/?p=ircu2.10.12-pk.git;a=commitdiff_plain;h=263c649848b2b25a097134227a7b89d868cb2e1e Author: Bleep Log message: Merge in changes from beta git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@37 c9e4aea6-c8fd-4c43-8297-357d70d61c8c --- diff --git a/ChangeLog b/ChangeLog index 016047f..3b9051f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,10 @@ # # ChangeLog for ircu2.10.11 # -# $Id: ChangeLog,v 1.14 2000-03-18 06:48:21 bleep Exp $ +# $Id: ChangeLog,v 1.15 2000-03-19 05:49:04 bleep Exp $ # # Insert new changes at beginning of the change list. # #----------------------------------------------------------------------------- +* Merge in u2_10_10_beta06 changes --Bleep * Start ircu2.10.11 development, beta branch u2_10_10 --Bleep diff --git a/ChangeLog.10 b/ChangeLog.10 index 1059c7e..70cd3b9 100644 --- a/ChangeLog.10 +++ b/ChangeLog.10 @@ -1,10 +1,14 @@ # # ChangeLog for ircu2.10.10 # -# $Id: ChangeLog.10,v 1.1 2000-03-18 05:20:28 bleep Exp $ +# $Id: ChangeLog.10,v 1.2 2000-03-19 05:49:04 bleep Exp $ # # Insert new changes at beginning of the change list. # +* Merge u2_10_10_beta06 create branch u2_10_10_beta07 --Bleep +* Remove size_t from socket calls, audit usage of size_t + values. --Bleep +* Fix for OSF1, RES_NOALIASES not defined there. --Bleep * Don't bother doing hostname lookup or setting me.sockhost since we never want to display it there is really no reason to have the info. --Bleep diff --git a/include/channel.h b/include/channel.h index fa2d5d9..048712e 100644 --- a/include/channel.h +++ b/include/channel.h @@ -147,10 +147,12 @@ typedef enum ChannelGetType { */ #define MAGIC_REMOTE_JOIN_TS 1270080000 - #ifdef OPER_WALK_THROUGH_LMODES - /* used in can_join to determine if an oper forced a join on a channel */ - #define MAGIC_OPER_OVERRIDE 1000 - #endif +#ifdef OPER_WALK_THROUGH_LMODES +/* + * used in can_join to determine if an oper forced a join on a channel + */ +#define MAGIC_OPER_OVERRIDE 1000 +#endif extern const char* const PartFmt1; diff --git a/include/class.h b/include/class.h index b95dc35..51ca7ef 100644 --- a/include/class.h +++ b/include/class.h @@ -78,11 +78,11 @@ extern unsigned int get_client_ping(struct Client *acptr); extern unsigned int get_conf_class(struct ConfItem *aconf); extern unsigned int get_client_class(struct Client *acptr); extern void add_class(unsigned int conclass, unsigned int ping, - unsigned int confreq, unsigned int maxli, size_t sendq); + unsigned int confreq, unsigned int maxli, unsigned int sendq); extern void check_class(void); extern void initclass(void); extern void report_classes(struct Client *sptr); -extern size_t get_sendq(struct Client* cptr); +extern unsigned int get_sendq(struct Client* cptr); extern struct ConfClass *classes; diff --git a/include/client.h b/include/client.h index 1e74687..49b71e6 100644 --- a/include/client.h +++ b/include/client.h @@ -120,7 +120,7 @@ struct Client { HandlerType handler; /* message index into command table for parsing */ struct DNSReply* dns_reply; /* DNS reply used during client registration */ struct ListingArgs* listing; - size_t max_sendq; /* cached max send queue for client */ + unsigned int max_sendq; /* cached max send queue for client */ unsigned short lastsq; /* # 2k blocks when sendqueued called last */ unsigned short port; /* and the remote port# too :-) */ unsigned char targets[MAXTARGETS]; /* Hash values of current targets */ diff --git a/include/dbuf.h b/include/dbuf.h index 570d500..97ce173 100644 --- a/include/dbuf.h +++ b/include/dbuf.h @@ -34,7 +34,7 @@ extern int DBufUsedCount; /* GLOBAL - count of dbufs in use */ struct DBufBuffer; struct DBuf { - size_t length; /* Current number of bytes stored */ + unsigned int length; /* Current number of bytes stored */ struct DBufBuffer *head; /* First data buffer, if length > 0 */ struct DBufBuffer *tail; /* last data buffer, if length > 0 */ }; @@ -53,11 +53,11 @@ struct DBuf { /* * Prototypes */ -extern void dbuf_delete(struct DBuf *dyn, size_t length); -extern int dbuf_put(struct DBuf *dyn, const char *buf, size_t length); -extern const char *dbuf_map(const struct DBuf *dyn, size_t *length); -extern size_t dbuf_get(struct DBuf *dyn, char *buf, size_t length); -extern size_t dbuf_getmsg(struct DBuf *dyn, char *buf, size_t length); +extern void dbuf_delete(struct DBuf *dyn, unsigned int length); +extern int dbuf_put(struct DBuf *dyn, const char *buf, unsigned int length); +extern const char *dbuf_map(const struct DBuf *dyn, unsigned int *length); +extern unsigned int dbuf_get(struct DBuf *dyn, char *buf, unsigned int length); +extern unsigned int dbuf_getmsg(struct DBuf *dyn, char *buf, unsigned int length); extern void dbuf_count_memory(size_t *allocated, size_t *used); diff --git a/include/numnicks.h b/include/numnicks.h index 8b0e5f8..e3bc250 100644 --- a/include/numnicks.h +++ b/include/numnicks.h @@ -68,7 +68,7 @@ extern void SetServerYXX(struct Client* cptr, struct Client* server, const char* yxx); extern void ClearServerYXX(const struct Client* server); -extern void SetYXXCapacity(struct Client* myself, size_t max_clients); +extern void SetYXXCapacity(struct Client* myself, unsigned int max_clients); extern void SetYXXServerName(struct Client* myself, unsigned int numeric); extern int markMatchexServer(const char* cmask, int minlen); @@ -77,7 +77,7 @@ extern struct Client* findNUser(const char* yxx); extern struct Client* FindNServer(const char* numeric); extern unsigned int base64toint(const char* str); -extern const char* inttobase64(char* buf, unsigned int v, size_t count); +extern const char* inttobase64(char* buf, unsigned int v, unsigned int count); #endif /* INCLUDED_numnicks_h */ diff --git a/include/packet.h b/include/packet.h index 46f2056..848e99b 100644 --- a/include/packet.h +++ b/include/packet.h @@ -17,6 +17,6 @@ struct Client; */ extern int server_dopacket(struct Client* cptr, const char* buffer, int length); -extern int client_dopacket(struct Client* cptr, size_t length); +extern int client_dopacket(struct Client* cptr, unsigned int length); #endif /* INCLUDED_packet_h */ diff --git a/include/patchlevel.h b/include/patchlevel.h index 90c1329..33d4599 100644 --- a/include/patchlevel.h +++ b/include/patchlevel.h @@ -18,7 +18,6 @@ * $Id$ * */ - #define PATCHLEVEL "00" #define RELEASE ".11.alpha." diff --git a/include/res.h b/include/res.h index 5869f29..c9f52af 100644 --- a/include/res.h +++ b/include/res.h @@ -39,13 +39,13 @@ extern time_t timeout_resolver(time_t now); * pointer arg, DO NOT call this from a resolver callback function the * resolver will delete the query itself for the affected client. */ -extern void delete_resolver_queries(const void* vptr); -extern unsigned long cres_mem(struct Client* cptr); -extern int m_dns(struct Client* cptr, struct Client* sptr, +extern void delete_resolver_queries(const void* vptr); +extern size_t cres_mem(struct Client* cptr); +extern int m_dns(struct Client* cptr, struct Client* sptr, int parc, char* parv[]); -extern int resolver_read(void); -extern void resolver_read_multiple(int count); -extern void flush_resolver_cache(void); +extern int resolver_read(void); +extern void resolver_read_multiple(int count); +extern void flush_resolver_cache(void); /* * add_local_domain - append local domain suffix to hostnames that diff --git a/include/s_bsd.h b/include/s_bsd.h index f7aae6e..3b39f16 100644 --- a/include/s_bsd.h +++ b/include/s_bsd.h @@ -76,7 +76,7 @@ struct Pollable { /* * Proto types */ -extern size_t deliver_it(struct Client *cptr, const char *str, size_t len); +extern unsigned int deliver_it(struct Client *cptr, const char *str, unsigned int len); extern int connect_server(struct ConfItem* aconf, struct Client* by, struct DNSReply* reply); extern void release_dns_reply(struct Client* cptr); diff --git a/ircd/channel.c b/ircd/channel.c index 209158f..d0f0fd5 100644 --- a/ircd/channel.c +++ b/ircd/channel.c @@ -798,7 +798,7 @@ static int send_mode_list(struct Client *cptr, char *chname, name = lp->value.ban.banstr; else name = lp->value.cptr->name; - if (strlen(parabuf) + strlen(name) + 11 < (size_t)MODEBUFLEN) + if (strlen(parabuf) + strlen(name) + 11 < MODEBUFLEN) { strcat(parabuf, " "); strcat(parabuf, name); @@ -1305,7 +1305,7 @@ int set_mode(struct Client* cptr, struct Client* sptr, { lp = &chops[opcnt++]; lp->value.cp = *parv; - if (strlen(lp->value.cp) > (size_t)KEYLEN) + if (strlen(lp->value.cp) > KEYLEN) lp->value.cp[KEYLEN] = '\0'; lp->flags = MODE_KEY | MODE_ADD; keychange = 1; @@ -1666,14 +1666,14 @@ int set_mode(struct Client* cptr, struct Client* sptr, } /* What could be added: cp+' '+' '++'\0' */ - if (len + strlen(cp) + 13 > (size_t)MODEBUFLEN || - nlen + strlen(cp) + NUMNICKLEN + 12 > (size_t)MODEBUFLEN) + if (len + strlen(cp) + 13 > MODEBUFLEN || + nlen + strlen(cp) + NUMNICKLEN + 12 > MODEBUFLEN) break; switch (lp->flags & MODE_WPARAS) { case MODE_KEY: - if (strlen(cp) > (size_t)KEYLEN) + if (strlen(cp) > KEYLEN) *(cp + KEYLEN) = '\0'; if ((whatt == MODE_ADD && (*mode->key == '\0' || 0 != ircd_strcmp(mode->key, cp))) || @@ -2044,9 +2044,11 @@ int set_mode(struct Client* cptr, struct Client* sptr, MyFree(banstr[cnt]); sblen += len[cnt]; } - for (member_z = chptr->members; member_z; member_z = member_z->next_member) - if (MyConnect(acptr = member_z->user) && !IsZombie(member_z)) + for (member_z = chptr->members; member_z; member_z = member_z->next_member) { + acptr = member_z->user; + if (MyConnect(acptr) && !IsZombie(member_z)) sendbufto_one(acptr); + } if (delayed) { banstr[0] = banstr[delayed - 1]; diff --git a/ircd/chkconf.c b/ircd/chkconf.c index 7d0fdb0..db8391f 100644 --- a/ircd/chkconf.c +++ b/ircd/chkconf.c @@ -205,7 +205,7 @@ static struct ConfItem *chk_initconf(void) if (!*(tmp + 1)) break; else - for (s = tmp; (*s = *++s);) + for (s = tmp; *s; *s = *++s) ; tmp++; } diff --git a/ircd/class.c b/ircd/class.c index 74da220..459caf0 100644 --- a/ircd/class.c +++ b/ircd/class.c @@ -123,7 +123,7 @@ unsigned int get_con_freq(struct ConfClass * clptr) * immeadiately after the first one (class 0). */ void add_class(unsigned int conClass, unsigned int ping, unsigned int confreq, - unsigned int maxli, size_t sendq) + unsigned int maxli, unsigned int sendq) { struct ConfClass *t, *p; @@ -203,7 +203,7 @@ void report_classes(struct Client *sptr) MaxLinks(cltmp), MaxSendq(cltmp)); } -size_t get_sendq(struct Client *cptr) +unsigned int get_sendq(struct Client *cptr) { assert(0 != cptr); assert(0 != cptr->local); diff --git a/ircd/dbuf.c b/ircd/dbuf.c index b9dd0b8..be96d72 100644 --- a/ircd/dbuf.c +++ b/ircd/dbuf.c @@ -121,11 +121,11 @@ static int dbuf_malloc_error(struct DBuf *dyn) * buf: Pointer to data to be stored * length: Number of bytes to store */ -int dbuf_put(struct DBuf *dyn, const char *buf, size_t length) +int dbuf_put(struct DBuf *dyn, const char *buf, unsigned int length) { struct DBufBuffer** h; struct DBufBuffer* db; - size_t chunk; + unsigned int chunk; assert(0 != dyn); assert(0 != buf); @@ -218,7 +218,7 @@ int dbuf_put(struct DBuf *dyn, const char *buf, size_t length) * dyn: Dynamic buffer header * length: Return number of bytes accessible */ -const char *dbuf_map(const struct DBuf *dyn, size_t *length) +const char *dbuf_map(const struct DBuf* dyn, unsigned int* length) { assert(0 != dyn); assert(0 != length); @@ -240,10 +240,10 @@ const char *dbuf_map(const struct DBuf *dyn, size_t *length) * dyn: Dynamic buffer header * length: Number of bytes to delete */ -void dbuf_delete(struct DBuf *dyn, size_t length) +void dbuf_delete(struct DBuf *dyn, unsigned int length) { struct DBufBuffer *db; - size_t chunk; + unsigned int chunk; if (length > dyn->length) length = dyn->length; @@ -289,10 +289,10 @@ void dbuf_delete(struct DBuf *dyn, size_t length) * buf: Pointer to buffer to receive the data * length: Max amount of bytes that can be received */ -size_t dbuf_get(struct DBuf *dyn, char *buf, size_t length) +unsigned int dbuf_get(struct DBuf *dyn, char *buf, unsigned int length) { - size_t moved = 0; - size_t chunk; + unsigned int moved = 0; + unsigned int chunk; const char *b; assert(0 != dyn); @@ -313,7 +313,7 @@ size_t dbuf_get(struct DBuf *dyn, char *buf, size_t length) return moved; } -static size_t dbuf_flush(struct DBuf *dyn) +static unsigned int dbuf_flush(struct DBuf *dyn) { struct DBufBuffer *db = dyn->head; @@ -349,13 +349,13 @@ static size_t dbuf_flush(struct DBuf *dyn) * possible (determined by length) into buf and return the amount copied * else return 0. */ -size_t dbuf_getmsg(struct DBuf *dyn, char *buf, size_t length) +unsigned int dbuf_getmsg(struct DBuf *dyn, char *buf, unsigned int length) { struct DBufBuffer *db; char *start; char *end; - size_t count; - size_t copied = 0; + unsigned int count; + unsigned int copied = 0; assert(0 != dyn); assert(0 != buf); diff --git a/ircd/gline.c b/ircd/gline.c index 12881b4..4e5245d 100644 --- a/ircd/gline.c +++ b/ircd/gline.c @@ -237,9 +237,8 @@ void add_gline(struct Client *sptr, int ip_mask, char *host, char *comment, /* * whee!! :) */ - if (!acptr->user || strlen(acptr->sockhost) > (size_t)HOSTLEN || - (acptr->user->username ? strlen(acptr->user->username) : 0) > - (size_t)HOSTLEN) + if (!acptr->user || strlen(acptr->sockhost) > HOSTLEN || + (acptr->user->username ? strlen(acptr->user->username) : 0) > HOSTLEN) continue; /* these tests right out of find_kill for safety's sake */ #endif diff --git a/ircd/ircd_string.c b/ircd/ircd_string.c index bb76933..e601613 100644 --- a/ircd/ircd_string.c +++ b/ircd/ircd_string.c @@ -139,7 +139,7 @@ NTL_HDR_strCasediff { NTL_SRC_strCasediff } * Other functions visible externally */ -int strnChattr(const char *s, const size_t n) +int strnChattr(const char *s, size_t n) { const char *rs = s; unsigned int x = ~0; @@ -170,7 +170,7 @@ int ircd_strcmp(const char *a, const char *b) * ircd_strncmp - counted case insensitive comparison of 2 strings * NOTE: see ircd_chattr.h for notes on case mapping. */ -int ircd_strncmp(const char *a, const char *b, const size_t n) +int ircd_strncmp(const char *a, const char *b, size_t n) { const char* ra = a; const char* rb = b; diff --git a/ircd/listener.c b/ircd/listener.c index b496265..f158ec1 100644 --- a/ircd/listener.c +++ b/ircd/listener.c @@ -395,8 +395,8 @@ void release_listener(struct Listener* listener) */ void accept_connection(struct Listener* listener) { - struct sockaddr_in addr; - size_t addrlen = sizeof(struct sockaddr_in); + struct sockaddr_in addr = { 0 }; + unsigned int addrlen = sizeof(struct sockaddr_in); int fd; assert(0 != listener); diff --git a/ircd/m_kill.c b/ircd/m_kill.c index 9bbcb50..bf62b60 100644 --- a/ircd/m_kill.c +++ b/ircd/m_kill.c @@ -441,7 +441,7 @@ int m_kill(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) if (EmptyString(path)) return need_more_params(sptr, parv[0], "KILL"); - if (strlen(path) > (size_t)TOPICLEN) + if (strlen(path) > TOPICLEN) path[TOPICLEN] = '\0'; } diff --git a/ircd/m_quit.c b/ircd/m_quit.c index 4d352d3..bc49038 100644 --- a/ircd/m_quit.c +++ b/ircd/m_quit.c @@ -169,7 +169,7 @@ int m_quit(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) return exit_client(cptr, sptr, sptr, "Signed off"); } } - if (strlen(comment) > (size_t)TOPICLEN) + if (strlen(comment) > TOPICLEN) comment[TOPICLEN] = '\0'; return IsServer(sptr) ? 0 : exit_client(cptr, sptr, sptr, comment); } diff --git a/ircd/numnicks.c b/ircd/numnicks.c index 8838e38..29ec260 100644 --- a/ircd/numnicks.c +++ b/ircd/numnicks.c @@ -130,7 +130,7 @@ unsigned int base64toint(const char* s) return i; } -const char* inttobase64(char* buf, unsigned int v, size_t count) +const char* inttobase64(char* buf, unsigned int v, unsigned int count) { buf[count] = '\0'; while (count > 0) { @@ -152,7 +152,7 @@ static struct Client* FindXNServer(const char* numeric) struct Client* FindNServer(const char* numeric) { - size_t len = strlen(numeric); + unsigned int len = strlen(numeric); if (len < 3) { Debug((DEBUG_DEBUG, "FindNServer: %s(%d)", numeric, base64toint(numeric))); @@ -232,7 +232,7 @@ void SetServerYXX(struct Client* cptr, struct Client* server, const char* yxx) sizeof(struct Client*)); } -void SetYXXCapacity(struct Client* c, size_t capacity) +void SetYXXCapacity(struct Client* c, unsigned int capacity) { unsigned int max_clients; #if defined(EXTENDED_NUMERICS) diff --git a/ircd/os_bsd.c b/ircd/os_bsd.c index 4a43fa1..09ce225 100644 --- a/ircd/os_bsd.c +++ b/ircd/os_bsd.c @@ -138,7 +138,7 @@ int os_get_sockerr(int fd) { int err = 0; #if defined(SO_ERROR) - size_t len = sizeof(err); + unsigned int len = sizeof(err); getsockopt(fd, SOL_SOCKET, SO_ERROR, &err, &len); #endif return err; @@ -193,14 +193,14 @@ int os_set_nonblocking(int fd) */ int os_set_reuseaddr(int fd) { - size_t opt = 1; + unsigned int opt = 1; return (0 == setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (const char*) &opt, sizeof(opt))); } int os_set_sockbufs(int fd, unsigned int size) { - size_t opt = size; + unsigned int opt = size; return (0 == setsockopt(fd, SOL_SOCKET, SO_RCVBUF, (const char*) &opt, sizeof(opt)) && 0 == setsockopt(fd, SOL_SOCKET, SO_SNDBUF, @@ -279,7 +279,7 @@ IOResult os_recvfrom_nonb(int fd, char* buf, unsigned int length, unsigned int* length_out, struct sockaddr_in* sin_out) { int res; - size_t len = sizeof(struct sockaddr_in); + unsigned int len = sizeof(struct sockaddr_in); assert(0 != buf); assert(0 != length_out); assert(0 != sin_out); @@ -326,14 +326,14 @@ int os_connect_nonb(int fd, const struct sockaddr_in* sin) int os_get_sockname(int fd, struct sockaddr_in* sin_out) { - size_t len = sizeof(struct sockaddr_in); + unsigned int len = sizeof(struct sockaddr_in); assert(0 != sin_out); return (0 == getsockname(fd, (struct sockaddr*) sin_out, &len)); } int os_get_peername(int fd, struct sockaddr_in* sin_out) { - size_t len = sizeof(struct sockaddr_in); + unsigned int len = sizeof(struct sockaddr_in); assert(0 != sin_out); return (0 == getpeername(fd, (struct sockaddr*) sin_out, &len)); } diff --git a/ircd/os_generic.c b/ircd/os_generic.c index 7f778db..40d57d6 100644 --- a/ircd/os_generic.c +++ b/ircd/os_generic.c @@ -141,7 +141,7 @@ int os_get_sockerr(int fd) { int err = 0; #if defined(SO_ERROR) - size_t len = sizeof(err); + unsigned int len = sizeof(err); getsockopt(fd, SOL_SOCKET, SO_ERROR, &err, &len); #endif return err; @@ -196,14 +196,14 @@ int os_set_nonblocking(int fd) */ int os_set_reuseaddr(int fd) { - size_t opt = 1; + unsigned int opt = 1; return (0 == setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (const char*) &opt, sizeof(opt))); } int os_set_sockbufs(int fd, unsigned int size) { - size_t opt = size; + unsigned int opt = size; return (0 == setsockopt(fd, SOL_SOCKET, SO_RCVBUF, (const char*) &opt, sizeof(opt)) && 0 == setsockopt(fd, SOL_SOCKET, SO_SNDBUF, @@ -282,7 +282,7 @@ IOResult os_recvfrom_nonb(int fd, char* buf, unsigned int length, unsigned int* length_out, struct sockaddr_in* sin_out) { int res; - size_t len = sizeof(struct sockaddr_in); + unsigned int len = sizeof(struct sockaddr_in); assert(0 != buf); assert(0 != length_out); assert(0 != sin_out); @@ -328,14 +328,14 @@ int os_connect_nonb(int fd, const struct sockaddr_in* sin) int os_get_sockname(int fd, struct sockaddr_in* sin_out) { - size_t len = sizeof(struct sockaddr_in); + unsigned int len = sizeof(struct sockaddr_in); assert(0 != sin_out); return (0 == getsockname(fd, (struct sockaddr*) sin_out, &len)); } int os_get_peername(int fd, struct sockaddr_in* sin_out) { - size_t len = sizeof(struct sockaddr_in); + unsigned int len = sizeof(struct sockaddr_in); assert(0 != sin_out); return (0 == getpeername(fd, (struct sockaddr*) sin_out, &len)); } diff --git a/ircd/os_linux.c b/ircd/os_linux.c index c2701d2..e3dc5e7 100644 --- a/ircd/os_linux.c +++ b/ircd/os_linux.c @@ -115,7 +115,7 @@ int os_get_rusage(struct Client *cptr, int uptime, EnumFn enumerator) int os_get_sockerr(int fd) { int err = 0; - size_t len = sizeof(err); + unsigned int len = sizeof(err); getsockopt(fd, SOL_SOCKET, SO_ERROR, &err, &len); return err; } @@ -141,13 +141,13 @@ int os_set_nonblocking(int fd) */ int os_set_reuseaddr(int fd) { - size_t opt = 1; + unsigned int opt = 1; return (0 == setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt))); } int os_set_sockbufs(int fd, unsigned int size) { - size_t opt = size; + unsigned int opt = size; return (0 == setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &opt, sizeof(opt)) && 0 == setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &opt, sizeof(opt))); } @@ -209,7 +209,7 @@ IOResult os_recvfrom_nonb(int fd, char* buf, unsigned int length, unsigned int* length_out, struct sockaddr_in* sin_out) { int res; - size_t len = sizeof(struct sockaddr_in); + unsigned int len = sizeof(struct sockaddr_in); assert(0 != buf); assert(0 != length_out); assert(0 != sin_out); @@ -265,14 +265,14 @@ int os_connect_nonb(int fd, const struct sockaddr_in* sin) int os_get_sockname(int fd, struct sockaddr_in* sin_out) { - size_t len = sizeof(struct sockaddr_in); + unsigned int len = sizeof(struct sockaddr_in); assert(0 != sin_out); return (0 == getsockname(fd, (struct sockaddr*) sin_out, &len)); } int os_get_peername(int fd, struct sockaddr_in* sin_out) { - size_t len = sizeof(struct sockaddr_in); + unsigned int len = sizeof(struct sockaddr_in); assert(0 != sin_out); return (0 == getpeername(fd, (struct sockaddr*) sin_out, &len)); } diff --git a/ircd/os_solaris.c b/ircd/os_solaris.c index 59cdbbe..b754988 100644 --- a/ircd/os_solaris.c +++ b/ircd/os_solaris.c @@ -113,14 +113,14 @@ int os_set_nonblocking(int fd) */ int os_set_reuseaddr(int fd) { - size_t opt = 1; + unsigned int opt = 1; return (0 == setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (const char*) &opt, sizeof(opt))); } int os_set_sockbufs(int fd, unsigned int size) { - size_t opt = size; + unsigned int opt = size; return (0 == setsockopt(fd, SOL_SOCKET, SO_RCVBUF, (const char*) &opt, sizeof(opt)) && 0 == setsockopt(fd, SOL_SOCKET, SO_SNDBUF, @@ -176,7 +176,7 @@ IOResult os_recvfrom_nonb(int fd, char* buf, unsigned int length, unsigned int* length_out, struct sockaddr_in* sin_out) { int res; - size_t len = sizeof(struct sockaddr_in); + unsigned int len = sizeof(struct sockaddr_in); assert(0 != buf); assert(0 != length_out); assert(0 != sin_out); diff --git a/ircd/packet.c b/ircd/packet.c index e167f79..35b5cff 100644 --- a/ircd/packet.c +++ b/ircd/packet.c @@ -30,7 +30,7 @@ #include -static void update_bytes_received(struct Client* cptr, size_t length) +static void update_bytes_received(struct Client* cptr, unsigned int length) { me.receiveB += length; /* Update bytes received */ cptr->receiveB += length; @@ -113,7 +113,7 @@ int server_dopacket(struct Client* cptr, const char* buffer, int length) /* * client_dopacket - handle client messages */ -int client_dopacket(struct Client *cptr, size_t length) +int client_dopacket(struct Client *cptr, unsigned int length) { assert(0 != cptr); diff --git a/ircd/res.c b/ircd/res.c index aa34071..2f824b2 100644 --- a/ircd/res.c +++ b/ircd/res.c @@ -61,17 +61,23 @@ #define MAXPACKET 1024 /* rfc sez 512 but we expand names so ... */ #define RES_MAXALIASES 35 /* maximum aliases allowed */ #define RES_MAXADDRS 35 /* maximum addresses allowed */ +/* + * OSF1 doesn't have RES_NOALIASES + */ +#ifndef RES_NOALIASES +#define RES_NOALIASES 0 +#endif /* * macros used to calulate offsets into fixed query buffer */ -#define ALIAS_BLEN (size_t) ((RES_MAXALIASES + 1) * sizeof(char*)) -#define ADDRS_BLEN (size_t) ((RES_MAXADDRS + 1) * sizeof(struct in_addr*)) +#define ALIAS_BLEN ((RES_MAXALIASES + 1) * sizeof(char*)) +#define ADDRS_BLEN ((RES_MAXADDRS + 1) * sizeof(struct in_addr*)) -#define ADDRS_OFFSET (size_t) (ALIAS_BLEN + ADDRS_BLEN) -#define ADDRS_DLEN (size_t) (RES_MAXADDRS * sizeof(struct in_addr)) -#define NAMES_OFFSET (size_t) (ADDRS_OFFSET + ADDRS_DLEN) -#define MAXGETHOSTLEN (size_t) (NAMES_OFFSET + MAXPACKET) +#define ADDRS_OFFSET (ALIAS_BLEN + ADDRS_BLEN) +#define ADDRS_DLEN (RES_MAXADDRS * sizeof(struct in_addr)) +#define NAMES_OFFSET (ADDRS_OFFSET + ADDRS_DLEN) +#define MAXGETHOSTLEN (NAMES_OFFSET + MAXPACKET) #define AR_TTL 600 /* TTL in seconds for dns cache entries */ @@ -86,10 +92,10 @@ * should be named, so for now, we'll just name them this way. * we probably should look at what named calls them or something. */ -#define TYPE_SIZE (size_t) 2 -#define CLASS_SIZE (size_t) 2 -#define TTL_SIZE (size_t) 4 -#define RDLENGTH_SIZE (size_t) 2 +#define TYPE_SIZE 2 +#define CLASS_SIZE 2 +#define TTL_SIZE 4 +#define RDLENGTH_SIZE 2 #define ANSWER_FIXED_SIZE (TYPE_SIZE + CLASS_SIZE + TTL_SIZE + RDLENGTH_SIZE) /* @@ -367,7 +373,7 @@ void restart_resolver(void) * add_local_domain - Add the domain to hostname, if it is missing * (as suggested by eps@TOASTER.SFSU.EDU) */ -void add_local_domain(char* hname, size_t size) +void add_local_domain(char* hname, unsigned int size) { assert(0 != hname); /* @@ -375,7 +381,7 @@ void add_local_domain(char* hname, size_t size) */ if ((_res.options & RES_DEFNAMES) && !strchr(hname, '.')) { if (_res.defdname[0]) { - size_t len = strlen(hname); + unsigned len = strlen(hname); if ((strlen(_res.defdname) + len + 2) < size) { hname[len++] = '.'; strcpy(hname + len, _res.defdname); @@ -1722,13 +1728,13 @@ int m_dns(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) return 0; } -unsigned long cres_mem(struct Client* sptr) +size_t cres_mem(struct Client* sptr) { struct CacheEntry* entry; struct ResRequest* request; size_t cache_mem = 0; - int cache_count = 0; size_t request_mem = 0; + int cache_count = 0; int request_count = 0; for (entry = cacheTop; entry; entry = entry->list_next) { diff --git a/ircd/s_auth.c b/ircd/s_auth.c index acb2663..58ca8a1 100644 --- a/ircd/s_auth.c +++ b/ircd/s_auth.c @@ -64,8 +64,8 @@ * this replaces the original sendheader macros */ static struct { - const char* message; - size_t length; + const char* message; + unsigned int length; } HeaderMessages [] = { /* 123456789012345678901234567890123456789012345678901234567890 */ { "NOTICE AUTH :*** Looking up your hostname\r\n", 43 }, @@ -604,7 +604,7 @@ void send_auth_query(struct AuthRequest* auth) struct sockaddr_in us; struct sockaddr_in them; char authbuf[32]; - size_t count; + unsigned int count; assert(0 != auth); assert(0 != auth->client); @@ -635,8 +635,8 @@ void send_auth_query(struct AuthRequest* auth) */ void read_auth_reply(struct AuthRequest* auth) { - char* username = 0; - size_t len; + char* username = 0; + unsigned int len; /* * rfc1453 sez we MUST accept 512 bytes */ diff --git a/ircd/s_bsd.c b/ircd/s_bsd.c index 7860bc9..8a78e70 100644 --- a/ircd/s_bsd.c +++ b/ircd/s_bsd.c @@ -300,9 +300,9 @@ static int connect_inet(struct ConfItem* aconf, struct Client* cptr) * net.loads today anyway. Commented out the alarms to save cpu. * --Run */ -size_t deliver_it(struct Client *cptr, const char *str, size_t len) +unsigned int deliver_it(struct Client *cptr, const char *str, unsigned int len) { - size_t bytes_written = 0; + unsigned int bytes_written = 0; assert(0 != cptr); switch (os_send_nonb(cptr->fd, str, len, &bytes_written)) { @@ -650,8 +650,8 @@ void add_connection(struct Listener* listener, int fd) */ static int read_packet(struct Client *cptr, int socket_ready) { - size_t dolen = 0; - size_t length = 0; + unsigned int dolen = 0; + unsigned int length = 0; if (socket_ready && !(IsUser(cptr) && DBufLength(&cptr->recvQ) > CLIENT_FLOOD)) { switch (os_recv_nonb(cptr->fd, readbuf, sizeof(readbuf), &length)) { @@ -857,7 +857,7 @@ int read_message(time_t delay) int read_ready; int write_ready; - unsigned long timeout; + unsigned int timeout; for ( ; ; ) { pfd_count = 0; @@ -1050,7 +1050,7 @@ int read_message(time_t delay) int nfds; struct timeval wait; time_t delay2 = delay; - unsigned long usec = 0; + unsigned int usec = 0; int res = 0; int length; int i; diff --git a/ircd/s_conf.c b/ircd/s_conf.c index b054781..53baa8e 100644 --- a/ircd/s_conf.c +++ b/ircd/s_conf.c @@ -78,8 +78,8 @@ struct tm motd_tm; */ static int is_comment(const char *comment) { - size_t i; - size_t len = strlen(comment); + unsigned int i; + unsigned int len = strlen(comment); for (i = 0; i < len; ++i) { if (!IsKTimeChar(comment[i])) return 1; @@ -437,8 +437,8 @@ static int validate_hostent(struct hostent* hp) const char* hname; for (hname = hp->h_name; hname; hname = hp->h_aliases[i++]) { - size_t fullnamelen = 0; - size_t label_count = 0; + unsigned int fullnamelen = 0; + unsigned int label_count = 0; ircd_strncpy(fullname, hname, HOSTLEN); fullname[HOSTLEN] = '\0'; @@ -1383,8 +1383,8 @@ int find_kill(struct Client *cptr) * whee :) * XXX - if this ever happens, we're already screwed */ - if (strlen(host) > (size_t)HOSTLEN || - (name ? strlen(name) : 0) > (size_t)HOSTLEN) + if (strlen(host) > HOSTLEN || + (name ? strlen(name) : 0) > HOSTLEN) return (0); #endif diff --git a/ircd/s_user.c b/ircd/s_user.c index c6e195f..495e0c2 100644 --- a/ircd/s_user.c +++ b/ircd/s_user.c @@ -151,7 +151,7 @@ int user_set_away(struct User* user, char* message) /* * Marking as away */ - size_t len = strlen(message); + unsigned int len = strlen(message); if (len > TOPICLEN) { message[TOPICLEN] = '\0'; @@ -842,7 +842,7 @@ int set_nick_name(struct Client* cptr, struct Client* sptr, void add_target(struct Client *sptr, void *target) { unsigned char *p; - unsigned int tmp = ((size_t)target & 0xffff00) >> 8; + unsigned int tmp = ((size_t) target & 0xffff00) >> 8; unsigned char hash = (tmp * tmp) >> 12; if (sptr->targets[0] == hash) /* Last person that we messaged ourself? */ return; diff --git a/ircd/send.c b/ircd/send.c index 9920407..787eeae 100644 --- a/ircd/send.c +++ b/ircd/send.c @@ -151,7 +151,7 @@ void send_queued(struct Client *to) return; /* Don't bother */ while (DBufLength(&to->sendQ) > 0) { - size_t len; + unsigned int len; const char* msg = dbuf_map(&to->sendQ, &len); if ((len = deliver_it(to, msg, len))) { @@ -191,7 +191,7 @@ static void send_to_god(struct Client* to, const char* buf) { if (!sdbflag && !IsUser(to)) { char sbuf2[BUFSIZE + 1]; - size_t len = strlen(buf) - 2; /* Remove "\r\n" */ + unsigned int len = strlen(buf) - 2; /* Remove "\r\n" */ sdbflag = 1; len = IRCD_MIN(len, BUFSIZE); @@ -213,7 +213,7 @@ static void send_to_god(struct Client* to, const char* buf) void send_buffer(struct Client* to, char* buf) { - size_t len; + unsigned int len; assert(0 != to); assert(0 != buf); @@ -639,7 +639,8 @@ void sendto_channel_butserv(struct Channel *chptr, struct Client *from, const ch va_start(vl, pattern); for (member = chptr->members; member; member = member->next_member) { - if (MyConnect(acptr = member->user) && !IsZombie(member)) + acptr = member->user; + if (MyConnect(acptr) && !IsZombie(member)) vsendto_prefix_one(acptr, from, pattern, vl); } va_end(vl); diff --git a/ircd/sprintf_irc.c b/ircd/sprintf_irc.c index 59e5218..6fce6c8 100644 --- a/ircd/sprintf_irc.c +++ b/ircd/sprintf_irc.c @@ -294,7 +294,8 @@ char *vsprintf_irc(char *str, const char *format, va_list vl) [ 100000000 , 4294967295 ] Actually prints like "%09lu" */ { - unsigned long v1, v2; + unsigned long v1; + unsigned long v2; const char *ap; ++format; v1 = va_arg(vl, unsigned long); diff --git a/ircd/uping.c b/ircd/uping.c index a7dc45f..b12fdcb 100644 --- a/ircd/uping.c +++ b/ircd/uping.c @@ -159,7 +159,7 @@ int uping_init(void) void polludp(int udpfd) { struct sockaddr_in from; - size_t len = 0; + unsigned int len = 0; static time_t last = 0; static int counter = 0; char buf[BUFSIZE + 1]; diff --git a/ircd/whowas.c b/ircd/whowas.c index ee00500..c2caf4a 100644 --- a/ircd/whowas.c +++ b/ircd/whowas.c @@ -259,24 +259,28 @@ void count_whowas_memory(int *wwu, size_t *wwum, int *wwa, size_t *wwam) { struct Whowas *tmp; int i; - int u = 0, a = 0; - size_t um = 0, am = 0; + int u = 0; + int a = 0; + size_t um = 0; + size_t am = 0; + assert(0 != wwu); + assert(0 != wwum); + assert(0 != wwa); + assert(0 != wwam); - for (i = 0, tmp = whowas; i < NICKNAMEHISTORYLENGTH; i++, tmp++) - if (tmp->hashv != WHOWAS_UNUSED) - { + for (i = 0, tmp = whowas; i < NICKNAMEHISTORYLENGTH; i++, tmp++) { + if (tmp->hashv != WHOWAS_UNUSED) { u++; um += (strlen(tmp->name) + 1); um += (strlen(tmp->username) + 1); um += (strlen(tmp->hostname) + 1); um += (strlen(tmp->servername) + 1); - if (tmp->away) - { + if (tmp->away) { a++; am += (strlen(tmp->away) + 1); } } - + } *wwu = u; *wwum = um; *wwa = a;