From 8f22dcc60d31264ea6a8965b21b1be8405ee3f6e Mon Sep 17 00:00:00 2001 From: psychon Date: Tue, 19 Feb 2008 20:25:21 +0000 Subject: [PATCH] Fix all those warnings from -Wshadow git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@964 726aef4b-f618-498e-8847-2d620e286838 --- Chan.cpp | 9 ++++--- Client.cpp | 56 ++++++++++++++++++++++-------------------- IRCSock.cpp | 9 +++---- User.cpp | 2 +- modules/autoattach.cpp | 12 ++++----- modules/autoop.cpp | 6 ++--- modules/partyline.cpp | 18 +++++++------- modules/savebuff.cpp | 2 +- znc.cpp | 4 +-- 9 files changed, 61 insertions(+), 57 deletions(-) diff --git a/Chan.cpp b/Chan.cpp index 58c408f9..8bfbda4e 100644 --- a/Chan.cpp +++ b/Chan.cpp @@ -494,15 +494,18 @@ void CChan::IncPermCount(unsigned char uPerm) { } bool CChan::RemNick(const CString& sNick) { - map::iterator it = m_msNicks.find(sNick); + map::iterator it; + set::iterator it2; + + it = m_msNicks.find(sNick); if (it == m_msNicks.end()) { return false; } const set& suPerms = it->second->GetChanPerms(); - for (set::iterator it = suPerms.begin(); it != suPerms.end(); it++) { - DecPermCount(*it); + for (it2 = suPerms.begin(); it2 != suPerms.end(); it2++) { + DecPermCount(*it2); } delete it->second; diff --git a/Client.cpp b/Client.cpp index 03f3f11b..2d9e86c9 100644 --- a/Client.cpp +++ b/Client.cpp @@ -657,10 +657,10 @@ void CClient::UserCommand(const CString& sLine) { } unsigned int uTableIdx = 0; - CString sLine; + CString sTmp; - while (Table.GetLine(uTableIdx++, sLine)) { - PutStatus(sLine); + while (Table.GetLine(uTableIdx++, sTmp)) { + PutStatus(sTmp); } } else if (sCommand.CaseCmp("DETACH") == 0) { if (m_pUser) { @@ -736,10 +736,10 @@ void CClient::UserCommand(const CString& sLine) { if (Table.size()) { unsigned int uTableIdx = 0; - CString sLine; + CString sTmp; - while (Table.GetLine(uTableIdx++, sLine)) { - PutStatus(sLine); + while (Table.GetLine(uTableIdx++, sTmp)) { + PutStatus(sTmp); } } } @@ -767,10 +767,10 @@ void CClient::UserCommand(const CString& sLine) { if (Table.size()) { unsigned int uTableIdx = 0; - CString sLine; + CString sTmp; - while (Table.GetLine(uTableIdx++, sLine)) { - PutStatus(sLine); + while (Table.GetLine(uTableIdx++, sTmp)) { + PutStatus(sTmp); } } } else if (m_pUser->IsAdmin() && sCommand.CaseCmp("SetMOTD") == 0) { @@ -893,10 +893,10 @@ void CClient::UserCommand(const CString& sLine) { if (Table.size()) { unsigned int uTableIdx = 0; - CString sLine; + CString sTmp; - while (Table.GetLine(uTableIdx++, sLine)) { - PutStatus(sLine); + while (Table.GetLine(uTableIdx++, sTmp)) { + PutStatus(sTmp); } } } @@ -959,10 +959,10 @@ void CClient::UserCommand(const CString& sLine) { if (Table.size()) { unsigned int uTableIdx = 0; - CString sLine; + CString sTmp; - while (Table.GetLine(uTableIdx++, sLine)) { - PutStatus(sLine); + while (Table.GetLine(uTableIdx++, sTmp)) { + PutStatus(sTmp); } } } else { @@ -987,10 +987,10 @@ void CClient::UserCommand(const CString& sLine) { if (Table.size()) { unsigned int uTableIdx = 0; - CString sLine; + CString sTmp; - while (Table.GetLine(uTableIdx++, sLine)) { - PutStatus(sLine); + while (Table.GetLine(uTableIdx++, sTmp)) { + PutStatus(sTmp); } } } @@ -1126,10 +1126,10 @@ void CClient::UserCommand(const CString& sLine) { if (Table.size()) { unsigned int uTableIdx = 0; - CString sLine; + CString sTmp; - while (Table.GetLine(uTableIdx++, sLine)) { - PutStatus(sLine); + while (Table.GetLine(uTableIdx++, sTmp)) { + PutStatus(sTmp); } } else { PutStatus("You have no active DCCs."); @@ -1152,10 +1152,11 @@ void CClient::UserCommand(const CString& sLine) { GTable.SetCell("Description", GModules[b]->GetDescription().Ellipsize(128)); } - unsigned int uTableIdx = 0; CString sLine; + unsigned int uTableIdx = 0; + CString sTmp; - while (GTable.GetLine(uTableIdx++, sLine)) { - PutStatus(sLine); + while (GTable.GetLine(uTableIdx++, sTmp)) { + PutStatus(sTmp); } } } @@ -1178,9 +1179,10 @@ void CClient::UserCommand(const CString& sLine) { Table.SetCell("Description", Modules[b]->GetDescription().Ellipsize(128)); } - unsigned int uTableIdx = 0; CString sLine; - while (Table.GetLine(uTableIdx++, sLine)) { - PutStatus(sLine); + unsigned int uTableIdx = 0; + CString sTmp; + while (Table.GetLine(uTableIdx++, sTmp)) { + PutStatus(sTmp); } } #else diff --git a/IRCSock.cpp b/IRCSock.cpp index cf5330e0..b14eba55 100644 --- a/IRCSock.cpp +++ b/IRCSock.cpp @@ -272,7 +272,7 @@ void CIRCSock::ReadLine(const CString& sData) { CChan* pChan = m_pUser->FindChan(sLine.Token(3)); if (pChan) { - CString sNick = sLine.Token(4); + sNick = sLine.Token(4); unsigned long ulDate = strtoul(sLine.Token(5).c_str(), NULL, 10); pChan->SetTopicOwner(sNick); @@ -283,8 +283,8 @@ void CIRCSock::ReadLine(const CString& sData) { } case 352: { // :irc.yourserver.com 352 yournick #chan ident theirhost.com irc.theirserver.com theirnick H :0 Real Name - CString sServer = sLine.Token(0); - CString sNick = sLine.Token(7); + sServer = sLine.Token(0); + sNick = sLine.Token(7); CString sIdent = sLine.Token(4); CString sHost = sLine.Token(5); @@ -342,7 +342,6 @@ void CIRCSock::ReadLine(const CString& sData) { // Get everything except the actual user list CString sTmp = sLine.Token(0, false, " :") + " :"; vector& vClients = m_pUser->GetClients(); - CString sNick; for (unsigned int a = 0; a < vClients.size(); a++) { if ((!m_bNamesx || vClients[a]->HasNamesx()) @@ -412,7 +411,7 @@ void CIRCSock::ReadLine(const CString& sData) { } } else { //if (CUtils::wildcmp(":*!*@* * *", sLine.c_str())) { CNick Nick(sLine.Token(0).LeftChomp_n()); - CString sCmd = sLine.Token(1); + sCmd = sLine.Token(1); CString sRest = sLine.Token(2, true); if (sCmd.CaseCmp("NICK") == 0) { diff --git a/User.cpp b/User.cpp index db94b92a..223d3cf3 100644 --- a/User.cpp +++ b/User.cpp @@ -277,7 +277,7 @@ bool CUser::Clone(const CUser& User, CString& sErrorRet) { AddAllowedHost(*it); } - for (unsigned int a = 0; a < m_vClients.size(); a++) { + for (a = 0; a < m_vClients.size(); a++) { CClient* pSock = m_vClients[a]; if (!IsHostAllowed(pSock->GetRemoteIP())) { diff --git a/modules/autoattach.cpp b/modules/autoattach.cpp index 7635b2fb..731fa2ca 100644 --- a/modules/autoattach.cpp +++ b/modules/autoattach.cpp @@ -89,10 +89,10 @@ public: if (Table.size()) { unsigned int uTableIdx = 0; - CString sLine; + CString sTmp; - while (Table.GetLine(uTableIdx++, sLine)) { - PutModule(sLine); + while (Table.GetLine(uTableIdx++, sTmp)) { + PutModule(sTmp); } } else { PutModule("You have no entries."); @@ -116,10 +116,10 @@ public: if (Table.size()) { unsigned int uTableIdx = 0; - CString sLine; + CString sTmp; - while (Table.GetLine(uTableIdx++, sLine)) { - PutModule(sLine); + while (Table.GetLine(uTableIdx++, sTmp)) { + PutModule(sTmp); } } else { PutModule("You have no entries."); diff --git a/modules/autoop.cpp b/modules/autoop.cpp index 00343730..ac154155 100644 --- a/modules/autoop.cpp +++ b/modules/autoop.cpp @@ -270,11 +270,11 @@ public: Table.SetCell("Channels", it->second->GetChannels()); } - CString sLine; + CString sTmp; unsigned int uTableIdx = 0; - while (Table.GetLine(uTableIdx++, sLine)) { - PutModule(sLine); + while (Table.GetLine(uTableIdx++, sTmp)) { + PutModule(sTmp); } } else if (sCommand.CaseCmp("ADDCHANS") == 0 || sCommand.CaseCmp("DELCHANS") == 0) { CString sUser = sLine.Token(1); diff --git a/modules/partyline.cpp b/modules/partyline.cpp index f640a685..930a13d2 100644 --- a/modules/partyline.cpp +++ b/modules/partyline.cpp @@ -419,10 +419,10 @@ public: Table.SetCell("Description", "Show which users can not part this channel"); unsigned int uTableIdx = 0; - CString sLine; + CString sTmp; - while (Table.GetLine(uTableIdx++, sLine)) { - PutModule(sLine); + while (Table.GetLine(uTableIdx++, sTmp)) { + PutModule(sTmp); } } else if (sCommand.CaseCmp("LIST") == 0) { if (!m_ssChannels.size()) { @@ -443,10 +443,10 @@ public: } unsigned int uTableIdx = 0; - CString sLine; + CString sTmp; - while (Table.GetLine(uTableIdx++, sLine)) { - PutModule(sLine); + while (Table.GetLine(uTableIdx++, sTmp)) { + PutModule(sTmp); } } else if (sCommand.CaseCmp("ADDFIXCHAN") == 0) { if(!m_pUser->IsAdmin()) { @@ -577,10 +577,10 @@ public: void SendNickList(CUser* pUser, const set& ssNicks, const CString& sChan) { CString sNickList; for (set::iterator it = ssNicks.begin(); it != ssNicks.end(); it++) { - CUser* pUser = CZNC::Get().FindUser(*it); + CUser* pChanUser = CZNC::Get().FindUser(*it); - if (pUser && pUser->IsUserAttached()) { - sNickList += (pUser->IsAdmin()) ? "@" : "+"; + if (pChanUser && pChanUser->IsUserAttached()) { + sNickList += (pChanUser->IsAdmin()) ? "@" : "+"; } sNickList += "?" + (*it) + " "; diff --git a/modules/savebuff.cpp b/modules/savebuff.cpp index a4f11860..07b125d3 100644 --- a/modules/savebuff.cpp +++ b/modules/savebuff.cpp @@ -180,7 +180,7 @@ public: if ( DecryptChannel( sArgs, sFile ) ) { CString sLine; - CString::size_type iPos = 0; + iPos = 0; while( ReadLine( sFile, sLine, iPos ) ) { sLine.Trim(); diff --git a/znc.cpp b/znc.cpp index 16c66c83..cabc71ea 100644 --- a/znc.cpp +++ b/znc.cpp @@ -713,7 +713,7 @@ bool CZNC::WriteNewConfig(const CString& sConfig) { do { CString sHost, sPass; bool bSSL = false; - unsigned int uPort = 0; + uPort = 0; while(!CUtils::GetInput("IRC server", sHost, "", "host only") || !CServer::IsValidHostName(sHost)) ; while(!CUtils::GetNumInput("[" + sHost + "] Port", uPort, 1, 65535, 6667)) ; @@ -938,7 +938,7 @@ bool CZNC::DoRehash(CString& sError) sValue.Trim(); if (sLine.Left(1) == "/") { - CString sTag = sLine.substr(1); + sTag = sTag.substr(1); if (pUser) { if (pChan) {