From 9e02ca2b3cbade11c2ccd9a9fa5336053411df21 Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Sat, 24 Aug 2019 19:37:25 +0200 Subject: [PATCH] More FORMAT_STRING() checking, get rid of old (non-)USE_VARARGS stuff. Fix some more bugs (type differences) when compiling in DEBUGMODE. --- include/config.h | 35 ++++++++------------------------ include/h.h | 50 +++++++++++++++++++++++----------------------- include/proto.h | 4 ++-- src/api-usermode.c | 2 +- src/bsd.c | 8 ++++---- src/conf.c | 16 ++++----------- src/debug.c | 14 +------------ src/extra.c | 2 +- src/ircd.c | 12 +++++------ src/misc.c | 4 ++-- src/send.c | 42 +++++++++++++++++++------------------- 11 files changed, 75 insertions(+), 114 deletions(-) diff --git a/include/config.h b/include/config.h index 86525ebbf..9a78bb8a2 100644 --- a/include/config.h +++ b/include/config.h @@ -118,19 +118,6 @@ #define RESTARTING_SYSTEMCALLS #endif -/* - * If your host supports varargs and has vsprintf(), vprintf() and vscanf() - * C calls in its library, then you can define USE_VARARGS to use varargs - * instead of imitation variable arg passing. -*/ -#define USE_VARARGS - -/* NOTE: with current server code, varargs doesn't survive because it can't - * be used in a chain of 3 or more funtions which all have a variable - * number of params. If anyone has a solution to this, please notify - * the maintainer. - */ - /* DEBUGMODE: This should only be used when tracing a problem. It creates * an insane amount of log output which can be very useful for debugging. * You should *NEVER* enable this setting on production servers. @@ -384,21 +371,15 @@ #endif #ifdef DEBUGMODE -#ifndef _WIN32 - extern void debug(int, char *, ...); -#define Debug(x) debug x + #define Debug(x) debug x + #define LOGFILE LPATH #else - extern void debug(int, char *, ...); -#define Debug(x) debug x -#endif -#define LOGFILE LPATH -#else -#define Debug(x) ; -#if VMS -#define LOGFILE "NLA0:" -#else -#define LOGFILE "/dev/null" -#endif + #define Debug(x) ; + #if VMS + #define LOGFILE "NLA0:" + #else + #define LOGFILE "/dev/null" + #endif #endif diff --git a/include/h.h b/include/h.h index 691190cce..b986cca12 100644 --- a/include/h.h +++ b/include/h.h @@ -102,8 +102,8 @@ extern EVENT(e_clean_out_throttling_buckets); extern void module_loadall(void); extern long set_usermode(char *umode); extern char *get_modestr(long umodes); -extern void config_error(FORMAT_STRING(char *format), ...) __attribute__((format(printf,1,2))); -extern void config_warn(FORMAT_STRING(char *format), ...) __attribute__((format(printf,1,2))); +extern void config_error(FORMAT_STRING(const char *format), ...) __attribute__((format(printf,1,2))); +extern void config_warn(FORMAT_STRING(const char *format), ...) __attribute__((format(printf,1,2))); extern void config_error_missing(const char *filename, int line, const char *entry); extern void config_error_unknown(const char *filename, int line, const char *block, const char *entry); extern void config_error_unknownflag(const char *filename, int line, const char *block, const char *entry); @@ -114,7 +114,7 @@ extern void config_error_empty(const char *filename, int line, const char *block extern void config_warn_duplicate(const char *filename, int line, const char *entry); extern int config_is_blankorempty(ConfigEntry *cep, const char *block); extern MODVAR int config_verbose; -extern void config_progress(FORMAT_STRING(char *format), ...) __attribute__((format(printf,1,2))); +extern void config_progress(FORMAT_STRING(const char *format), ...) __attribute__((format(printf,1,2))); extern void ipport_seperate(char *string, char **ip, char **port); extern ConfigItem_class *Find_class(char *name); extern ConfigItem_deny_dcc *Find_deny_dcc(char *name); @@ -206,7 +206,7 @@ extern Ban *is_banned(aClient *, aChannel *, int, char **, char **); extern Ban *is_banned_with_nick(aClient *, aChannel *, int, char *, char **, char **); extern int parse_help(aClient *, char *, char *); -extern void ircd_log(int, FORMAT_STRING(char *), ...) __attribute__((format(printf,2,3))); +extern void ircd_log(int, FORMAT_STRING(const char *), ...) __attribute__((format(printf,2,3))); extern aClient *find_client(char *, aClient *); extern aClient *find_name(char *, aClient *); extern aClient *find_nickserv(char *, aClient *); @@ -280,27 +280,27 @@ extern void sendto_message_one(aClient *to, aClient *from, char *sender, extern void sendto_channel(aChannel *chptr, aClient *from, aClient *skip, int prefix, long clicap, int sendflags, MessageTag *mtags, - FORMAT_STRING(char *pattern), ...) __attribute__((format(printf,8,9))); + FORMAT_STRING(const char *pattern), ...) __attribute__((format(printf,8,9))); extern void sendto_local_common_channels(aClient *user, aClient *skip, long clicap, MessageTag *mtags, - FORMAT_STRING(char *pattern), ...) __attribute__((format(printf,5,6))); -extern void sendto_match_servs(aChannel *, aClient *, FORMAT_STRING(char *), ...) __attribute__((format(printf,3,4))); -extern void sendto_match_butone(aClient *, aClient *, FORMAT_STRING(char *), int, MessageTag *, - FORMAT_STRING(char *pattern), ...) __attribute__((format(printf,6,7))); -extern void sendto_all_butone(aClient *, aClient *, FORMAT_STRING(char *), ...) __attribute__((format(printf,3,4))); -extern void sendto_ops(FORMAT_STRING(char *), ...) __attribute__((format(printf,1,2))); -extern void sendto_ops_butone(FORMAT_STRING(aClient *), aClient *, char *, ...) __attribute__((format(printf,3,4))); + FORMAT_STRING(const char *pattern), ...) __attribute__((format(printf,5,6))); +extern void sendto_match_servs(aChannel *, aClient *, FORMAT_STRING(const char *), ...) __attribute__((format(printf,3,4))); +extern void sendto_match_butone(aClient *, aClient *, char *, int, MessageTag *, + FORMAT_STRING(const char *pattern), ...) __attribute__((format(printf,6,7))); +extern void sendto_all_butone(aClient *, aClient *, FORMAT_STRING(const char *), ...) __attribute__((format(printf,3,4))); +extern void sendto_ops(FORMAT_STRING(const char *), ...) __attribute__((format(printf,1,2))); +extern void sendto_ops_butone(aClient *, aClient *, FORMAT_STRING(const char *), ...) __attribute__((format(printf,3,4))); extern void sendto_prefix_one(aClient *, aClient *, MessageTag *, FORMAT_STRING(const char *), ...) __attribute__((format(printf,4,5))); -extern void sendto_opers(FORMAT_STRING(char *), ...) __attribute__((format(printf,1,2))); -extern void sendto_umode(int, FORMAT_STRING(char *), ...) __attribute__((format(printf,2,3))); -extern void sendto_umode_global(int, FORMAT_STRING(char *), ...) __attribute__((format(printf,2,3))); -extern void sendto_snomask(int snomask, FORMAT_STRING(char *pattern), ...) __attribute__((format(printf,2,3))); -extern void sendto_snomask_global(int snomask, FORMAT_STRING(char *pattern), ...) __attribute__((format(printf,2,3))); -extern void sendnotice(aClient *to, FORMAT_STRING(char *pattern), ...) __attribute__((format(printf,2,3))); +extern void sendto_opers(FORMAT_STRING(const char *), ...) __attribute__((format(printf,1,2))); +extern void sendto_umode(int, FORMAT_STRING(const char *), ...) __attribute__((format(printf,2,3))); +extern void sendto_umode_global(int, FORMAT_STRING(const char *), ...) __attribute__((format(printf,2,3))); +extern void sendto_snomask(int snomask, FORMAT_STRING(const char *pattern), ...) __attribute__((format(printf,2,3))); +extern void sendto_snomask_global(int snomask, FORMAT_STRING(const char *pattern), ...) __attribute__((format(printf,2,3))); +extern void sendnotice(aClient *to, FORMAT_STRING(const char *pattern), ...) __attribute__((format(printf,2,3))); extern void sendnumeric(aClient *to, int numeric, ...); -extern void sendnumericfmt(aClient *to, int numeric, FORMAT_STRING(char *pattern), ...) __attribute__((format(printf,3,4))); +extern void sendnumericfmt(aClient *to, int numeric, FORMAT_STRING(const char *pattern), ...) __attribute__((format(printf,3,4))); extern void sendto_server(aClient *one, unsigned long caps, unsigned long nocaps, MessageTag *mtags, FORMAT_STRING(const char *format), ...) __attribute__((format(printf, 5, 6))); -extern void sendto_ops_and_log(FORMAT_STRING(char *pattern), ...) __attribute__((format(printf,1,2))); +extern void sendto_ops_and_log(FORMAT_STRING(const char *pattern), ...) __attribute__((format(printf,1,2))); extern MODVAR int writecalls, writeb[]; extern int deliver_it(aClient *cptr, char *str, int len, int *want_read); @@ -445,7 +445,7 @@ extern char *strldup(const char *src, size_t n); extern int dopacket(aClient *, char *, int); -extern void debug(int, FORMAT_STRING(char *), ...); +extern void debug(int, FORMAT_STRING(const char *), ...) __attribute__((format(printf,2,3))); #if defined(DEBUGMODE) extern void send_usage(aClient *, char *); extern void count_memory(aClient *, char *); @@ -523,7 +523,7 @@ extern TLSOptions *get_tls_options_for_client(aClient *acptr); extern int outdated_tls_client(aClient *acptr); extern char *outdated_tls_client_build_string(char *pattern, aClient *acptr); extern long config_checkval(char *value, unsigned short flags); -extern void config_status(FORMAT_STRING(char *format), ...) __attribute__((format(printf,1,2))); +extern void config_status(FORMAT_STRING(const char *format), ...) __attribute__((format(printf,1,2))); extern void init_random(); extern u_char getrandom8(); extern uint16_t getrandom16(); @@ -710,7 +710,7 @@ extern MODVAR aTKline *tklines[TKLISTLEN]; extern MODVAR aTKline *tklines_ip_hash[TKLIPHASHLEN1][TKLIPHASHLEN2]; extern char *cmdname_by_spamftarget(int target); extern void unrealdns_delreq_bycptr(aClient *cptr); -extern void sendtxtnumeric(aClient *to, FORMAT_STRING(char *pattern), ...) __attribute__((format(printf,2,3))); +extern void sendtxtnumeric(aClient *to, FORMAT_STRING(const char *pattern), ...) __attribute__((format(printf,2,3))); extern void unrealdns_gethostbyname_link(char *name, ConfigItem_link *conf, int ipv4_only); extern void unrealdns_delasyncconnects(void); extern int is_autojoin_chan(char *chname); @@ -741,7 +741,7 @@ extern MODVAR char *IsupportStrings[]; extern void finish_auth(aClient *acptr); extern void read_packet(int fd, int revents, void *data); extern int process_packet(aClient *cptr, char *readbuf, int length, int killsafely); -extern void sendto_realops_and_log(FORMAT_STRING(char *fmt), ...) __attribute__((format(printf,1,2))); +extern void sendto_realops_and_log(FORMAT_STRING(const char *fmt), ...) __attribute__((format(printf,1,2))); extern int parse_chanmode(ParseMode *pm, char *modebuf_in, char *parabuf_in); extern void config_report_ssl_error(void); extern int dead_link(aClient *to, char *notice); @@ -846,7 +846,7 @@ extern int is_handshake_finished(aClient *sptr); extern void SetCapability(aClient *acptr, const char *token); extern void ClearCapability(aClient *acptr, const char *token); extern void new_message(aClient *sender, MessageTag *recv_mtags, MessageTag **mtag_list); -extern void new_message_special(aClient *sender, MessageTag *recv_mtags, MessageTag **mtag_list, FORMAT_STRING(char *pattern), ...) __attribute__((format(printf,4,5))); +extern void new_message_special(aClient *sender, MessageTag *recv_mtags, MessageTag **mtag_list, FORMAT_STRING(const char *pattern), ...) __attribute__((format(printf,4,5))); extern void generate_batch_id(char *str); extern MessageTag *find_mtag(MessageTag *mtags, const char *token); extern MessageTag *duplicate_mtag(MessageTag *mtag); diff --git a/include/proto.h b/include/proto.h index f66ad9f86..8b4feb41a 100644 --- a/include/proto.h +++ b/include/proto.h @@ -36,8 +36,8 @@ extern char *collapse(char *pattern); extern void clear_scache_hash_table(void); /* send.c */ -extern void sendto_one(aClient *, MessageTag *mtags, FORMAT_STRING(char *), ...) __attribute__((format(printf,3,4))); -extern void sendto_realops(FORMAT_STRING(char *pattern), ...) __attribute__((format(printf,1,2))); +extern void sendto_one(aClient *, MessageTag *mtags, FORMAT_STRING(const char *), ...) __attribute__((format(printf,3,4))); +extern void sendto_realops(FORMAT_STRING(const char *pattern), ...) __attribute__((format(printf,1,2))); /* ircd.c */ extern EVENT(garbage_collect); diff --git a/src/api-usermode.c b/src/api-usermode.c index 57ccfdc4b..c661b5f7e 100644 --- a/src/api-usermode.c +++ b/src/api-usermode.c @@ -186,7 +186,7 @@ Umode *UmodeAdd(Module *module, char ch, int global, int unset_on_deoper, int (* Usermode_Table[i].flag = ch; Usermode_Table[i].allowed = allowed; Usermode_Table[i].unset_on_deoper = unset_on_deoper; - Debug((DEBUG_DEBUG, "UmodeAdd(%c) returning %04x", + Debug((DEBUG_DEBUG, "UmodeAdd(%c) returning %04lx", ch, Usermode_Table[i].mode)); /* Update usermode table highest */ for (j = 0; j < UMODETABLESZ; j++) diff --git a/src/bsd.c b/src/bsd.c index fdc30bf97..248cbbe86 100644 --- a/src/bsd.c +++ b/src/bsd.c @@ -1536,7 +1536,7 @@ static void read_authports(int fd, int revents, void *data); void ident_failed(aClient *cptr) { - Debug((DEBUG_NOTICE, "ident_failed() for %x", cptr)); + Debug((DEBUG_NOTICE, "ident_failed() for %p", cptr)); ircstp->is_abad++; if (cptr->local->authfd != -1) { @@ -1573,7 +1573,7 @@ void start_auth(aClient *cptr) finish_auth(cptr); return; } - Debug((DEBUG_NOTICE, "start_auth(%x) fd=%d, status=%d", + Debug((DEBUG_NOTICE, "start_auth(%p) fd=%d, status=%d", cptr, cptr->fd, cptr->status)); snprintf(buf, sizeof buf, "identd: %s", get_client_name(cptr, TRUE)); if ((cptr->local->authfd = fd_socket(IsIPV6(cptr) ? AF_INET6 : AF_INET, SOCK_STREAM, 0, buf)) == -1) @@ -1629,7 +1629,7 @@ static void send_authports(int fd, int revents, void *data) int ulen, tlen; aClient *cptr = data; - Debug((DEBUG_NOTICE, "write_authports(%x) fd %d authfd %d stat %d", + Debug((DEBUG_NOTICE, "write_authports(%p) fd %d authfd %d stat %d", cptr, cptr->fd, cptr->local->authfd, cptr->status)); ircsnprintf(authbuf, sizeof(authbuf), "%d , %d\r\n", @@ -1668,7 +1668,7 @@ static void read_authports(int fd, int revents, void *userdata) aClient *cptr = userdata; *system = *ruser = '\0'; - Debug((DEBUG_NOTICE, "read_authports(%x) fd %d authfd %d stat %d", + Debug((DEBUG_NOTICE, "read_authports(%p) fd %d authfd %d stat %d", cptr, cptr->fd, cptr->local->authfd, cptr->status)); /* * Nasty. Cant allow any other reads from client fd while we're diff --git a/src/conf.c b/src/conf.c index 2eca9c430..d7c95d29a 100644 --- a/src/conf.c +++ b/src/conf.c @@ -209,14 +209,6 @@ void config_free(ConfigFile *cfptr); static ConfigFile *config_parse(char *filename, char *confdata); static void config_entry_free(ConfigEntry *ceptr); ConfigEntry *config_find_entry(ConfigEntry *ce, char *name); -/* - * Error handling -*/ - -void config_warn(char *format, ...); -void config_error(char *format, ...); -void config_status(char *format, ...); -void config_progress(char *format, ...); #ifdef _WIN32 extern void win_log(char *format, ...); @@ -1203,7 +1195,7 @@ ConfigEntry *config_find_entry(ConfigEntry *ce, char *name) return cep; } -void config_error(char *format, ...) +void config_error(FORMAT_STRING(const char *format), ...) { va_list ap; char buffer[1024]; @@ -1266,7 +1258,7 @@ void config_error_empty(const char *filename, int line, const char *block, filename, line, block, entry); } -void config_status(char *format, ...) +void config_status(FORMAT_STRING(const char *format), ...) { va_list ap; char buffer[1024]; @@ -1287,7 +1279,7 @@ void config_status(char *format, ...) sendnotice(remote_rehash_client, "%s", buffer); } -void config_warn(char *format, ...) +void config_warn(FORMAT_STRING(const char *format), ...) { va_list ap; char buffer[1024]; @@ -1386,7 +1378,7 @@ int config_test_openfile(ConfigEntry *cep, int flags, mode_t mode, const char *e return 0; } -void config_progress(char *format, ...) +void config_progress(FORMAT_STRING(const char *format), ...) { va_list ap; char buffer[1024]; diff --git a/src/debug.c b/src/debug.c index 8a3f7a036..5ab4ef0d5 100644 --- a/src/debug.c +++ b/src/debug.c @@ -119,15 +119,7 @@ void flag_del(char ch) static char debugbuf[4096]; -#ifndef USE_VARARGS -/*VARARGS2*/ -void debug(level, form, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10) - int level; - char *form, *p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8, *p9, *p10; -{ -#else -void debug(int level, char *form, ...) -#endif +void debug(int level, FORMAT_STRING(const char *form), ...) { int err = ERRNO; @@ -136,11 +128,7 @@ void debug(int level, char *form, ...) if ((debuglevel >= 0) && (level <= debuglevel)) { -#ifndef USE_VARARGS - (void)ircsnprintf(debugbuf, sizeof(debugbuf), form, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); -#else (void)ircvsnprintf(debugbuf, sizeof(debugbuf), form, vl); -#endif #ifndef _WIN32 strlcat(debugbuf, "\n", sizeof(debugbuf)); diff --git a/src/extra.c b/src/extra.c index 3ae282436..7b7010279 100644 --- a/src/extra.c +++ b/src/extra.c @@ -234,7 +234,7 @@ int found = 0; } /* irc logs.. */ -void ircd_log(int flags, char *format, ...) +void ircd_log(int flags, FORMAT_STRING(const char *format), ...) { static int last_log_file_warning = 0; static char recursion_trap=0; diff --git a/src/ircd.c b/src/ircd.c index 886da1973..ec0f96a4f 100644 --- a/src/ircd.c +++ b/src/ircd.c @@ -488,9 +488,9 @@ int check_ping(aClient *cptr) int ping = 0; ping = cptr->local->class ? cptr->local->class->pingfreq : iConf.handshake_timeout; - Debug((DEBUG_DEBUG, "c(%s)=%d p %d a %d", cptr->name, + Debug((DEBUG_DEBUG, "c(%s)=%d p %d a %lld", cptr->name, cptr->status, ping, - TStime() - cptr->local->lasttime)); + (long long)(TStime() - cptr->local->lasttime))); /* If ping is less than or equal to the last time we received a command from them */ if (ping > (TStime() - cptr->local->lasttime)) @@ -518,10 +518,10 @@ int check_ping(aClient *cptr) FALSE)); } if (IsTLSAcceptHandshake(cptr)) - Debug((DEBUG_DEBUG, "ssl accept handshake timeout: %s (%li-%li > %li)", cptr->local->sockhost, - TStime(), cptr->local->since, ping)); - (void)ircsnprintf(scratch, sizeof(scratch), "Ping timeout: %ld seconds", - (long) (TStime() - cptr->local->lasttime)); + Debug((DEBUG_DEBUG, "ssl accept handshake timeout: %s (%lld-%lld > %lld)", cptr->local->sockhost, + (long long)TStime(), (long long)cptr->local->since, (long long)ping)); + (void)ircsnprintf(scratch, sizeof(scratch), "Ping timeout: %lld seconds", + (long long) (TStime() - cptr->local->lasttime)); return exit_client(cptr, cptr, &me, NULL, scratch); } else if (IsRegistered(cptr) && diff --git a/src/misc.c b/src/misc.c index 75444dbce..5893775ae 100644 --- a/src/misc.c +++ b/src/misc.c @@ -1082,7 +1082,7 @@ int IsWebsocket(aClient *acptr) return (MyConnect(acptr) && moddata_client(acptr, md).ptr) ? 1 : 0; } -extern void send_raw_direct(aClient *user, char *pattern, ...); +extern void send_raw_direct(aClient *user, FORMAT_STRING(const char *pattern), ...); /** Generic function to inform the user he/she has been banned. * @param acptr The affected client. @@ -1304,7 +1304,7 @@ void new_message(aClient *sender, MessageTag *recv_mtags, MessageTag **mtag_list * identical to the message that is sent to clients (end-users). * For example ":xyz JOIN #chan". */ -void new_message_special(aClient *sender, MessageTag *recv_mtags, MessageTag **mtag_list, char *pattern, ...) +void new_message_special(aClient *sender, MessageTag *recv_mtags, MessageTag **mtag_list, FORMAT_STRING(const char *pattern), ...) { Hook *h; va_list vl; diff --git a/src/send.c b/src/send.c index c92473fef..b67a7f41c 100644 --- a/src/send.c +++ b/src/send.c @@ -155,7 +155,7 @@ int send_queued(aClient *to) /* * send message to single client */ -void sendto_one(aClient *to, MessageTag *mtags, char *pattern, ...) +void sendto_one(aClient *to, MessageTag *mtags, FORMAT_STRING(const char *pattern), ...) { va_list vl; va_start(vl, pattern); @@ -356,7 +356,7 @@ void sendbufto_one(aClient *to, char *msg, unsigned int quick) void sendto_channel(aChannel *chptr, aClient *from, aClient *skip, int prefix, long clicap, int sendflags, MessageTag *mtags, - char *pattern, ...) + FORMAT_STRING(const char *pattern), ...) { va_list vl; Member *lp; @@ -474,7 +474,7 @@ good: * what we had going on here. * - kaniini */ -void sendto_server(aClient *one, unsigned long caps, unsigned long nocaps, MessageTag *mtags, const char *format, ...) +void sendto_server(aClient *one, unsigned long caps, unsigned long nocaps, MessageTag *mtags, FORMAT_STRING(const char *format), ...) { aClient *cptr; @@ -514,7 +514,7 @@ void sendto_server(aClient *one, unsigned long caps, unsigned long nocaps, Messa * @param pattern The pattern (eg: ":%s NICK %s"). * @param ... The parameters for the pattern. */ -void sendto_local_common_channels(aClient *user, aClient *skip, long clicap, MessageTag *mtags, char *pattern, ...) +void sendto_local_common_channels(aClient *user, aClient *skip, long clicap, MessageTag *mtags, FORMAT_STRING(const char *pattern), ...) { va_list vl; Membership *channels; @@ -585,7 +585,7 @@ static int match_it(aClient *one, char *mask, int what) * either by user hostname or user servername. */ void sendto_match_butone(aClient *one, aClient *from, char *mask, int what, - MessageTag *mtags, char *pattern, ...) + MessageTag *mtags, FORMAT_STRING(const char *pattern), ...) { va_list vl; int i; @@ -632,7 +632,7 @@ void sendto_match_butone(aClient *one, aClient *from, char *mask, int what, * * Send to *local* ops only. */ -void sendto_ops(char *pattern, ...) +void sendto_ops(FORMAT_STRING(const char *pattern), ...) { va_list vl; aClient *cptr; @@ -655,7 +655,7 @@ void sendto_ops(char *pattern, ...) * * Send to specified umode */ -void sendto_umode(int umodes, char *pattern, ...) +void sendto_umode(int umodes, FORMAT_STRING(const char *pattern), ...) { va_list vl; aClient *cptr; @@ -679,7 +679,7 @@ void sendto_umode(int umodes, char *pattern, ...) * * Send to specified umode *GLOBALLY* (on all servers) */ -void sendto_umode_global(int umodes, char *pattern, ...) +void sendto_umode_global(int umodes, FORMAT_STRING(const char *pattern), ...) { va_list vl; aClient *cptr; @@ -727,7 +727,7 @@ void sendto_umode_global(int umodes, char *pattern, ...) * @param pattern printf-style pattern, followed by parameters. * This function does not send snomasks to non-opers. */ -void sendto_snomask(int snomask, char *pattern, ...) +void sendto_snomask(int snomask, FORMAT_STRING(const char *pattern), ...) { va_list vl; aClient *cptr; @@ -749,7 +749,7 @@ void sendto_snomask(int snomask, char *pattern, ...) * @param pattern printf-style pattern, followed by parameters * This function does not send snomasks to non-opers. */ -void sendto_snomask_global(int snomask, char *pattern, ...) +void sendto_snomask_global(int snomask, FORMAT_STRING(const char *pattern), ...) { va_list vl; aClient *cptr; @@ -824,7 +824,7 @@ void send_cap_notify(int add, char *token) ** one - client not to send message to ** from- client which message is from *NEVER* NULL!! */ -void sendto_ops_butone(aClient *one, aClient *from, char *pattern, ...) +void sendto_ops_butone(aClient *one, aClient *from, FORMAT_STRING(const char *pattern), ...) { va_list vl; int i; @@ -854,7 +854,7 @@ void sendto_ops_butone(aClient *one, aClient *from, char *pattern, ...) * they do not want or need the expanded prefix. In that case, simply * use ircvsnprintf() directly. */ -static int vmakebuf_local_withprefix(char *buf, size_t buflen, struct Client *from, const char *pattern, va_list vl) +static int vmakebuf_local_withprefix(char *buf, size_t buflen, struct Client *from, FORMAT_STRING(const char *pattern), va_list vl) { int len; @@ -900,7 +900,7 @@ static int vmakebuf_local_withprefix(char *buf, size_t buflen, struct Client *fr } void vsendto_prefix_one(struct Client *to, struct Client *from, MessageTag *mtags, - const char *pattern, va_list vl) + FORMAT_STRING(const char *pattern), va_list vl) { char *mtags_str = mtags ? mtags_to_string(mtags, to) : NULL; @@ -930,7 +930,7 @@ void vsendto_prefix_one(struct Client *to, struct Client *from, MessageTag *mtag * -avalon */ -void sendto_prefix_one(aClient *to, aClient *from, MessageTag *mtags, const char *pattern, ...) +void sendto_prefix_one(aClient *to, aClient *from, MessageTag *mtags, FORMAT_STRING(const char *pattern), ...) { va_list vl; va_start(vl, pattern); @@ -943,7 +943,7 @@ void sendto_prefix_one(aClient *to, aClient *from, MessageTag *mtags, const char * * Send to *local* ops only but NOT +s nonopers. */ -void sendto_realops(char *pattern, ...) +void sendto_realops(FORMAT_STRING(const char *pattern), ...) { va_list vl; aClient *cptr; @@ -962,7 +962,7 @@ void sendto_realops(char *pattern, ...) } /* Sends a message to all (local) opers AND logs to the ircdlog (as LOG_ERROR) */ -void sendto_realops_and_log(char *fmt, ...) +void sendto_realops_and_log(FORMAT_STRING(const char *fmt), ...) { va_list vl; static char buf[2048]; @@ -1123,7 +1123,7 @@ void sendto_one_nickcmd(aClient *cptr, aClient *sptr, char *umodes) * has a % in their nick, which is a safe assumption since % is illegal. */ -void sendnotice(aClient *to, char *pattern, ...) +void sendnotice(aClient *to, FORMAT_STRING(const char *pattern), ...) { static char realpattern[1024]; va_list vl; @@ -1136,7 +1136,7 @@ char *name = *to->name ? to->name : "*"; va_end(vl); } -void sendtxtnumeric(aClient *to, char *pattern, ...) +void sendtxtnumeric(aClient *to, FORMAT_STRING(const char *pattern), ...) { static char realpattern[1024]; va_list vl; @@ -1162,7 +1162,7 @@ void sendnumeric(aClient *to, int numeric, ...) } /** Send numeric to IRC client */ -void sendnumericfmt(aClient *to, int numeric, char *pattern, ...) +void sendnumericfmt(aClient *to, int numeric, FORMAT_STRING(const char *pattern), ...) { va_list vl; char realpattern[512]; @@ -1189,7 +1189,7 @@ void sendnumericfmt(aClient *to, int numeric, char *pattern, ...) * By the way, did I already mention that you SHOULD NOT USE THIS * FUNCTION? ;) */ -void send_raw_direct(aClient *user, char *pattern, ...) +void send_raw_direct(aClient *user, FORMAT_STRING(FORMAT_STRING(const char *pattern)), ...) { va_list vl; int sendlen; @@ -1203,7 +1203,7 @@ void send_raw_direct(aClient *user, char *pattern, ...) /** Send a message to all locally connected IRCOps and log the error. */ -void sendto_ops_and_log(char *pattern, ...) +void sendto_ops_and_log(FORMAT_STRING(const char *pattern), ...) { va_list vl; char buf[1024];