diff options
author | rob rob@31f1291d-b8d6-0310-a050-a5561fc1590b <rob rob@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> | 2004-10-12 21:48:40 +0000 |
---|---|---|
committer | rob rob@31f1291d-b8d6-0310-a050-a5561fc1590b <rob rob@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> | 2004-10-12 21:48:40 +0000 |
commit | ee5de492f765f02b09fee772540017fb5ea1007e (patch) | |
tree | ce2c80ecf8f19b2ccef62ad6c90b97b47b6c9c45 | |
parent | 61ad72831ef31065b31a49908bab487dcf6cc54f (diff) |
BUILD : 1.7.5 (391) BUGS : N/A NOTES : Code tidy, added make strict to the makefile, allowing ansi Wall pedantic to be used for compiling
git-svn-id: svn://svn.anope.org/anope/trunk@391 31f1291d-b8d6-0310-a050-a5561fc1590b
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@256 5417fbe8-f217-4b02-8779-1006273d7864
-rw-r--r-- | Changes | 1 | ||||
-rw-r--r-- | Makefile.in | 6 | ||||
-rw-r--r-- | include/datafiles.h | 6 | ||||
-rw-r--r-- | include/sysconf.h.in | 16 | ||||
-rw-r--r-- | lang/langcomp.c | 18 | ||||
-rw-r--r-- | src/botserv.c | 39 | ||||
-rw-r--r-- | src/chanserv.c | 6 | ||||
-rw-r--r-- | src/memoserv.c | 5 | ||||
-rw-r--r-- | src/misc.c | 3 | ||||
-rw-r--r-- | src/modules.c | 14 | ||||
-rw-r--r-- | src/mysql.c | 4 | ||||
-rw-r--r-- | src/nickserv.c | 5 | ||||
-rw-r--r-- | src/unreal32.c | 2 | ||||
-rw-r--r-- | version.log | 6 |
14 files changed, 87 insertions, 44 deletions
@@ -4,6 +4,7 @@ Provided by Anope Dev. <dev@anope.org> - 2004 09/20 A Added RestrictOperNicks as new feature in services.conf. [ #00] 09/08 A Removed rand() and ported bsd's arc4random() to fit our needs. [ #00] 08/24 A New -l option for am script to list possible selectors. [ #00] +10/12 F Code Tidy, fixed some error checking. [ #00] 10/09 F Bug in LogChannel possibly causing segfaults. [#176] 10/03 F Changed UserKeys from uint to long uint. [ #00] 09/21 F An option to explicitly not use mysql is added to Config [ #00] diff --git a/Makefile.in b/Makefile.in index 14bc76dc5..ab3a2a742 100644 --- a/Makefile.in +++ b/Makefile.in @@ -30,6 +30,12 @@ build: ( cd $$i; ${MAKE} ${MAKEARGS} all; ) \ done +strict: language headers + @for i in $(SUBDIRS); do \ + echo "*** Strict Building $$i";\ + ( cd $$i; ${MAKE} ${MAKEARGS} 'CFLAGS=${CFLAGS} -ansi -Wall -pedantic' all; ) \ + done + modules: build (cd src/modules ; ./configure ; ${MAKE} ${MAKEARGS} all; ) @echo "*** All done, now (g)make install to install Anope/Modules"; diff --git a/include/datafiles.h b/include/datafiles.h index 4312b5af1..568f8917f 100644 --- a/include/datafiles.h +++ b/include/datafiles.h @@ -15,6 +15,8 @@ #ifndef DATAFILES_H #define DATAFILES_H +#include <sys/param.h> + /*************************************************************************/ typedef struct dbFILE_ dbFILE; @@ -23,8 +25,8 @@ struct dbFILE_ { FILE *fp; /* The normal file descriptor */ FILE *backupfp; /* Open file pointer to a backup copy of * the database file (if non-NULL) */ - char filename[PATH_MAX]; /* Name of the database file */ - char backupname[PATH_MAX]; /* Name of the backup file */ + char filename[MAXPATHLEN]; /* Name of the database file */ + char backupname[MAXPATHLEN]; /* Name of the backup file */ }; /*************************************************************************/ diff --git a/include/sysconf.h.in b/include/sysconf.h.in index 5142b6cec..dcb6f2dbe 100644 --- a/include/sysconf.h.in +++ b/include/sysconf.h.in @@ -202,6 +202,22 @@ #include <sys/types.h> #endif +#ifdef __STRICT_ANSI__ +#include <stdarg.h> +#include <stdio.h> + +/* We KNOW these are not ansi, we are defining them here to suppress the warning +s messages on a "make strict" compile */ +int snprintf(char *str, size_t size, const char *format, ...); +int vprintf(const char *format, va_list ap); +int vfprintf(FILE *stream, const char *format, va_list ap); +int vsprintf(char *str, const char *format, va_list ap); +int vsnprintf(char *str, size_t size, const char *format, va_list ap); + +typedef unsigned char u_char; +#endif + + typedef int16_t int16; typedef u_int16_t uint16; typedef int32_t int32; diff --git a/lang/langcomp.c b/lang/langcomp.c index 791e23f93..cca689263 100644 --- a/lang/langcomp.c +++ b/lang/langcomp.c @@ -44,12 +44,16 @@ #include <stdlib.h> #include <string.h> #undef getline + int numstrings = 0; /* Number of strings we should have */ char **stringnames; /* Names of the strings (from index file) */ char **strings; /* Strings we have loaded */ int linenum = 0; /* Current line number in input file */ + +char *anopeStrDup(const char *src); + /*************************************************************************/ /* Read the index file and load numstrings and stringnames. Return -1 on @@ -80,7 +84,7 @@ int read_index_file() while (fgets(buf, sizeof(buf), f)) { if (buf[strlen(buf)-1] == '\n') buf[strlen(buf)-1] = '\0'; - if (!(stringnames[i++] = strdup(buf))) { + if (!(stringnames[i++] = anopeStrDup(buf))) { perror("strdup()"); return -1; } @@ -143,10 +147,20 @@ int fput32(int val, FILE *f) } /*************************************************************************/ +char *anopeStrDup(const char *src) { + char *ret=NULL; + if(src) { + if( (ret = (char *)malloc(strlen(src)+1)) ) {; + strcpy(ret,src); + } + } + return ret; +} +/*************************************************************************/ int main(int ac, char **av) { - unsigned char *filename = NULL, *s; + char *filename = NULL, *s; char langname[254], outfile[256]; FILE *in, *out; int warn = 0; diff --git a/src/botserv.c b/src/botserv.c index bc35c5101..28245c7c8 100644 --- a/src/botserv.c +++ b/src/botserv.c @@ -608,8 +608,8 @@ void load_bs_dbase(void) { dbFILE *f; int c, ver; - int16 tmp16; - int32 tmp32; + uint16 tmp16; + uint32 tmp32; BotInfo *bi; int failed = 0; @@ -1891,8 +1891,9 @@ static int do_kickcmd(User * u) if (!stricmp(option, "BADWORDS")) { if (!stricmp(value, "ON")) { if (ttb) { - ci->ttb[TTB_BADWORDS] = atol(ttb); - if (ci->ttb[TTB_BADWORDS] < 0) { + ci->ttb[TTB_BADWORDS] = + strtol(ttb, (char **) NULL, 10); + if (errno) { notice_lang(s_BotServ, u, BOT_KICK_BAD_TTB, ttb); return MOD_CONT; } @@ -1911,8 +1912,8 @@ static int do_kickcmd(User * u) } else if (!stricmp(option, "BOLDS")) { if (!stricmp(value, "ON")) { if (ttb) { - ci->ttb[TTB_BOLDS] = atol(ttb); - if (ci->ttb[TTB_BOLDS] < 0) { + ci->ttb[TTB_BOLDS] = strtol(ttb, (char **) NULL, 10); + if (errno) { notice_lang(s_BotServ, u, BOT_KICK_BAD_TTB, ttb); return MOD_CONT; } @@ -1934,8 +1935,8 @@ static int do_kickcmd(User * u) char *percent = strtok(NULL, " "); if (ttb) { - ci->ttb[TTB_CAPS] = atol(ttb); - if (ci->ttb[TTB_CAPS] < 0) { + ci->ttb[TTB_CAPS] = strtol(ttb, (char **) NULL, 10); + if (errno) { notice_lang(s_BotServ, u, BOT_KICK_BAD_TTB, ttb); return MOD_CONT; } @@ -1971,8 +1972,8 @@ static int do_kickcmd(User * u) } else if (!stricmp(option, "COLORS")) { if (!stricmp(value, "ON")) { if (ttb) { - ci->ttb[TTB_COLORS] = atol(ttb); - if (ci->ttb[TTB_COLORS] < 0) { + ci->ttb[TTB_COLORS] = strtol(ttb, (char **) NULL, 10); + if (errno) { notice_lang(s_BotServ, u, BOT_KICK_BAD_TTB, ttb); return MOD_CONT; } @@ -1994,8 +1995,8 @@ static int do_kickcmd(User * u) char *secs = strtok(NULL, " "); if (ttb) { - ci->ttb[TTB_FLOOD] = atol(ttb); - if (ci->ttb[TTB_FLOOD] < 0) { + ci->ttb[TTB_FLOOD] = strtol(ttb, (char **) NULL, 10); + if (errno) { notice_lang(s_BotServ, u, BOT_KICK_BAD_TTB, ttb); return MOD_CONT; } @@ -2033,8 +2034,8 @@ static int do_kickcmd(User * u) char *times = strtok(NULL, " "); if (ttb) { - ci->ttb[TTB_REPEAT] = atol(ttb); - if (ci->ttb[TTB_REPEAT] < 0) { + ci->ttb[TTB_REPEAT] = strtol(ttb, (char **) NULL, 10); + if (errno) { notice_lang(s_BotServ, u, BOT_KICK_BAD_TTB, ttb); return MOD_CONT; } @@ -2062,8 +2063,9 @@ static int do_kickcmd(User * u) } else if (!stricmp(option, "REVERSES")) { if (!stricmp(value, "ON")) { if (ttb) { - ci->ttb[TTB_REVERSES] = atol(ttb); - if (ci->ttb[TTB_REVERSES] < 0) { + ci->ttb[TTB_REVERSES] = + strtol(ttb, (char **) NULL, 10); + if (errno) { notice_lang(s_BotServ, u, BOT_KICK_BAD_TTB, ttb); return MOD_CONT; } @@ -2082,8 +2084,9 @@ static int do_kickcmd(User * u) } else if (!stricmp(option, "UNDERLINES")) { if (!stricmp(value, "ON")) { if (ttb) { - ci->ttb[TTB_UNDERLINES] = atol(ttb); - if (ci->ttb[TTB_UNDERLINES] < 0) { + ci->ttb[TTB_UNDERLINES] = + strtol(ttb, (char **) NULL, 10); + if (errno) { notice_lang(s_BotServ, u, BOT_KICK_BAD_TTB, ttb); return MOD_CONT; } diff --git a/src/chanserv.c b/src/chanserv.c index 64c092c1f..3a5a7e166 100644 --- a/src/chanserv.c +++ b/src/chanserv.c @@ -624,7 +624,7 @@ void chanserv(User * u, char *buf) void load_cs_dbase(void) { dbFILE *f; - int ver, i, j, c, m; + int ver, i, j, c; ChannelInfo *ci, **last, *prev; int failed = 0; @@ -634,8 +634,8 @@ void load_cs_dbase(void) ver = get_file_version(f); for (i = 0; i < 256 && !failed; i++) { - int16 tmp16; - int32 tmp32; + uint16 tmp16; + uint32 tmp32; int n_levels; char *s; NickAlias *na; diff --git a/src/memoserv.c b/src/memoserv.c index c4e0aacbf..e54f554bc 100644 --- a/src/memoserv.c +++ b/src/memoserv.c @@ -291,7 +291,6 @@ void memo_send(User * u, char *name, char *text, int z) time_t now = time(NULL); char *source = u->na->nc->display; int is_servoper = is_services_oper(u); - int j; if (readonly) { notice_lang(s_MemoServ, u, MEMO_SEND_DISABLED); @@ -310,7 +309,7 @@ void memo_send(User * u, char *name, char *text, int z) notice_lang(s_MemoServ, u, NICK_IDENTIFY_REQUIRED, s_NickServ); } else if (!(mi = getmemoinfo(name, &ischan, &isforbid))) { - if (z == 0 || z == 3) + if (z == 0 || z == 3) { if (isforbid) { notice_lang(s_MemoServ, u, ischan ? CHAN_X_FORBIDDEN : @@ -320,7 +319,7 @@ void memo_send(User * u, char *name, char *text, int z) ischan ? CHAN_X_NOT_REGISTERED : NICK_X_NOT_REGISTERED, name); } - + } } else if (z != 2 && MSSendDelay > 0 && u && u->lastmemosend + MSSendDelay > now && !is_servoper) { u->lastmemosend = now; diff --git a/src/misc.c b/src/misc.c index d1db39f18..4820a9fae 100644 --- a/src/misc.c +++ b/src/misc.c @@ -751,7 +751,7 @@ static void arc4_init(void) rs.j = 0; } -static inline void arc4_addrandom(void *dat, int datlen) +static void arc4_addrandom(void *dat, int datlen) { int n; u_int8_t si; @@ -907,4 +907,3 @@ char *host_resolve(char *host) } } - diff --git a/src/modules.c b/src/modules.c index ad5da8034..f764fab1d 100644 --- a/src/modules.c +++ b/src/modules.c @@ -2003,18 +2003,18 @@ void moduleCleanStruct(ModuleData **moduleData) { **/ boolean moduleMinVersion(int major,int minor,int patch,int build) { boolean ret=false; - if(VERSION_MAJOR>major) { // Def. new + if(VERSION_MAJOR>major) { /* Def. new */ ret = true; - } else if(VERSION_MAJOR == major) { // Might be newer - if(minor == -1) { return true; } // They dont care about minor - if(VERSION_MINOR > minor) { // Def. newer + } else if(VERSION_MAJOR == major) { /* Might be newer */ + if(minor == -1) { return true; } /* They dont care about minor */ + if(VERSION_MINOR > minor) { /* Def. newer*/ ret = true; - } else if(VERSION_MINOR == minor) { // Might be newer - if(patch == -1) { return true; } // They dont care about patch + } else if(VERSION_MINOR == minor) { /* Might be newer */ + if(patch == -1) { return true; } /* They dont care about patch */ if(VERSION_PATCH > patch) { ret = true; } else if(VERSION_PATCH == patch) { - if(build == -1) { return true; } // They dont care about build + if(build == -1) { return true; } /* They dont care about build */ if(VERSION_BUILD >= build) { ret = true; } diff --git a/src/mysql.c b/src/mysql.c index 0153493ea..aeab71668 100644 --- a/src/mysql.c +++ b/src/mysql.c @@ -1167,7 +1167,7 @@ void db_mysql_load_cs_dbase(void) { char sqlcmd[MAX_SQL_BUF], *tempstr; ChannelInfo *ci; - int n_levels, j, m; + int n_levels, j; MYSQL_RES *res; MYSQL_ROW row; @@ -1436,7 +1436,7 @@ void db_mysql_load_ns_dbase(void) NickAlias *na; MYSQL_RES *res; MYSQL_ROW row; - int i, j, m; + int i, j; if (!do_mysql) return; diff --git a/src/nickserv.c b/src/nickserv.c index 44a4e1bb6..d14472099 100644 --- a/src/nickserv.c +++ b/src/nickserv.c @@ -367,7 +367,7 @@ void nickserv(User * u, char *buf) void load_old_ns_dbase(void) { dbFILE *f; - int ver, i, j, c, m; + int ver, i, j, c; NickAlias *na, *na2, *next; NickCore *nc; int failed = 0; @@ -657,7 +657,7 @@ void load_ns_req_db(void) void load_ns_dbase(void) { dbFILE *f; - int ver, i, j, c, m; + int ver, i, j, c; NickAlias *na, **nalast, *naprev; NickCore *nc, **nclast, *ncprev; int failed = 0; @@ -3328,7 +3328,6 @@ static int do_info(User * u) NickAlias *na; NickRequest *nr = NULL; int is_servadmin = is_services_admin(u); - char *vHost; if (!nick) { syntax_error(s_NickServ, u, "INFO", NICK_INFO_SYNTAX); diff --git a/src/unreal32.c b/src/unreal32.c index b5dfd87d6..406629570 100644 --- a/src/unreal32.c +++ b/src/unreal32.c @@ -1935,7 +1935,7 @@ void anope_cmd_svid_umode2(User * u, char *ts) void anope_cmd_svid_umode3(User * u, char *ts) { - // not used + /* not used */ } int anope_event_error(char *source, int ac, char **av) diff --git a/version.log b/version.log index 7ae1f55a3..5b3bbdedc 100644 --- a/version.log +++ b/version.log @@ -8,10 +8,14 @@ VERSION_MAJOR="1" VERSION_MINOR="7" VERSION_PATCH="5" -VERSION_BUILD="390" +VERSION_BUILD="391" # $Log$ # +# BUILD : 1.7.5 (391) +# BUGS : N/A +# NOTES : Code tidy, added make strict to the makefile, allowing ansi Wall pedantic to be used for compiling +# # BUILD : 1.7.5 (390) # BUGS : 149 # NOTES : Bug in MySQL debug, possibly causing segfaults. |