diff options
author | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-02-11 09:41:58 +0000 |
---|---|---|
committer | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-02-11 09:41:58 +0000 |
commit | 5db1d322be106c8462dc691072f9415dc0766ed4 (patch) | |
tree | 311cb5e6d5307d3e2b77652a9a2461a324c5ab2e /src | |
parent | 0626e6a68af3327ecfda4467f2dd09d4e729773d (diff) |
Add -Wshadow to cflags, and fix a bunch of warnings that come with it. Add a note to webirc that needs looking at.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8892 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
30 files changed, 178 insertions, 176 deletions
diff --git a/src/channels.cpp b/src/channels.cpp index cab05caeb..bb388e21e 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -18,14 +18,14 @@ #include "wildcard.h" #include "mode.h" -Channel::Channel(InspIRCd* Instance, const std::string &name, time_t ts) : ServerInstance(Instance) +Channel::Channel(InspIRCd* Instance, const std::string &cname, time_t ts) : ServerInstance(Instance) { chan_hash::iterator findchan = ServerInstance->chanlist->find(name); if (findchan != Instance->chanlist->end()) - throw CoreException("Cannot create duplicate channel " + name); + throw CoreException("Cannot create duplicate channel " + cname); - (*(ServerInstance->chanlist))[name.c_str()] = this; - strlcpy(this->name, name.c_str(), CHANMAX); + (*(ServerInstance->chanlist))[cname.c_str()] = this; + strlcpy(this->name, cname.c_str(), CHANMAX); this->created = ts ? ts : ServerInstance->Time(true); this->age = this->created; diff --git a/src/command_parse.cpp b/src/command_parse.cpp index d3b8500f1..bc84982eb 100644 --- a/src/command_parse.cpp +++ b/src/command_parse.cpp @@ -354,7 +354,7 @@ bool CommandParser::ProcessCommand(User *user, std::string &cmd) cm->second->total_bytes += cmd.length(); /* module calls too */ - int MOD_RESULT = 0; + MOD_RESULT = 0; FOREACH_RESULT(I_OnPreCommand,OnPreCommand(command,command_p,items,user,true,cmd)); if (MOD_RESULT == 1) return do_more; diff --git a/src/commands/cmd_nick.cpp b/src/commands/cmd_nick.cpp index 25bf858c8..5a7ed846a 100644 --- a/src/commands/cmd_nick.cpp +++ b/src/commands/cmd_nick.cpp @@ -147,7 +147,7 @@ CmdResult CommandNick::Handle (const char** parameters, int, User *user) else if (user->registered == REG_NICKUSER) { /* user is registered now, bit 0 = USER command, bit 1 = sent a NICK command */ - int MOD_RESULT = 0; + MOD_RESULT = 0; FOREACH_RESULT(I_OnUserRegister,OnUserRegister(user)); if (MOD_RESULT > 0) return CMD_FAILURE; diff --git a/src/commands/cmd_whowas.cpp b/src/commands/cmd_whowas.cpp index b961bc839..7b44a0290 100644 --- a/src/commands/cmd_whowas.cpp +++ b/src/commands/cmd_whowas.cpp @@ -150,23 +150,23 @@ void CommandWhowas::AddToWhoWas(User* user) if ((int)(whowas.size()) > ServerInstance->Config->WhoWasMaxGroups) { - whowas_users::iterator iter = whowas.find(whowas_fifo[0].second); - if (iter != whowas.end()) + whowas_users::iterator iter2 = whowas.find(whowas_fifo[0].second); + if (iter2 != whowas.end()) { - whowas_set* n = (whowas_set*)iter->second; + whowas_set* n2 = (whowas_set*)iter2->second; - if (n->size()) + if (n2->size()) { - while (n->begin() != n->end()) + while (n2->begin() != n2->end()) { - WhoWasGroup *a = *(n->begin()); - delete a; - n->pop_front(); + WhoWasGroup *a2 = *(n2->begin()); + delete a2; + n2->pop_front(); } } - delete n; - whowas.erase(iter); + delete n2; + whowas.erase(iter2); } whowas_fifo.pop_front(); } @@ -179,8 +179,8 @@ void CommandWhowas::AddToWhoWas(User* user) if ((int)(group->size()) > ServerInstance->Config->WhoWasGroupSize) { - WhoWasGroup *a = (WhoWasGroup*)*(group->begin()); - delete a; + WhoWasGroup *a2 = (WhoWasGroup*)*(group->begin()); + delete a2; group->pop_front(); } } diff --git a/src/configreader.cpp b/src/configreader.cpp index f083f7895..9f7a59885 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -583,11 +583,11 @@ bool DoConnect(ServerConfig* conf, const char*, char**, ValueList &values, int*) */ for (ClassVector::iterator item = conf->Classes.begin(); item != conf->Classes.end(); ++item) { - ConnectClass* c = *item; - if ((*name && (c->GetName() == name)) || (*allow && (c->GetHost() == allow)) || (*deny && (c->GetHost() == deny))) + ConnectClass* cc = *item; + if ((*name && (cc->GetName() == name)) || (*allow && (cc->GetHost() == allow)) || (*deny && (cc->GetHost() == deny))) { /* reenable class so users can be shoved into it :P */ - c->SetDisabled(false); + cc->SetDisabled(false); conf->GetInstance()->Log(DEFAULT, "Not adding class, it already exists!"); return true; } @@ -603,11 +603,11 @@ bool DoConnect(ServerConfig* conf, const char*, char**, ValueList &values, int*) ClassVector::iterator item = conf->Classes.begin(); for (; item != conf->Classes.end(); ++item) { - ConnectClass* c = *item; - conf->GetInstance()->Log(DEBUG,"Class: %s", c->GetName().c_str()); - if (c->GetName() == parent) + ConnectClass* cc = *item; + conf->GetInstance()->Log(DEBUG,"Class: %s", cc->GetName().c_str()); + if (cc->GetName() == parent) { - ConnectClass* newclass = new ConnectClass(name, c); + ConnectClass* newclass = new ConnectClass(name, cc); newclass->Update(timeout, flood, *allow ? allow : deny, pingfreq, password, threshold, sendq, recvq, localmax, globalmax, maxchans, port, limit); conf->Classes.push_back(newclass); break; @@ -620,16 +620,16 @@ bool DoConnect(ServerConfig* conf, const char*, char**, ValueList &values, int*) { if (*allow) { - ConnectClass* c = new ConnectClass(name, timeout, flood, allow, pingfreq, password, hashtype, threshold, sendq, recvq, localmax, globalmax, maxchans); - c->limit = limit; - c->SetPort(port); - conf->Classes.push_back(c); + ConnectClass* cc = new ConnectClass(name, timeout, flood, allow, pingfreq, password, hashtype, threshold, sendq, recvq, localmax, globalmax, maxchans); + cc->limit = limit; + cc->SetPort(port); + conf->Classes.push_back(cc); } else { - ConnectClass* c = new ConnectClass(name, deny); - c->SetPort(port); - conf->Classes.push_back(c); + ConnectClass* cc = new ConnectClass(name, deny); + cc->SetPort(port); + conf->Classes.push_back(cc); } } diff --git a/src/dns.cpp b/src/dns.cpp index 77eacefd9..0d822a17d 100644 --- a/src/dns.cpp +++ b/src/dns.cpp @@ -154,12 +154,12 @@ class RequestTimeout : public Timer }; /* Allocate the processing buffer */ -DNSRequest::DNSRequest(InspIRCd* Instance, DNS* dns, int id, const std::string &original) : dnsobj(dns), ServerInstance(Instance) +DNSRequest::DNSRequest(InspIRCd* Instance, DNS* dns, int rid, const std::string &original) : dnsobj(dns), ServerInstance(Instance) { res = new unsigned char[512]; *res = 0; orig = original; - RequestTimeout* RT = new RequestTimeout(Instance->Config->dns_timeout ? Instance->Config->dns_timeout : 5, Instance, this, id); + RequestTimeout* RT = new RequestTimeout(Instance->Config->dns_timeout ? Instance->Config->dns_timeout : 5, Instance, this, rid); Instance->Timers->AddTimer(RT); /* The timer manager frees this */ } diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp index d325b40aa..8e9f4dfd5 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -416,19 +416,19 @@ long InspIRCd::Duration(const std::string &str) return total + subtotal; } -bool InspIRCd::ULine(const char* server) +bool InspIRCd::ULine(const char* sserver) { - if (!server) + if (!sserver) return false; - if (!*server) + if (!*sserver) return true; - return (Config->ulines.find(server) != Config->ulines.end()); + return (Config->ulines.find(sserver) != Config->ulines.end()); } -bool InspIRCd::SilentULine(const char* server) +bool InspIRCd::SilentULine(const char* sserver) { - std::map<irc::string,bool>::iterator n = Config->ulines.find(server); + std::map<irc::string,bool>::iterator n = Config->ulines.find(sserver); if (n != Config->ulines.end()) return n->second; else return false; diff --git a/src/inspsocket.cpp b/src/inspsocket.cpp index 0e8744d17..d412b961c 100644 --- a/src/inspsocket.cpp +++ b/src/inspsocket.cpp @@ -178,10 +178,10 @@ bool BufferedSocket::BindAddr(const std::string &ip) int j = 0; while (j < Conf.Enumerate("bind") || (!ip.empty())) { - std::string IP = ip.empty() ? Conf.ReadValue("bind","address",j) : ip; + std::string sIP = ip.empty() ? Conf.ReadValue("bind","address",j) : ip; if (!ip.empty() || Conf.ReadValue("bind","type",j) == "servers") { - if (!ip.empty() || ((IP != "*") && (IP != "127.0.0.1") && (!IP.empty()) && (IP != "::1"))) + if (!ip.empty() || ((sIP != "*") && (sIP != "127.0.0.1") && (!sIP.empty()) && (sIP != "::1"))) { /* The [2] is required because we may write a sockaddr_in6 here, and sockaddr_in6 is larger than sockaddr, where sockaddr_in4 is not. */ sockaddr* s = new sockaddr[2]; @@ -189,7 +189,7 @@ bool BufferedSocket::BindAddr(const std::string &ip) if (v6) { in6_addr n; - if (inet_pton(AF_INET6, IP.c_str(), &n) > 0) + if (inet_pton(AF_INET6, sIP.c_str(), &n) > 0) { memcpy(&((sockaddr_in6*)s)->sin6_addr, &n, sizeof(sockaddr_in6)); ((sockaddr_in6*)s)->sin6_port = 0; @@ -207,7 +207,7 @@ bool BufferedSocket::BindAddr(const std::string &ip) #endif { in_addr n; - if (inet_aton(IP.c_str(), &n) > 0) + if (inet_aton(sIP.c_str(), &n) > 0) { ((sockaddr_in*)s)->sin_addr = n; ((sockaddr_in*)s)->sin_port = 0; diff --git a/src/logger.cpp b/src/logger.cpp index 1d5111fb7..b8cd3b298 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -122,10 +122,11 @@ void LogManager::CloseLogs() LogStreams.erase(i); } /* Now close FileLoggers, for those logstreams that neglected to properly free their stuff. */ - for (FileLogMap::iterator i = FileLogs.begin(); i != FileLogs.end(); ++i) + for (FileLogMap::iterator it = FileLogs.begin(); it != FileLogs.end(); ++i) { - delete i->first; + delete it->first; } + FileLogMap().swap(FileLogs); /* Swap with empty map to clear */ } diff --git a/src/modes/cmode_h.cpp b/src/modes/cmode_h.cpp index e54488bd1..2df6170ca 100644 --- a/src/modes/cmode_h.cpp +++ b/src/modes/cmode_h.cpp @@ -47,11 +47,11 @@ ModePair ModeChannelHalfOp::ModeSet(User*, User*, Channel* channel, const std::s void ModeChannelHalfOp::RemoveMode(Channel* channel) { - CUList* list = channel->GetHalfoppedUsers(); + CUList* clist = channel->GetHalfoppedUsers(); CUList copy; char moderemove[MAXBUF]; - for (CUList::iterator i = list->begin(); i != list->end(); i++) + for (CUList::iterator i = clist->begin(); i != clist->end(); i++) { User* n = i->first; copy.insert(std::make_pair(n,n->nick)); diff --git a/src/modes/cmode_o.cpp b/src/modes/cmode_o.cpp index dac4198ff..caef82bf6 100644 --- a/src/modes/cmode_o.cpp +++ b/src/modes/cmode_o.cpp @@ -48,11 +48,11 @@ ModePair ModeChannelOp::ModeSet(User*, User*, Channel* channel, const std::strin void ModeChannelOp::RemoveMode(Channel* channel) { - CUList* list = channel->GetOppedUsers(); + CUList* clist = channel->GetOppedUsers(); CUList copy; char moderemove[MAXBUF]; - for (CUList::iterator i = list->begin(); i != list->end(); i++) + for (CUList::iterator i = clist->begin(); i != clist->end(); i++) { User* n = i->first; copy.insert(std::make_pair(n,n->nick)); diff --git a/src/modes/cmode_v.cpp b/src/modes/cmode_v.cpp index 66e58a479..2abf4e161 100644 --- a/src/modes/cmode_v.cpp +++ b/src/modes/cmode_v.cpp @@ -1,3 +1,4 @@ + /* +------------------------------------+ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ @@ -47,11 +48,11 @@ ModePair ModeChannelVoice::ModeSet(User*, User*, Channel* channel, const std::st void ModeChannelVoice::RemoveMode(Channel* channel) { - CUList* list = channel->GetVoicedUsers(); + CUList* clist = channel->GetVoicedUsers(); CUList copy; char moderemove[MAXBUF]; - for (CUList::iterator i = list->begin(); i != list->end(); i++) + for (CUList::iterator i = clist->begin(); i != clist->end(); i++) { User* n = i->first; copy.insert(std::make_pair(n,n->nick)); diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp index 5a6850f61..1e7c87241 100644 --- a/src/modules/m_alias.cpp +++ b/src/modules/m_alias.cpp @@ -197,10 +197,10 @@ class ModuleAlias : public Module else { irc::sepstream commands(Aliases[i].replace_with, '\n'); - std::string command; - while (commands.GetToken(command)) + std::string scommand; + while (commands.GetToken(scommand)) { - DoCommand(command, user, safe); + DoCommand(scommand, user, safe); } return 1; } diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp index e854b8d4e..53fdb6ff7 100644 --- a/src/modules/m_cgiirc.cpp +++ b/src/modules/m_cgiirc.cpp @@ -33,8 +33,8 @@ public: CGItype type; std::string password; - CGIhost(const std::string &mask = "", CGItype t = IDENTFIRST, const std::string &password ="") - : hostmask(mask), type(t), password(password) + CGIhost(const std::string &mask = "", CGItype t = IDENTFIRST, const std::string &spassword ="") + : hostmask(mask), type(t), password(spassword) { } }; @@ -53,11 +53,12 @@ typedef std::vector<CGIhost> CGIHostlist; */ class CommandWebirc : public Command { + // XXX why is inspircd declared here? does class command not have one? InspIRCd* Me; CGIHostlist Hosts; bool notify; public: - CommandWebirc(InspIRCd* Me, CGIHostlist &Hosts, bool notify) : Command(Me, "WEBIRC", 0, 4, true), Hosts(Hosts), notify(notify) + CommandWebirc(InspIRCd* iMe, CGIHostlist &cHosts, bool bnotify) : Command(iMe, "WEBIRC", 0, 4, true), Hosts(cHosts), notify(bnotify) { this->source = "m_cgiirc.so"; this->syntax = "password client hostname ip"; @@ -97,8 +98,8 @@ class CGIResolver : public Resolver User* them; bool notify; public: - CGIResolver(Module* me, InspIRCd* ServerInstance, bool NotifyOpers, const std::string &source, bool forward, User* u, int userfd, const std::string &type, bool &cached) - : Resolver(ServerInstance, source, forward ? DNS_QUERY_A : DNS_QUERY_PTR4, cached, me), typ(type), theirfd(userfd), them(u), notify(NotifyOpers) { } + CGIResolver(Module* me, InspIRCd* Instance, bool NotifyOpers, const std::string &source, bool forward, User* u, int userfd, const std::string &type, bool &cached) + : Resolver(Instance, source, forward ? DNS_QUERY_A : DNS_QUERY_PTR4, cached, me), typ(type), theirfd(userfd), them(u), notify(NotifyOpers) { } virtual void OnLookupComplete(const std::string &result, unsigned int ttl, bool cached, int resultnum = 0) { diff --git a/src/modules/m_customtitle.cpp b/src/modules/m_customtitle.cpp index 0caa2d6f5..6bde81c67 100644 --- a/src/modules/m_customtitle.cpp +++ b/src/modules/m_customtitle.cpp @@ -209,8 +209,8 @@ class ModuleCustomTitle : public Module std::string* text; if (!dest->GetExt("ctitle", text)) { - std::string* text = new std::string(extdata); - dest->Extend("ctitle",text); + std::string* ntext = new std::string(extdata); + dest->Extend("ctitle",ntext); } } } diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp index 7ac1bc737..0ae5791cd 100644 --- a/src/modules/m_dccallow.cpp +++ b/src/modules/m_dccallow.cpp @@ -268,13 +268,13 @@ class ModuleDCCAllow : public Module virtual void OnUserQuit(User* user, const std::string &reason, const std::string &oper_message) { - dccallowlist* dl; + dccallowlist* udl; // remove their DCCALLOW list if they have one - user->GetExt("dccallow_list", dl); - if (dl) + user->GetExt("dccallow_list", udl); + if (udl) { - delete dl; + delete udl; user->Shrink("dccallow_list"); RemoveFromUserlist(user); } @@ -389,17 +389,17 @@ class ModuleDCCAllow : public Module { if (dl->size()) { - dccallowlist::iterator iter = dl->begin(); - while (iter != dl->end()) + dccallowlist::iterator iter2 = dl->begin(); + while (iter2 != dl->end()) { - if ((iter->set_on + iter->length) <= ServerInstance->Time()) + if ((iter2->set_on + iter2->length) <= ServerInstance->Time()) { - u->WriteServ("997 %s %s :DCCALLOW entry for %s has expired", u->nick, u->nick, iter->nickname.c_str()); - iter = dl->erase(iter); + u->WriteServ("997 %s %s :DCCALLOW entry for %s has expired", u->nick, u->nick, iter2->nickname.c_str()); + iter2 = dl->erase(iter2); } else { - ++iter; + ++iter2; } } } diff --git a/src/modules/m_denychans.cpp b/src/modules/m_denychans.cpp index eff6e64a4..969aa8b5b 100644 --- a/src/modules/m_denychans.cpp +++ b/src/modules/m_denychans.cpp @@ -64,9 +64,9 @@ class ModuleDenyChannels : public Module std::string reason = Conf->ReadValue("badchan","reason",j); std::string redirect = Conf->ReadValue("badchan","redirect",j); - for (int j = 0; j < Conf->Enumerate("goodchan"); j++) + for (int i = 0; i < Conf->Enumerate("goodchan"); i++) { - if (match(cname, Conf->ReadValue("goodchan", "name", j).c_str())) + if (match(cname, Conf->ReadValue("goodchan", "name", i).c_str())) { return 0; } diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp index 40f5c2910..1c6939220 100644 --- a/src/modules/m_dnsbl.cpp +++ b/src/modules/m_dnsbl.cpp @@ -51,8 +51,8 @@ class DNSBLResolver : public Resolver public: - DNSBLResolver(Module *me, InspIRCd *ServerInstance, const std::string &hostname, User* u, int userfd, DNSBLConfEntry *conf, bool &cached) - : Resolver(ServerInstance, hostname, DNS_QUERY_A, cached, me) + DNSBLResolver(Module *me, InspIRCd *Instance, const std::string &hostname, User* u, int userfd, DNSBLConfEntry *conf, bool &cached) + : Resolver(Instance, hostname, DNS_QUERY_A, cached, me) { theirfd = userfd; them = u; @@ -220,7 +220,6 @@ class ModuleDNSBL : public Module */ void ClearEntries() { - std::vector<DNSBLConfEntry *>::iterator i; for (std::vector<DNSBLConfEntry *>::iterator i = DNSBLConfEntries.begin(); i != DNSBLConfEntries.end(); i++) delete *i; DNSBLConfEntries.clear(); diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index 32b80d283..2be2cfeca 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -36,13 +36,13 @@ class ModuleFilter : public FilterBase { } - virtual FilterResult* FilterMatch(User* user, const std::string &text, int flags) + virtual FilterResult* FilterMatch(User* user, const std::string &text, int iflags) { for (filter_t::iterator index = filters.begin(); index != filters.end(); index++) { /* Skip ones that dont apply to us */ - if (!FilterBase::AppliesToMe(user, index->second, flags)) + if (!FilterBase::AppliesToMe(user, index->second, iflags)) continue; if (ServerInstance->MatchText(text,index->first)) @@ -71,14 +71,14 @@ class ModuleFilter : public FilterBase return false; } - virtual std::pair<bool, std::string> AddFilter(const std::string &freeform, const std::string &type, const std::string &reason, long duration, const std::string &flags) + virtual std::pair<bool, std::string> AddFilter(const std::string &freeform, const std::string &type, const std::string &reason, long duration, const std::string &sflags) { if (filters.find(freeform) != filters.end()) { return std::make_pair(false, "Filter already exists"); } - FilterResult* x = new FilterResult(freeform, reason, type, duration, flags); + FilterResult* x = new FilterResult(freeform, reason, type, duration, sflags); filters[freeform] = x; return std::make_pair(true, ""); @@ -103,13 +103,13 @@ class ModuleFilter : public FilterBase std::string pattern = MyConf->ReadValue("keyword","pattern",index); std::string reason = MyConf->ReadValue("keyword","reason",index); std::string do_action = MyConf->ReadValue("keyword","action",index); - std::string flags = MyConf->ReadValue("keyword","flags",index); + std::string sflags = MyConf->ReadValue("keyword","flags",index); long gline_time = ServerInstance->Duration(MyConf->ReadValue("keyword","duration",index)); if (do_action.empty()) do_action = "none"; - if (flags.empty()) - flags = "*"; - FilterResult* x = new FilterResult(pattern, reason, do_action, gline_time, flags); + if (sflags.empty()) + sflags = "*"; + FilterResult* x = new FilterResult(pattern, reason, do_action, gline_time, sflags); filters[pattern] = x; } delete MyConf; diff --git a/src/modules/m_filter.h b/src/modules/m_filter.h index 5bc41b136..130509682 100644 --- a/src/modules/m_filter.h +++ b/src/modules/m_filter.h @@ -36,10 +36,10 @@ class FilterResult : public classbase bool flag_privmsg; bool flag_notice; - FilterResult(const std::string free, const std::string &rea, const std::string &act, long gt, const std::string &fla) : freeform(free), reason(rea), - action(act), gline_time(gt), flags(fla) + FilterResult(const std::string free, const std::string &rea, const std::string &act, long gt, const std::string &fla) : + freeform(free), reason(rea), action(act), gline_time(gt), flags(fla) { - this->FillFlags(flags); + this->FillFlags(fla); } int FillFlags(const std::string &fl) @@ -121,9 +121,9 @@ class CommandFilter : public Command { FilterBase* Base; public: - CommandFilter(FilterBase* f, InspIRCd* Me, const std::string &source) : Command(Me, "FILTER", 'o', 1), Base(f) + CommandFilter(FilterBase* f, InspIRCd* Me, const std::string &ssource) : Command(Me, "FILTER", 'o', 1), Base(f) { - this->source = source; + this->source = ssource; this->syntax = "<filter-definition> <type> <flags> [<gline-duration>] :<reason>"; } @@ -207,17 +207,17 @@ class CommandFilter : public Command } }; -bool FilterBase::AppliesToMe(User* user, FilterResult* filter, int flags) +bool FilterBase::AppliesToMe(User* user, FilterResult* filter, int iflags) { if ((filter->flag_no_opers) && IS_OPER(user)) return false; - if ((flags & FLAG_PRIVMSG) && (!filter->flag_privmsg)) + if ((iflags & FLAG_PRIVMSG) && (!filter->flag_privmsg)) return false; - if ((flags & FLAG_NOTICE) && (!filter->flag_notice)) + if ((iflags & FLAG_NOTICE) && (!filter->flag_notice)) return false; - if ((flags & FLAG_QUIT) && (!filter->flag_quit_message)) + if ((iflags & FLAG_QUIT) && (!filter->flag_quit_message)) return false; - if ((flags & FLAG_PART) && (!filter->flag_part_message)) + if ((iflags & FLAG_PART) && (!filter->flag_part_message)) return false; return true; } diff --git a/src/modules/m_hash.h b/src/modules/m_hash.h index 47176f26f..6351cf04f 100644 --- a/src/modules/m_hash.h +++ b/src/modules/m_hash.h @@ -135,7 +135,7 @@ class HashSumRequest : public HashRequest * @param Target A pointer to the hashing module * @param data The data to be hashed */ - HashSumRequest(Module* Me, Module* Target, const std::string &data) : HashRequest(Me, Target, data) + HashSumRequest(Module* Me, Module* Target, const std::string &sdata) : HashRequest(Me, Target, sdata) { } }; @@ -161,7 +161,7 @@ class HashKeyRequest : public HashRequest * @param data The new IV's. This should be an array of exactly four 32 bit values. * On 64-bit architectures, the upper 32 bits of the values will be discarded. */ - HashKeyRequest(Module* Me, Module* Target, unsigned int* data) : HashRequest(Me, Target, data) + HashKeyRequest(Module* Me, Module* Target, unsigned int* sdata) : HashRequest(Me, Target, sdata) { } }; @@ -187,7 +187,7 @@ class HashHexRequest : public HashRequest * @param data The hex sequence to use. This should contain exactly 16 ASCII characters, * terminated by a NULL char. */ - HashHexRequest(Module* Me, Module* Target, const char* data) : HashRequest(Me, Target, data) + HashHexRequest(Module* Me, Module* Target, const char* sdata) : HashRequest(Me, Target, sdata) { } }; diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp index 7623493c4..efae473d9 100644 --- a/src/modules/m_httpd.cpp +++ b/src/modules/m_httpd.cpp @@ -76,7 +76,7 @@ class HttpServerSocket : public BufferedSocket public: - HttpServerSocket(InspIRCd* SI, std::string host, int port, bool listening, unsigned long maxtime, FileReader* index_page) : BufferedSocket(SI, host, port, listening, maxtime), index(index_page), postsize(0) + HttpServerSocket(InspIRCd* SI, std::string shost, int iport, bool listening, unsigned long maxtime, FileReader* index_page) : BufferedSocket(SI, shost, iport, listening, maxtime), index(index_page), postsize(0) { InternalState = HTTP_LISTEN; Timeout = NULL; @@ -407,9 +407,9 @@ class HttpServerSocket : public BufferedSocket } } - void Page(std::stringstream* n, int response, HTTPHeaders *headers) + void Page(std::stringstream* n, int response, HTTPHeaders *hheaders) { - SendHeaders(n->str().length(), response, *headers); + SendHeaders(n->str().length(), response, *hheaders); this->Write(n->str()); if (!keepalive) diff --git a/src/modules/m_md5.cpp b/src/modules/m_md5.cpp index d39910838..b88258368 100644 --- a/src/modules/m_md5.cpp +++ b/src/modules/m_md5.cpp @@ -61,10 +61,10 @@ class ModuleMD5 : public Module } while (--words); } - void MD5Init(MD5Context *ctx, unsigned int* key = NULL) + void MD5Init(MD5Context *ctx, unsigned int* ikey = NULL) { /* These are the defaults for md5 */ - if (!key) + if (!ikey) { ctx->buf[0] = 0x67452301; ctx->buf[1] = 0xefcdab89; @@ -73,10 +73,10 @@ class ModuleMD5 : public Module } else { - ctx->buf[0] = key[0]; - ctx->buf[1] = key[1]; - ctx->buf[2] = key[2]; - ctx->buf[3] = key[3]; + ctx->buf[0] = ikey[0]; + ctx->buf[1] = ikey[1]; + ctx->buf[2] = ikey[2]; + ctx->buf[3] = ikey[3]; } ctx->bytes[0] = 0; @@ -236,20 +236,20 @@ class ModuleMD5 : public Module } - void MyMD5(void *dest, void *orig, int len, unsigned int* key) + void MyMD5(void *dest, void *orig, int len, unsigned int* ikey) { MD5Context context; - MD5Init(&context, key); + MD5Init(&context, ikey); MD5Update(&context, (const unsigned char*)orig, len); MD5Final((unsigned char*)dest, &context); } - void GenHash(const char* src, char* dest, const char* xtab, unsigned int* key) + void GenHash(const char* src, char* dest, const char* xtab, unsigned int* ikey) { unsigned char bytes[16]; - MyMD5((char*)bytes, (void*)src, strlen(src), key); + MyMD5((char*)bytes, (void*)src, strlen(src), ikey); for (int i = 0; i < 16; i++) { diff --git a/src/modules/m_nicklock.cpp b/src/modules/m_nicklock.cpp index 5e994e3fd..83b0888da 100644 --- a/src/modules/m_nicklock.cpp +++ b/src/modules/m_nicklock.cpp @@ -30,20 +30,20 @@ class CommandNicklock : public Command CmdResult Handle(const char** parameters, int pcnt, User *user) { - User* source = ServerInstance->FindNick(parameters[0]); + User* target = ServerInstance->FindNick(parameters[0]); irc::string server; irc::string me; // check user exists - if (!source) + if (!target) { return CMD_FAILURE; } // check if user is locked - if (source->GetExt("nick_locked", dummy)) + if (target->GetExt("nick_locked", dummy)) { - user->WriteServ("946 %s %s :This user's nickname is already locked.",user->nick,source->nick); + user->WriteServ("946 %s %s :This user's nickname is already locked.",user->nick,target->nick); return CMD_FAILURE; } @@ -56,14 +56,14 @@ class CommandNicklock : public Command // let others know ServerInstance->SNO->WriteToSnoMask('A', std::string(user->nick)+" used NICKLOCK to change and hold "+parameters[0]+" to "+parameters[1]); - if (!source->ForceNickChange(parameters[1])) + if (!target->ForceNickChange(parameters[1])) { // ugh, nickchange failed for some reason -- possibly existing nick? - User::QuitUser(ServerInstance, source, "Nickname collision"); + User::QuitUser(ServerInstance, target, "Nickname collision"); } // give them a lock flag - source->Extend("nick_locked", "ON"); + target->Extend("nick_locked", "ON"); /* route */ return CMD_SUCCESS; @@ -83,11 +83,11 @@ class CommandNickunlock : public Command CmdResult Handle (const char** parameters, int pcnt, User *user) { - User* source = ServerInstance->FindNick(parameters[0]); - if (source) + User* target = ServerInstance->FindNick(parameters[0]); + if (target) { - source->Shrink("nick_locked"); - user->WriteServ("945 %s %s :Nickname now unlocked.",user->nick,source->nick); + target->Shrink("nick_locked"); + user->WriteServ("945 %s %s :Nickname now unlocked.",user->nick,target->nick); ServerInstance->SNO->WriteToSnoMask('A', std::string(user->nick)+" used NICKUNLOCK on "+parameters[0]); return CMD_SUCCESS; } diff --git a/src/modules/m_password_hash.cpp b/src/modules/m_password_hash.cpp index baf73e113..66b917e18 100644 --- a/src/modules/m_password_hash.cpp +++ b/src/modules/m_password_hash.cpp @@ -121,9 +121,9 @@ class ModuleOperHash : public Module if (ServerInstance->Modules->ModuleHasInterface(mod, "HashRequest")) { ServerInstance->Log(DEBUG, "Post-load registering hasher: %s", name.c_str()); - std::string name = HashNameRequest(this, mod).Send(); - hashers[name.c_str()] = mod; - names.push_back(name); + std::string sname = HashNameRequest(this, mod).Send(); + hashers[sname.c_str()] = mod; + names.push_back(sname); if (!diduseiface) { ServerInstance->Modules->UseInterface("HashRequest"); diff --git a/src/modules/m_proxyscan.cpp b/src/modules/m_proxyscan.cpp index af47a1d57..328b92612 100644 --- a/src/modules/m_proxyscan.cpp +++ b/src/modules/m_proxyscan.cpp @@ -76,12 +76,12 @@ class ProxySocket : public EventHandler int rlen; bool done; public: - ProxySocket(InspIRCd *Server, User* u, const std::string &bindip, int port, char *cstr, int clen, char *rstr, int rlen) + ProxySocket(InspIRCd *Server, User* u, const std::string &bindip, int port, char *cstr, int mclen, char *rstr, int mrlen) { user = u; ServerInstance = Server; - this->clen = clen; - this->rlen = rlen; + this->clen = mclen; + this->rlen = mrlen; int i; diff --git a/src/socket.cpp b/src/socket.cpp index bd8147b3f..b9e22c949 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -312,8 +312,8 @@ bool irc::sockets::MatchCIDR(const char* address, const char* cidr_mask, bool ma bool InspIRCd::BindSocket(int sockfd, int port, char* addr, bool dolisten) { /* We allocate 2 of these, because sockaddr_in6 is larger than sockaddr (ugh, hax) */ - sockaddr* server = new sockaddr[2]; - memset(server,0,sizeof(sockaddr)*2); + sockaddr* servaddr = new sockaddr[2]; + memset(servaddr,0,sizeof(sockaddr)*2); int ret, size; @@ -330,13 +330,13 @@ bool InspIRCd::BindSocket(int sockfd, int port, char* addr, bool dolisten) in6_addr addy; if (inet_pton(AF_INET6, addr, &addy) < 1) { - delete[] server; + delete[] servaddr; return false; } - ((sockaddr_in6*)server)->sin6_family = AF_INET6; - memcpy(&(((sockaddr_in6*)server)->sin6_addr), &addy, sizeof(in6_addr)); - ((sockaddr_in6*)server)->sin6_port = htons(port); + ((sockaddr_in6*)servaddr)->sin6_family = AF_INET6; + memcpy(&(((sockaddr_in6*)servaddr)->sin6_addr), &addy, sizeof(in6_addr)); + ((sockaddr_in6*)servaddr)->sin6_port = htons(port); size = sizeof(sockaddr_in6); } else @@ -345,13 +345,13 @@ bool InspIRCd::BindSocket(int sockfd, int port, char* addr, bool dolisten) in_addr addy; if (inet_pton(AF_INET, addr, &addy) < 1) { - delete[] server; + delete[] servaddr; return false; } - ((sockaddr_in*)server)->sin_family = AF_INET; - ((sockaddr_in*)server)->sin_addr = addy; - ((sockaddr_in*)server)->sin_port = htons(port); + ((sockaddr_in*)servaddr)->sin_family = AF_INET; + ((sockaddr_in*)servaddr)->sin_addr = addy; + ((sockaddr_in*)servaddr)->sin_port = htons(port); size = sizeof(sockaddr_in); } } @@ -362,45 +362,45 @@ bool InspIRCd::BindSocket(int sockfd, int port, char* addr, bool dolisten) /* Port -1: Means UDP IPV4 port binding - Special case * used by DNS engine. */ - ((sockaddr_in*)server)->sin_family = AF_INET; - ((sockaddr_in*)server)->sin_addr.s_addr = htonl(INADDR_ANY); - ((sockaddr_in*)server)->sin_port = 0; + ((sockaddr_in*)servaddr)->sin_family = AF_INET; + ((sockaddr_in*)servaddr)->sin_addr.s_addr = htonl(INADDR_ANY); + ((sockaddr_in*)servaddr)->sin_port = 0; size = sizeof(sockaddr_in); } else { /* Theres no address here, default to ipv6 bind to all */ - ((sockaddr_in6*)server)->sin6_family = AF_INET6; - memset(&(((sockaddr_in6*)server)->sin6_addr), 0, sizeof(in6_addr)); - ((sockaddr_in6*)server)->sin6_port = htons(port); + ((sockaddr_in6*)servaddr)->sin6_family = AF_INET6; + memset(&(((sockaddr_in6*)servaddr)->sin6_addr), 0, sizeof(in6_addr)); + ((sockaddr_in6*)servaddr)->sin6_port = htons(port); size = sizeof(sockaddr_in6); } } #else /* If we aren't built with ipv6, the choice becomes simple */ - ((sockaddr_in*)server)->sin_family = AF_INET; + ((sockaddr_in*)servaddr)->sin_family = AF_INET; if (*addr) { /* There is an address here. */ in_addr addy; if (inet_pton(AF_INET, addr, &addy) < 1) { - delete[] server; + delete[] servaddr; return false; } - ((sockaddr_in*)server)->sin_addr = addy; + ((sockaddr_in*)servaddr)->sin_addr = addy; } else { /* Bind ipv4 to all */ - ((sockaddr_in*)server)->sin_addr.s_addr = htonl(INADDR_ANY); + ((sockaddr_in*)servaddr)->sin_addr.s_addr = htonl(INADDR_ANY); } /* Bind ipv4 port number */ - ((sockaddr_in*)server)->sin_port = htons(port); + ((sockaddr_in*)servaddr)->sin_port = htons(port); size = sizeof(sockaddr_in); #endif - ret = SE->Bind(sockfd, server, size); - delete[] server; + ret = SE->Bind(sockfd, servaddr, size); + delete[] servaddr; if (ret < 0) { diff --git a/src/user_resolver.cpp b/src/user_resolver.cpp index cb3db0851..ea3b46272 100644 --- a/src/user_resolver.cpp +++ b/src/user_resolver.cpp @@ -36,20 +36,20 @@ void UserResolver::OnLookupComplete(const std::string &result, unsigned int ttl, /* Check we didnt time out */ if (this->bound_user->registered != REG_ALL) { - bool cached; + bool lcached; #ifdef IPV6 if (this->bound_user->GetProtocolFamily() == AF_INET6) { /* IPV6 forward lookup (with possibility of 4in6) */ const char* ip = this->bound_user->GetIPString(); - bound_user->res_forward = new UserResolver(this->ServerInstance, this->bound_user, result, (!strncmp(ip, "0::ffff:", 8) ? DNS_QUERY_A : DNS_QUERY_AAAA), cached); + bound_user->res_forward = new UserResolver(this->ServerInstance, this->bound_user, result, (!strncmp(ip, "0::ffff:", 8) ? DNS_QUERY_A : DNS_QUERY_AAAA), lcached); } else /* IPV4 lookup (mixed protocol mode) */ #endif /* IPV4 lookup (ipv4 only mode) */ - bound_user->res_forward = new UserResolver(this->ServerInstance, this->bound_user, result, DNS_QUERY_A, cached); - this->ServerInstance->AddResolver(bound_user->res_forward, cached); + bound_user->res_forward = new UserResolver(this->ServerInstance, this->bound_user, result, DNS_QUERY_A, lcached); + this->ServerInstance->AddResolver(bound_user->res_forward, lcached); } } catch (CoreException& e) diff --git a/src/users.cpp b/src/users.cpp index 2e0e0d3cc..19e4925b6 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -88,13 +88,13 @@ void User::StartDNSLookup() try { bool cached; - const char* ip = this->GetIPString(); + const char* sip = this->GetIPString(); /* Special case for 4in6 (Have i mentioned i HATE 4in6?) */ - if (!strncmp(ip, "0::ffff:", 8)) - res_reverse = new UserResolver(this->ServerInstance, this, ip + 8, DNS_QUERY_PTR4, cached); + if (!strncmp(sip, "0::ffff:", 8)) + res_reverse = new UserResolver(this->ServerInstance, this, sip + 8, DNS_QUERY_PTR4, cached); else - res_reverse = new UserResolver(this->ServerInstance, this, ip, this->GetProtocolFamily() == AF_INET ? DNS_QUERY_PTR4 : DNS_QUERY_PTR6, cached); + res_reverse = new UserResolver(this->ServerInstance, this, sip, this->GetProtocolFamily() == AF_INET ? DNS_QUERY_PTR4 : DNS_QUERY_PTR6, cached); this->ServerInstance->AddResolver(res_reverse, cached); } @@ -405,21 +405,21 @@ InvitedList* User::GetInviteList() return &invites; } -void User::InviteTo(const irc::string &channel, time_t timeout) +void User::InviteTo(const irc::string &channel, time_t invtimeout) { time_t now = time(NULL); - if (timeout != 0 && now > timeout) return; /* Don't add invites that are expired from the get-go. */ + if (invtimeout != 0 && now > invtimeout) return; /* Don't add invites that are expired from the get-go. */ for (InvitedList::iterator i = invites.begin(); i != invites.end(); ++i) { if (channel == i->first) { - if (i->second != 0 && timeout > i->second) + if (i->second != 0 && invtimeout > i->second) { - i->second = timeout; + i->second = invtimeout; } } } - invites.push_back(std::make_pair(channel, timeout)); + invites.push_back(std::make_pair(channel, invtimeout)); } void User::RemoveInvite(const irc::string &channel) @@ -926,7 +926,7 @@ bool User::ForceNickChange(const char* newnick) return false; } -void User::SetSockAddr(int protocol_family, const char* ip, int port) +void User::SetSockAddr(int protocol_family, const char* sip, int port) { this->cachedip = ""; @@ -938,7 +938,7 @@ void User::SetSockAddr(int protocol_family, const char* ip, int port) sockaddr_in6* sin = new sockaddr_in6; sin->sin6_family = AF_INET6; sin->sin6_port = port; - inet_pton(AF_INET6, ip, &sin->sin6_addr); + inet_pton(AF_INET6, sip, &sin->sin6_addr); this->ip = (sockaddr*)sin; } break; @@ -948,7 +948,7 @@ void User::SetSockAddr(int protocol_family, const char* ip, int port) sockaddr_in* sin = new sockaddr_in; sin->sin_family = AF_INET; sin->sin_port = port; - inet_pton(AF_INET, ip, &sin->sin_addr); + inet_pton(AF_INET, sip, &sin->sin_addr); this->ip = (sockaddr*)sin; } break; @@ -1380,25 +1380,25 @@ bool User::ChangeName(const char* gecos) return true; } -bool User::ChangeDisplayedHost(const char* host) +bool User::ChangeDisplayedHost(const char* shost) { - if (!strcmp(host, this->dhost)) + if (!strcmp(shost, this->dhost)) return true; if (IS_LOCAL(this)) { int MOD_RESULT = 0; - FOREACH_RESULT(I_OnChangeLocalUserHost,OnChangeLocalUserHost(this,host)); + FOREACH_RESULT(I_OnChangeLocalUserHost,OnChangeLocalUserHost(this,shost)); if (MOD_RESULT) return false; - FOREACH_MOD(I_OnChangeHost,OnChangeHost(this,host)); + FOREACH_MOD(I_OnChangeHost,OnChangeHost(this,shost)); } if (this->ServerInstance->Config->CycleHosts) this->WriteCommonExcept("QUIT :Changing hosts"); /* Fix by Om: User::dhost is 65 long, this was truncating some long hosts */ - strlcpy(this->dhost,host,64); + strlcpy(this->dhost,shost,64); this->InvalidateCache(); diff --git a/src/xline.cpp b/src/xline.cpp index 268804f9d..20f824da0 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -392,14 +392,14 @@ void XLine::Apply(User* u) void XLine::DefaultApply(User* u, const std::string &line, bool bancache) { - char reason[MAXBUF]; - snprintf(reason, MAXBUF, "%s-Lined: %s", line.c_str(), this->reason); + char sreason[MAXBUF]; + snprintf(sreason, MAXBUF, "%s-Lined: %s", line.c_str(), this->reason); if (*ServerInstance->Config->MoronBanner) u->WriteServ("NOTICE %s :*** %s", u->nick, ServerInstance->Config->MoronBanner); if (ServerInstance->Config->HideBans) - User::QuitUser(ServerInstance, u, line + "-Lined", reason); + User::QuitUser(ServerInstance, u, line + "-Lined", sreason); else - User::QuitUser(ServerInstance, u, reason); + User::QuitUser(ServerInstance, u, sreason); if (bancache) |