diff --git a/bandb/bandb.c b/bandb/bandb.c index 2d272a1f..3b3ab8cc 100644 --- a/bandb/bandb.c +++ b/bandb/bandb.c @@ -255,7 +255,7 @@ dummy_handler(int sig) #endif static void -setup_signals() +setup_signals(void) { #ifndef WINDOWS struct sigaction act; @@ -298,7 +298,7 @@ int main(int argc, char *argv[]) { setup_signals(); - bandb_helper = rb_helper_child(parse_request, error_cb, NULL, NULL, NULL, 256, 256, 256, 256); /* XXX fix me */ + bandb_helper = rb_helper_child(parse_request, error_cb, NULL, NULL, NULL, 256, 256, 256); /* XXX fix me */ if(bandb_helper == NULL) { fprintf(stderr, diff --git a/bandb/bantool.c b/bandb/bantool.c index e43c0f8f..3bebb596 100644 --- a/bandb/bantool.c +++ b/bandb/bantool.c @@ -255,10 +255,10 @@ main(int argc, char *argv[]) if(flag.import) { if(count.error && flag.verbose) - fprintf(stderr, "* I was unable to locate %i config files to import.\n", + fprintf(stderr, "* I was unable to locate %u config files to import.\n", count.error); - fprintf(stdout, "* Import Stats: Klines: %i, Dlines: %i, Xlines: %i, Resvs: %i \n", + fprintf(stdout, "* Import Stats: Klines: %u, Dlines: %u, Xlines: %u, Resvs: %u \n", count.klines, count.dlines, count.xlines, count.resvs); fprintf(stdout, diff --git a/bandb/rsdb_sqlite3.c b/bandb/rsdb_sqlite3.c index 77903200..77898e82 100644 --- a/bandb/rsdb_sqlite3.c +++ b/bandb/rsdb_sqlite3.c @@ -120,7 +120,7 @@ static int rsdb_callback_func(void *cbfunc, int argc, char **argv, char **colnames) { rsdb_callback cb = (rsdb_callback)((uintptr_t)cbfunc); - (cb) (argc, (const char **)argv); + (cb) (argc, (const char **)(void *)argv); return 0; } diff --git a/extensions/ip_cloaking.c b/extensions/ip_cloaking.c index 3d13fb18..8aa872c6 100644 --- a/extensions/ip_cloaking.c +++ b/extensions/ip_cloaking.c @@ -141,7 +141,7 @@ do_host_cloak_host(const char *inbuf, char *outbuf) if (*tptr == '.') break; - if (isdigit(*tptr) || *tptr == '-') + if (isdigit((unsigned char)*tptr) || *tptr == '-') continue; *tptr = b26_alphabet[(*tptr + accum) % 26]; @@ -153,7 +153,7 @@ do_host_cloak_host(const char *inbuf, char *outbuf) /* pass 2: scramble each number in the address */ for (tptr = outbuf; *tptr != '\0'; tptr++) { - if (isdigit(*tptr)) + if (isdigit((unsigned char)*tptr)) *tptr = '0' + (*tptr + accum) % 10; accum = (accum << 1) | (accum >> 31); diff --git a/extensions/ip_cloaking_3.0.c b/extensions/ip_cloaking_3.0.c index 57c2ce30..627bd366 100644 --- a/extensions/ip_cloaking_3.0.c +++ b/extensions/ip_cloaking_3.0.c @@ -151,7 +151,7 @@ do_host_cloak_host(const char *inbuf, char *outbuf) if (*tptr == '.') break; - if (isdigit(*tptr) || *tptr == '-') + if (isdigit((unsigned char)*tptr) || *tptr == '-') continue; *tptr = b26_alphabet[(*tptr * accum) % 26]; @@ -160,7 +160,7 @@ do_host_cloak_host(const char *inbuf, char *outbuf) /* pass 2: scramble each number in the address */ for (tptr = outbuf; *tptr != '\0'; tptr++) { - if (isdigit(*tptr)) + if (isdigit((unsigned char)*tptr)) { *tptr = 48 + ((*tptr * accum) % 10); } diff --git a/extensions/ip_cloaking_4.0.c b/extensions/ip_cloaking_4.0.c index 82fdad95..df9a4117 100644 --- a/extensions/ip_cloaking_4.0.c +++ b/extensions/ip_cloaking_4.0.c @@ -141,7 +141,7 @@ do_host_cloak_host(const char *inbuf, char *outbuf) if (*tptr == '.') break; - if (isdigit(*tptr) || *tptr == '-') + if (isdigit((unsigned char)*tptr) || *tptr == '-') continue; *tptr = b26_alphabet[(*tptr + accum) % 26]; @@ -153,7 +153,7 @@ do_host_cloak_host(const char *inbuf, char *outbuf) /* pass 2: scramble each number in the address */ for (tptr = outbuf; *tptr != '\0'; tptr++) { - if (isdigit(*tptr)) + if (isdigit((unsigned char)*tptr)) *tptr = '0' + (*tptr + accum) % 10; accum = (accum << 1) | (accum >> 31); diff --git a/extensions/ip_cloaking_old.c b/extensions/ip_cloaking_old.c index f33ee46b..80b6807d 100644 --- a/extensions/ip_cloaking_old.c +++ b/extensions/ip_cloaking_old.c @@ -71,7 +71,7 @@ distribute_hostchange(struct Client *client_p, char *newhost) static void do_host_cloak(const char *inbuf, char *outbuf, int ipmask) { - int cyc; + unsigned int cyc; unsigned int hosthash = 1, hosthash2 = 1; unsigned int maxcycle = strlen(inbuf); int len1; diff --git a/include/hostmask.h b/include/hostmask.h index 2a7878b9..4a265aa6 100644 --- a/include/hostmask.h +++ b/include/hostmask.h @@ -36,7 +36,7 @@ enum #endif }; -int parse_netmask(const char *, struct sockaddr *, int *); +int parse_netmask(const char *, struct rb_sockaddr_storage *, int *); struct ConfItem *find_conf_by_address(const char *host, const char *sockhost, const char *orighost, struct sockaddr *, int, int, const char *, const char *); diff --git a/include/s_conf.h b/include/s_conf.h index 3f4d69f5..42d34633 100644 --- a/include/s_conf.h +++ b/include/s_conf.h @@ -350,7 +350,7 @@ extern int detach_conf(struct Client *); extern struct ConfItem *find_tkline(const char *, const char *, struct sockaddr *); extern char *show_iline_prefix(struct Client *, struct ConfItem *, char *); extern void get_printable_conf(struct ConfItem *, - char **, char **, char **, char **, int *, char **); + char **, char **, const char **, char **, int *, char **); extern char *get_user_ban_reason(struct ConfItem *aconf); extern void get_printable_kline(struct Client *, struct ConfItem *, char **, char **, char **, char **); diff --git a/include/s_user.h b/include/s_user.h index 137119b8..0c39ec5e 100644 --- a/include/s_user.h +++ b/include/s_user.h @@ -38,7 +38,7 @@ extern int valid_hostname(const char *hostname); extern int valid_username(const char *username); extern int user_mode(struct Client *, struct Client *, int, const char **); -extern void send_umode(struct Client *, struct Client *, int, int, char *); +extern void send_umode(struct Client *, struct Client *, int, char *); extern void send_umode_out(struct Client *, struct Client *, int); extern int show_lusers(struct Client *source_p); extern int register_local_user(struct Client *, struct Client *, const char *); diff --git a/libratbox/include/ratbox_lib.h b/libratbox/include/ratbox_lib.h index 85c84030..ac91f476 100644 --- a/libratbox/include/ratbox_lib.h +++ b/libratbox/include/ratbox_lib.h @@ -124,7 +124,7 @@ char *rb_strerror(int error); #else #define slrb_assert(expr) do \ if(rb_unlikely(!(expr))) { \ - rb_lib_log(L_MAIN, \ + rb_lib_log( \ "file: %s line: %d: Assertion failed: (%s)", \ __FILE__, __LINE__, #expr); \ } \ diff --git a/libratbox/include/rb_helper.h b/libratbox/include/rb_helper.h index 246438c0..3287e8d9 100644 --- a/libratbox/include/rb_helper.h +++ b/libratbox/include/rb_helper.h @@ -41,7 +41,7 @@ rb_helper *rb_helper_start(const char *name, const char *fullpath, rb_helper_cb rb_helper *rb_helper_child(rb_helper_cb * read_cb, rb_helper_cb * error_cb, log_cb * ilog, restart_cb * irestart, die_cb * idie, - int maxcon, size_t lb_heap_size, size_t dh_size, size_t fd_heap_size); + size_t lb_heap_size, size_t dh_size, size_t fd_heap_size); void rb_helper_restart(rb_helper *helper); #ifdef __GNUC__ diff --git a/libratbox/src/commio.c b/libratbox/src/commio.c index 3ba0974a..1c8b2616 100644 --- a/libratbox/src/commio.c +++ b/libratbox/src/commio.c @@ -1514,7 +1514,7 @@ inet_pton6(const char *src, unsigned char *dst) curtok = src; saw_xdigit = 0; val = 0; - while((ch = tolower(*src++)) != '\0') + while((ch = tolower((unsigned char)*src++)) != '\0') { const char *pch; diff --git a/libratbox/src/helper.c b/libratbox/src/helper.c index 91e83d99..5e9c98c4 100644 --- a/libratbox/src/helper.c +++ b/libratbox/src/helper.c @@ -42,7 +42,7 @@ struct _rb_helper /* setup all the stuff a new child needs */ rb_helper * rb_helper_child(rb_helper_cb * read_cb, rb_helper_cb * error_cb, log_cb * ilog, - restart_cb * irestart, die_cb * idie, int maxcon, size_t lb_heap_size, + restart_cb * irestart, die_cb * idie, size_t lb_heap_size, size_t dh_size, size_t fd_heap_size) { rb_helper *helper; diff --git a/libratbox/src/patricia.c b/libratbox/src/patricia.c index b662fc1e..cf0dd31e 100644 --- a/libratbox/src/patricia.c +++ b/libratbox/src/patricia.c @@ -399,7 +399,7 @@ rb_patricia_search_exact(rb_patricia_tree_t *patricia, rb_prefix_t *prefix) prefix_toa(node->prefix), node->prefix->bitlen); else fprintf(stderr, - "patricia_search_exact: take right at %d\n", node->bit); + "patricia_search_exact: take right at %u\n", node->bit); #endif /* PATRICIA_DEBUG */ node = node->r; } @@ -412,7 +412,7 @@ rb_patricia_search_exact(rb_patricia_tree_t *patricia, rb_prefix_t *prefix) prefix_toa(node->prefix), node->prefix->bitlen); else fprintf(stderr, - "patricia_search_exact: take left at %d\n", node->bit); + "patricia_search_exact: take left at %u\n", node->bit); #endif /* PATRICIA_DEBUG */ node = node->l; } @@ -423,10 +423,10 @@ rb_patricia_search_exact(rb_patricia_tree_t *patricia, rb_prefix_t *prefix) #ifdef PATRICIA_DEBUG if(node->prefix) - fprintf(stderr, "patricia_search_exact: stop at %s/%d %d\n", + fprintf(stderr, "patricia_search_exact: stop at %s/%d %u\n", prefix_toa(node->prefix), node->prefix->bitlen, node->bit); else - fprintf(stderr, "patricia_search_exact: stop at %d\n", node->bit); + fprintf(stderr, "patricia_search_exact: stop at %u\n", node->bit); #endif /* PATRICIA_DEBUG */ if(node->bit > bitlen || node->prefix == NULL) return (NULL); @@ -486,7 +486,7 @@ rb_patricia_search_best2(rb_patricia_tree_t *patricia, rb_prefix_t *prefix, int prefix_toa(node->prefix), node->prefix->bitlen); else fprintf(stderr, - "patricia_search_best: take right at %d\n", node->bit); + "patricia_search_best: take right at %u\n", node->bit); #endif /* PATRICIA_DEBUG */ node = node->r; } @@ -499,7 +499,7 @@ rb_patricia_search_best2(rb_patricia_tree_t *patricia, rb_prefix_t *prefix, int prefix_toa(node->prefix), node->prefix->bitlen); else fprintf(stderr, - "patricia_search_best: take left at %d\n", node->bit); + "patricia_search_best: take left at %u\n", node->bit); #endif /* PATRICIA_DEBUG */ node = node->l; } @@ -518,7 +518,7 @@ rb_patricia_search_best2(rb_patricia_tree_t *patricia, rb_prefix_t *prefix, int fprintf(stderr, "patricia_search_best: stop at %s/%d\n", prefix_toa(node->prefix), node->prefix->bitlen); else - fprintf(stderr, "patricia_search_best: stop at %d\n", node->bit); + fprintf(stderr, "patricia_search_best: stop at %u\n", node->bit); #endif /* PATRICIA_DEBUG */ if(cnt <= 0) @@ -601,7 +601,7 @@ rb_patricia_lookup(rb_patricia_tree_t *patricia, rb_prefix_t *prefix) "patricia_lookup: take right %s/%d\n", prefix_toa(node->prefix), node->prefix->bitlen); else - fprintf(stderr, "patricia_lookup: take right at %d\n", node->bit); + fprintf(stderr, "patricia_lookup: take right at %u\n", node->bit); #endif /* PATRICIA_DEBUG */ node = node->r; } @@ -615,7 +615,7 @@ rb_patricia_lookup(rb_patricia_tree_t *patricia, rb_prefix_t *prefix) "patricia_lookup: take left %s/%d\n", prefix_toa(node->prefix), node->prefix->bitlen); else - fprintf(stderr, "patricia_lookup: take left at %d\n", node->bit); + fprintf(stderr, "patricia_lookup: take left at %u\n", node->bit); #endif /* PATRICIA_DEBUG */ node = node->l; } @@ -654,7 +654,7 @@ rb_patricia_lookup(rb_patricia_tree_t *patricia, rb_prefix_t *prefix) if(differ_bit > check_bit) differ_bit = check_bit; #ifdef PATRICIA_DEBUG - fprintf(stderr, "patricia_lookup: differ_bit %d\n", differ_bit); + fprintf(stderr, "patricia_lookup: differ_bit %u\n", differ_bit); #endif /* PATRICIA_DEBUG */ parent = node->parent; @@ -667,7 +667,7 @@ rb_patricia_lookup(rb_patricia_tree_t *patricia, rb_prefix_t *prefix) fprintf(stderr, "patricia_lookup: up to %s/%d\n", prefix_toa(node->prefix), node->prefix->bitlen); else - fprintf(stderr, "patricia_lookup: up to %d\n", node->bit); + fprintf(stderr, "patricia_lookup: up to %u\n", node->bit); #endif /* PATRICIA_DEBUG */ } diff --git a/libratbox/src/ports.c b/libratbox/src/ports.c index 5bbad0bb..505ff481 100644 --- a/libratbox/src/ports.c +++ b/libratbox/src/ports.c @@ -124,7 +124,7 @@ int rb_select_ports(long delay) { int i, fd; - int nget = 1; + unsigned int nget = 1; struct timespec poll_time; struct timespec *p = NULL; struct ev_entry *ev; @@ -143,7 +143,7 @@ rb_select_ports(long delay) if(i == -1) return RB_OK; - for(i = 0; i < nget; i++) + for(i = 0; (unsigned)i < nget; i++) { if(pelst[i].portev_source == PORT_SOURCE_FD) { diff --git a/libratbox/src/snprintf.c b/libratbox/src/snprintf.c index 1c616620..d2b7cfba 100644 --- a/libratbox/src/snprintf.c +++ b/libratbox/src/snprintf.c @@ -32,7 +32,7 @@ skip_atoi(const char **s) { int i = 0; - while(isdigit(**s)) + while(isdigit((unsigned char)**s)) i = i * 10 + *((*s)++) - '0'; return i; } @@ -373,7 +373,7 @@ rb_vsnprintf(char *buf, size_t size, const char *fmt, va_list args) /* get field width */ field_width = -1; - if(isdigit(*fmt)) + if(isdigit((unsigned char)*fmt)) field_width = skip_atoi(&fmt); else if(*fmt == '*') { @@ -392,7 +392,7 @@ rb_vsnprintf(char *buf, size_t size, const char *fmt, va_list args) if(*fmt == '.') { ++fmt; - if(isdigit(*fmt)) + if(isdigit((unsigned char)*fmt)) precision = skip_atoi(&fmt); else if(*fmt == '*') { diff --git a/modules/m_dline.c b/modules/m_dline.c index 98d51fce..a4bc9887 100644 --- a/modules/m_dline.c +++ b/modules/m_dline.c @@ -223,7 +223,7 @@ apply_dline(struct Client *source_p, const char *dlhost, int tdline_time, char * int t = AF_INET, ty, b; const char *creason; - ty = parse_netmask(dlhost, (struct sockaddr *) &daddr, &b); + ty = parse_netmask(dlhost, &daddr, &b); if(ty == HM_HOST) { sendto_one(source_p, ":%s NOTICE %s :Invalid D-Line", me.name, source_p->name); diff --git a/modules/m_kline.c b/modules/m_kline.c index ff034d8d..a47939d4 100644 --- a/modules/m_kline.c +++ b/modules/m_kline.c @@ -724,7 +724,7 @@ already_placed_kline(struct Client *source_p, const char *luser, const char *lho if(aconf == NULL && ConfigFileEntry.non_redundant_klines) { bits = 0; - if((t = parse_netmask(lhost, (struct sockaddr *) &iphost, &bits)) != HM_HOST) + if((t = parse_netmask(lhost, &iphost, &bits)) != HM_HOST) { #ifdef RB_IPV6 if(t == HM_IPV6) diff --git a/modules/m_privs.c b/modules/m_privs.c index f6a32891..65cbbf7d 100644 --- a/modules/m_privs.c +++ b/modules/m_privs.c @@ -58,7 +58,7 @@ mapi_clist_av1 privs_clist[] = { struct mode_table { const char *name; - int mode; + unsigned int mode; }; /* there is no such table like this anywhere else */ diff --git a/modules/m_stats.c b/modules/m_stats.c index f61e4885..44c2e15c 100644 --- a/modules/m_stats.c +++ b/modules/m_stats.c @@ -412,7 +412,8 @@ stats_deny (struct Client *source_p) static void stats_exempt(struct Client *source_p) { - char *name, *host, *pass, *user, *classname; + char *name, *host, *user, *classname; + const char *pass; struct AddressRec *arec; struct ConfItem *aconf; int i, port; @@ -523,7 +524,8 @@ stats_auth (struct Client *source_p) else if((ConfigFileEntry.stats_i_oper_only == 1) && !IsOper (source_p)) { struct ConfItem *aconf; - char *name, *host, *pass = "*", *user, *classname; + char *name, *host, *user, *classname; + const char *pass = "*"; int port; if(MyConnect (source_p)) diff --git a/modules/m_svinfo.c b/modules/m_svinfo.c index 1adc81da..a8e2dffa 100644 --- a/modules/m_svinfo.c +++ b/modules/m_svinfo.c @@ -57,7 +57,7 @@ DECLARE_MODULE_AV1(svinfo, NULL, NULL, svinfo_clist, NULL, NULL, "$Revision: 494 static int ms_svinfo(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { - signed int deltat; + signed long deltat; time_t theirtime; char squitreason[120]; @@ -82,20 +82,20 @@ ms_svinfo(struct Client *client_p, struct Client *source_p, int parc, const char */ rb_set_time(); theirtime = atol(parv[4]); - deltat = abs(theirtime - rb_current_time()); + deltat = labs(theirtime - rb_current_time()); if(deltat > ConfigFileEntry.ts_max_delta) { sendto_realops_snomask(SNO_GENERAL, L_ALL, "Link %s dropped, excessive TS delta" - " (my TS=%ld, their TS=%ld, delta=%d)", + " (my TS=%ld, their TS=%ld, delta=%ld)", source_p->name, (long) rb_current_time(), (long) theirtime, deltat); ilog(L_SERVER, "Link %s dropped, excessive TS delta" - " (my TS=%ld, their TS=%ld, delta=%d)", + " (my TS=%ld, their TS=%ld, delta=%ld)", log_client_name(source_p, SHOW_IP), (long) rb_current_time(), (long) theirtime, deltat); - rb_snprintf(squitreason, sizeof squitreason, "Excessive TS delta (my TS=%ld, their TS=%ld, delta=%d)", + rb_snprintf(squitreason, sizeof squitreason, "Excessive TS delta (my TS=%ld, their TS=%ld, delta=%ld)", (long) rb_current_time(), (long) theirtime, deltat); disable_server_conf_autoconn(source_p->name); exit_client(source_p, source_p, source_p, squitreason); @@ -106,7 +106,7 @@ ms_svinfo(struct Client *client_p, struct Client *source_p, int parc, const char { sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, "Link %s notable TS delta" - " (my TS=%ld, their TS=%ld, delta=%d)", + " (my TS=%ld, their TS=%ld, delta=%ld)", source_p->name, (long) rb_current_time(), (long) theirtime, deltat); } diff --git a/modules/m_testline.c b/modules/m_testline.c index 63ee1a3f..c74edd63 100644 --- a/modules/m_testline.c +++ b/modules/m_testline.c @@ -120,7 +120,7 @@ mo_testline(struct Client *client_p, struct Client *source_p, int parc, const ch host = mask; /* parses as an IP, check for a dline */ - if((type = parse_netmask(host, (struct sockaddr *)&ip, &host_mask)) != HM_HOST) + if((type = parse_netmask(host, &ip, &host_mask)) != HM_HOST) { #ifdef RB_IPV6 if(type == HM_IPV6) diff --git a/modules/m_version.c b/modules/m_version.c index f19e8fb4..be97edfe 100644 --- a/modules/m_version.c +++ b/modules/m_version.c @@ -36,7 +36,7 @@ #include "parse.h" #include "modules.h" -static char *confopts(struct Client *source_p); +static char *confopts(void); static int m_version(struct Client *, struct Client *, int, const char **); static int mo_version(struct Client *, struct Client *, int, const char **); @@ -79,7 +79,7 @@ m_version(struct Client *client_p, struct Client *source_p, int parc, const char #ifdef CUSTOM_BRANDING PACKAGE_NAME "-" PACKAGE_VERSION, #endif - me.name, confopts(source_p), TS_CURRENT, + me.name, confopts(), TS_CURRENT, ServerInfo.sid); show_isupport(source_p); @@ -101,7 +101,7 @@ mo_version(struct Client *client_p, struct Client *source_p, int parc, const cha #ifdef CUSTOM_BRANDING PACKAGE_NAME "-" PACKAGE_VERSION, #endif - me.name, confopts(source_p), TS_CURRENT, + me.name, confopts(), TS_CURRENT, ServerInfo.sid); show_isupport(source_p); } @@ -110,12 +110,12 @@ mo_version(struct Client *client_p, struct Client *source_p, int parc, const cha } /* confopts() - * input - client pointer + * input - none * output - ircd.conf option string * side effects - none */ static char * -confopts(struct Client *source_p) +confopts(void) { static char result[15]; char *p; diff --git a/src/bandbi.c b/src/bandbi.c index 03dd9076..1e713220 100644 --- a/src/bandbi.c +++ b/src/bandbi.c @@ -221,7 +221,7 @@ bandb_check_kline(struct ConfItem *aconf) int aftype; const char *p; - aftype = parse_netmask(aconf->host, (struct sockaddr *)&daddr, NULL); + aftype = parse_netmask(aconf->host, &daddr, NULL); if(aftype != HM_HOST) { @@ -260,10 +260,9 @@ static int bandb_check_dline(struct ConfItem *aconf) { struct rb_sockaddr_storage daddr; -/* struct ConfItem *dconf; */ int bits; - if(!parse_netmask(aconf->host, (struct sockaddr *)&daddr, &bits)) + if(!parse_netmask(aconf->host, &daddr, &bits)) return 0; return 1; diff --git a/src/hostmask.c b/src/hostmask.c index b78fd77c..864cbf93 100644 --- a/src/hostmask.c +++ b/src/hostmask.c @@ -48,7 +48,7 @@ static unsigned long hash_ipv4(struct sockaddr *, int); * Side effects: None */ int -parse_netmask(const char *text, struct sockaddr *naddr, int *nb) +parse_netmask(const char *text, struct rb_sockaddr_storage *naddr, int *nb) { char *ip = LOCAL_COPY(text); char *ptr; @@ -60,9 +60,9 @@ parse_netmask(const char *text, struct sockaddr *naddr, int *nb) b = nb; if(naddr == NULL) - addr = (struct rb_sockaddr_storage *)&xaddr; + addr = &xaddr; else - addr = (struct rb_sockaddr_storage *)naddr; + addr = naddr; if(strpbrk(ip, "*?") != NULL) { @@ -126,7 +126,7 @@ init_host_hash(void) static unsigned long hash_ipv4(struct sockaddr *saddr, int bits) { - struct sockaddr_in *addr = (struct sockaddr_in *) saddr; + struct sockaddr_in *addr = (struct sockaddr_in *)(void *)saddr; if(bits != 0) { @@ -146,7 +146,7 @@ hash_ipv4(struct sockaddr *saddr, int bits) static unsigned long hash_ipv6(struct sockaddr *saddr, int bits) { - struct sockaddr_in6 *addr = (struct sockaddr_in6 *) saddr; + struct sockaddr_in6 *addr = (struct sockaddr_in6 *)(void *)saddr; unsigned long v = 0, n; for (n = 0; n < 16; n++) { @@ -484,7 +484,7 @@ find_exact_conf_by_address(const char *address, int type, const char *username) if(address == NULL) address = "/NOMATCH!/"; - masktype = parse_netmask(address, (struct sockaddr *)&addr, &bits); + masktype = parse_netmask(address, &addr, &bits); #ifdef RB_IPV6 if(masktype == HM_IPV6) { @@ -541,7 +541,7 @@ add_conf_by_address(const char *address, int type, const char *username, const c if(address == NULL) address = "/NOMATCH!/"; arec = rb_malloc(sizeof(struct AddressRec)); - masktype = parse_netmask(address, (struct sockaddr *)&arec->Mask.ipa.addr, &bits); + masktype = parse_netmask(address, &arec->Mask.ipa.addr, &bits); arec->Mask.ipa.bits = bits; arec->masktype = masktype; #ifdef RB_IPV6 @@ -587,7 +587,7 @@ delete_one_address_conf(const char *address, struct ConfItem *aconf) unsigned long hv; struct AddressRec *arec, *arecl = NULL; struct rb_sockaddr_storage addr; - masktype = parse_netmask(address, (struct sockaddr *)&addr, &bits); + masktype = parse_netmask(address, &addr, &bits); #ifdef RB_IPV6 if(masktype == HM_IPV6) { @@ -741,7 +741,8 @@ show_iline_prefix(struct Client *sptr, struct ConfItem *aconf, char *name) void report_auth(struct Client *client_p) { - char *name, *host, *pass, *user, *classname; + char *name, *host, *user, *classname; + const char *pass; struct AddressRec *arec; struct ConfItem *aconf; int i, port; diff --git a/src/match.c b/src/match.c index 7f69e2f8..d06b7420 100644 --- a/src/match.c +++ b/src/match.c @@ -331,14 +331,14 @@ int comp_with_mask_sock(struct sockaddr *addr, struct sockaddr *dest, u_int mask if (addr->sa_family == AF_INET) { - iaddr = &((struct sockaddr_in *)addr)->sin_addr; - idest = &((struct sockaddr_in *)dest)->sin_addr; + iaddr = &((struct sockaddr_in *)(void *)addr)->sin_addr; + idest = &((struct sockaddr_in *)(void *)dest)->sin_addr; } #ifdef RB_IPV6 else { - iaddr = &((struct sockaddr_in6 *)addr)->sin6_addr; - idest = &((struct sockaddr_in6 *)dest)->sin6_addr; + iaddr = &((struct sockaddr_in6 *)(void *)addr)->sin6_addr; + idest = &((struct sockaddr_in6 *)(void *)dest)->sin6_addr; } #endif diff --git a/src/modules.c b/src/modules.c index 0c845a93..85da9f09 100644 --- a/src/modules.c +++ b/src/modules.c @@ -802,7 +802,7 @@ load_a_module(const char *path, int warn, int core) { case 1: { - struct mapi_mheader_av1 *mheader = (struct mapi_mheader_av1 *) mapi_version; /* see above */ + struct mapi_mheader_av1 *mheader = (struct mapi_mheader_av1 *)(void *)mapi_version; /* see above */ if(mheader->mapi_register && (mheader->mapi_register() == -1)) { ilog(L_MAIN, "Module %s indicated failure during load.", diff --git a/src/newconf.c b/src/newconf.c index 35aa2342..62bd8d79 100644 --- a/src/newconf.c +++ b/src/newconf.c @@ -1864,7 +1864,7 @@ conf_set_blacklist_matches(void *data) /* Check for validity */ if (*p == '.') type = BLACKLIST_FILTER_ALL; - else if (!isalnum(*p)) + else if (!isalnum((unsigned char)*p)) { conf_report_error("blacklist::matches has invalid IP match entry %s", str); diff --git a/src/parse.c b/src/parse.c index c382cadd..3257d482 100644 --- a/src/parse.c +++ b/src/parse.c @@ -49,7 +49,7 @@ struct Dictionary *alias_dict = NULL; /* parv[0] is not used, and parv[LAST] == NULL */ static char *para[MAXPARA + 2]; -static void cancel_clients(struct Client *, struct Client *, char *); +static void cancel_clients(struct Client *, struct Client *); static void remove_unknown(struct Client *, char *, char *); static void do_numeric(char[], struct Client *, struct Client *, int, char **); @@ -169,7 +169,7 @@ parse(struct Client *client_p, char *pbuffer, char *bufend) if(from->from != client_p) { ServerStats.is_wrdi++; - cancel_clients(client_p, from, pbuffer); + cancel_clients(client_p, from); return; } } @@ -269,7 +269,7 @@ parse(struct Client *client_p, char *pbuffer, char *bufend) return; } - if(handle_command(mptr, client_p, from, i, /* XXX discards const!!! */ (const char **)para) < -1) + if(handle_command(mptr, client_p, from, i, /* XXX discards const!!! */ (const char **)(void *)para) < -1) { char *p; for (p = pbuffer; p <= end; p += 8) @@ -489,12 +489,12 @@ report_messages(struct Client *source_p) /* cancel_clients() * * inputs - client who sent us the message, client with fake - * direction, command + * direction * outputs - a given warning about the fake direction * side effects - */ static void -cancel_clients(struct Client *client_p, struct Client *source_p, char *cmd) +cancel_clients(struct Client *client_p, struct Client *source_p) { /* ok, fake prefix happens naturally during a burst on a nick * collision with TS5, we cant kill them because one client has to diff --git a/src/privilege.c b/src/privilege.c index c082cbca..b0d8a0d2 100644 --- a/src/privilege.c +++ b/src/privilege.c @@ -29,7 +29,7 @@ #include "logger.h" #include "send.h" -static rb_dlink_list privilegeset_list = {}; +static rb_dlink_list privilegeset_list = {NULL, NULL, 0}; int privilegeset_in_set(struct PrivilegeSet *set, const char *priv) diff --git a/src/res.c b/src/res.c index c330987c..5fe6fc6d 100644 --- a/src/res.c +++ b/src/res.c @@ -552,7 +552,7 @@ static void query_name(struct reslist *request) if ((request_len = irc_res_mkquery(request->queryname, C_IN, request->type, (unsigned char *)buf, sizeof(buf))) > 0) { - HEADER *header = (HEADER *) buf; + HEADER *header = (HEADER *)(void *)buf; header->id = request->id; ++request->sends; @@ -784,7 +784,7 @@ static int res_read_single_reply(rb_fde_t *F, void *data) /* * convert DNS reply reader from Network byte order to CPU byte order. */ - header = (HEADER *) buf; + header = (HEADER *)(void *)buf; header->ancount = ntohs(header->ancount); header->qdcount = ntohs(header->qdcount); header->nscount = ntohs(header->nscount); diff --git a/src/reslib.c b/src/reslib.c index e3a643cb..c2495071 100644 --- a/src/reslib.c +++ b/src/reslib.c @@ -478,7 +478,7 @@ irc_ns_name_ntop(const char *src, char *dst, size_t dstsiz) */ static int irc_dn_comp(const char *src, unsigned char *dst, int dstsiz, - unsigned char **dnptrs, unsigned char **lastdnptr) + const unsigned char **dnptrs, const unsigned char **lastdnptr) { return(irc_ns_name_compress(src, dst, (size_t)dstsiz, (const unsigned char **)dnptrs, @@ -1145,7 +1145,7 @@ irc_res_mkquery( HEADER *hp; unsigned char *cp; int n; - unsigned char *dnptrs[20], **dpp, **lastdnptr; + const unsigned char *dnptrs[20], **dpp, **lastdnptr; /* * Initialize header fields. @@ -1153,7 +1153,7 @@ irc_res_mkquery( if ((buf == NULL) || (buflen < HFIXEDSZ)) return (-1); memset(buf, 0, HFIXEDSZ); - hp = (HEADER *) buf; + hp = (HEADER *)(void *)buf; hp->id = 0; hp->opcode = QUERY; diff --git a/src/s_conf.c b/src/s_conf.c index a4318f1b..d31b1f41 100644 --- a/src/s_conf.c +++ b/src/s_conf.c @@ -75,7 +75,7 @@ rb_dlink_list service_list; /* internally defined functions */ static void set_default_conf(void); static void validate_conf(void); -static void read_conf(FILE *); +static void read_conf(void); static void clear_out_old_conf(void); static void expire_prop_bans(void *list); @@ -818,12 +818,12 @@ set_default_conf(void) * read_conf() * * - * inputs - file descriptor pointing to config file to use + * inputs - None * output - None * side effects - Read configuration file. */ static void -read_conf(FILE * file) +read_conf(void) { lineno = 0; @@ -1280,7 +1280,7 @@ get_oper_name(struct Client *client_p) */ void get_printable_conf(struct ConfItem *aconf, char **name, char **host, - char **pass, char **user, int *port, char **classname) + const char **pass, char **user, int *port, char **classname) { static char null[] = ""; static char zero[] = "default"; @@ -1399,7 +1399,7 @@ read_conf_files(int cold) } call_hook(h_conf_read_start, NULL); - read_conf(conf_fbfile_in); + read_conf(); call_hook(h_conf_read_end, NULL); fclose(conf_fbfile_in); diff --git a/src/s_newconf.c b/src/s_newconf.c index 7ca43ad6..ae250fc3 100644 --- a/src/s_newconf.c +++ b/src/s_newconf.c @@ -291,7 +291,7 @@ find_oper_conf(const char *username, const char *host, const char *locip, const int bits, cbits; rb_dlink_node *ptr; - parse_netmask(locip, (struct sockaddr *)&cip, &cbits); + parse_netmask(locip, &cip, &cbits); RB_DLINK_FOREACH(ptr, oper_conf_list.head) { @@ -303,7 +303,7 @@ find_oper_conf(const char *username, const char *host, const char *locip, const rb_strlcpy(addr, oper_p->host, sizeof(addr)); - if(parse_netmask(addr, (struct sockaddr *)&ip, &bits) != HM_HOST) + if(parse_netmask(addr, &ip, &bits) != HM_HOST) { if(ip.ss_family == cip.ss_family && comp_with_mask_sock((struct sockaddr *)&ip, (struct sockaddr *)&cip, bits)) diff --git a/src/s_serv.c b/src/s_serv.c index fc6db9cc..cf0dd391 100644 --- a/src/s_serv.c +++ b/src/s_serv.c @@ -578,7 +578,7 @@ burst_TS6(struct Client *client_p) if(!IsPerson(target_p)) continue; - send_umode(NULL, target_p, 0, 0, ubuf); + send_umode(NULL, target_p, 0, ubuf); if(!*ubuf) { ubuf[0] = '+'; diff --git a/src/s_user.c b/src/s_user.c index 551b9e50..0e3c41b5 100644 --- a/src/s_user.c +++ b/src/s_user.c @@ -599,9 +599,9 @@ introduce_client(struct Client *client_p, struct Client *source_p, struct User * hook_data_client hdata2; if(MyClient(source_p)) - send_umode(source_p, source_p, 0, 0, ubuf); + send_umode(source_p, source_p, 0, ubuf); else - send_umode(NULL, source_p, 0, 0, ubuf); + send_umode(NULL, source_p, 0, ubuf); if(!*ubuf) { @@ -1155,7 +1155,7 @@ user_mode(struct Client *client_p, struct Client *source_p, int parc, const char * -avalon */ void -send_umode(struct Client *client_p, struct Client *source_p, int old, int sendmask, char *umode_buf) +send_umode(struct Client *client_p, struct Client *source_p, int old, char *umode_buf) { int i; int flag; @@ -1216,7 +1216,7 @@ send_umode_out(struct Client *client_p, struct Client *source_p, int old) char buf[BUFSIZE]; rb_dlink_node *ptr; - send_umode(NULL, source_p, old, 0, buf); + send_umode(NULL, source_p, old, buf); RB_DLINK_FOREACH(ptr, serv_list.head) { @@ -1231,7 +1231,7 @@ send_umode_out(struct Client *client_p, struct Client *source_p, int old) } if(client_p && MyClient(client_p)) - send_umode(client_p, source_p, old, 0, buf); + send_umode(client_p, source_p, old, buf); } /* diff --git a/src/sslproc.c b/src/sslproc.c index 4f2de979..f7d0b9c6 100644 --- a/src/sslproc.c +++ b/src/sslproc.c @@ -91,23 +91,6 @@ int32_to_buf(char *buf, int32_t x) return; } - -static inline uint16_t -buf_to_uint16(char *buf) -{ - uint16_t x; - memcpy(&x, buf, sizeof(x)); - return x; -} - -static inline void -uint16_to_buf(char *buf, uint16_t x) -{ - memcpy(buf, &x, sizeof(x)); - return; -} - - static ssl_ctl_t * allocate_ssl_daemon(rb_fde_t * F, rb_fde_t * P, int pid) { diff --git a/ssld/ssld.c b/ssld/ssld.c index d8e1b455..cad491c2 100644 --- a/ssld/ssld.c +++ b/ssld/ssld.c @@ -51,22 +51,6 @@ int32_to_buf(uint8_t *buf, int32_t x) return; } -static inline uint16_t -buf_to_uint16(uint8_t *buf) -{ - uint16_t x; - memcpy(&x, buf, sizeof(x)); - return x; -} - -static inline void -uint16_to_buf(uint8_t *buf, uint16_t x) -{ - memcpy(buf, &x, sizeof(x)); - return; -} - - static char inbuf[READBUF_SIZE]; #ifdef HAVE_LIBZ static char outbuf[READBUF_SIZE]; diff --git a/tools/mkpasswd.c b/tools/mkpasswd.c index 958d6dff..4f80b970 100644 --- a/tools/mkpasswd.c +++ b/tools/mkpasswd.c @@ -55,9 +55,6 @@ static void brief_usage(void); static char saltChars[] = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; /* 0 .. 63, ascii - 64 */ -extern char *optarg; - - #ifdef __MINGW32__ #include #ifdef PASS_MAX @@ -72,7 +69,7 @@ getpass(const char *prompt) int c; int i = 0; - memset(getpassbuf, sizeof(getpassbuf), 0); + memset(getpassbuf, 0, sizeof(getpassbuf)); fputs(prompt, stderr); for(;;) {