summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormichael <michael@82007160-df01-0410-b94d-b575c5fd34c7>2014-05-29 16:13:05 +0000
committermichael <michael@82007160-df01-0410-b94d-b575c5fd34c7>2014-05-29 16:13:05 +0000
commit3c5cc280463c2771af029940ce1e03ac602423db (patch)
tree949ede2045ed2508e747a20ad4b3b4cd2f371e7a /src
parent3b74594929207be2eaea2765d73e279eefa29ea5 (diff)
- channel_mode.c:channel_modes(): replaced sprintf with strcat;
use %u conversion specifier for unsigned ints git-svn-id: svn://svn.ircd-hybrid.org/svnroot/ircd-hybrid/branches/8.1.x@3689 82007160-df01-0410-b94d-b575c5fd34c7
Diffstat (limited to 'src')
-rw-r--r--src/channel_mode.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/channel_mode.c b/src/channel_mode.c
index 6f0abe4..3aa6343 100644
--- a/src/channel_mode.c
+++ b/src/channel_mode.c
@@ -301,24 +301,24 @@ const struct mode_letter chan_modes[] =
* chptr onto buffer mbuf with the parameters in pbuf.
*/
void
-channel_modes(struct Channel *chptr, struct Client *client_p,
- char *mbuf, char *pbuf)
+channel_modes(struct Channel *chptr, struct Client *client_p, char *mbuf, char *pbuf)
{
- const struct mode_letter *tab = chan_modes;
+ int previous_mode = 0;
*mbuf++ = '+';
*pbuf = '\0';
- for (; tab->mode; ++tab)
+ for (const struct mode_letter *tab = chan_modes; tab->mode; ++tab)
if (chptr->mode.mode & tab->mode)
*mbuf++ = tab->letter;
if (chptr->mode.limit)
{
+ previous_mode = 1;
*mbuf++ = 'l';
if (IsServer(client_p) || HasFlag(client_p, FLAGS_SERVICE) || IsMember(client_p, chptr))
- pbuf += sprintf(pbuf, "%d", chptr->mode.limit);
+ sprintf(pbuf, "%u", chptr->mode.limit);
}
if (chptr->mode.key[0])
@@ -326,7 +326,11 @@ channel_modes(struct Channel *chptr, struct Client *client_p,
*mbuf++ = 'k';
if (IsServer(client_p) || HasFlag(client_p, FLAGS_SERVICE) || IsMember(client_p, chptr))
- sprintf(pbuf, *pbuf ? " %s" : "%s", chptr->mode.key);
+ {
+ if (previous_mode)
+ strcat(pbuf, " ");
+ strcat(pbuf, chptr->mode.key);
+ }
}
*mbuf = '\0';