From 86650fb9472630fe2e20863bc08827cd855e5bfb Mon Sep 17 00:00:00 2001 From: "Kevin L. Mitchell" Date: Fri, 31 Aug 2001 14:37:30 +0000 Subject: [PATCH] Author: Kev Log message: Channel limits are unsigned; display and process them that way. git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@555 c9e4aea6-c8fd-4c43-8297-357d70d61c8c --- ChangeLog | 7 +++++++ ircd/channel.c | 8 ++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 28f642e..3242387 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2001-08-31 Kevin L Mitchell + + * ircd/channel.c: use "%u" to format limit arguments; use + strtoul() to process limit arguments in a /mode command--note: + most clients seem to truncate the integer, probably because + they're using atoi, and perhaps signed ints + 2001-08-17 Kevin L Mitchell * ircd/numnicks.c: include stdlib.h for exit() diff --git a/ircd/channel.c b/ircd/channel.c index c209148..c9cf899 100644 --- a/ircd/channel.c +++ b/ircd/channel.c @@ -691,7 +691,7 @@ void channel_modes(struct Client *cptr, char *mbuf, char *pbuf, *mbuf++ = 'n'; if (chptr->mode.limit) { *mbuf++ = 'l'; - ircd_snprintf(0, pbuf, sizeof(pbuf), "%d", chptr->mode.limit); + ircd_snprintf(0, pbuf, sizeof(pbuf), "%u", chptr->mode.limit); } if (*chptr->mode.key) { @@ -1408,7 +1408,7 @@ modebuf_flush_int(struct ModeBuf *mbuf, int all) } } else if (MB_TYPE(mbuf, i) & MODE_LIMIT) { /* if it's a limit, we also format the number */ - ircd_snprintf(0, limitbuf, sizeof(limitbuf), "%d", MB_UINT(mbuf, i)); + ircd_snprintf(0, limitbuf, sizeof(limitbuf), "%u", MB_UINT(mbuf, i)); tmp = strlen(limitbuf); @@ -1810,7 +1810,7 @@ modebuf_extract(struct ModeBuf *mbuf, char *buf) if (MB_TYPE(mbuf, i) & MODE_KEY) /* keep strings */ key = MB_STRING(mbuf, i); else if (MB_TYPE(mbuf, i) & MODE_LIMIT) - ircd_snprintf(0, limitbuf, sizeof(limitbuf), "%d", MB_UINT(mbuf, i)); + ircd_snprintf(0, limitbuf, sizeof(limitbuf), "%u", MB_UINT(mbuf, i)); } } @@ -1920,7 +1920,7 @@ mode_parse_limit(struct ParseState *state, int *flag_p) return; } - t_limit = atoi(state->parv[state->args_used++]); /* grab arg */ + t_limit = strtoul(state->parv[state->args_used++], 0, 10); /* grab arg */ state->parc--; state->max_args--; -- 2.20.1