summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/commands.cpp39
-rw-r--r--src/dns.cpp11
-rw-r--r--src/hashcomp.cpp14
-rw-r--r--src/helperfuncs.cpp47
-rw-r--r--src/inspircd.cpp70
-rw-r--r--src/inspircd_io.cpp14
-rw-r--r--src/message.cpp6
-rw-r--r--src/mode.cpp69
-rw-r--r--src/modules.cpp29
-rw-r--r--src/modules/extra/m_filter_pcre.cpp4
-rw-r--r--src/modules/extra/m_sqlauth.cpp2
-rw-r--r--src/modules/extra/m_sqloper.cpp4
-rw-r--r--src/modules/m_alias.cpp2
-rw-r--r--src/modules/m_antibottler.cpp4
-rw-r--r--src/modules/m_chanfilter.cpp6
-rw-r--r--src/modules/m_chanprotect.cpp6
-rw-r--r--src/modules/m_chghost.cpp2
-rw-r--r--src/modules/m_helpop.cpp2
-rw-r--r--src/modules/m_hostchange.cpp2
-rw-r--r--src/modules/m_ident.cpp1
-rw-r--r--src/modules/m_park.cpp2
-rw-r--r--src/modules/m_remove.cpp2
-rw-r--r--src/modules/m_sajoin.cpp3
-rw-r--r--src/modules/m_sapart.cpp2
-rw-r--r--src/modules/m_sethost.cpp2
-rw-r--r--src/servers.cpp16
-rw-r--r--src/users.cpp10
27 files changed, 188 insertions, 183 deletions
diff --git a/src/commands.cpp b/src/commands.cpp
index 3a9399f7c..6017148e9 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -189,7 +189,7 @@ void handle_part(char **parameters, int pcnt, userrec *user)
void handle_commands(char **parameters, int pcnt, userrec *user)
{
- for (int i = 0; i < cmdlist.size(); i++)
+ for (unsigned int i = 0; i < cmdlist.size(); i++)
{
WriteServ(user->fd,"902 %s :%s %s %d",user->nick,cmdlist[i].command,cmdlist[i].source,cmdlist[i].min_params);
}
@@ -1291,7 +1291,7 @@ void handle_trace(char **parameters, int pcnt, userrec *user)
void handle_modules(char **parameters, int pcnt, userrec *user)
{
- for (int i = 0; i < module_names.size(); i++)
+ for (unsigned int i = 0; i < module_names.size(); i++)
{
Version V = modules[i]->GetVersion();
char modulename[MAXBUF];
@@ -1389,7 +1389,6 @@ void handle_stats(char **parameters, int pcnt, userrec *user)
}
}
WriteServ(user->fd,"249 %s :%d OPER(s)",user->nick,idx);
- //249 [Brain] :bwoadway-monitor (~wgmon@204.152.186.58) Idle: 18
}
if (*parameters[0] == 'k')
@@ -1420,7 +1419,7 @@ void handle_stats(char **parameters, int pcnt, userrec *user)
/* stats m (list number of times each command has been used, plus bytecount) */
if (*parameters[0] == 'm')
{
- for (int i = 0; i < cmdlist.size(); i++)
+ for (unsigned int i = 0; i < cmdlist.size(); i++)
{
if (cmdlist[i].handler_function)
{
@@ -1614,7 +1613,7 @@ void handle_squit(char **parameters, int pcnt, userrec *user)
{
if (me[j] != NULL)
{
- for (int x = 0; x < me[j]->connectors.size(); x++)
+ for (unsigned int x = 0; x < me[j]->connectors.size(); x++)
{
if (match(me[j]->connectors[x].GetServerName().c_str(),parameters[0]))
{
@@ -1651,7 +1650,7 @@ void handle_links(char **parameters, int pcnt, userrec *user)
{
if (me[j] != NULL)
{
- for (int k = 0; k < me[j]->connectors.size(); k++)
+ for (unsigned int k = 0; k < me[j]->connectors.size(); k++)
{
WriteServ(user->fd,"364 %s %s %s :1 %s",user->nick,me[j]->connectors[k].GetServerName().c_str(),ServerName,me[j]->connectors[k].GetDescription().c_str());
}
@@ -1671,7 +1670,7 @@ void handle_map(char **parameters, int pcnt, userrec *user)
{
if (me[j] != NULL)
{
- for (int k = 0; k < me[j]->connectors.size(); k++)
+ for (unsigned int k = 0; k < me[j]->connectors.size(); k++)
{
int state = me[j]->connectors[k].GetState();
snprintf(line,MAXBUF,"006 %s :%c%s%s",user->nick,islast(me[j]->connectors[k].GetServerName().c_str()),state == STATE_NOAUTH_INBOUND || state == STATE_NOAUTH_OUTBOUND ? "-*" : "--", me[j]->connectors[k].GetServerName().c_str());
@@ -1917,7 +1916,7 @@ void handle_v(char token,char* params,serverrec* source,serverrec* reply, char*
{
if (me[j] != NULL)
{
- for (int x = 0; x < me[j]->connectors.size(); x++)
+ for (unsigned int x = 0; x < me[j]->connectors.size(); x++)
{
if (!strcasecmp(me[j]->connectors[x].GetServerName().c_str(),servername))
{
@@ -2354,7 +2353,7 @@ void handle_H(char token,char* params,serverrec* source,serverrec* reply, char*
{
if (me[j] != NULL)
{
- for (int k = 0; k < me[j]->connectors.size(); k++)
+ for (unsigned int k = 0; k < me[j]->connectors.size(); k++)
{
if (!strcasecmp(me[j]->connectors[k].GetServerName().c_str(),params))
{
@@ -2490,7 +2489,7 @@ void handle_plus(char token,char* params,serverrec* source,serverrec* reply, cha
{
if (me[i] != NULL)
{
- for (int j = 0; j < me[i]->connectors.size(); j++)
+ for (unsigned int j = 0; j < me[i]->connectors.size(); j++)
{
if (!strcasecmp(me[i]->connectors[j].GetServerName().c_str(),servername))
{
@@ -2589,7 +2588,7 @@ void handle_dollar(char token,char* params,serverrec* source,serverrec* reply, c
{
if (me[i] != NULL)
{
- for (int j = 0; j < me[i]->connectors.size(); j++)
+ for (unsigned int j = 0; j < me[i]->connectors.size(); j++)
{
if (!strcasecmp(me[i]->connectors[j].GetServerName().c_str(),sourceserver))
{
@@ -3249,7 +3248,7 @@ void handle_link_packet(char* tcp_msg, char* tcp_host, serverrec *serv,char* tcp
WriteOpers("AuthCookie CONNECT from %s (%s)",servername,tcp_host);
- for (int u = 0; u < auth_cookies.size(); u++)
+ for (unsigned int u = 0; u < auth_cookies.size(); u++)
{
if (auth_cookies[u] == atoi(cookie))
{
@@ -3260,7 +3259,7 @@ void handle_link_packet(char* tcp_msg, char* tcp_host, serverrec *serv,char* tcp
{
if (me[j] != NULL)
{
- for (int k = 0; k < me[j]->connectors.size(); k++)
+ for (unsigned int k = 0; k < me[j]->connectors.size(); k++)
{
if (!strcasecmp(me[j]->connectors[k].GetServerName().c_str(),tcp_host))
{
@@ -3324,7 +3323,7 @@ void handle_link_packet(char* tcp_msg, char* tcp_host, serverrec *serv,char* tcp
return;
}
- for (int j = 0; j < serv->connectors.size(); j++)
+ for (unsigned int j = 0; j < serv->connectors.size(); j++)
{
if (!strcasecmp(serv->connectors[j].GetServerName().c_str(),tcp_host))
{
@@ -3358,7 +3357,7 @@ void handle_link_packet(char* tcp_msg, char* tcp_host, serverrec *serv,char* tcp
snprintf(response,10240,"%s s %s %s :%s",CreateSum().c_str(),ServerName,Link_SendPass,ServerDesc);
serv->SendPacket(response,servername);
- for (int t = 0; t < serv->connectors.size(); t++)
+ for (unsigned int t = 0; t < serv->connectors.size(); t++)
{
if (!strcasecmp(serv->connectors[t].GetServerName().c_str(),servername))
{
@@ -3423,7 +3422,7 @@ void handle_link_packet(char* tcp_msg, char* tcp_host, serverrec *serv,char* tcp
{
if (me[j] != NULL)
{
- for (int k = 0; k < me[j]->connectors.size(); k++)
+ for (unsigned int k = 0; k < me[j]->connectors.size(); k++)
{
if (!strcasecmp(me[j]->connectors[k].GetServerName().c_str(),tcp_host))
{
@@ -3480,7 +3479,7 @@ void handle_link_packet(char* tcp_msg, char* tcp_host, serverrec *serv,char* tcp
{
if (me[j] != NULL)
{
- for (int k = 0; k < me[j]->connectors.size(); k++)
+ for (unsigned int k = 0; k < me[j]->connectors.size(); k++)
{
if (!strcasecmp(me[j]->connectors[k].GetServerName().c_str(),servername))
{
@@ -3515,7 +3514,7 @@ void handle_link_packet(char* tcp_msg, char* tcp_host, serverrec *serv,char* tcp
{
if (me[j] != NULL)
{
- for (int k = 0; k < me[j]->connectors.size(); k++)
+ for (unsigned int k = 0; k < me[j]->connectors.size(); k++)
{
if (!strcasecmp(me[j]->connectors[k].GetServerName().c_str(),tcp_host))
{
@@ -3527,7 +3526,7 @@ void handle_link_packet(char* tcp_msg, char* tcp_host, serverrec *serv,char* tcp
AddServerName(servername);
snprintf(buffer,MAXBUF,"%s X 0",CreateSum().c_str());
serv->SendPacket(buffer,servername);
- snprintf(buffer,MAXBUF,"%s s %s %s %lu :%s",CreateSum().c_str(),ServerName,Link_SendPass,LinkPort,ServerDesc);
+ snprintf(buffer,MAXBUF,"%s s %s %s %d :%s",CreateSum().c_str(),ServerName,Link_SendPass,LinkPort,ServerDesc);
serv->SendPacket(buffer,servername);
DoSync(me[j],servername);
snprintf(buffer,MAXBUF,"H %s",servername);
@@ -3570,7 +3569,7 @@ void handle_link_packet(char* tcp_msg, char* tcp_host, serverrec *serv,char* tcp
{
if (me[j] != NULL)
{
- for (int x = 0; x < me[j]->connectors.size(); x++)
+ for (unsigned int x = 0; x < me[j]->connectors.size(); x++)
{
log(DEBUG,"Servers are: '%s' '%s'",tcp_host,me[j]->connectors[x].GetServerName().c_str());
if (!strcasecmp(me[j]->connectors[x].GetServerName().c_str(),tcp_host))
diff --git a/src/dns.cpp b/src/dns.cpp
index 28b131586..bc2ca8c17 100644
--- a/src/dns.cpp
+++ b/src/dns.cpp
@@ -497,7 +497,7 @@ char* DNS::dns_getresult_s(const int cfd, char *res) { /* retrieve result of DNS
i = 0;
q = 0;
l -= 12;
- while (q < h.qdcount && i < l) {
+ while ((unsigned)q < h.qdcount && i < l) {
if (h.payload[i] > 63) { /* pointer */
i += 6; /* skip pointer, _class and type */
q++;
@@ -511,7 +511,7 @@ char* DNS::dns_getresult_s(const int cfd, char *res) { /* retrieve result of DNS
}
/* &h.payload[i] should now be the start of the first response */
curanswer = 0;
- while (curanswer < h.ancount) {
+ while ((unsigned)curanswer < h.ancount) {
q = 0;
while (q == 0 && i < l) {
if (h.payload[i] > 63) { /* pointer */
@@ -543,9 +543,9 @@ char* DNS::dns_getresult_s(const int cfd, char *res) { /* retrieve result of DNS
}
break;
}
- if (curanswer == h.ancount)
+ if ((unsigned)curanswer == h.ancount)
return NULL;
- if (i + rr.rdlength > l)
+ if ((unsigned)i + rr.rdlength > (unsigned)l)
return NULL;
if (rr.rdlength > 1023)
return NULL;
@@ -586,7 +586,7 @@ char* DNS::dns_getresult_s(const int cfd, char *res) { /* retrieve result of DNS
return NULL;
}
memcpy(&alist->ip,&h.payload[i],4);
- if (++curanswer >= h.ancount)
+ if ((unsigned)++curanswer >= h.ancount)
break;
i += rr.rdlength;
{
@@ -667,6 +667,7 @@ bool DNS::ReverseLookup(std::string ip)
bool DNS::ForwardLookup(std::string host)
{
+ return false;
}
bool DNS::HasResult()
diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp
index d21a83274..3ef18189e 100644
--- a/src/hashcomp.cpp
+++ b/src/hashcomp.cpp
@@ -116,27 +116,27 @@ bool irc::InAddr_HashComp::operator()(const in_addr &s1, const in_addr &s2) cons
bool irc::irc_char_traits::eq(char c1st, char c2nd)
{
- return lowermap[c1st] == lowermap[c2nd];
+ return lowermap[(unsigned)c1st] == lowermap[(unsigned)c2nd];
}
bool irc::irc_char_traits::ne(char c1st, char c2nd)
{
- return lowermap[c1st] != lowermap[c2nd];
+ return lowermap[(unsigned)c1st] != lowermap[(unsigned)c2nd];
}
bool irc::irc_char_traits::lt(char c1st, char c2nd)
{
- return lowermap[c1st] < lowermap[c2nd];
+ return lowermap[(unsigned)c1st] < lowermap[(unsigned)c2nd];
}
int irc::irc_char_traits::compare(const char* str1, const char* str2, size_t n)
{
- for(int i = 0; i < n; i++)
+ for(unsigned int i = 0; i < n; i++)
{
- if(lowermap[*str1] > lowermap[*str2])
+ if(lowermap[(unsigned)*str1] > lowermap[(unsigned)*str2])
return 1;
- if(lowermap[*str1] < lowermap[*str2])
+ if(lowermap[(unsigned)*str1] < lowermap[(unsigned)*str2])
return -1;
if(*str1 == 0 || *str2 == 0)
@@ -150,7 +150,7 @@ int irc::irc_char_traits::compare(const char* str1, const char* str2, size_t n)
const char* irc::irc_char_traits::find(const char* s1, int n, char c)
{
- while(n-- > 0 && lowermap[*s1] != lowermap[c])
+ while(n-- > 0 && lowermap[(unsigned)*s1] != lowermap[(unsigned)c])
s1++;
return s1;
}
diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp
index 7d4321caa..736ca14f8 100644
--- a/src/helperfuncs.cpp
+++ b/src/helperfuncs.cpp
@@ -161,7 +161,6 @@ void Write(int sock,char *text, ...)
char textbuffer[MAXBUF];
va_list argsPtr;
char tb[MAXBUF];
- int res;
va_start (argsPtr, text);
vsnprintf(textbuffer, MAXBUF, text, argsPtr);
@@ -190,7 +189,6 @@ void WriteServ(int sock, char* text, ...)
return;
}
char textbuffer[MAXBUF],tb[MAXBUF];
- int res;
va_list argsPtr;
va_start (argsPtr, text);
@@ -221,7 +219,6 @@ void WriteFrom(int sock, userrec *user,char* text, ...)
}
char textbuffer[MAXBUF],tb[MAXBUF];
va_list argsPtr;
- int res;
va_start (argsPtr, text);
vsnprintf(textbuffer, MAXBUF, text, argsPtr);
@@ -284,7 +281,7 @@ void WriteChannel(chanrec* Ptr, userrec* user, char* text, ...)
va_end(argsPtr);
std::vector<char*> *ulist = Ptr->GetUsers();
- for (int j = 0; j < ulist->size(); j++)
+ for (unsigned int j = 0; j < ulist->size(); j++)
{
char* o = (*ulist)[j];
userrec* otheruser = (userrec*)o;
@@ -311,7 +308,7 @@ void WriteChannelLocal(chanrec* Ptr, userrec* user, char* text, ...)
va_end(argsPtr);
std::vector<char*> *ulist = Ptr->GetUsers();
- for (int j = 0; j < ulist->size(); j++)
+ for (unsigned int j = 0; j < ulist->size(); j++)
{
char* o = (*ulist)[j];
userrec* otheruser = (userrec*)o;
@@ -344,7 +341,7 @@ void WriteChannelWithServ(char* ServName, chanrec* Ptr, char* text, ...)
std::vector<char*> *ulist = Ptr->GetUsers();
- for (int j = 0; j < ulist->size(); j++)
+ for (unsigned int j = 0; j < ulist->size(); j++)
{
char* o = (*ulist)[j];
userrec* otheruser = (userrec*)o;
@@ -370,7 +367,7 @@ void ChanExceptSender(chanrec* Ptr, userrec* user, char* text, ...)
va_end(argsPtr);
std::vector<char*> *ulist = Ptr->GetUsers();
- for (int j = 0; j < ulist->size(); j++)
+ for (unsigned int j = 0; j < ulist->size(); j++)
{
char* o = (*ulist)[j];
userrec* otheruser = (userrec*)o;
@@ -385,7 +382,7 @@ std::string GetServerDescription(char* servername)
{
if (me[j] != NULL)
{
- for (int k = 0; k < me[j]->connectors.size(); k++)
+ for (unsigned int k = 0; k < me[j]->connectors.size(); k++)
{
if (!strcasecmp(me[j]->connectors[k].GetServerName().c_str(),servername))
{
@@ -393,8 +390,8 @@ std::string GetServerDescription(char* servername)
}
}
}
- return ServerDesc; // not a remote server that can be found, it must be me.
}
+ return ServerDesc; // not a remote server that can be found, it must be me.
}
/* write a formatted string to all users who share at least one common
@@ -429,7 +426,7 @@ void WriteCommon(userrec *u, char* text, ...)
if (u->chans[i].channel)
{
std::vector<char*> *ulist = u->chans[i].channel->GetUsers();
- for (int j = 0; j < ulist->size(); j++)
+ for (unsigned int j = 0; j < ulist->size(); j++)
{
char* o = (*ulist)[j];
userrec* otheruser = (userrec*)o;
@@ -479,7 +476,7 @@ void WriteCommonExcept(userrec *u, char* text, ...)
if (u->chans[i].channel)
{
std::vector<char*> *ulist = u->chans[i].channel->GetUsers();
- for (int j = 0; j < ulist->size(); j++)
+ for (unsigned int j = 0; j < ulist->size(); j++)
{
char* o = (*ulist)[j];
userrec* otheruser = (userrec*)o;
@@ -565,7 +562,7 @@ bool ChanAnyOnThisServer(chanrec *c,char* servername)
log(DEBUG,"ChanAnyOnThisServer");
std::vector<char*> *ulist = c->GetUsers();
- for (int j = 0; j < ulist->size(); j++)
+ for (unsigned int j = 0; j < ulist->size(); j++)
{
char* o = (*ulist)[j];
userrec* user = (userrec*)o;
@@ -586,7 +583,7 @@ bool CommonOnThisServer(userrec* u,const char* servername)
if (u->chans[i].channel)
{
std::vector<char*> *ulist = u->chans[i].channel->GetUsers();
- for (int j = 0; j < ulist->size(); j++)
+ for (unsigned int j = 0; j < ulist->size(); j++)
{
char* o = (*ulist)[j];
userrec* user = (userrec*)o;
@@ -617,7 +614,7 @@ void NetSendToCommon(userrec* u, char* s)
{
if (me[j] != NULL)
{
- for (int k = 0; k < me[j]->connectors.size(); k++)
+ for (unsigned int k = 0; k < me[j]->connectors.size(); k++)
{
if (CommonOnThisServer(u,me[j]->connectors[k].GetServerName().c_str()))
{
@@ -648,7 +645,7 @@ void NetSendToAll(char* s)
{
if (me[j] != NULL)
{
- for (int k = 0; k < me[j]->connectors.size(); k++)
+ for (unsigned int k = 0; k < me[j]->connectors.size(); k++)
{
me[j]->SendPacket(buffer,me[j]->connectors[k].GetServerName().c_str());
}
@@ -676,7 +673,7 @@ void NetSendToAll_WithSum(char* s,char* u)
{
if (me[j] != NULL)
{
- for (int k = 0; k < me[j]->connectors.size(); k++)
+ for (unsigned int k = 0; k < me[j]->connectors.size(); k++)
{
me[j]->SendPacket(buffer,me[j]->connectors[k].GetServerName().c_str());
}
@@ -703,7 +700,7 @@ void NetSendToAllAlive(char* s)
{
if (me[j] != NULL)
{
- for (int k = 0; k < me[j]->connectors.size(); k++)
+ for (unsigned int k = 0; k < me[j]->connectors.size(); k++)
{
if (me[j]->connectors[k].GetState() != STATE_DISCONNECTED)
{
@@ -738,7 +735,7 @@ void NetSendToOne(char* target,char* s)
{
if (me[j] != NULL)
{
- for (int k = 0; k < me[j]->connectors.size(); k++)
+ for (unsigned int k = 0; k < me[j]->connectors.size(); k++)
{
if (!strcasecmp(me[j]->connectors[k].GetServerName().c_str(),target))
{
@@ -768,7 +765,7 @@ void NetSendToAllExcept(const char* target,char* s)
{
if (me[j] != NULL)
{
- for (int k = 0; k < me[j]->connectors.size(); k++)
+ for (unsigned int k = 0; k < me[j]->connectors.size(); k++)
{
if (strcasecmp(me[j]->connectors[k].GetServerName().c_str(),target))
{
@@ -798,7 +795,7 @@ void NetSendToAllExcept_WithSum(const char* target,char* s,char* u)
{
if (me[j] != NULL)
{
- for (int k = 0; k < me[j]->connectors.size(); k++)
+ for (unsigned int k = 0; k < me[j]->connectors.size(); k++)
{
if (strcasecmp(me[j]->connectors[k].GetServerName().c_str(),target))
{
@@ -944,7 +941,7 @@ void strlower(char *n)
if (n)
{
for (char* t = n; *t; t++)
- *t = lowermap[*t];
+ *t = lowermap[(unsigned)*t];
}
}
@@ -1131,7 +1128,7 @@ void userlist(userrec *user,chanrec *c)
snprintf(list,MAXBUF,"353 %s = %s :", user->nick, c->name);
std::vector<char*> *ulist = c->GetUsers();
- for (int i = 0; i < ulist->size(); i++)
+ for (unsigned int i = 0; i < ulist->size(); i++)
{
char* o = (*ulist)[i];
userrec* otheruser = (userrec*)o;
@@ -1374,7 +1371,7 @@ void ShowMOTD(userrec *user)
}
snprintf(buf,65535,":%s 375 %s :- %s message of the day\r\n", ServerName, user->nick, ServerName);
WholeMOTD = WholeMOTD + buf;
- for (int i = 0; i != MOTD.size(); i++)
+ for (unsigned int i = 0; i != MOTD.size(); i++)
{
snprintf(buf,65535,":%s 372 %s :- %s\r\n", ServerName, user->nick, MOTD[i].c_str());
WholeMOTD = WholeMOTD + buf;
@@ -1394,7 +1391,7 @@ void ShowRULES(userrec *user)
return;
}
WriteServ(user->fd,"NOTICE %s :%s rules",user->nick,ServerName);
- for (int i = 0; i != RULES.size(); i++)
+ for (unsigned int i = 0; i != RULES.size(); i++)
{
WriteServ(user->fd,"NOTICE %s :%s",user->nick,RULES[i].c_str());
}
@@ -1422,7 +1419,7 @@ char islast(const char* s)
{
if (me[j] != NULL)
{
- for (int k = 0; k < me[j]->connectors.size(); k++)
+ for (unsigned int k = 0; k < me[j]->connectors.size(); k++)
{
if (strcasecmp(me[j]->connectors[k].GetServerName().c_str(),s))
{
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index c780b8bf1..4291f604c 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -843,6 +843,8 @@ chanrec* del_channel(userrec *user, const char* cname, const char* reason, bool
chanlist.erase(iter);
}
}
+
+ return NULL;
}
@@ -1272,15 +1274,15 @@ int main(int argc, char** argv)
strlcpy(MyExecutable,argv[0],MAXBUF);
// initialize the lowercase mapping table
- for (int cn = 0; cn < 256; cn++)
+ for (unsigned int cn = 0; cn < 256; cn++)
lowermap[cn] = cn;
// lowercase the uppercase chars
- for (int cn = 65; cn < 91; cn++)
+ for (unsigned int cn = 65; cn < 91; cn++)
lowermap[cn] = tolower(cn);
// now replace the specific chars for scandanavian comparison
- lowermap['['] = '{';
- lowermap[']'] = '}';
- lowermap['\\'] = '|';
+ lowermap[(unsigned)'['] = '{';
+ lowermap[(unsigned)']'] = '}';
+ lowermap[(unsigned)'\\'] = '|';
if (InspIRCd(argv,argc) == ERROR)
{
@@ -1348,7 +1350,7 @@ void AddWhoWas(userrec* u)
if (iter == whowas.end())
{
- if (whowas.size() >= WHOWAS_MAX)
+ if (whowas.size() >= (unsigned)WHOWAS_MAX)
{
for (whowas_hash::iterator i = whowas.begin(); i != whowas.end(); i++)
{
@@ -1659,7 +1661,7 @@ void handle_version(char **parameters, int pcnt, userrec *user)
{
if (me[j] != NULL)
{
- for (int x = 0; x < me[j]->connectors.size(); x++)
+ for (unsigned int x = 0; x < me[j]->connectors.size(); x++)
{
WriteServ(user->fd,"351 %s :Server %d:%d (%s): %s",user->nick,j,x,me[j]->connectors[x].GetServerName().c_str(),me[j]->connectors[x].GetVersionString().c_str());
}
@@ -1677,7 +1679,7 @@ void handle_version(char **parameters, int pcnt, userrec *user)
{
if (me[j] != NULL)
{
- for (int x = 0; x < me[j]->connectors.size(); x++)
+ for (unsigned int x = 0; x < me[j]->connectors.size(); x++)
{
if (match(me[j]->connectors[x].GetServerName().c_str(),parameters[0]))
{
@@ -1709,7 +1711,7 @@ void handle_version(char **parameters, int pcnt, userrec *user)
void call_handler(const char* commandname,char **parameters, int pcnt, userrec *user)
{
- for (int i = 0; i < cmdlist.size(); i++)
+ for (unsigned int i = 0; i < cmdlist.size(); i++)
{
if (!strcasecmp(cmdlist[i].command,commandname))
{
@@ -1887,7 +1889,7 @@ void process_command(userrec *user, char* cmd)
int total_params = 0;
if (strlen(cmd)>2)
{
- for (int q = 0; q < strlen(cmd)-1; q++)
+ for (unsigned int q = 0; q < strlen(cmd)-1; q++)
{
if ((cmd[q] == ' ') && (cmd[q+1] == ':'))
{
@@ -1934,7 +1936,7 @@ void process_command(userrec *user, char* cmd)
items = 0;
command_p[0] = NULL;
parameters = NULL;
- for (int i = 0; i <= strlen(cmd); i++)
+ for (unsigned int i = 0; i <= strlen(cmd); i++)
{
cmd[i] = toupper(cmd[i]);
}
@@ -1945,7 +1947,7 @@ void process_command(userrec *user, char* cmd)
strcpy(cmd,"");
j = 0;
/* strip out extraneous linefeeds through mirc's crappy pasting (thanks Craig) */
- for (int i = 0; i < strlen(temp); i++)
+ for (unsigned int i = 0; i < strlen(temp); i++)
{
if ((temp[i] != 10) && (temp[i] != 13) && (temp[i] != 0) && (temp[i] != 7))
{
@@ -1959,7 +1961,7 @@ void process_command(userrec *user, char* cmd)
command = cmd;
if (strchr(cmd,' '))
{
- for (int i = 0; i <= strlen(cmd); i++)
+ for (unsigned int i = 0; i <= strlen(cmd); i++)
{
/* capitalise the command ONLY, leave params intact */
cmd[i] = toupper(cmd[i]);
@@ -1975,7 +1977,7 @@ void process_command(userrec *user, char* cmd)
}
else
{
- for (int i = 0; i <= strlen(cmd); i++)
+ for (unsigned int i = 0; i <= strlen(cmd); i++)
{
cmd[i] = toupper(cmd[i]);
}
@@ -1990,7 +1992,7 @@ void process_command(userrec *user, char* cmd)
return;
}
- for (int x = 0; x < strlen(command); x++)
+ for (unsigned int x = 0; x < strlen(command); x++)
{
if (((command[x] < 'A') || (command[x] > 'Z')) && (command[x] != '.'))
{
@@ -2006,7 +2008,7 @@ void process_command(userrec *user, char* cmd)
}
}
- for (int i = 0; i != cmdlist.size(); i++)
+ for (unsigned int i = 0; i != cmdlist.size(); i++)
{
if (cmdlist[i].command[0])
{
@@ -2215,7 +2217,7 @@ void DoSync(serverrec* serv, char* tcp_host)
{
if (me[j] != NULL)
{
- for (int k = 0; k < me[j]->connectors.size(); k++)
+ for (unsigned int k = 0; k < me[j]->connectors.size(); k++)
{
if (is_uline(me[j]->connectors[k].GetServerName().c_str()))
{
@@ -2243,7 +2245,7 @@ void DoSync(serverrec* serv, char* tcp_host)
for (int i = 0; i <= MODCOUNT; i++)
{
string_list l = modules[i]->OnUserSync(u->second);
- for (int j = 0; j < l.size(); j++)
+ for (unsigned int j = 0; j < l.size(); j++)
{
snprintf(data,MAXBUF,"%s %s",CreateSum().c_str(),l[j].c_str());
serv->SendPacket(data,tcp_host);
@@ -2264,7 +2266,7 @@ void DoSync(serverrec* serv, char* tcp_host)
for (int i = 0; i <= MODCOUNT; i++)
{
string_list l = modules[i]->OnChannelSync(c->second);
- for (int j = 0; j < l.size(); j++)
+ for (unsigned int j = 0; j < l.size(); j++)
{
snprintf(data,MAXBUF,"%s %s",CreateSum().c_str(),l[j].c_str());
serv->SendPacket(data,tcp_host);
@@ -2308,7 +2310,7 @@ void NetSendMyRoutingTable()
{
if (me[i] != NULL)
{
- for (int j = 0; j < me[i]->connectors.size(); j++)
+ for (unsigned int j = 0; j < me[i]->connectors.size(); j++)
{
if ((me[i]->connectors[j].GetState() != STATE_DISCONNECTED) || (is_uline(me[i]->connectors[j].GetServerName().c_str())))
{
@@ -2452,7 +2454,7 @@ void erase_module(int j)
bool UnloadModule(const char* filename)
{
std::string filename_str = filename;
- for (int j = 0; j != module_names.size(); j++)
+ for (unsigned int j = 0; j != module_names.size(); j++)
{
if (module_names[j] == filename_str)
{
@@ -2501,7 +2503,7 @@ bool LoadModule(const char* filename)
if (FileExists(modfile))
{
#endif
- for (int j = 0; j < module_names.size(); j++)
+ for (unsigned int j = 0; j < module_names.size(); j++)
{
if (module_names[j] == filename_str)
{
@@ -2553,7 +2555,7 @@ bool GotServer(std::string name)
{
if (me[j] != NULL)
{
- for (int k = 0; k < me[j]->connectors.size(); k++)
+ for (unsigned int k = 0; k < me[j]->connectors.size(); k++)
{
if (name == me[j]->connectors[k].GetServerName())
{
@@ -2573,9 +2575,11 @@ int InspIRCd(char** argv, int argc)
int incomingSockfd, result = TRUE;
socklen_t length;
int count = 0;
+#ifdef USE_SELECT
int selectResult = 0, selectResult2 = 0;
- char configToken[MAXBUF], Addr[MAXBUF], Type[MAXBUF];
fd_set selectFds;
+#endif
+ char configToken[MAXBUF], Addr[MAXBUF], Type[MAXBUF];
timeval tv;
std::string logpath = GetFullProgDir(argv,argc) + "/ircd.log";
@@ -2838,7 +2842,10 @@ int InspIRCd(char** argv, int argc)
#ifdef USE_EPOLL
struct epoll_event event[33];
#endif
+#ifdef USE_SELECT
fd_set serverfds;
+ fd_set sfd;
+#endif
timeval tvs;
tvs.tv_usec = 10000L;
tvs.tv_sec = 0;
@@ -2846,7 +2853,6 @@ int InspIRCd(char** argv, int argc)
tv.tv_usec = 10000L;
char data[65536];
timeval tval;
- fd_set sfd;
tval.tv_usec = 10000L;
tval.tv_sec = 0;
int total_in_this_set = 0;
@@ -2909,7 +2915,7 @@ int InspIRCd(char** argv, int argc)
log(DEBUG,"epoll: Listening server socket event, i=%d, event.data.fd=%d",i,event[0].data.fd);
for (int x = 0; x != SERVERportCount; x++)
{
- if ((me[x]) && (event[0].data.fd == me[x]->fd))
+ if ((me[x]) && ((unsigned)event[0].data.fd == (unsigned)me[x]->fd))
{
#endif
#ifdef USE_KQUEUE
@@ -2921,7 +2927,7 @@ int InspIRCd(char** argv, int argc)
log(DEBUG,"kqueue: Listening server socket event, i=%d, ke.ident=%d",i,ke.ident);
for (int x = 0; x != SERVERportCount; x++)
{
- if ((me[x]) && (ke.ident == me[x]->fd))
+ if ((me[x]) && ((unsigned)ke.ident == (unsigned)me[x]->fd))
{
#endif
@@ -2971,7 +2977,7 @@ int InspIRCd(char** argv, int argc)
while ((me[x]) && (me[x]->RecvPacket(msgs, tcp_host, sums))) // returns 0 or more lines (can be multiple lines!)
{
has_been_netsplit = false;
- for (int ctr = 0; ctr < msgs.size(); ctr++)
+ for (unsigned int ctr = 0; ctr < msgs.size(); ctr++)
{
strlcpy(tcp_msg,msgs[ctr].c_str(),MAXBUF);
strlcpy(tcp_sum,sums[ctr].c_str(),MAXBUF);
@@ -3134,7 +3140,7 @@ int InspIRCd(char** argv, int argc)
// registration timeout -- didnt send USER/NICK/HOST in the time specified in
// their connection class.
- if ((TIME > curr->timeout) && (curr->registered != 7))
+ if (((unsigned)TIME > (unsigned)curr->timeout) && (curr->registered != 7))
{
log(DEBUG,"InspIRCd: registration timeout: %s",curr->nick);
kill_link(curr,"Registration timeout");
@@ -3273,7 +3279,7 @@ int InspIRCd(char** argv, int argc)
}
goto label;
}
- if (current->recvq.length() > NetBufferSize)
+ if (current->recvq.length() > (unsigned)NetBufferSize)
{
if (current->registered == 7)
{
@@ -3425,7 +3431,7 @@ int InspIRCd(char** argv, int argc)
// compared to the number of clients (possibly over 2000)
for (count = 0; count < boundPortCount; count++)
{
- if (ke_list[j].ident == openSockfd[count])
+ if ((unsigned)ke_list[j].ident == (unsigned)openSockfd[count])
{
#endif
#ifdef USE_EPOLL
@@ -3435,7 +3441,7 @@ int InspIRCd(char** argv, int argc)
log(DEBUG,"epoll: Listening socket event, i=%d,events[j].data.fd=%d",i,event[j].data.fd);
for (count = 0; count < boundPortCount; count++)
{
- if (event[j].data.fd == openSockfd[count])
+ if ((unsigned)event[j].data.fd == (unsigned)openSockfd[count])
{
#endif
char target[MAXBUF], resolved[MAXBUF];
diff --git a/src/inspircd_io.cpp b/src/inspircd_io.cpp
index 96a751d65..aa5d5af65 100644
--- a/src/inspircd_io.cpp
+++ b/src/inspircd_io.cpp
@@ -179,7 +179,7 @@ std::string ConfProcess(char* buffer, long linenumber, std::stringstream* errors
return "";
}
// firstly clean up the line by stripping spaces from the start and end and converting tabs to spaces
- for (int d = 0; d < strlen(buffer); d++)
+ for (unsigned int d = 0; d < strlen(buffer); d++)
if ((buffer[d]) == 9)
buffer[d] = ' ';
while ((buffer[0] == ' ') && (strlen(buffer)>0)) buffer++;
@@ -189,7 +189,7 @@ std::string ConfProcess(char* buffer, long linenumber, std::stringstream* errors
return "";
else if (buffer[0] == '#')
return "";
- for (int c = 0; c < strlen(buffer); c++)
+ for (unsigned int c = 0; c < strlen(buffer); c++)
{
// convert all spaces that are OUTSIDE quotes into hardspace (0xA0) as this will make them easier to
// search and replace later :)
@@ -276,7 +276,7 @@ std::string ConfProcess(char* buffer, long linenumber, std::stringstream* errors
}
// turn our hardspace back into softspace
- for (int d = 0; d < parsedata.length(); d++)
+ for (unsigned int d = 0; d < parsedata.length(); d++)
{
if (parsedata[d] == '\xA0')
parsedata[d] = ' ';
@@ -313,7 +313,7 @@ bool LoadConf(const char* filename, std::stringstream *target, std::stringstream
}
// Fix the chmod of the file to restrict it to the current user and group
chmod(filename,0600);
- for (int t = 0; t < include_stack.size(); t++)
+ for (unsigned int t = 0; t < include_stack.size(); t++)
{
if (std::string(filename) == include_stack[t])
{
@@ -341,7 +341,7 @@ bool LoadConf(const char* filename, std::stringstream *target, std::stringstream
char confpath[10240],newconf[10240];
// include file directive
buf += 15; // advance to filename
- for (int j = 0; j < strlen(buf); j++)
+ for (unsigned int j = 0; j < strlen(buf); j++)
{
if (buf[j] == '\\')
buf[j] = '/';
@@ -574,7 +574,7 @@ int ReadConf(std::stringstream *config, const char* tag, const char* var, int in
{
int ptr = 0;
char buffer[65535], c_tag[MAXBUF], c, lastc;
- int in_token, in_quotes, tptr, j, idx = 0;
+ int in_token, in_quotes, tptr, idx = 0;
char* key;
const char* buf = config->str().c_str();
@@ -642,7 +642,7 @@ int ReadConf(std::stringstream *config, const char* tag, const char* var, int in
key++;
}
key++;
- for (j = 0; j < strlen(key); j++)
+ for (unsigned j = 0; j < strlen(key); j++)
{
if (key[j] == '"')
{
diff --git a/src/message.cpp b/src/message.cpp
index 6e76449fc..c177eee93 100644
--- a/src/message.cpp
+++ b/src/message.cpp
@@ -109,7 +109,7 @@ void tidystring(char* str)
while (go_again)
{
bool noparse = false;
- int t = 0, a = 0;
+ unsigned int t = 0, a = 0;
go_again = false;
while (a < strlen(str))
{
@@ -254,7 +254,7 @@ int isident(const char* n)
{
return 0;
}
- for (int i = 0; i != strlen(n); i++)
+ for (unsigned int i = 0; i < strlen(n); i++)
{
if ((n[i] < 33) || (n[i] > 125))
{
@@ -284,7 +284,7 @@ int isnick(const char* n)
{
return 0;
}
- for (int i = 0; i != strlen(n); i++)
+ for (unsigned int i = 0; i != strlen(n); i++)
{
if ((n[i] < 33) || (n[i] > 125))
{
diff --git a/src/mode.cpp b/src/mode.cpp
index 9f7073615..57db1d509 100644
--- a/src/mode.cpp
+++ b/src/mode.cpp
@@ -116,7 +116,7 @@ char* give_ops(userrec *user,char *dest,chanrec *chan,int status)
}
- for (int i = 0; i != MAXCHANS; i++)
+ for (unsigned int i = 0; i != MAXCHANS; i++)
{
if ((d->chans[i].channel != NULL) && (chan != NULL))
if (!strcasecmp(d->chans[i].channel->name,chan->name))
@@ -174,7 +174,7 @@ char* give_hops(userrec *user,char *dest,chanrec *chan,int status)
}
}
- for (int i = 0; i != MAXCHANS; i++)
+ for (unsigned int i = 0; i != MAXCHANS; i++)
{
if ((d->chans[i].channel != NULL) && (chan != NULL))
if (!strcasecmp(d->chans[i].channel->name,chan->name))
@@ -230,7 +230,7 @@ char* give_voice(userrec *user,char *dest,chanrec *chan,int status)
}
}
- for (int i = 0; i != MAXCHANS; i++)
+ for (unsigned int i = 0; i != MAXCHANS; i++)
{
if ((d->chans[i].channel != NULL) && (chan != NULL))
if (!strcasecmp(d->chans[i].channel->name,chan->name))
@@ -288,7 +288,7 @@ char* take_ops(userrec *user,char *dest,chanrec *chan,int status)
}
}
- for (int i = 0; i != MAXCHANS; i++)
+ for (unsigned int i = 0; i != MAXCHANS; i++)
{
if ((d->chans[i].channel != NULL) && (chan != NULL))
if (!strcasecmp(d->chans[i].channel->name,chan->name))
@@ -345,7 +345,7 @@ char* take_hops(userrec *user,char *dest,chanrec *chan,int status)
}
}
- for (int i = 0; i != MAXCHANS; i++)
+ for (unsigned int i = 0; i != MAXCHANS; i++)
{
if ((d->chans[i].channel != NULL) && (chan != NULL))
if (!strcasecmp(d->chans[i].channel->name,chan->name))
@@ -401,7 +401,7 @@ char* take_voice(userrec *user,char *dest,chanrec *chan,int status)
}
}
- for (int i = 0; i != MAXCHANS; i++)
+ for (unsigned int i = 0; i != MAXCHANS; i++)
{
if ((d->chans[i].channel != NULL) && (chan != NULL))
if (!strcasecmp(d->chans[i].channel->name,chan->name))
@@ -430,32 +430,32 @@ char* add_ban(userrec *user,char *dest,chanrec *chan,int status)
BanItem b;
if ((!user) || (!dest) || (!chan))
return NULL;
- int l = strlen(dest);
+ unsigned int l = strlen(dest);
if (strchr(dest,'!')==0)
return NULL;
if (strchr(dest,'@')==0)
return NULL;
- for (int i = 0; i < l; i++)
+ for (unsigned int i = 0; i < l; i++)
if (dest[i] < 32)
return NULL;
- for (int i = 0; i < l; i++)
+ for (unsigned int i = 0; i < l; i++)
if (dest[i] > 126)
return NULL;
int c = 0;
- for (int i = 0; i < l; i++)
+ for (unsigned int i = 0; i < l; i++)
if (dest[i] == '!')
c++;
if (c>1)
return NULL;
c = 0;
- for (int i = 0; i < l; i++)
+ for (unsigned int i = 0; i < l; i++)
if (dest[i] == '@')
c++;
if (c>1)
return NULL;
long maxbans = GetMaxBans(chan->name);
- if (chan->bans.size() > maxbans)
+ if ((unsigned)chan->bans.size() > (unsigned)maxbans)
{
WriteServ(user->fd,"478 %s %s :Channel ban list for %s is full (maximum entries for this channel is %d)",user->nick, chan->name,chan->name,maxbans);
return NULL;
@@ -514,11 +514,10 @@ std::string compress_modes(std::string modes,bool channelmodes)
{
int counts[127];
bool active[127];
- int delta = 1;
memset(counts,0,sizeof(counts));
memset(active,0,sizeof(active));
log(DEBUG,"compress_modes: %s",modes.c_str());
- for (int i = 0; i < modes.length(); i++)
+ for (unsigned int i = 0; i < modes.length(); i++)
{
if ((modes[i] == '+') || (modes[i] == '-'))
continue;
@@ -851,7 +850,7 @@ void process_modes(char **parameters,userrec* user,chanrec *chan,int status, int
break;
previously_set_l = true;
bool invalid = false;
- for (int i = 0; i < strlen(parameters[param]); i++)
+ for (unsigned int i = 0; i < strlen(parameters[param]); i++)
{
if ((parameters[param][i] < '0') || (parameters[param][i] > '9'))
{
@@ -1318,7 +1317,7 @@ void handle_mode(char **parameters, int pcnt, userrec *user)
if ((parameters[1][0] != '+') && (parameters[1][0] != '-'))
return;
- for (int i = 0; i < strlen(parameters[1]); i++)
+ for (unsigned int i = 0; i < strlen(parameters[1]); i++)
{
if (parameters[1][i] == ' ')
continue;
@@ -1398,11 +1397,11 @@ void handle_mode(char **parameters, int pcnt, userrec *user)
char umode = parameters[1][i];
if ((process_module_umode(umode, user, dest, direction)) || (umode == 'i') || (umode == 's') || (umode == 'w') || (umode == 'o'))
{
- int q = 0;
+ unsigned int q = 0;
char temp[MAXBUF];
char moo[MAXBUF];
- int r = strlen(outpars);
+ unsigned int r = strlen(outpars);
outpars[r+1]='\0';
outpars[r] = parameters[1][i];
@@ -1430,8 +1429,8 @@ void handle_mode(char **parameters, int pcnt, userrec *user)
{
char b[MAXBUF];
strlcpy(b,"",MAXBUF);
- int z = 0;
- int i = 0;
+ unsigned int z = 0;
+ unsigned int i = 0;
while (i < strlen (outpars))
{
b[z++] = outpars[i++];
@@ -1587,7 +1586,7 @@ void server_mode(char **parameters, int pcnt, userrec *user)
if ((parameters[1][0] != '+') && (parameters[1][0] != '-'))
return;
- for (int i = 0; i < strlen(parameters[1]); i++)
+ for (unsigned int i = 0; i < strlen(parameters[1]); i++)
{
if (parameters[1][i] == ' ')
continue;
@@ -1658,11 +1657,11 @@ void server_mode(char **parameters, int pcnt, userrec *user)
log(DEBUG,"umode %c is an allowed umode",umode);
if ((process_module_umode(umode, user, dest, direction)) || (umode == 'i') || (umode == 's') || (umode == 'w') || (umode == 'o'))
{
- int q = 0;
+ unsigned int q = 0;
char temp[MAXBUF];
char moo[MAXBUF];
- int v1 = strlen(outpars);
+ unsigned int v1 = strlen(outpars);
outpars[v1+1]='\0';
outpars[v1] = parameters[1][i];
@@ -1687,8 +1686,8 @@ void server_mode(char **parameters, int pcnt, userrec *user)
{
char b[MAXBUF];
strlcpy(b,"",MAXBUF);
- int z = 0;
- int i = 0;
+ unsigned int z = 0;
+ unsigned int i = 0;
while (i < strlen (outpars))
{
b[z++] = outpars[i++];
@@ -1783,7 +1782,7 @@ void merge_mode(char **parameters, int pcnt)
if ((parameters[1][0] != '+') && (parameters[1][0] != '-'))
return;
- for (int i = 0; i < strlen(parameters[1]); i++)
+ for (unsigned int i = 0; i < strlen(parameters[1]); i++)
{
if (parameters[1][i] == ' ')
continue;
@@ -1854,11 +1853,11 @@ void merge_mode(char **parameters, int pcnt)
log(DEBUG,"umode %c is an allowed umode",umode);
if ((process_module_umode(umode, NULL, dest, direction)) || (umode == 'i') || (umode == 's') || (umode == 'w') || (umode == 'o'))
{
- int q = 0;
+ unsigned int q = 0;
char temp[MAXBUF];
char moo[MAXBUF];
- int v1 = strlen(outpars);
+ unsigned int v1 = strlen(outpars);
outpars[v1+1]='\0';
outpars[v1] = parameters[1][i];
@@ -1883,8 +1882,8 @@ void merge_mode(char **parameters, int pcnt)
{
char b[MAXBUF];
strcpy(b,"");
- int z = 0;
- int i = 0;
+ unsigned int z = 0;
+ unsigned int i = 0;
while (i < strlen (outpars))
{
b[z++] = outpars[i++];
@@ -1974,7 +1973,7 @@ void merge_mode2(char **parameters, int pcnt, userrec* user)
if ((parameters[1][0] != '+') && (parameters[1][0] != '-'))
return;
- for (int i = 0; i < strlen(parameters[1]); i++)
+ for (unsigned int i = 0; i < strlen(parameters[1]); i++)
{
if (parameters[1][i] == ' ')
continue;
@@ -2046,11 +2045,11 @@ void merge_mode2(char **parameters, int pcnt, userrec* user)
log(DEBUG,"umode %c is an allowed umode",umode);
if ((process_module_umode(umode, NULL, dest, direction)) || (umode == 'i') || (umode == 's') || (umode == 'w') || (umode == 'o'))
{
- int q = 0;
+ unsigned int q = 0;
char temp[MAXBUF];
char moo[MAXBUF];
- int v1 = strlen(outpars);
+ unsigned int v1 = strlen(outpars);
outpars[v1+1]='\0';
outpars[v1] = parameters[1][i];
@@ -2076,8 +2075,8 @@ void merge_mode2(char **parameters, int pcnt, userrec* user)
{
char b[MAXBUF];
strcpy(b,"");
- int z = 0;
- int i = 0;
+ unsigned int z = 0;
+ unsigned int i = 0;
while (i < strlen (outpars))
{
b[z++] = outpars[i++];
diff --git a/src/modules.cpp b/src/modules.cpp
index 964cd2b74..6f2fc82ec 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -140,9 +140,9 @@ class ExtMode : public classbase
public:
char modechar;
int type;
+ bool needsoper;
int params_when_on;
int params_when_off;
- bool needsoper;
bool list;
ExtMode(char mc, int ty, bool oper, int p_on, int p_off) : modechar(mc), type(ty), needsoper(oper), params_when_on(p_on), params_when_off(p_off) { };
};
@@ -646,6 +646,7 @@ bool Server::UserToPseudo(userrec* user,std::string message)
shutdown(old_fd,2);
close(old_fd);
+ return true;
}
bool Server::PseudoToUser(userrec* alive,userrec* zombie,std::string message)
@@ -675,7 +676,7 @@ bool Server::PseudoToUser(userrec* alive,userrec* zombie,std::string message)
}
}
}
-
+ return true;
}
void Server::AddGLine(long duration, std::string source, std::string reason, std::string hostmask)
@@ -705,27 +706,27 @@ void Server::AddELine(long duration, std::string source, std::string reason, std
bool Server::DelGLine(std::string hostmask)
{
- del_gline(hostmask.c_str());
+ return del_gline(hostmask.c_str());
}
bool Server::DelQLine(std::string nickname)
{
- del_qline(nickname.c_str());
+ return del_qline(nickname.c_str());
}
bool Server::DelZLine(std::string ipaddr)
{
- del_zline(ipaddr.c_str());
+ return del_zline(ipaddr.c_str());
}
bool Server::DelKLine(std::string hostmask)
{
- del_kline(hostmask.c_str());
+ return del_kline(hostmask.c_str());
}
bool Server::DelELine(std::string hostmask)
{
- del_eline(hostmask.c_str());
+ return del_eline(hostmask.c_str());
}
long Server::CalcDuration(std::string delta)
@@ -740,20 +741,20 @@ bool Server::IsValidMask(std::string mask)
return false;
if (strchr(dest,'@')==0)
return false;
- for (int i = 0; i < strlen(dest); i++)
+ for (unsigned int i = 0; i < strlen(dest); i++)
if (dest[i] < 32)
return false;
- for (int i = 0; i < strlen(dest); i++)
+ for (unsigned int i = 0; i < strlen(dest); i++)
if (dest[i] > 126)
return false;
- int c = 0;
- for (int i = 0; i < strlen(dest); i++)
+ unsigned int c = 0;
+ for (unsigned int i = 0; i < strlen(dest); i++)
if (dest[i] == '!')
c++;
if (c>1)
return false;
c = 0;
- for (int i = 0; i < strlen(dest); i++)
+ for (unsigned int i = 0; i < strlen(dest); i++)
if (dest[i] == '@')
c++;
if (c>1)
@@ -893,7 +894,7 @@ long ConfigReader::ReadInteger(std::string tag, std::string name, int index, boo
this->error = CONF_VALUE_NOT_FOUND;
return 0;
}
- for (int i = 0; i < strlen(val); i++)
+ for (unsigned int i = 0; i < strlen(val); i++)
{
if (!isdigit(val[i]))
{
@@ -1002,7 +1003,7 @@ bool FileReader::Exists()
std::string FileReader::GetLine(int x)
{
- if ((x<0) || (x>fc.size()))
+ if ((x<0) || ((unsigned)x>fc.size()))
return "";
return fc[x];
}
diff --git a/src/modules/extra/m_filter_pcre.cpp b/src/modules/extra/m_filter_pcre.cpp
index 2619b7b21..0cc7fcc26 100644
--- a/src/modules/extra/m_filter_pcre.cpp
+++ b/src/modules/extra/m_filter_pcre.cpp
@@ -90,7 +90,7 @@ class ModuleFilterPCRE : public Module
virtual int OnUserPreMessage(userrec* user,void* dest,int target_type, std::string &text)
{
- for (int index = 0; index < filters.size(); index++)
+ for (unsigned int index = 0; index < filters.size(); index++)
{
if (pcre_exec(filters[index],NULL,text.c_str(),text.length(),0,0,NULL,0) > -1)
{
@@ -137,7 +137,7 @@ class ModuleFilterPCRE : public Module
virtual int OnUserPreNotice(userrec* user,void* dest,int target_type, std::string &text)
{
- for (int index = 0; index < filters.size(); index++)
+ for (unsigned int index = 0; index < filters.size(); index++)
{
if (pcre_exec(filters[index],NULL,text.c_str(),text.length(),0,0,NULL,0) > -1)
{
diff --git a/src/modules/extra/m_sqlauth.cpp b/src/modules/extra/m_sqlauth.cpp
index 16274de26..d6a6b5e81 100644
--- a/src/modules/extra/m_sqlauth.cpp
+++ b/src/modules/extra/m_sqlauth.cpp
@@ -106,7 +106,7 @@ class ModuleSQLAuth : public Module
// sanitize the password (we dont want any mysql insertion exploits!)
std::string temp = "";
- for (int q = 0; q < password.length(); q++)
+ for (unsigned int q = 0; q < password.length(); q++)
{
if (password[q] == '\'')
{
diff --git a/src/modules/extra/m_sqloper.cpp b/src/modules/extra/m_sqloper.cpp
index 70e971aae..9ccfd7a29 100644
--- a/src/modules/extra/m_sqloper.cpp
+++ b/src/modules/extra/m_sqloper.cpp
@@ -89,7 +89,7 @@ class ModuleSQLOper : public Module
// sanitize the password (we dont want any mysql insertion exploits!)
std::string temp = "";
- for (int q = 0; q < password.length(); q++)
+ for (unsigned int q = 0; q < password.length(); q++)
{
if (password[q] == '\'')
{
@@ -103,7 +103,7 @@ class ModuleSQLOper : public Module
}
password = temp;
temp = "";
- for (int v = 0; v < username.length(); v++)
+ for (unsigned int v = 0; v < username.length(); v++)
{
if (username[v] == '\'')
{
diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp
index b5f62f584..9bb2a9df2 100644
--- a/src/modules/m_alias.cpp
+++ b/src/modules/m_alias.cpp
@@ -89,7 +89,7 @@ class ModuleAlias : public Module
strncpy(data,raw.c_str(),MAXBUF);
char* dptr = data;
- for (int i = 0; i < Aliases.size(); i++)
+ for (unsigned int i = 0; i < Aliases.size(); i++)
{
if (!strncasecmp(Aliases[i].text.c_str(),data,Aliases[i].text.length()))
{
diff --git a/src/modules/m_antibottler.cpp b/src/modules/m_antibottler.cpp
index 8351969e9..8c456bdfb 100644
--- a/src/modules/m_antibottler.cpp
+++ b/src/modules/m_antibottler.cpp
@@ -52,7 +52,7 @@ class ModuleAntiBottler : public Module
bool not_bottler = false;
if (!strncmp(data,"user ",5))
{
- for (int j = 0; j < strlen(data); j++)
+ for (unsigned int j = 0; j < strlen(data); j++)
{
if (data[j] == ':')
break;
@@ -73,7 +73,7 @@ class ModuleAntiBottler : public Module
char *remote = strtok(NULL," :");
if (!strlen(data)) return;
char *gecos = strtok(NULL,"\r\n");
- for (int j = 0; j < strlen(remote); j++)
+ for (unsigned int j = 0; j < strlen(remote); j++)
{
if (((remote[j] < '0') || (remote[j] > '9')) && (remote[j] != '.'))
{
diff --git a/src/modules/m_chanfilter.cpp b/src/modules/m_chanfilter.cpp
index 1d10bcd08..e8abd91a3 100644
--- a/src/modules/m_chanfilter.cpp
+++ b/src/modules/m_chanfilter.cpp
@@ -89,7 +89,7 @@ class ModuleChanFilter : public Module
{
char buffer[MAXBUF];
strlcpy(buffer,text.c_str(),MAXBUF);
- for (int j = 0; j < strlen(buffer); j++)
+ for (unsigned int j = 0; j < strlen(buffer); j++)
buffer[j] = tolower(buffer[j]);
SpamList* spamlist = (SpamList*)chan->GetExt("spam_list");
if (spamlist)
@@ -130,7 +130,7 @@ class ModuleChanFilter : public Module
{
chanrec* chan = (chanrec*)target;
- for (int j = 0; j < params[0].length(); j++)
+ for (unsigned int j = 0; j < params[0].length(); j++)
params[0][j] = tolower(params[0][j]);
std::string param = params[0];
@@ -143,7 +143,7 @@ class ModuleChanFilter : public Module
spamlist = new SpamList;
chan->Extend("spam_list",(char*)spamlist);
}
- if (spamlist->size() < MaxEntries)
+ if (spamlist->size() < (unsigned)MaxEntries)
{
for (SpamList::iterator i = spamlist->begin(); i != spamlist->end(); i++)
{
diff --git a/src/modules/m_chanprotect.cpp b/src/modules/m_chanprotect.cpp
index 8cf91d45c..2bb446676 100644
--- a/src/modules/m_chanprotect.cpp
+++ b/src/modules/m_chanprotect.cpp
@@ -300,7 +300,7 @@ class ModuleChanProtect : public Module
if (mode == 'q')
{
chanuserlist cl = Srv->GetUsers(channel);
- for (int i = 0; i < cl.size(); i++)
+ for (unsigned int i = 0; i < cl.size(); i++)
{
if (cl[i]->GetExt("cm_founder_"+std::string(channel->name)))
{
@@ -312,7 +312,7 @@ class ModuleChanProtect : public Module
if (mode == 'a')
{
chanuserlist cl = Srv->GetUsers(channel);
- for (int i = 0; i < cl.size(); i++)
+ for (unsigned int i = 0; i < cl.size(); i++)
{
if (cl[i]->GetExt("cm_protect_"+std::string(channel->name)))
{
@@ -342,7 +342,7 @@ class ModuleChanProtect : public Module
// know whos +q/+a on the channel.
chanuserlist cl = Srv->GetUsers(chan);
string_list commands;
- for (int i = 0; i < cl.size(); i++)
+ for (unsigned int i = 0; i < cl.size(); i++)
{
if (cl[i]->GetExt("cm_founder_"+std::string(chan->name)))
{
diff --git a/src/modules/m_chghost.cpp b/src/modules/m_chghost.cpp
index e1cc5a8cb..f786a9f30 100644
--- a/src/modules/m_chghost.cpp
+++ b/src/modules/m_chghost.cpp
@@ -28,7 +28,7 @@ Server *Srv;
void handle_chghost(char **parameters, int pcnt, userrec *user)
{
- for (int x = 0; x < strlen(parameters[1]); x++)
+ for (unsigned int x = 0; x < strlen(parameters[1]); x++)
{
if (((tolower(parameters[1][x]) < 'a') || (tolower(parameters[1][x]) > 'z')) && (parameters[1][x] != '.'))
{
diff --git a/src/modules/m_helpop.cpp b/src/modules/m_helpop.cpp
index 7331db0a8..8df47ce3d 100644
--- a/src/modules/m_helpop.cpp
+++ b/src/modules/m_helpop.cpp
@@ -98,7 +98,7 @@ bool do_helpop(char **parameters, int pcnt, userrec *src)
// case sensitive
char lower[MAXBUF];
strlcpy(lower,search,MAXBUF);
- for (int t = 0; t < strlen(lower); t++)
+ for (unsigned int t = 0; t < strlen(lower); t++)
lower[t] = tolower(lower[t]);
diff --git a/src/modules/m_hostchange.cpp b/src/modules/m_hostchange.cpp
index 36cd3ea70..a3e839cad 100644
--- a/src/modules/m_hostchange.cpp
+++ b/src/modules/m_hostchange.cpp
@@ -84,7 +84,7 @@ class ModuleHostChange : public Module
// first take their nick and strip out non-dns, leaving just [A-Z0-9\-]
std::string complete = "";
std::string old = user->nick;
- for (int j = 0; j < old.length(); j++)
+ for (unsigned int j = 0; j < old.length(); j++)
{
if (((old[j] >= 'A') && (old[j] <= 'Z')) ||
((old[j] >= 'a') && (old[j] <= 'z')) ||
diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp
index 6bbc58e97..45be7e874 100644
--- a/src/modules/m_ident.cpp
+++ b/src/modules/m_ident.cpp
@@ -237,6 +237,7 @@ class RFC1413
break;
}
}
+ return true;
}
// returns true if the operation is completed,
diff --git a/src/modules/m_park.cpp b/src/modules/m_park.cpp
index 28733298f..8ceb54715 100644
--- a/src/modules/m_park.cpp
+++ b/src/modules/m_park.cpp
@@ -229,7 +229,7 @@ class ModulePark : public Module
awaylog* awy = (awaylog*)dest->GetExt("park_awaylog");
if (awy)
{
- if (awy->size() <= ParkMaxMsgs)
+ if (awy->size() <= (unsigned)ParkMaxMsgs)
{
awaymsg am;
am.text = text;
diff --git a/src/modules/m_remove.cpp b/src/modules/m_remove.cpp
index da4fc49d7..fafbff877 100644
--- a/src/modules/m_remove.cpp
+++ b/src/modules/m_remove.cpp
@@ -65,7 +65,7 @@ void handle_remove(char **parameters, int pcnt, userrec *user)
/* If the target nick exists... */
if (target && channel)
{
- for (int x = 0; x < strlen(parameters[1]); x++)
+ for (unsigned int x = 0; x < strlen(parameters[1]); x++)
{
if ((parameters[1][0] != '#') || (parameters[1][x] == ' ') || (parameters[1][x] == ','))
{
diff --git a/src/modules/m_sajoin.cpp b/src/modules/m_sajoin.cpp
index 038d511f6..76c568ea7 100644
--- a/src/modules/m_sajoin.cpp
+++ b/src/modules/m_sajoin.cpp
@@ -31,8 +31,7 @@ void handle_sajoin(char **parameters, int pcnt, userrec *user)
userrec* dest = Srv->FindNick(std::string(parameters[0]));
if (dest)
{
-
- for (int x = 0; x < strlen(parameters[1]); x++)
+ for (unsigned int x = 0; x < strlen(parameters[1]); x++)
{
if ((parameters[1][0] != '#') || (parameters[1][x] == ' ') || (parameters[1][x] == ','))
{
diff --git a/src/modules/m_sapart.cpp b/src/modules/m_sapart.cpp
index 4c7927a64..a403accc7 100644
--- a/src/modules/m_sapart.cpp
+++ b/src/modules/m_sapart.cpp
@@ -31,7 +31,7 @@ void handle_sapart(char **parameters, int pcnt, userrec *user)
userrec* dest = Srv->FindNick(std::string(parameters[0]));
if (dest)
{
- for (int x = 0; x < strlen(parameters[1]); x++)
+ for (unsigned int x = 0; x < strlen(parameters[1]); x++)
{
if ((parameters[1][0] != '#') || (parameters[1][x] == ' ') || (parameters[1][x] == ','))
{
diff --git a/src/modules/m_sethost.cpp b/src/modules/m_sethost.cpp
index c064bbe0b..d4f8a4f1d 100644
--- a/src/modules/m_sethost.cpp
+++ b/src/modules/m_sethost.cpp
@@ -29,7 +29,7 @@ Server *Srv;
void handle_sethost(char **parameters, int pcnt, userrec *user)
{
- for (int x = 0; x < strlen(parameters[0]); x++)
+ for (unsigned int x = 0; x < strlen(parameters[0]); x++)
{
if (((tolower(parameters[0][x]) < 'a') || (tolower(parameters[0][x]) > 'z')) && (parameters[0][x] != '.'))
{
diff --git a/src/servers.cpp b/src/servers.cpp
index 891eaf722..0660e0e3f 100644
--- a/src/servers.cpp
+++ b/src/servers.cpp
@@ -173,6 +173,7 @@ bool serverrec::BeginLink(char* targethost, int newport, char* password, char* s
{
connector.SetState(STATE_DISCONNECTED);
WriteOpers("Could not create outbound connection to %s:%d",targethost,newport);
+ return false;
}
}
return false;
@@ -241,7 +242,7 @@ void serverrec::TerminateLink(char* targethost)
// Returns a pointer to the connector for 'host'
ircd_connector* serverrec::FindHost(std::string findhost)
{
- for (int i = 0; i < this->connectors.size(); i++)
+ for (unsigned int i = 0; i < this->connectors.size(); i++)
{
if (this->connectors[i].GetServerName() == findhost)
{
@@ -259,7 +260,7 @@ bool IsRoutable(std::string servername)
for (int x = 0; x < 32; x++)
if (me[x])
{
- for (int i = 0; i < me[x]->connectors.size(); i++)
+ for (unsigned int i = 0; i < me[x]->connectors.size(); i++)
{
if ((me[x]->connectors[i].GetServerName() == servername) && (me[x]->connectors[i].GetState() != STATE_DISCONNECTED))
{
@@ -274,7 +275,7 @@ bool IsRoutable(std::string servername)
void serverrec::FlushWriteBuffers()
{
char buffer[MAXBUF];
- for (int i = 0; i < this->connectors.size(); i++)
+ for (unsigned int i = 0; i < this->connectors.size(); i++)
{
// don't try and ping a NOAUTH_OUTBOUND state, its not authed yet!
if ((this->connectors[i].GetState() == STATE_NOAUTH_OUTBOUND) && (TIME > this->connectors[i].age+30))
@@ -370,11 +371,11 @@ bool serverrec::SendPacket(char *message, const char* sendhost)
{
log(DEBUG,"Not a double reroute");
// this route is down, we must re-route the packet through an available point in the mesh.
- for (int k = 0; k < this->connectors.size(); k++)
+ for (unsigned int k = 0; k < this->connectors.size(); k++)
{
log(DEBUG,"Check connector %d: %s",k,this->connectors[k].GetServerName().c_str());
// search for another point in the mesh which can 'reach' where we want to go
- for (int m = 0; m < this->connectors[k].routes.size(); m++)
+ for (unsigned int m = 0; m < this->connectors[k].routes.size(); m++)
{
if (!strcasecmp(this->connectors[k].routes[m].c_str(),sendhost))
{
@@ -420,11 +421,12 @@ bool serverrec::SendPacket(char *message, const char* sendhost)
}
return true;
}
+ return false;
}
bool already_have_sum(std::string sum)
{
- for (int i = 0; i < xsums.size(); i++)
+ for (unsigned int i = 0; i < xsums.size(); i++)
{
if (xsums[i] == sum)
{
@@ -446,7 +448,7 @@ bool serverrec::RecvPacket(std::deque<std::string> &messages, char* recvhost,std
{
char data[65536],buffer[MAXBUF];
memset(data, 0, 65536);
- for (int i = 0; i < this->connectors.size(); i++)
+ for (unsigned int i = 0; i < this->connectors.size(); i++)
{
if (this->connectors[i].GetState() != STATE_DISCONNECTED)
{
diff --git a/src/users.cpp b/src/users.cpp
index 60072ed0c..d4e87780c 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -192,20 +192,20 @@ bool userrec::HasPermission(char* command)
bool userrec::AddBuffer(std::string a)
{
std::string b = "";
- for (int i = 0; i < a.length(); i++)
+ for (unsigned int i = 0; i < a.length(); i++)
if ((a[i] != '\r') && (a[i] != '\0') && (a[i] != 7))
b = b + a[i];
std::stringstream stream(recvq);
stream << b;
recvq = stream.str();
- int i = 0;
+ unsigned int i = 0;
// count the size of the first line in the buffer.
while (i < recvq.length())
{
if (recvq[i++] == '\n')
break;
}
- if (recvq.length() > this->recvqmax)
+ if (recvq.length() > (unsigned)this->recvqmax)
{
this->SetWriteError("RecvQ exceeded");
WriteOpers("*** User %s RecvQ of %d exceeds connect class maximum of %d",this->nick,recvq.length(),this->recvqmax);
@@ -217,7 +217,7 @@ bool userrec::AddBuffer(std::string a)
bool userrec::BufferIsReady()
{
- for (int i = 0; i < recvq.length(); i++)
+ for (unsigned int i = 0; i < recvq.length(); i++)
if (recvq[i] == '\n')
return true;
return false;
@@ -249,7 +249,7 @@ void userrec::AddWriteBuf(std::string data)
{
if (this->GetWriteError() != "")
return;
- if (sendq.length() + data.length() > this->sendqmax)
+ if (sendq.length() + data.length() > (unsigned)this->sendqmax)
{
WriteOpers("*** User %s SendQ of %d exceeds connect class maximum of %d",this->nick,sendq.length() + data.length(),this->sendqmax);
this->SetWriteError("SendQ exceeded");