summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-03-02 12:00:57 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-03-02 12:00:57 +0000
commit4c6fb8032bf8a6310080069cc65c975087d93a76 (patch)
treefb5316853d6f962c13c96221f3336ea1da8b0b3a
parent99f6009b2d0d1bc4b7ddc09f164fc19b78e6b431 (diff)
Made extensive use of charlcat to cut down on strlcat usage
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3417 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--include/helperfuncs.h2
-rw-r--r--src/cmd_ison.cpp2
-rw-r--r--src/commands.cpp2
-rw-r--r--src/inspircd_io.cpp2
-rw-r--r--src/mode.cpp61
-rwxr-xr-xsrc/svn-rev.sh2
6 files changed, 32 insertions, 39 deletions
diff --git a/include/helperfuncs.h b/include/helperfuncs.h
index 933aeaca1..ae83dbf27 100644
--- a/include/helperfuncs.h
+++ b/include/helperfuncs.h
@@ -87,6 +87,6 @@ std::string GetFullProgDir(char** argv, int argc);
int InsertMode(std::string &output, const char* modes, unsigned short section);
bool IsValidChannelName(const char *);
-inline int charlcat(char* x,char y,int z);
+int charlcat(char* x,char y,int z);
#endif
diff --git a/src/cmd_ison.cpp b/src/cmd_ison.cpp
index 8ced97801..8d0c239cc 100644
--- a/src/cmd_ison.cpp
+++ b/src/cmd_ison.cpp
@@ -44,7 +44,7 @@ void cmd_ison::Handle (char **parameters, int pcnt, userrec *user)
if (u)
{
strlcat(Return,u->nick,MAXBUF);
- strlcat(Return," ",MAXBUF);
+ charlcat(Return,' ',MAXBUF);
}
}
WriteServ(user->fd,Return);
diff --git a/src/commands.cpp b/src/commands.cpp
index 00f44c74a..048a5fae7 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -285,7 +285,7 @@ bool host_matches_everyone(std::string mask, userrec* user)
for (user_hash::iterator u = clientlist.begin(); u != clientlist.end(); u++)
{
strlcpy(buffer,u->second->ident,MAXBUF);
- strlcat(buffer,"@",MAXBUF);
+ charlcat(buffer,'@',MAXBUF);
strlcat(buffer,u->second->host,MAXBUF);
if (match(buffer,mask.c_str()))
matches++;
diff --git a/src/inspircd_io.cpp b/src/inspircd_io.cpp
index 01ee4d7a8..c9d64d57c 100644
--- a/src/inspircd_io.cpp
+++ b/src/inspircd_io.cpp
@@ -265,7 +265,7 @@ void ServerConfig::Read(bool bail, userrec* user)
if (!strchr(Config->ServerName,'.'))
{
log(DEFAULT,"WARNING: <server:name> '%s' is not a fully-qualified domain name. Changed to '%s%c'",Config->ServerName,Config->ServerName,'.');
- strlcat(Config->ServerName,".",MAXBUF);
+ charlcat(Config->ServerName,'.',MAXBUF);
}
if (!Config->dns_timeout)
Config->dns_timeout = 5;
diff --git a/src/mode.cpp b/src/mode.cpp
index d07675e5f..8644af8cd 100644
--- a/src/mode.cpp
+++ b/src/mode.cpp
@@ -672,7 +672,7 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int
}
if (r)
{
- strlcat(outlist,"o",MAXBUF);
+ charlcat(outlist,'o',MAXBUF);
strlcpy(outpars[pc++],r,MAXBUF);
}
break;
@@ -702,7 +702,7 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int
}
if (r)
{
- strlcat(outlist,"h",MAXBUF);
+ charlcat(outlist,'h',MAXBUF);
strlcpy(outpars[pc++],r,MAXBUF);
}
break;
@@ -733,7 +733,7 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int
}
if (r)
{
- strlcat(outlist,"v",MAXBUF);
+ charlcat(outlist,'v',MAXBUF);
strlcpy(outpars[pc++],r,MAXBUF);
}
break;
@@ -763,7 +763,7 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int
}
if (r)
{
- strlcat(outlist,"b",MAXBUF);
+ charlcat(outlist,'b',MAXBUF);
strlcpy(outpars[pc++],parameters[param-1],MAXBUF);
}
break;
@@ -815,8 +815,8 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int
/* only allow -k if correct key given */
if (!strcmp(chan->key,key))
{
- strlcat(outlist,"k",MAXBUF);
- strlcpy(chan->key,"",MAXBUF);
+ charlcat(outlist,'k',MAXBUF);
+ *chan->key = 0;
strlcpy(outpars[pc++],key,MAXBUF);
}
}
@@ -836,7 +836,7 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int
{
if (chan->limit)
{
- strcat(outlist,"l");
+ charlcat(outlist,'l',MAXBUF);
chan->limit = 0;
}
}
@@ -881,7 +881,7 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int
if (chan->limit)
{
- strlcat(outlist,"l",MAXBUF);
+ charlcat(outlist,'l',MAXBUF);
strlcpy(outpars[pc++],parameters[param++],MAXBUF);
l_set = true;
}
@@ -895,12 +895,12 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int
{
if (mdir)
{
- if (!(chan->binarymodes & CM_INVITEONLY)) strlcat(outlist,"i",MAXBUF);
+ if (!(chan->binarymodes & CM_INVITEONLY)) charlcat(outlist,'i',MAXBUF);
chan->binarymodes |= CM_INVITEONLY;
}
else
{
- if (chan->binarymodes & CM_INVITEONLY) strlcat(outlist,"i",MAXBUF);
+ if (chan->binarymodes & CM_INVITEONLY) charlcat(outlist,'i',MAXBUF);
chan->binarymodes &= ~CM_INVITEONLY;
}
}
@@ -913,12 +913,12 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int
{
if (mdir)
{
- if (!(chan->binarymodes & CM_TOPICLOCK)) strlcat(outlist,"t",MAXBUF);
+ if (!(chan->binarymodes & CM_TOPICLOCK)) charlcat(outlist,'t',MAXBUF);
chan->binarymodes |= CM_TOPICLOCK;
}
else
{
- if (chan->binarymodes & CM_TOPICLOCK) strlcat(outlist,"t",MAXBUF);
+ if (chan->binarymodes & CM_TOPICLOCK) charlcat(outlist,'t',MAXBUF);
chan->binarymodes &= ~CM_TOPICLOCK;
}
}
@@ -931,12 +931,12 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int
{
if (mdir)
{
- if (!(chan->binarymodes & CM_NOEXTERNAL)) strlcat(outlist,"n",MAXBUF);
+ if (!(chan->binarymodes & CM_NOEXTERNAL)) charlcat(outlist,'n',MAXBUF);
chan->binarymodes |= CM_NOEXTERNAL;
}
else
{
- if (chan->binarymodes & CM_NOEXTERNAL) strlcat(outlist,"n",MAXBUF);
+ if (chan->binarymodes & CM_NOEXTERNAL) charlcat(outlist,'n',MAXBUF);
chan->binarymodes &= ~CM_NOEXTERNAL;
}
}
@@ -949,12 +949,12 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int
{
if (mdir)
{
- if (!(chan->binarymodes & CM_MODERATED)) strlcat(outlist,"m",MAXBUF);
+ if (!(chan->binarymodes & CM_MODERATED)) charlcat(outlist,'m',MAXBUF);
chan->binarymodes |= CM_MODERATED;
}
else
{
- if (chan->binarymodes & CM_MODERATED) strlcat(outlist,"m",MAXBUF);
+ if (chan->binarymodes & CM_MODERATED) charlcat(outlist,'m',MAXBUF);
chan->binarymodes &= ~CM_MODERATED;
}
}
@@ -967,7 +967,7 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int
{
if (mdir)
{
- if (!(chan->binarymodes & CM_SECRET)) strlcat(outlist,"s",MAXBUF);
+ if (!(chan->binarymodes & CM_SECRET)) charlcat(outlist,'s',MAXBUF);
chan->binarymodes |= CM_SECRET;
if (chan->binarymodes & CM_PRIVATE)
{
@@ -980,7 +980,7 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int
}
else
{
- if (chan->binarymodes & CM_SECRET) strlcat(outlist,"s",MAXBUF);
+ if (chan->binarymodes & CM_SECRET) charlcat(outlist,'s',MAXBUF);
chan->binarymodes &= ~CM_SECRET;
}
}
@@ -993,7 +993,7 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int
{
if (mdir)
{
- if (!(chan->binarymodes & CM_PRIVATE)) strlcat(outlist,"p",MAXBUF);
+ if (!(chan->binarymodes & CM_PRIVATE)) charlcat(outlist,'p',MAXBUF);
chan->binarymodes |= CM_PRIVATE;
if (chan->binarymodes & CM_SECRET)
{
@@ -1006,7 +1006,7 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int
}
else
{
- if (chan->binarymodes & CM_PRIVATE) strlcat(outlist,"p",MAXBUF);
+ if (chan->binarymodes & CM_PRIVATE) charlcat(outlist,'p',MAXBUF);
chan->binarymodes &= ~CM_PRIVATE;
}
}
@@ -1069,7 +1069,6 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int
if (t != 0)
{
log(DEBUG,"OnExtendedMode returned nonzero for a module");
- char app[] = {*modechar, 0};
if (ModeIsListMode(*modechar,MT_CHANNEL))
{
if (t == -1)
@@ -1081,7 +1080,7 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int
{
if (ptr>0)
{
- strlcat(outlist, app,MAXBUF);
+ charlcat(outlist,*modechar,MAXBUF);
}
strlcpy(outpars[pc++],parameters[param++],MAXBUF);
}
@@ -1092,11 +1091,11 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int
{
if ((modelist[ptr-1] == '+') || (modelist[ptr-1] == '-'))
{
- strlcat(outlist, app,MAXBUF);
+ charlcat(outlist,*modechar,MAXBUF);
}
else if (!strchr(outlist,*modechar))
{
- strlcat(outlist, app,MAXBUF);
+ charlcat(outlist,*modechar,MAXBUF);
}
}
chan->SetCustomMode(*modechar,mdir);
@@ -1137,7 +1136,7 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int
strlcpy(outstr,outlist,MAXBUF);
for (ptr = 0; ptr < pc; ptr++)
{
- strlcat(outstr," ",MAXBUF);
+ charlcat(outstr,' ',MAXBUF);
strlcat(outstr,outpars[ptr],MAXBUF);
}
if (local)
@@ -1401,8 +1400,7 @@ void cmd_mode::Handle (char **parameters, int pcnt, userrec *user)
if ((ServerInstance->ModeGrok->ProcessModuleUmode(umode, user, dest, direction)) || (umode == 'i') || (umode == 's') || (umode == 'w') || (umode == 'o'))
{
unsigned int q = 0;
- char temp[MAXBUF];
- char moo[MAXBUF];
+ char temp[MAXBUF];
unsigned int r = strlen(outpars);
outpars[r+1]='\0';
@@ -1413,9 +1411,7 @@ void cmd_mode::Handle (char **parameters, int pcnt, userrec *user)
{
if (dmodes[q] != parameters[1][i])
{
- moo[0] = dmodes[q];
- moo[1] = '\0';
- strlcat(temp,moo,MAXBUF);
+ charlcat(temp,dmodes[q],MAXBUF);
}
}
strlcpy(dmodes,temp,52);
@@ -1663,7 +1659,6 @@ void ModeParser::ServerMode(char **parameters, int pcnt, userrec *user)
{
unsigned int q = 0;
char temp[MAXBUF];
- char moo[MAXBUF];
unsigned int v1 = strlen(outpars);
outpars[v1+1]='\0';
@@ -1673,9 +1668,7 @@ void ModeParser::ServerMode(char **parameters, int pcnt, userrec *user)
{
if (dmodes[q] != parameters[1][i])
{
- moo[0] = dmodes[q];
- moo[1] = '\0';
- strlcat(temp,moo,MAXBUF);
+ charlcat(temp,dmodes[q],MAXBUF);
}
}
strlcpy(dmodes,temp,52);
diff --git a/src/svn-rev.sh b/src/svn-rev.sh
index c773323d3..337832030 100755
--- a/src/svn-rev.sh
+++ b/src/svn-rev.sh
@@ -1 +1 @@
-echo 3414
+echo 3416