More cleanup
This commit is contained in:
parent
5861f8a677
commit
66769bc1f8
8 changed files with 19 additions and 29 deletions
|
@ -20,18 +20,16 @@ DECLARE_MODULE_AV2(echotags, NULL, NULL, echotags_clist, NULL, NULL, NULL, NULL,
|
|||
static void
|
||||
m_echotags(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
||||
{
|
||||
int i;
|
||||
|
||||
sendto_one_notice(source_p, ":*** You sent %zu tags.", msgbuf_p->n_tags);
|
||||
|
||||
for (i = 0; i < msgbuf_p->n_tags; i++)
|
||||
for (size_t i = 0; i < msgbuf_p->n_tags; i++)
|
||||
{
|
||||
struct MsgTag *tag = &msgbuf_p->tags[i];
|
||||
|
||||
if (tag->value)
|
||||
sendto_one_notice(source_p, ":*** %d: %s => %s", i, tag->key, tag->value);
|
||||
sendto_one_notice(source_p, ":*** %zu: %s => %s", i, tag->key, tag->value);
|
||||
else
|
||||
sendto_one_notice(source_p, ":*** %d: %s", i, tag->key);
|
||||
sendto_one_notice(source_p, ":*** %zu: %s", i, tag->key);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ struct Channel
|
|||
unsigned int join_count; /* joins within delta */
|
||||
unsigned int join_delta; /* last ts of join */
|
||||
|
||||
unsigned long bants;
|
||||
time_t bants;
|
||||
time_t channelts;
|
||||
char *chname;
|
||||
|
||||
|
@ -93,7 +93,7 @@ struct membership
|
|||
struct Client *client_p;
|
||||
unsigned int flags;
|
||||
|
||||
unsigned long bants;
|
||||
time_t bants;
|
||||
};
|
||||
|
||||
#define BANLEN 195
|
||||
|
|
|
@ -54,7 +54,7 @@ typedef void (*MessageHandler) (struct MsgBuf *, struct Client *, struct Client
|
|||
struct MessageEntry
|
||||
{
|
||||
MessageHandler handler;
|
||||
int min_para;
|
||||
size_t min_para;
|
||||
};
|
||||
|
||||
/* Message table structure */
|
||||
|
|
|
@ -35,7 +35,6 @@ msgbuf_parse(struct MsgBuf *msgbuf, char *line)
|
|||
char *ch;
|
||||
char *parv[MAXPARA];
|
||||
size_t n_para;
|
||||
int i;
|
||||
|
||||
/* skip any leading spaces */
|
||||
for (ch = line; *ch && *ch == ' '; ch++)
|
||||
|
@ -108,7 +107,7 @@ msgbuf_parse(struct MsgBuf *msgbuf, char *line)
|
|||
return 1;
|
||||
|
||||
msgbuf->cmd = parv[0];
|
||||
for (i = 0; i < n_para; i++)
|
||||
for (size_t i = 0; i < n_para; i++)
|
||||
msgbuf_append_para(msgbuf, parv[i]);
|
||||
|
||||
return 0;
|
||||
|
@ -117,9 +116,7 @@ msgbuf_parse(struct MsgBuf *msgbuf, char *line)
|
|||
static int
|
||||
msgbuf_has_matching_tags(struct MsgBuf *msgbuf, unsigned int capmask)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < msgbuf->n_tags; i++)
|
||||
for (size_t i = 0; i < msgbuf->n_tags; i++)
|
||||
{
|
||||
if ((msgbuf->tags[i].capmask & capmask) != 0)
|
||||
return 1;
|
||||
|
@ -131,14 +128,12 @@ msgbuf_has_matching_tags(struct MsgBuf *msgbuf, unsigned int capmask)
|
|||
static void
|
||||
msgbuf_unparse_tags(char *buf, size_t buflen, struct MsgBuf *msgbuf, unsigned int capmask)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!msgbuf_has_matching_tags(msgbuf, capmask))
|
||||
return;
|
||||
|
||||
*buf = '@';
|
||||
|
||||
for (i = 0; i < msgbuf->n_tags; i++)
|
||||
for (size_t i = 0; i < msgbuf->n_tags; i++)
|
||||
{
|
||||
if ((msgbuf->tags[i].capmask & capmask) == 0)
|
||||
continue;
|
||||
|
@ -185,11 +180,9 @@ msgbuf_unparse_prefix(char *buf, size_t buflen, struct MsgBuf *msgbuf, unsigned
|
|||
int
|
||||
msgbuf_unparse(char *buf, size_t buflen, struct MsgBuf *msgbuf, unsigned int capmask)
|
||||
{
|
||||
int i;
|
||||
|
||||
msgbuf_unparse_prefix(buf, buflen, msgbuf, capmask);
|
||||
|
||||
for (i = msgbuf->cmd != NULL ? 0 : 1; i < msgbuf->n_para; i++)
|
||||
for (size_t i = msgbuf->cmd != NULL ? 0 : 1; i < msgbuf->n_para; i++)
|
||||
{
|
||||
if (i == (msgbuf->n_para - 1))
|
||||
{
|
||||
|
|
|
@ -246,13 +246,13 @@ handle_command(struct Message *mptr, struct MsgBuf *msgbuf_p, struct Client *cli
|
|||
|
||||
sendto_realops_snomask(SNO_GENERAL, L_ALL,
|
||||
"Dropping server %s due to (invalid) command '%s'"
|
||||
" with only %zu arguments (expecting %d).",
|
||||
" with only %zu arguments (expecting %zu).",
|
||||
client_p->name, mptr->cmd, msgbuf_p->n_para, ehandler.min_para);
|
||||
ilog(L_SERVER,
|
||||
"Insufficient parameters (%zu < %d) for command '%s' from %s.",
|
||||
"Insufficient parameters (%zu < %zu) for command '%s' from %s.",
|
||||
msgbuf_p->n_para, ehandler.min_para, mptr->cmd, client_p->name);
|
||||
snprintf(squitreason, sizeof squitreason,
|
||||
"Insufficient parameters (%zu < %d) for command '%s'",
|
||||
"Insufficient parameters (%zu < %zu) for command '%s'",
|
||||
msgbuf_p->n_para, ehandler.min_para, mptr->cmd);
|
||||
exit_client(client_p, client_p, client_p, squitreason);
|
||||
return (-1);
|
||||
|
@ -278,7 +278,7 @@ handle_encap(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *so
|
|||
ehandler = mptr->handlers[ENCAP_HANDLER];
|
||||
handler = ehandler.handler;
|
||||
|
||||
if(parc < ehandler.min_para ||
|
||||
if((size_t)parc < ehandler.min_para ||
|
||||
(ehandler.min_para && EmptyString(parv[ehandler.min_para - 1])))
|
||||
return;
|
||||
|
||||
|
|
|
@ -223,7 +223,7 @@ linebuf_put_msgvbuf(struct MsgBuf *msgbuf, buf_head_t *linebuf, unsigned int cap
|
|||
rb_linebuf_newbuf(linebuf);
|
||||
msgbuf_unparse_prefix(buf, sizeof buf, msgbuf, capmask);
|
||||
rb_linebuf_putprefix(linebuf, pattern, va, buf);
|
||||
}
|
||||
}
|
||||
|
||||
/* linebuf_put_msgbuf
|
||||
*
|
||||
|
@ -505,7 +505,7 @@ sendto_channel_flags(struct Client *one, int type, struct Client *source_p,
|
|||
struct membership *msptr;
|
||||
rb_dlink_node *ptr;
|
||||
rb_dlink_node *next_ptr;
|
||||
unsigned int current_capmask = 0;
|
||||
int current_capmask = 0;
|
||||
struct MsgBuf msgbuf;
|
||||
|
||||
rb_linebuf_newbuf(&rb_linebuf_local);
|
||||
|
|
|
@ -452,7 +452,6 @@ ssl_process_certfp(ssl_ctl_t * ctl, ssl_ctl_buf_t * ctl_buf)
|
|||
uint32_t len;
|
||||
uint8_t *certfp;
|
||||
char *certfp_string;
|
||||
int i;
|
||||
|
||||
if(ctl_buf->buflen > 5 + RB_SSL_CERTFP_LEN)
|
||||
return; /* bogus message..drop it.. XXX should warn here */
|
||||
|
@ -465,7 +464,7 @@ ssl_process_certfp(ssl_ctl_t * ctl, ssl_ctl_buf_t * ctl_buf)
|
|||
return;
|
||||
rb_free(client_p->certfp);
|
||||
certfp_string = rb_malloc(len * 2 + 1);
|
||||
for(i = 0; i < len; i++)
|
||||
for(uint32_t i = 0; i < len; i++)
|
||||
snprintf(certfp_string + 2 * i, 3, "%02x",
|
||||
certfp[i]);
|
||||
client_p->certfp = certfp_string;
|
||||
|
@ -478,7 +477,7 @@ ssl_process_cmd_recv(ssl_ctl_t * ctl)
|
|||
static const char *no_ssl_or_zlib = "ssld has neither SSL/TLS or zlib support killing all sslds";
|
||||
rb_dlink_node *ptr, *next;
|
||||
ssl_ctl_buf_t *ctl_buf;
|
||||
int len;
|
||||
unsigned long len;
|
||||
|
||||
if(ctl->dead)
|
||||
return;
|
||||
|
|
|
@ -157,7 +157,7 @@ flattened_map(struct Client *client_p)
|
|||
rb_dlink_node *ptr;
|
||||
struct Client *target_p;
|
||||
int i, len;
|
||||
int cnt = 0;
|
||||
unsigned long cnt = 0;
|
||||
|
||||
/* First display me as the root */
|
||||
rb_strlcpy(buf, me.name, BUFSIZE);
|
||||
|
|
Loading…
Reference in a new issue