Last of the -Wshadow fixes.

git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8894 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
w00t 2008-02-11 10:26:18 +00:00
parent 25c8c8ba02
commit 4798f98ada
11 changed files with 79 additions and 80 deletions

View File

@ -35,8 +35,8 @@ class HTTPClientRequest : public Request
Module *src;
HeaderMap Headers;
public:
HTTPClientRequest(InspIRCd *Instance, Module *src, Module* target, const std::string &url)
: Request(src, target, HTTP_CLIENT_REQUEST), url(url), Instance(Instance), src(src)
HTTPClientRequest(InspIRCd *SI, Module *m, Module* target, const std::string &surl)
: Request(m, target, HTTP_CLIENT_REQUEST), url(surl), Instance(SI), src(m)
{
Headers["User-Agent"] = "InspIRCd (m_http_client.so)";
Headers["Connection"] = "Close";
@ -52,9 +52,9 @@ class HTTPClientRequest : public Request
return url;
}
void AddHeader(std::string &header, std::string &data)
void AddHeader(std::string &header, std::string &sdata)
{
Headers[header] = data;
Headers[header] = sdata;
}
void DeleteHeader(std::string &header)
@ -77,8 +77,8 @@ class HTTPClientError : public Request
std::string responsestr;
HeaderMap Headers;
public:
HTTPClientError(Module* src, Module* target, const std::string &url, int response)
: Request(src, target, HTTP_CLIENT_ERROR), url(url), response(response)
HTTPClientError(Module* src, Module* target, const std::string &surl, int iresponse)
: Request(src, target, HTTP_CLIENT_ERROR), url(surl), response(iresponse)
{
}
@ -99,8 +99,8 @@ class HTTPClientResponse : public Request
std::string responsestr;
HeaderMap Headers;
public:
HTTPClientResponse(Module* src, Module* target, std::string &url, int response, std::string responsestr)
: Request(src, target, HTTP_CLIENT_RESPONSE), url(url), response(response), responsestr(responsestr)
HTTPClientResponse(Module* src, Module* target, std::string &surl, int iresponse, std::string sresponsestr)
: Request(src, target, HTTP_CLIENT_RESPONSE), url(surl), response(iresponse), responsestr(sresponsestr)
{
}
@ -113,9 +113,9 @@ class HTTPClientResponse : public Request
data = ndata;
}
void AddHeader(const std::string &header, const std::string &data)
void AddHeader(const std::string &header, const std::string &sdata)
{
Headers[header] = data;
Headers[header] = sdata;
}
const std::string &GetURL()

View File

@ -116,8 +116,8 @@ class ModuleHTTPClient : public Module
}
};
HTTPSocket::HTTPSocket(InspIRCd *Instance, ModuleHTTPClient *Mod)
: BufferedSocket(Instance), Server(Instance), Mod(Mod), status(HTTP_CLOSED)
HTTPSocket::HTTPSocket(InspIRCd *SI, ModuleHTTPClient *m)
: BufferedSocket(SI), Server(SI), Mod(m), status(HTTP_CLOSED)
{
Instance->Log(DEBUG,"HTTPSocket::HTTPSocket");
this->port = 80;
@ -139,7 +139,7 @@ HTTPSocket::~HTTPSocket()
}
}
bool HTTPSocket::DoRequest(HTTPClientRequest *req)
bool HTTPSocket::DoRequest(HTTPClientRequest *request)
{
Instance->Log(DEBUG,"HTTPSocket::DoRequest");
/* Tweak by brain - we take a copy of this,
@ -147,7 +147,7 @@ bool HTTPSocket::DoRequest(HTTPClientRequest *req)
* pointers knocking around, less chance of
* a memory leak.
*/
this->req = *req;
this->req = *request;
if (!ParseURL(this->req.GetURL()))
return false;
@ -298,9 +298,9 @@ bool HTTPSocket::OnConnected()
bool HTTPSocket::OnDataReady()
{
Instance->Log(DEBUG,"HTTPSocket::OnDataReady() for %s", url.url.c_str());
char *data = this->Read();
char *sdata = this->Read();
if (!data)
if (!sdata)
return false;
if (this->status < HTTP_DATA)
@ -308,7 +308,7 @@ bool HTTPSocket::OnDataReady()
std::string line;
std::string::size_type pos;
this->buffer += data;
this->buffer += sdata;
while ((pos = buffer.find("\r\n")) != std::string::npos)
{
line = buffer.substr(0, pos);
@ -324,10 +324,10 @@ bool HTTPSocket::OnDataReady()
if (this->status == HTTP_REQSENT)
{
// HTTP reply (HTTP/1.1 200 msg)
char const* data = line.c_str();
data += 9;
response->SetResponse(data);
response->SetData(data + 4);
char const* sdata2 = line.c_str();
sdata2 += 9;
response->SetResponse(sdata2);
response->SetData(sdata2 + 4);
this->status = HTTP_HEADERS;
continue;
}

View File

@ -140,8 +140,8 @@ class MsgFlood : public ModeHandler
if (!channel->GetExt("flood", f))
{
parameter = std::string(ban ? "*" : "") + ConvToStr(nlines) + ":" +ConvToStr(nsecs);
floodsettings *f = new floodsettings(ban,nsecs,nlines);
channel->Extend("flood",f);
floodsettings *fs = new floodsettings(ban,nsecs,nlines);
channel->Extend("flood",fs);
channel->SetMode('f', true);
channel->SetModeParam('f', parameter.c_str(), true);
return MODEACTION_ALLOW;
@ -160,9 +160,9 @@ class MsgFlood : public ModeHandler
if (((nlines != f->lines) || (nsecs != f->secs)) && ((nsecs > 0) && (nlines > 0)) || (ban != f->ban))
{
delete f;
floodsettings *f = new floodsettings(ban,nsecs,nlines);
floodsettings *fs = new floodsettings(ban,nsecs,nlines);
channel->Shrink("flood");
channel->Extend("flood",f);
channel->Extend("flood",fs);
channel->SetModeParam('f', cur_param.c_str(), false);
channel->SetModeParam('f', parameter.c_str(), true);
return MODEACTION_ALLOW;

View File

@ -27,8 +27,8 @@ class JsonException : public std::exception
private:
std::string _what;
public:
JsonException(const std::string &what)
: _what(what)
JsonException(const std::string &swhat)
: _what(swhat)
{
}

View File

@ -95,30 +95,30 @@ std::string TreeSocket::MakePass(const std::string &password, const std::string
return password;
}
std::string TreeSocket::RandString(unsigned int length)
std::string TreeSocket::RandString(unsigned int ilength)
{
char* randombuf = new char[length+1];
char* randombuf = new char[ilength+1];
std::string out;
#ifdef WINDOWS
int fd = -1;
int f = -1;
#else
int fd = open("/dev/urandom", O_RDONLY, 0);
int f = open("/dev/urandom", O_RDONLY, 0);
#endif
if (fd >= 0)
if (f >= 0)
{
#ifndef WINDOWS
read(fd, randombuf, length);
close(fd);
read(f, randombuf, ilength);
close(f);
#endif
}
else
{
for (unsigned int i = 0; i < length; i++)
for (unsigned int i = 0; i < ilength; i++)
randombuf[i] = rand();
}
for (unsigned int i = 0; i < length; i++)
for (unsigned int i = 0; i < ilength; i++)
{
char randchar = static_cast<char>((randombuf[i] & 0x7F) | 0x21);
out += (randchar == '=' ? '_' : randchar);

View File

@ -760,14 +760,14 @@ void ModuleSpanningTree::OnOper(User* user, const std::string &opertype)
}
}
void ModuleSpanningTree::OnAddLine(XLine* line, User* user)
void ModuleSpanningTree::OnAddLine(XLine* x, User* user)
{
if (line->type == "K")
if (x->type == "K")
return;
char data[MAXBUF];
snprintf(data,MAXBUF,"%s %s %s %lu %lu :%s", line->type.c_str(), line->Displayable(),
ServerInstance->Config->ServerName, (unsigned long)line->set_time, (unsigned long)line->duration, line->reason);
snprintf(data,MAXBUF,"%s %s %s %lu %lu :%s", x->type.c_str(), x->Displayable(),
ServerInstance->Config->ServerName, (unsigned long)x->set_time, (unsigned long)x->duration, x->reason);
std::deque<std::string> params;
params.push_back(data);
@ -783,13 +783,13 @@ void ModuleSpanningTree::OnAddLine(XLine* line, User* user)
}
}
void ModuleSpanningTree::OnDelLine(XLine* line, User* user)
void ModuleSpanningTree::OnDelLine(XLine* x, User* user)
{
if (line->type == "K")
if (x->type == "K")
return;
char data[MAXBUF];
snprintf(data,MAXBUF,"%s %s", line->type.c_str(), line->Displayable());
snprintf(data,MAXBUF,"%s %s", x->type.c_str(), x->Displayable());
std::deque<std::string> params;
params.push_back(data);
@ -939,10 +939,10 @@ void ModuleSpanningTree::OnEvent(Event* event)
}
else
{
Channel* a = ServerInstance->FindChan((*params)[0]);
if (a)
Channel* c = ServerInstance->FindChan((*params)[0]);
if (c)
{
ourTS = a->age;
ourTS = c->age;
params->insert(params->begin() + 1,ConvToStr(ourTS));
Utils->DoOneToMany(ServerInstance->Config->GetSID(),"FMODE",*params);
}

View File

@ -37,8 +37,8 @@
* most of the action, and append a few of our own values
* to it.
*/
TreeSocket::TreeSocket(SpanningTreeUtilities* Util, InspIRCd* SI, std::string host, int port, bool listening, unsigned long maxtime, Module* HookMod)
: BufferedSocket(SI, host, port, listening, maxtime), Utils(Util), Hook(HookMod)
TreeSocket::TreeSocket(SpanningTreeUtilities* Util, InspIRCd* SI, std::string shost, int iport, bool listening, unsigned long maxtime, Module* HookMod)
: BufferedSocket(SI, shost, iport, listening, maxtime), Utils(Util), Hook(HookMod)
{
myhost = host;
this->LinkState = LISTENER;
@ -48,8 +48,8 @@ TreeSocket::TreeSocket(SpanningTreeUtilities* Util, InspIRCd* SI, std::string ho
BufferedSocketHookRequest(this, (Module*)Utils->Creator, Hook).Send();
}
TreeSocket::TreeSocket(SpanningTreeUtilities* Util, InspIRCd* SI, std::string host, int port, bool listening, unsigned long maxtime, const std::string &ServerName, const std::string &bindto, Module* HookMod)
: BufferedSocket(SI, host, port, listening, maxtime, bindto), Utils(Util), Hook(HookMod)
TreeSocket::TreeSocket(SpanningTreeUtilities* Util, InspIRCd* SI, std::string shost, int iport, bool listening, unsigned long maxtime, const std::string &ServerName, const std::string &bindto, Module* HookMod)
: BufferedSocket(SI, shost, iport, listening, maxtime, bindto), Utils(Util), Hook(HookMod)
{
myhost = ServerName;
theirchallenge.clear();

View File

@ -43,7 +43,7 @@ bool TreeSocket::ParseUID(const std::string &source, std::deque<std::string> &pa
return true;
}
time_t age = ConvToInt(params[1]);
time_t age_t = ConvToInt(params[1]);
time_t signon = ConvToInt(params[8]);
const char* tempnick = params[2].c_str();
std::string empty;
@ -60,7 +60,7 @@ bool TreeSocket::ParseUID(const std::string &source, std::deque<std::string> &pa
}
/* Check parameters for validity before introducing the client, discovered by dmb */
if (!age)
if (!age_t)
{
this->WriteLine(std::string(":")+this->Instance->Config->GetSID()+" KILL "+params[0]+" :Invalid client introduction (Invalid TS?)");
return true;
@ -85,7 +85,7 @@ bool TreeSocket::ParseUID(const std::string &source, std::deque<std::string> &pa
* Nick collision.
*/
Instance->Log(DEBUG,"*** Collision on %s", tempnick);
int collide = this->DoCollision(iter->second, age, params[5].c_str(), params[7].c_str(), params[0].c_str());
int collide = this->DoCollision(iter->second, age_t, params[5].c_str(), params[7].c_str(), params[0].c_str());
if (collide == 2)
{
@ -117,7 +117,7 @@ bool TreeSocket::ParseUID(const std::string &source, std::deque<std::string> &pa
strlcpy(_new->fullname, params[9].c_str(),MAXGECOS);
_new->registered = REG_ALL;
_new->signon = signon;
_new->age = age;
_new->age = age_t;
/* we need to remove the + from the modestring, so we can do our stuff */
std::string::size_type pos_after_plus = params[6].find_first_not_of('+');

View File

@ -43,7 +43,6 @@ bool TreeSocket::Whois(const std::string &prefix, std::deque<std::string> &param
User* x = this->Instance->FindNick(params[0]);
if ((x) && (IS_LOCAL(x)))
{
User* x = this->Instance->FindNick(params[0]);
char signon[MAXBUF];
char idle[MAXBUF];
snprintf(signon, MAXBUF, "%lu", (unsigned long)x->signon);

View File

@ -118,10 +118,10 @@ class CommandWatch : public Command
if (x != whos_watching_me->end())
{
/* People are watching this user, am i one of them? */
std::deque<User*>::iterator n = std::find(x->second.begin(), x->second.end(), user);
if (n != x->second.end())
std::deque<User*>::iterator n2 = std::find(x->second.begin(), x->second.end(), user);
if (n2 != x->second.end())
/* I'm no longer watching you... */
x->second.erase(n);
x->second.erase(n2);
if (!x->second.size())
whos_watching_me->erase(nick);
@ -231,16 +231,16 @@ class CommandWatch : public Command
{
for (watchlist::iterator i = wl->begin(); i != wl->end(); i++)
{
watchentries::iterator x = whos_watching_me->find(i->first);
if (x != whos_watching_me->end())
watchentries::iterator i2 = whos_watching_me->find(i->first);
if (i2 != whos_watching_me->end())
{
/* People are watching this user, am i one of them? */
std::deque<User*>::iterator n = std::find(x->second.begin(), x->second.end(), user);
if (n != x->second.end())
std::deque<User*>::iterator n = std::find(i2->second.begin(), i2->second.end(), user);
if (n != i2->second.end())
/* I'm no longer watching you... */
x->second.erase(n);
i2->second.erase(n);
if (!x->second.size())
if (!i2->second.size())
whos_watching_me->erase(user->nick);
}
}
@ -278,9 +278,9 @@ class CommandWatch : public Command
you_have = wl->size();
}
watchentries::iterator x = whos_watching_me->find(user->nick);
if (x != whos_watching_me->end())
youre_on = x->second.size();
watchentries::iterator i2 = whos_watching_me->find(user->nick);
if (i2 != whos_watching_me->end())
youre_on = i2->second.size();
user->WriteServ("603 %s :You have %d and are on %d WATCH entries", user->nick, you_have, youre_on);
user->WriteServ("606 %s :%s",user->nick, list.c_str());
@ -353,16 +353,16 @@ class Modulewatch : public Module
/* Iterate every user on my watch list, and take me out of the whos_watching_me map for each one we're watching */
for (watchlist::iterator i = wl->begin(); i != wl->end(); i++)
{
watchentries::iterator x = whos_watching_me->find(i->first);
if (x != whos_watching_me->end())
watchentries::iterator i2 = whos_watching_me->find(i->first);
if (i2 != whos_watching_me->end())
{
/* People are watching this user, am i one of them? */
std::deque<User*>::iterator n = std::find(x->second.begin(), x->second.end(), user);
if (n != x->second.end())
std::deque<User*>::iterator n = std::find(i2->second.begin(), i2->second.end(), user);
if (n != i2->second.end())
/* I'm no longer watching you... */
x->second.erase(n);
i2->second.erase(n);
if (!x->second.size())
if (!i2->second.size())
whos_watching_me->erase(user->nick);
}
}

View File

@ -106,11 +106,11 @@ class RPCValue : public classbase
public:
RPCValue *parent;
RPCValue(RPCValue *parent = NULL) : type(RPCNull), value(NULL), parent(parent) { }
RPCValue(RPCValueType type, RPCValue *parent = NULL) : type(type), value(NULL), parent(parent) { InitValue(); }
RPCValue(bool nvalue, RPCValue *parent = NULL) : type(RPCBoolean), value((void*)nvalue), parent(parent) { }
RPCValue(double nvalue, RPCValue *parent = NULL) : type(RPCInteger), parent(parent) { value = new double(nvalue); }
RPCValue(const std::string &nvalue, RPCValue *parent = NULL) : type(RPCString), parent(parent) { value = new std::string(nvalue); }
RPCValue(RPCValue *rparent = NULL) : type(RPCNull), value(NULL), parent(rparent) { }
RPCValue(RPCValueType ttype, RPCValue *rparent = NULL) : type(ttype), value(NULL), parent(rparent) { InitValue(); }
RPCValue(bool nvalue, RPCValue *rparent = NULL) : type(RPCBoolean), value((void*)nvalue), parent(rparent) { }
RPCValue(double nvalue, RPCValue *rparent = NULL) : type(RPCInteger), parent(rparent) { value = new double(nvalue); }
RPCValue(const std::string &nvalue, RPCValue *rparent = NULL) : type(RPCString), parent(rparent) { value = new std::string(nvalue); }
virtual ~RPCValue()
{
@ -280,8 +280,8 @@ class RPCRequest : public classbase
bool claimed;
std::string error;
RPCRequest(const std::string &provider, const std::string &method, RPCValue *parameters)
: method(method), parameters(parameters), provider(provider), claimed(false)
RPCRequest(const std::string &sprovider, const std::string &smethod, RPCValue *rparameters)
: method(smethod), parameters(rparameters), provider(sprovider), claimed(false)
{
result = new RPCValue();
}