diff options
author | Robin Burchell w00t@inspircd.org <Robin Burchell w00t@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-10-03 17:37:45 +0000 |
---|---|---|
committer | Robin Burchell w00t@inspircd.org <Robin Burchell w00t@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-10-03 17:37:45 +0000 |
commit | f09953561bebb310cfe6a534c1262d77433a4e42 (patch) | |
tree | f1c3f89d74931b5f191212a73c1513d19803ee0d /src | |
parent | 69ed36bbf5a6aebc34a5a86946398083a45ab981 (diff) |
Merge commit 'cbx/anopeng-charfix' into anopeng
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1408 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src')
-rw-r--r-- | src/botserv.c | 12 | ||||
-rw-r--r-- | src/core/bs_fantasy_kickban.c | 4 | ||||
-rw-r--r-- | src/core/cs_xop.c | 10 | ||||
-rw-r--r-- | src/datafiles.c | 6 | ||||
-rw-r--r-- | src/events.c | 2 | ||||
-rw-r--r-- | src/hostserv.c | 6 | ||||
-rw-r--r-- | src/main.c | 4 | ||||
-rw-r--r-- | src/misc.c | 2 | ||||
-rw-r--r-- | src/modules.c | 20 | ||||
-rw-r--r-- | src/modules/hs_request.c | 4 | ||||
-rw-r--r-- | src/news.c | 6 | ||||
-rw-r--r-- | src/operserv.c | 2 | ||||
-rw-r--r-- | src/protocol/ratbox.c | 2 | ||||
-rw-r--r-- | src/send.c | 3 | ||||
-rw-r--r-- | src/sockutil.c | 10 |
15 files changed, 47 insertions, 46 deletions
diff --git a/src/botserv.c b/src/botserv.c index 7ff55c9c1..9f05ec9b3 100644 --- a/src/botserv.c +++ b/src/botserv.c @@ -413,7 +413,7 @@ void botchanmsgs(User * u, ChannelInfo * ci, char *buf) if (cmd && (cmd[0] == *BSFantasyCharacter)) { char *params = strtok(NULL, ""); - char *event_name = EVENT_BOT_FANTASY_NO_ACCESS; + const char *event_name = EVENT_BOT_FANTASY_NO_ACCESS; /* Strip off the fantasy character */ cmd++; @@ -832,7 +832,7 @@ static void bot_kick(ChannelInfo * ci, User * u, int message, ...) /* Makes a simple ban and kicks the target */ void bot_raw_ban(User * requester, ChannelInfo * ci, char *nick, - char *reason) + const char *reason) { int ac; const char *av[4]; @@ -890,7 +890,7 @@ void bot_raw_ban(User * requester, ChannelInfo * ci, char *nick, kav[2] = ci->bi->nick; } else { if (strlen(reason) > 200) - reason[200] = '\0'; + *((char **)&reason[200]) = '\0'; // Unsafe cast -- will review later -- CyberBotX kav[2] = reason; } @@ -912,7 +912,7 @@ void bot_raw_ban(User * requester, ChannelInfo * ci, char *nick, /* Makes a kick with a "dynamic" reason ;) */ void bot_raw_kick(User * requester, ChannelInfo * ci, char *nick, - char *reason) + const char *reason) { const char *av[3]; User *u = finduser(nick); @@ -939,7 +939,7 @@ void bot_raw_kick(User * requester, ChannelInfo * ci, char *nick, av[2] = ci->bi->nick; } else { if (strlen(reason) > 200) - reason[200] = '\0'; + *((char **)&reason[200]) = '\0'; // Unsafe cast -- will review later -- CyberBotX av[2] = reason; } @@ -958,7 +958,7 @@ void bot_raw_kick(User * requester, ChannelInfo * ci, char *nick, /* Makes a mode operation on a channel for a nick */ -void bot_raw_mode(User * requester, ChannelInfo * ci, char *mode, +void bot_raw_mode(User * requester, ChannelInfo * ci, const char *mode, char *nick) { const char *av[4]; diff --git a/src/core/bs_fantasy_kickban.c b/src/core/bs_fantasy_kickban.c index 526dfb9a1..f8bdc957c 100644 --- a/src/core/bs_fantasy_kickban.c +++ b/src/core/bs_fantasy_kickban.c @@ -6,8 +6,8 @@ * Please read COPYING and README for further details. * * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - * + * Based on the original code of Services by Andy Church. + * * $Id$ * */ diff --git a/src/core/cs_xop.c b/src/core/cs_xop.c index 4d8031106..e4589d24e 100644 --- a/src/core/cs_xop.c +++ b/src/core/cs_xop.c @@ -6,8 +6,8 @@ * Please read COPYING and README for further details. * * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - * + * Based on the original code of Services by Andy Church. + * * $Id$ * */ @@ -15,7 +15,7 @@ #include "module.h" -int do_xop(User * u, char *xname, int xlev, int *xmsgs); +int do_xop(User * u, const char *xname, int xlev, int *xmsgs); int do_aop(User * u); int do_hop(User * u); int do_sop(User * u); @@ -235,7 +235,7 @@ int xop_list_callback(User * u, int num, va_list args) } -int do_xop(User * u, char *xname, int xlev, int *xmsgs) +int do_xop(User * u, const char *xname, int xlev, int *xmsgs) { char *chan = strtok(NULL, " "); char *cmd = strtok(NULL, " "); @@ -500,7 +500,7 @@ int do_xop(User * u, char *xname, int xlev, int *xmsgs) } send_event(EVENT_ACCESS_CLEAR, 2, ci->name, u->nick); - + notice_lang(s_ChanServ, u, xmsgs[13], ci->name); } else { syntax_error(s_ChanServ, u, xname, xmsgs[0]); diff --git a/src/datafiles.c b/src/datafiles.c index b5d381c32..fd1b05f94 100644 --- a/src/datafiles.c +++ b/src/datafiles.c @@ -579,7 +579,7 @@ int write_string(const char *s, dbFILE * f) * @param ext Extention * @return void */ -static void rename_database(char *name, char *ext) +static void rename_database(const char *name, char *ext) { char destpath[PATH_MAX]; @@ -728,7 +728,7 @@ void backup_databases(void) /*************************************************************************/ -void ModuleDatabaseBackup(char *dbname) +void ModuleDatabaseBackup(const char *dbname) { time_t t; @@ -762,7 +762,7 @@ void ModuleDatabaseBackup(char *dbname) /*************************************************************************/ -void ModuleRemoveBackups(char *dbname) +void ModuleRemoveBackups(const char *dbname) { char ext[9]; char path[PATH_MAX]; diff --git a/src/events.c b/src/events.c index ff20f8ced..04229a0d4 100644 --- a/src/events.c +++ b/src/events.c @@ -294,7 +294,7 @@ EvtMessage *createEventHandler(char *name, * @param func a pointer to the function to call when we recive this message * @return a new Message object **/ -EvtHook *createEventHook(char *name, int (*func) (int argc, char **argv)) +EvtHook *createEventHook(const char *name, int (*func) (int argc, char **argv)) { EvtHook *evh = NULL; if (!func) { diff --git a/src/hostserv.c b/src/hostserv.c index be2e52e00..cdf43889c 100644 --- a/src/hostserv.c +++ b/src/hostserv.c @@ -99,7 +99,7 @@ HostCore *hostCoreListHead() * @return HostCore */ HostCore *createHostCorelist(HostCore * next, char *nick, char *vIdent, - char *vHost, char *creator, int32 tmp_time) + char *vHost, const char *creator, int32 tmp_time) { next = (HostCore *)malloc(sizeof(HostCore)); @@ -180,7 +180,7 @@ HostCore *findHostCore(HostCore * head, char *nick, bool* found) /*************************************************************************/ HostCore *insertHostCore(HostCore * head, HostCore * prev, char *nick, - char *vIdent, char *vHost, char *creator, + char *vIdent, char *vHost, const char *creator, int32 tmp_time) { @@ -258,7 +258,7 @@ HostCore *deleteHostCore(HostCore * head, HostCore * prev) } /*************************************************************************/ -void addHostCore(char *nick, char *vIdent, char *vhost, char *creator, +void addHostCore(char *nick, char *vIdent, char *vhost, const char *creator, int32 tmp_time) { HostCore *tmp; diff --git a/src/main.c b/src/main.c index 5602e1d00..7e33c3de8 100644 --- a/src/main.c +++ b/src/main.c @@ -34,8 +34,8 @@ /******** Global variables! ********/ /* Command-line options: (note that configuration variables are in config.c) */ -char *services_dir = SERVICES_DIR; /* -dir dirname */ -char *log_filename = LOG_FILENAME; /* -log filename */ +const char *services_dir = SERVICES_DIR; /* -dir dirname */ +const char *log_filename = LOG_FILENAME; /* -log filename */ int debug = 0; /* -debug */ int readonly = 0; /* -readonly */ int logchan = 0; /* -logchan */ diff --git a/src/misc.c b/src/misc.c index 7b226c148..7d2c28d0f 100644 --- a/src/misc.c +++ b/src/misc.c @@ -1088,7 +1088,7 @@ u_int32_t getrandom32(void) * @param token2 * @return token to send */ -char *send_token(char *token1, char *token2) +const char *send_token(const char *token1, const char *token2) { if (UseTokens && ircd->token && ircdcap->token) { return token2; diff --git a/src/modules.c b/src/modules.c index 2436f6fb6..55c82d818 100644 --- a/src/modules.c +++ b/src/modules.c @@ -435,7 +435,7 @@ int delModule(Module * m) * @param name the name of the module to find * @return a pointer to the module found, or NULL */ -Module *findModule(char *name) +Module *findModule(const char *name) { int idx; ModuleHash *current = NULL; @@ -1695,7 +1695,7 @@ void moduleAddAuthor(const char *author) * @return MOD_ERR_OK on success, anything else on fail. * @see moduleDelCallBack **/ -int moduleAddCallback(char *name, time_t when, +int moduleAddCallback(const char *name, time_t when, int (*func) (int argc, char *argv[]), int argc, char **argv) { @@ -2121,7 +2121,7 @@ int moduleDataDebug(ModuleData ** md) * @param value The value for the key/value pair, this is what will be stored for you * @return MOD_ERR_OK will be returned on success **/ -int moduleAddData(ModuleData ** md, char *key, char *value) +int moduleAddData(ModuleData ** md, const char *key, char *value) { ModuleData *newData = NULL; @@ -2162,7 +2162,7 @@ int moduleAddData(ModuleData ** md, char *key, char *value) * @param key The key to find the data for * @return the value paired to the given key will be returned, or NULL **/ -char *moduleGetData(ModuleData ** md, char *key) +char *moduleGetData(ModuleData ** md, const char *key) { /* See comment in moduleAddData... -GD */ char *mod_name = sstrdup(mod_current_module_name); @@ -2197,7 +2197,7 @@ char *moduleGetData(ModuleData ** md, char *key) * @param md The module data for the struct to be used * @param key The key to delete the key/value pair for **/ -void moduleDelData(ModuleData ** md, char *key) +void moduleDelData(ModuleData ** md, const char *key) { /* See comment in moduleAddData... -GD */ char *mod_name = sstrdup(mod_current_module_name); @@ -2408,11 +2408,11 @@ const char *ano_moderr(void) /** * Allow ircd protocol files to update the protect level info tables. **/ -void updateProtectDetails(char *level_info_protect_word, - char *level_info_protectme_word, - char *fant_protect_add, char *fant_protect_del, - char *level_protect_word, char *protect_set_mode, - char *protect_unset_mode) +void updateProtectDetails(const char *level_info_protect_word, + const char *level_info_protectme_word, + const char *fant_protect_add, const char *fant_protect_del, + const char *level_protect_word, const char *protect_set_mode, + const char *protect_unset_mode) { int i = 0; CSModeUtil ptr; diff --git a/src/modules/hs_request.c b/src/modules/hs_request.c index e2a5a51b6..b80e51a55 100644 --- a/src/modules/hs_request.c +++ b/src/modules/hs_request.c @@ -587,7 +587,7 @@ void hs_help(User * u) void hsreq_load_db(void) { FILE *fp; - char *filename; + const char *filename; char readbuf[1024]; char *nick, *vident, *vhost, *creator, *tmp; int32 tmp_time; @@ -646,7 +646,7 @@ void hsreq_load_db(void) void hsreq_save_db(void) { FILE *fp; - char *filename; + const char *filename; const char *vident; HostCore *current; diff --git a/src/news.c b/src/news.c index 92ffa1910..3fffee433 100644 --- a/src/news.c +++ b/src/news.c @@ -42,7 +42,7 @@ NewsItem *news = NULL; struct newsmsgs { int16 type; - char *name; + const char *name; int msgs[MSG_MAX + 1]; }; @@ -91,7 +91,7 @@ struct newsmsgs msgarray[] = { } }; -static int *findmsgs(int16 type, char **type_name) +static int *findmsgs(int16 type, const char **type_name) { int i; for (i = 0; i < lenof(msgarray); i++) { @@ -362,7 +362,7 @@ void do_news(User * u, short type) { int is_servadmin = is_services_admin(u); char *cmd = strtok(NULL, " "); - char *type_name; + const char *type_name; int *msgs; msgs = findmsgs(type, &type_name); diff --git a/src/operserv.c b/src/operserv.c index d1613e365..20ff4f28e 100644 --- a/src/operserv.c +++ b/src/operserv.c @@ -687,7 +687,7 @@ Server *server_global(Server * s, char *msg) } -void oper_global(char *nick, char *fmt, ...) +void oper_global(char *nick, const char *fmt, ...) { va_list args; char msg[2048]; /* largest valid message is 512, this should cover any global */ diff --git a/src/protocol/ratbox.c b/src/protocol/ratbox.c index 42966bd8f..582a3a6c6 100644 --- a/src/protocol/ratbox.c +++ b/src/protocol/ratbox.c @@ -678,7 +678,7 @@ class RatboxProto : public IRCDTS6Proto { if (UseTS6) { BotInfo *bi = findbot(nick); - ratbox_cmd_tmode(nick, chan, "%s %s", ircd->botchanumode, bi ? bi->uid : nick); + ratbox_cmd_tmode(nick, chan, "%s %s", ircd->botchanumode, bi ? bi->uid.c_str() : nick); } else SendMode(findbot(nick), chan, "%s %s", ircd->botchanumode, nick); } diff --git a/src/send.c b/src/send.c index 82e6727ae..446020f35 100644 --- a/src/send.c +++ b/src/send.c @@ -54,6 +54,7 @@ void send_cmd(const char *source, const char *fmt, ...) /* * Copypasta version that accepts std::string source. + */ void send_cmd(const std::string &source, const char *fmt, ...) { va_list args; @@ -91,7 +92,7 @@ void send_cmd(const std::string &source, const char *fmt, ...) * @param ... any number of parameters * @return void */ -void notice_server(char *source, Server * s, char *fmt, ...) +void notice_server(char *source, Server * s, const char *fmt, ...) { va_list args; char buf[BUFSIZE]; diff --git a/src/sockutil.c b/src/sockutil.c index b28989bdb..b63c42cc3 100644 --- a/src/sockutil.c +++ b/src/sockutil.c @@ -6,9 +6,9 @@ * Please read COPYING and README for further details. * * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - * - * $Id$ + * Based on the original code of Services by Andy Church. + * + * $Id$ * */ @@ -499,7 +499,7 @@ int sputs(char *str, ano_socket_t s) * @param ... various args * @return int */ -int sockprintf(ano_socket_t s, char *fmt, ...) +int sockprintf(ano_socket_t s, const char *fmt, ...) { va_list args; char buf[16384]; /* Really huge, to try and avoid truncation */ @@ -713,7 +713,7 @@ char *ano_sockstrerror(int error) /* Microsoft decided not to use sequential numbers for the error codes, * so we can't just use the array index for the code. But, at least - * use a binary search to make it as fast as possible. + * use a binary search to make it as fast as possible. */ while (start <= stop) { mid = (start + stop) / 2; |