From: Michael Poole Date: Tue, 19 Jul 2005 18:18:48 +0000 (+0000) Subject: Fix gcc-4.0 compile warnings and errors. X-Git-Tag: v1.4.0-rc1~168 X-Git-Url: http://git.pk910.de/?p=srvx.git;a=commitdiff_plain;h=e1a4408c83869c52247fd6a9d2acba37bfa86a6d Fix gcc-4.0 compile warnings and errors. configure.in: Make sure socklen_t is defined. src/chanserv.c (bad_channel_ban): Make victimCount unsigned. src/ioset.c (ioset_run): Fifth argument to getsockopt() should be socklen_t. src/ioset.h (clock_skew): Undeclare; it is defined as static. src/nickserv.c (is_secure_password): Create appropriately typed local variable for third argument of dict_find(). src/opserv.c (opserv_bad_channel): Likewise. src/proto-p10.c (call_oper_funcs): Declare at file scope rather than locally to mod_usermode() function. src/proto.h (dead_users): Undeclare; it is defined as static. src/saxdb.c (saxdb_write_int): Fix type of string buffer. git-archimport-id: srvx@srvx.net--2005-srvx/srvx--devo--1.3--patch-24 --- diff --git a/ChangeLog b/ChangeLog index 49f932c..e273b96 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,47 @@ # arch-tag: automatic-ChangeLog--srvx@srvx.net--2005-srvx/srvx--devo--1.3 # +2005-07-19 18:18:48 GMT Michael Poole patch-24 + + Summary: + Fix gcc-4.0 compile warnings and errors. + Revision: + srvx--devo--1.3--patch-24 + + configure.in: Make sure socklen_t is defined. + + src/chanserv.c (bad_channel_ban): Make victimCount unsigned. + + src/ioset.c (ioset_run): Fifth argument to getsockopt() should be + socklen_t. + + src/ioset.h (clock_skew): Undeclare; it is defined as static. + + src/nickserv.c (is_secure_password): Create appropriately typed local + variable for third argument of dict_find(). + + src/opserv.c (opserv_bad_channel): Likewise. + + src/proto-p10.c (call_oper_funcs): Declare at file scope rather than + locally to mod_usermode() function. + + src/proto.h (dead_users): Undeclare; it is defined as static. + + src/saxdb.c (saxdb_write_int): Fix type of string buffer. + + modified files: + ChangeLog configure.in languages/validate.pl src/chanserv.c + src/ioset.c src/ioset.h src/nickserv.c src/opserv.c + src/proto-p10.c src/proto.h src/saxdb.c + {arch}/srvx/srvx--devo/srvx--devo--1.3/srvx@srvx.net--2004-srvx/patch-log/patch-71 + {arch}/srvx/srvx--devo/srvx--devo--1.3/srvx@srvx.net--2004-srvx/patch-log/patch-76 + {arch}/srvx/srvx--devo/srvx--devo--1.3/srvx@srvx.net--2004-srvx/patch-log/patch-77 + {arch}/srvx/srvx--devo/srvx--devo--1.3/srvx@srvx.net--2004-srvx/patch-log/patch-81 + {arch}/srvx/srvx--devo/srvx--devo--1.3/srvx@srvx.net--2004-srvx/patch-log/patch-84 + {arch}/srvx/srvx--devo/srvx--devo--1.3/srvx@srvx.net--2005-srvx/patch-log/patch-22 + {arch}/srvx/srvx--devo/srvx--devo--1.3/srvx@srvx.net--2005-srvx/patch-log/patch-23 + + 2005-07-04 00:37:07 GMT Zoot patch-23 Summary: diff --git a/configure.in b/configure.in index 3fe7fa0..69e75c6 100644 --- a/configure.in +++ b/configure.in @@ -2,8 +2,8 @@ dnl Process this file with autoconf to create a configure script. dnl General initialization. AC_REVISION([$Id: configure.in,v 1.77 2004/01/02 01:49:15 entrope Exp $]) -AC_PREREQ(2.57) -AC_INIT(srvx, 1.3, srvx-bugs@lists.sourceforge.net) +AC_PREREQ(2.59) +AC_INIT([srvx],[1.3],[srvx-bugs@lists.sourceforge.net]) CODENAME=surge AC_CONFIG_HEADERS(src/config.h) AC_CONFIG_SRCDIR(src/opserv.c) @@ -96,6 +96,32 @@ if test $ac_cv_sin_len = yes ; then AC_DEFINE(HAVE_SIN_LEN, 1, [Define if struct sockaddr_in contains a sin_len field]) fi +dnl Check for socklen_t. In traditional BSD this is an int, but some +dnl OSes use a different type. Test until we find something that will +dnl work properly. Test borrowed from a patch submitted for Python. +AC_CHECK_TYPE([socklen_t], ,[ + AC_MSG_CHECKING([for socklen_t equivalent]) + AC_CACHE_VAL([curl_cv_socklen_t_equiv], + [ +dnl Systems have either "struct sockaddr*" or "void*" as second +dnl arg to getpeername. + curl_cv_socklen_t_equiv= + for arg2 in "struct sockaddr" void ; do + for t in int size_t unsigned long "unsigned long" ; do + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include +#include +int getpeername (int $arg2 *, $t *);]], [[$t len; + getpeername(0, 0, &len);]])],[curl_cv_socklen_t_equiv="$t" + break],[]) + done + done + ]) + AC_MSG_RESULT($curl_cv_socklen_t_equiv) + AC_DEFINE_UNQUOTED(socklen_t, $curl_cv_socklen_t_equiv, + [type to use in place of socklen_t if not defined])], + [#include +#include]) + dnl Can only check with -Werror, but the rest of configure doesn't like -Werror OLD_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -W -Wall -Werror" diff --git a/languages/validate.pl b/languages/validate.pl old mode 100644 new mode 100755 diff --git a/src/chanserv.c b/src/chanserv.c index 9f6c141..84ea68c 100644 --- a/src/chanserv.c +++ b/src/chanserv.c @@ -2677,7 +2677,7 @@ static CHANSERV_FUNC(cmd_devoice) } static int -bad_channel_ban(struct chanNode *channel, struct userNode *user, const char *ban, int *victimCount, struct modeNode **victims) +bad_channel_ban(struct chanNode *channel, struct userNode *user, const char *ban, unsigned int *victimCount, struct modeNode **victims) { unsigned int ii; diff --git a/src/ioset.c b/src/ioset.c index d16a8eb..e102732 100644 --- a/src/ioset.c +++ b/src/ioset.c @@ -406,7 +406,10 @@ ioset_run(void) { fd->readable_cb(fd); } if (FD_ISSET(nn, &write_fds) && !fd->connected) { - int rc, arglen = sizeof(rc); + socklen_t arglen; + int rc; + + arglen = sizeof(rc); if (getsockopt(fd->fd, SOL_SOCKET, SO_ERROR, &rc, &arglen) < 0) rc = errno; fd->connected = 1; diff --git a/src/ioset.h b/src/ioset.h index c0afb02..0c4f84f 100644 --- a/src/ioset.h +++ b/src/ioset.h @@ -44,7 +44,6 @@ struct io_fd { void (*destroy_cb)(struct io_fd *fd); }; -extern int clock_skew; extern int do_write_dbs; extern int do_reopen; diff --git a/src/nickserv.c b/src/nickserv.c index 0a05aaf..e092ac4 100644 --- a/src/nickserv.c +++ b/src/nickserv.c @@ -750,6 +750,8 @@ is_secure_password(const char *handle, const char *pass, struct userNode *user) { unsigned int i, len; unsigned int cnt_digits = 0, cnt_upper = 0, cnt_lower = 0; + int p; + len = strlen(pass); if (len < nickserv_conf.password_min_length) { if (user) @@ -761,8 +763,8 @@ is_secure_password(const char *handle, const char *pass, struct userNode *user) send_message(user, nickserv, "NSMSG_PASSWORD_ACCOUNT"); return 0; } - dict_find(nickserv_conf.weak_password_dict, pass, &i); - if (i) { + dict_find(nickserv_conf.weak_password_dict, pass, &p); + if (p) { if (user) send_message(user, nickserv, "NSMSG_PASSWORD_DICTIONARY"); return 0; diff --git a/src/opserv.c b/src/opserv.c index a5d8c4e..77448b7 100644 --- a/src/opserv.c +++ b/src/opserv.c @@ -1801,9 +1801,10 @@ int opserv_bad_channel(const char *name) { unsigned int found; + int present; - dict_find(opserv_exempt_channels, name, &found); - if (found) + dict_find(opserv_exempt_channels, name, &present); + if (present) return 0; if (gline_find(name)) diff --git a/src/proto-p10.c b/src/proto-p10.c index 96d3df6..eb2d6ae 100644 --- a/src/proto-p10.c +++ b/src/proto-p10.c @@ -1987,8 +1987,9 @@ DelUser(struct userNode* user, struct userNode *killer, int announce, const char free_user(user); } +static void call_oper_funcs(struct userNode *user); + void mod_usermode(struct userNode *user, const char *mode_change) { - static void call_oper_funcs(struct userNode *user); int add = 1; const char *word = mode_change; diff --git a/src/proto.h b/src/proto.h index 342cedb..373470c 100644 --- a/src/proto.h +++ b/src/proto.h @@ -108,8 +108,6 @@ void unreg_notice_func(struct userNode *user, privmsg_func_t handler); typedef void (*oper_func_t) (struct userNode *user); void reg_oper_func(oper_func_t handler); -extern struct userList dead_users; - /* replay silliness */ void replay_read_line(void); void replay_event_loop(void); diff --git a/src/saxdb.c b/src/saxdb.c index 88f8352..4028ccf 100644 --- a/src/saxdb.c +++ b/src/saxdb.c @@ -296,7 +296,7 @@ saxdb_write_string(struct saxdb_context *dest, const char *name, const char *val void saxdb_write_int(struct saxdb_context *dest, const char *name, unsigned long value) { - unsigned char buf[16]; + char buf[16]; /* we could optimize this to take advantage of the fact that buf will never need escapes */ snprintf(buf, sizeof(buf), "%lu", value); saxdb_write_string(dest, name, buf);