From: Amos Jeffries Date: Mon, 21 Jan 2013 07:15:09 +0000 (+1300) Subject: Bug 3676: Fix Shadowed variables X-Git-Tag: SQUID_3_4_0_1~365 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9dca980df1365aa3d56909dd485d72e786268fd3;p=thirdparty%2Fsquid.git Bug 3676: Fix Shadowed variables This resolves a number more shadowed variables by renaming. There should be no logic changes in this patch. --- diff --git a/include/snmp_api_util.h b/include/snmp_api_util.h index 536578a03d..5e7811229b 100644 --- a/include/snmp_api_util.h +++ b/include/snmp_api_util.h @@ -57,7 +57,7 @@ struct session_list { struct snmp_internal_session { int sd; /* socket descriptor for this connection */ - ipaddr addr; /* address of connected peer */ + struct sockaddr_in addr; /* address of connected peer */ struct request_list *requests; /* Info about outstanding requests */ }; diff --git a/include/snmp_pdu.h b/include/snmp_pdu.h index be1680a2db..732aa88b66 100644 --- a/include/snmp_pdu.h +++ b/include/snmp_pdu.h @@ -39,12 +39,10 @@ extern "C" { #endif - typedef struct sockaddr_in ipaddr; - /* An SNMP PDU */ struct snmp_pdu { int command; /* Type of this PDU */ - ipaddr address; /* Address of peer */ + struct sockaddr_in address; /* Address of peer */ int reqid; /* Integer32: Request id */ int errstat; /* INTEGER: Error status */ @@ -59,7 +57,7 @@ extern "C" { /* Trap information */ oid *enterprise; /* System OID */ int enterprise_length; - ipaddr agent_addr; /* address of object generating trap */ + struct sockaddr_in agent_addr; /* address of object generating trap */ int trap_type; /* generic trap type */ int specific_type; /* specific type */ u_int time; /* Uptime */ diff --git a/src/StatHist.cc b/src/StatHist.cc index dfdd132572..6523d393d0 100644 --- a/src/StatHist.cc +++ b/src/StatHist.cc @@ -73,11 +73,11 @@ StatHist::StatHist(const StatHist &src) : } void -StatHist::count(double val) +StatHist::count(double v) { if (bins==NULL) //do not count before initialization or after destruction return; - const unsigned int bin = findBin(val); + const unsigned int bin = findBin(v); ++bins[bin]; } diff --git a/src/auth/basic/UserRequest.cc b/src/auth/basic/UserRequest.cc index a3d9651579..669c8beb7c 100644 --- a/src/auth/basic/UserRequest.cc +++ b/src/auth/basic/UserRequest.cc @@ -112,18 +112,18 @@ Auth::Basic::UserRequest::module_start(AUTHCB * handler, void *data) /* mark this user as having verification in progress */ user()->credentials(Auth::Pending); char buf[HELPER_INPUT_BUFFER]; - static char username[HELPER_INPUT_BUFFER]; + static char usern[HELPER_INPUT_BUFFER]; static char pass[HELPER_INPUT_BUFFER]; if (static_cast(user()->config)->utf8) { - latin1_to_utf8(username, sizeof(username), user()->username()); + latin1_to_utf8(usern, sizeof(usern), user()->username()); latin1_to_utf8(pass, sizeof(pass), basic_auth->passwd); - xstrncpy(username, rfc1738_escape(username), sizeof(username)); + xstrncpy(usern, rfc1738_escape(usern), sizeof(usern)); xstrncpy(pass, rfc1738_escape(pass), sizeof(pass)); } else { - xstrncpy(username, rfc1738_escape(user()->username()), sizeof(username)); + xstrncpy(usern, rfc1738_escape(user()->username()), sizeof(usern)); xstrncpy(pass, rfc1738_escape(basic_auth->passwd), sizeof(pass)); } - int sz = snprintf(buf, sizeof(buf), "%s %s\n", username, pass); + int sz = snprintf(buf, sizeof(buf), "%s %s\n", usern, pass); if (sz<=0) { debugs(9, DBG_CRITICAL, "ERROR: Basic Authentication Failure. Can not build helper validation request."); handler(data); diff --git a/src/auth/digest/auth_digest.cc b/src/auth/digest/auth_digest.cc index 54dbdc4613..b70f744659 100644 --- a/src/auth/digest/auth_digest.cc +++ b/src/auth/digest/auth_digest.cc @@ -851,9 +851,9 @@ Auth::Digest::Config::decode(char const *proxy_auth) } /* find type */ - http_digest_attr_type type = (http_digest_attr_type)httpHeaderIdByName(item, nlen, DigestFieldsInfo, DIGEST_ENUM_END); + http_digest_attr_type t = (http_digest_attr_type)httpHeaderIdByName(item, nlen, DigestFieldsInfo, DIGEST_ENUM_END); - switch (type) { + switch (t) { case DIGEST_USERNAME: safe_free(username); username = xstrndup(value.rawBuf(), value.size() + 1); diff --git a/src/client_side_request.cc b/src/client_side_request.cc index 2d3d9e5b29..414017771c 100644 --- a/src/client_side_request.cc +++ b/src/client_side_request.cc @@ -1695,8 +1695,8 @@ ClientHttpRequest::doCallouts() #endif if (calloutContext->error) { - const char *uri = urlCanonical(request); - StoreEntry *e= storeCreateEntry(uri, uri, request->flags, request->method); + const char *url = urlCanonical(request); + StoreEntry *e= storeCreateEntry(url, url, request->flags, request->method); #if USE_SSL if (sslBumpNeeded()) { // set final error but delay sending until we bump diff --git a/src/dns_internal.cc b/src/dns_internal.cc index 63a8b32104..fdf5846aed 100644 --- a/src/dns_internal.cc +++ b/src/dns_internal.cc @@ -836,13 +836,13 @@ idnsVCClosed(const CommCloseCbParams ¶ms) } static void -idnsInitVC(int ns) +idnsInitVC(int nsv) { nsvc *vc = cbdataAlloc(nsvc); - assert(ns < nns); + assert(nsv < nns); assert(vc->conn == NULL); // MUST be NULL from the construction process! - nameservers[ns].vc = vc; - vc->ns = ns; + nameservers[nsv].vc = vc; + vc->ns = nsv; vc->queue = new MemBuf; vc->msg = new MemBuf; vc->busy = 1; @@ -854,7 +854,7 @@ idnsInitVC(int ns) else conn->local = Config.Addrs.udp_incoming; - conn->remote = nameservers[ns].S; + conn->remote = nameservers[nsv].S; if (conn->remote.IsIPv4()) { conn->local.SetIPv4(); @@ -868,17 +868,17 @@ idnsInitVC(int ns) } static void -idnsSendQueryVC(idns_query * q, int ns) +idnsSendQueryVC(idns_query * q, int nsn) { - assert(ns < nns); - if (nameservers[ns].vc == NULL) - idnsInitVC(ns); + assert(nsn < nns); + if (nameservers[nsn].vc == NULL) + idnsInitVC(nsn); - nsvc *vc = nameservers[ns].vc; + nsvc *vc = nameservers[nsn].vc; if (!vc) { char buf[MAX_IPSTRLEN]; - debugs(78, DBG_IMPORTANT, "idnsSendQuery: Failed to initiate TCP connection to nameserver " << nameservers[ns].S.NtoA(buf,MAX_IPSTRLEN) << "!"); + debugs(78, DBG_IMPORTANT, "idnsSendQuery: Failed to initiate TCP connection to nameserver " << nameservers[nsn].S.NtoA(buf,MAX_IPSTRLEN) << "!"); return; } @@ -912,28 +912,28 @@ idnsSendQuery(idns_query * q) assert(q->lru.prev == NULL); int x = -1, y = -1; - int ns; + int nsn; do { - ns = q->nsends % nns; + nsn = q->nsends % nns; if (q->need_vc) { - idnsSendQueryVC(q, ns); + idnsSendQueryVC(q, nsn); x = y = 0; } else { - if (DnsSocketB >= 0 && nameservers[ns].S.IsIPv6()) - y = comm_udp_sendto(DnsSocketB, nameservers[ns].S, q->buf, q->sz); + if (DnsSocketB >= 0 && nameservers[nsn].S.IsIPv6()) + y = comm_udp_sendto(DnsSocketB, nameservers[nsn].S, q->buf, q->sz); else if (DnsSocketA >= 0) - x = comm_udp_sendto(DnsSocketA, nameservers[ns].S, q->buf, q->sz); + x = comm_udp_sendto(DnsSocketA, nameservers[nsn].S, q->buf, q->sz); } ++ q->nsends; q->sent_t = current_time; - if (y < 0 && nameservers[ns].S.IsIPv6()) + if (y < 0 && nameservers[nsn].S.IsIPv6()) debugs(50, DBG_IMPORTANT, "idnsSendQuery: FD " << DnsSocketB << ": sendto: " << xstrerror()); - if (x < 0 && nameservers[ns].S.IsIPv4()) + if (x < 0 && nameservers[nsn].S.IsIPv4()) debugs(50, DBG_IMPORTANT, "idnsSendQuery: FD " << DnsSocketA << ": sendto: " << xstrerror()); } while ( (x<0 && y<0) && q->nsends % nns != 0); @@ -945,7 +945,7 @@ idnsSendQuery(idns_query * q) fd_bytes(DnsSocketA, x, FD_WRITE); } - ++ nameservers[ns].nqueries; + ++ nameservers[nsn].nqueries; q->queue_t = current_time; dlinkAdd(q, &q->lru, &lru_list); q->pending = 1; @@ -1016,9 +1016,8 @@ idnsCallback(idns_query *q, const char *error) if (q->master) q = q->master; - idns_query *q2; // If any of our subqueries are still pending then wait for them to complete before continuing - for ( q2 = q; q2; q2 = q2->slave) { + for (idns_query *q2 = q; q2; q2 = q2->slave) { if (q2->pending) { return; } @@ -1030,7 +1029,7 @@ idnsCallback(idns_query *q, const char *error) int n = q->ancount; error = q->error; - while ( (q2 = q->slave) ) { + while ( idns_query *q2 = q->slave ) { debugs(78, 6, HERE << "Merging DNS results " << q->name << " A has " << n << " RR, AAAA has " << q2->ancount << " RR"); q->slave = q2->slave; if ( !q2->error ) { @@ -1252,7 +1251,6 @@ idnsRead(int fd, void *data) int len; int max = INCOMING_DNS_MAX; static char rbuf[SQUID_UDP_SO_RCVBUF]; - int ns; Ip::Address from; debugs(78, 3, "idnsRead: starting with FD " << fd); @@ -1304,10 +1302,10 @@ idnsRead(int fd, void *data) debugs(78, 3, "idnsRead: FD " << fd << ": received " << len << " bytes from " << from); /* BUG: see above. Its here that it becomes apparent that the content of bugbypass is gone. */ - ns = idnsFromKnownNameserver(from); + int nsn = idnsFromKnownNameserver(from); - if (ns >= 0) { - ++ nameservers[ns].nreplies; + if (nsn >= 0) { + ++ nameservers[nsn].nreplies; } // Before unknown_nameservers check to avoid flooding cache.log on attacks, @@ -1315,7 +1313,7 @@ idnsRead(int fd, void *data) if (!lru_list.head) continue; // Don't process replies if there is no pending query. - if (ns < 0 && Config.onoff.ignore_unknown_nameservers) { + if (nsn < 0 && Config.onoff.ignore_unknown_nameservers) { static time_t last_warning = 0; if (squid_curtime - last_warning > 60) { @@ -1327,7 +1325,7 @@ idnsRead(int fd, void *data) continue; } - idnsGrokReply(rbuf, len, ns); + idnsGrokReply(rbuf, len, nsn); } } diff --git a/src/fs/rock/RockSwapDir.cc b/src/fs/rock/RockSwapDir.cc index aa4dd966df..7a99f5a313 100644 --- a/src/fs/rock/RockSwapDir.cc +++ b/src/fs/rock/RockSwapDir.cc @@ -285,14 +285,14 @@ Rock::SwapDir::reconfigure() /// parse maximum db disk size void -Rock::SwapDir::parseSize(const bool reconfiguring) +Rock::SwapDir::parseSize(const bool reconfig) { const int i = GetInteger(); if (i < 0) fatal("negative Rock cache_dir size value"); const uint64_t new_max_size = static_cast(i) << 20; // MBytes to Bytes - if (!reconfiguring) + if (!reconfig) max_size = new_max_size; else if (new_max_size != max_size) { debugs(3, DBG_IMPORTANT, "WARNING: cache_dir '" << path << "' size " @@ -320,7 +320,7 @@ Rock::SwapDir::allowOptionReconfigure(const char *const option) const /// parses time-specific options; mimics ::SwapDir::optionObjectSizeParse() bool -Rock::SwapDir::parseTimeOption(char const *option, const char *value, int reconfiguring) +Rock::SwapDir::parseTimeOption(char const *option, const char *value, int reconfig) { // TODO: ::SwapDir or, better, Config should provide time-parsing routines, // including time unit handling. Same for size. @@ -343,7 +343,7 @@ Rock::SwapDir::parseTimeOption(char const *option, const char *value, int reconf const time_msec_t newTime = static_cast(parsedValue); - if (!reconfiguring) + if (!reconfig) *storedTime = newTime; else if (*storedTime != newTime) { debugs(3, DBG_IMPORTANT, "WARNING: cache_dir " << path << ' ' << option @@ -642,12 +642,12 @@ Rock::SwapDir::readCompleted(const char *buf, int rlen, int errflag, RefCount< : sio->offset_ += rlen; assert(sio->diskOffset + sio->offset_ <= diskOffsetLimit()); // post-factum - StoreIOState::STRCB *callback = sio->read.callback; - assert(callback); + StoreIOState::STRCB *callb = sio->read.callback; + assert(callb); sio->read.callback = NULL; void *cbdata; if (cbdataReferenceValidDone(sio->read.callback_data, &cbdata)) - callback(cbdata, r->buf, rlen, sio.getRaw()); + callb(cbdata, r->buf, rlen, sio.getRaw()); } void diff --git a/src/ipc/Coordinator.cc b/src/ipc/Coordinator.cc index 38e6ef4141..7cf2619723 100644 --- a/src/ipc/Coordinator.cc +++ b/src/ipc/Coordinator.cc @@ -255,23 +255,23 @@ Ipc::Coordinator::openListenSocket(const SharedListenRequest& request, debugs(54, 6, HERE << "opening listen FD at " << p.addr << " for kid" << request.requestorId); - Comm::ConnectionPointer conn = new Comm::Connection; - conn->local = p.addr; // comm_open_listener may modify it - conn->flags = p.flags; + Comm::ConnectionPointer newConn = new Comm::Connection; + newConn->local = p.addr; // comm_open_listener may modify it + newConn->flags = p.flags; enter_suid(); - comm_open_listener(p.sock_type, p.proto, conn, FdNote(p.fdNote)); - errNo = Comm::IsConnOpen(conn) ? 0 : errno; + comm_open_listener(p.sock_type, p.proto, newConn, FdNote(p.fdNote)); + errNo = Comm::IsConnOpen(newConn) ? 0 : errno; leave_suid(); - debugs(54, 6, HERE << "tried listening on " << conn << " for kid" << + debugs(54, 6, HERE << "tried listening on " << newConn << " for kid" << request.requestorId); // cache positive results - if (Comm::IsConnOpen(conn)) - listeners[request.params] = conn; + if (Comm::IsConnOpen(newConn)) + listeners[request.params] = newConn; - return conn; + return newConn; } void Ipc::Coordinator::broadcastSignal(int sig) const diff --git a/src/ipc/Kid.cc b/src/ipc/Kid.cc index ee54cfb114..5f87f9986a 100644 --- a/src/ipc/Kid.cc +++ b/src/ipc/Kid.cc @@ -44,7 +44,7 @@ void Kid::start(pid_t cpid) } /// called when kid terminates, sets exiting status -void Kid::stop(status_type exitStatus) +void Kid::stop(status_type theExitStatus) { assert(running()); assert(startTime != 0); @@ -58,7 +58,7 @@ void Kid::stop(status_type exitStatus) else badFailures = 0; // the failures are not "frequent" [any more] - status = exitStatus; + status = theExitStatus; } /// returns true if tracking of kid is stopped diff --git a/src/ipc/TypedMsgHdr.cc b/src/ipc/TypedMsgHdr.cc index 74cae6aa7a..eb29354205 100644 --- a/src/ipc/TypedMsgHdr.cc +++ b/src/ipc/TypedMsgHdr.cc @@ -132,38 +132,38 @@ Ipc::TypedMsgHdr::putString(const String &s) } void -Ipc::TypedMsgHdr::getFixed(void *raw, size_t size) const +Ipc::TypedMsgHdr::getFixed(void *rawBuf, size_t rawSize) const { // no need to load size because it is constant - getRaw(raw, size); + getRaw(rawBuf, rawSize); } void -Ipc::TypedMsgHdr::putFixed(const void *raw, size_t size) +Ipc::TypedMsgHdr::putFixed(const void *rawBuf, size_t rawSize) { // no need to store size because it is constant - putRaw(raw, size); + putRaw(rawBuf, rawSize); } /// low-level loading of exactly size bytes of raw data void -Ipc::TypedMsgHdr::getRaw(void *raw, size_t size) const +Ipc::TypedMsgHdr::getRaw(void *rawBuf, size_t rawSize) const { - if (size > 0) { - Must(size <= data.size - offset); - memcpy(raw, data.raw + offset, size); - offset += size; + if (rawSize > 0) { + Must(rawSize <= data.size - offset); + memcpy(rawBuf, data.raw + offset, rawSize); + offset += rawSize; } } /// low-level storage of exactly size bytes of raw data void -Ipc::TypedMsgHdr::putRaw(const void *raw, size_t size) +Ipc::TypedMsgHdr::putRaw(const void *rawBuf, size_t rawSize) { - if (size > 0) { - Must(size <= sizeof(data.raw) - data.size); - memcpy(data.raw + data.size, raw, size); - data.size += size; + if (rawSize > 0) { + Must(rawSize <= sizeof(data.raw) - data.size); + memcpy(data.raw + data.size, rawBuf, rawSize); + data.size += rawSize; } } diff --git a/src/mgr/BasicActions.cc b/src/mgr/BasicActions.cc index 578a6204f4..8f96df20ca 100644 --- a/src/mgr/BasicActions.cc +++ b/src/mgr/BasicActions.cc @@ -20,7 +20,7 @@ Mgr::IndexAction::Create(const Command::Pointer &cmd) return new IndexAction(cmd); } -Mgr::IndexAction::IndexAction(const Command::Pointer &cmd): Action(cmd) +Mgr::IndexAction::IndexAction(const Command::Pointer &aCmd): Action(aCmd) { debugs(16, 5, HERE); } @@ -37,7 +37,7 @@ Mgr::MenuAction::Create(const Command::Pointer &cmd) return new MenuAction(cmd); } -Mgr::MenuAction::MenuAction(const Command::Pointer &cmd): Action(cmd) +Mgr::MenuAction::MenuAction(const Command::Pointer &aCmd): Action(aCmd) { debugs(16, 5, HERE); } @@ -64,7 +64,7 @@ Mgr::ShutdownAction::Create(const Command::Pointer &cmd) return new ShutdownAction(cmd); } -Mgr::ShutdownAction::ShutdownAction(const Command::Pointer &cmd): Action(cmd) +Mgr::ShutdownAction::ShutdownAction(const Command::Pointer &aCmd): Action(aCmd) { debugs(16, 5, HERE); } @@ -82,8 +82,8 @@ Mgr::ReconfigureAction::Create(const Command::Pointer &cmd) return new ReconfigureAction(cmd); } -Mgr::ReconfigureAction::ReconfigureAction(const Command::Pointer &cmd): - Action(cmd) +Mgr::ReconfigureAction::ReconfigureAction(const Command::Pointer &aCmd): + Action(aCmd) { debugs(16, 5, HERE); } @@ -102,7 +102,7 @@ Mgr::RotateAction::Create(const Command::Pointer &cmd) return new RotateAction(cmd); } -Mgr::RotateAction::RotateAction(const Command::Pointer &cmd): Action(cmd) +Mgr::RotateAction::RotateAction(const Command::Pointer &aCmd): Action(aCmd) { debugs(16, 5, HERE); } @@ -125,8 +125,8 @@ Mgr::OfflineToggleAction::Create(const Command::Pointer &cmd) return new OfflineToggleAction(cmd); } -Mgr::OfflineToggleAction::OfflineToggleAction(const Command::Pointer &cmd): - Action(cmd) +Mgr::OfflineToggleAction::OfflineToggleAction(const Command::Pointer &aCmd): + Action(aCmd) { debugs(16, 5, HERE); } diff --git a/src/mgr/CountersAction.cc b/src/mgr/CountersAction.cc index 322fdc8f25..051c015e14 100644 --- a/src/mgr/CountersAction.cc +++ b/src/mgr/CountersAction.cc @@ -90,8 +90,8 @@ Mgr::CountersAction::Create(const CommandPointer &cmd) return new CountersAction(cmd); } -Mgr::CountersAction::CountersAction(const CommandPointer &cmd): - Action(cmd), data() +Mgr::CountersAction::CountersAction(const CommandPointer &aCmd): + Action(aCmd), data() { debugs(16, 5, HERE); } diff --git a/src/mgr/InfoAction.cc b/src/mgr/InfoAction.cc index 034a07dbc5..09fb699df0 100644 --- a/src/mgr/InfoAction.cc +++ b/src/mgr/InfoAction.cc @@ -131,8 +131,8 @@ Mgr::InfoAction::Create(const CommandPointer &cmd) return new InfoAction(cmd); } -Mgr::InfoAction::InfoAction(const CommandPointer &cmd): - Action(cmd), data() +Mgr::InfoAction::InfoAction(const CommandPointer &aCmd): + Action(aCmd), data() { debugs(16, 5, HERE); } diff --git a/src/mgr/IntervalAction.cc b/src/mgr/IntervalAction.cc index 175995093d..0e26732986 100644 --- a/src/mgr/IntervalAction.cc +++ b/src/mgr/IntervalAction.cc @@ -115,8 +115,8 @@ Mgr::IntervalAction::Create60min(const CommandPointer &cmd) return new IntervalAction(cmd, 60, 0); } -Mgr::IntervalAction::IntervalAction(const CommandPointer &cmd, int aMinutes, int aHours): - Action(cmd), minutes(aMinutes), hours(aHours), data() +Mgr::IntervalAction::IntervalAction(const CommandPointer &aCmd, int aMinutes, int aHours): + Action(aCmd), minutes(aMinutes), hours(aHours), data() { debugs(16, 5, HERE); } diff --git a/src/mgr/IoAction.cc b/src/mgr/IoAction.cc index ed8db0ed95..03a6670edd 100644 --- a/src/mgr/IoAction.cc +++ b/src/mgr/IoAction.cc @@ -43,8 +43,8 @@ Mgr::IoAction::Create(const CommandPointer &cmd) return new IoAction(cmd); } -Mgr::IoAction::IoAction(const CommandPointer &cmd): - Action(cmd), data() +Mgr::IoAction::IoAction(const CommandPointer &aCmd): + Action(aCmd), data() { debugs(16, 5, HERE); } diff --git a/src/mgr/ServiceTimesAction.cc b/src/mgr/ServiceTimesAction.cc index b56af190b3..d4ae9ed04c 100644 --- a/src/mgr/ServiceTimesAction.cc +++ b/src/mgr/ServiceTimesAction.cc @@ -55,8 +55,8 @@ Mgr::ServiceTimesAction::Create(const CommandPointer &cmd) return new ServiceTimesAction(cmd); } -Mgr::ServiceTimesAction::ServiceTimesAction(const CommandPointer &cmd): - Action(cmd), data() +Mgr::ServiceTimesAction::ServiceTimesAction(const CommandPointer &aCmd): + Action(aCmd), data() { debugs(16, 5, HERE); } diff --git a/src/mgr/StoreIoAction.cc b/src/mgr/StoreIoAction.cc index c71f010dca..a1fef68201 100644 --- a/src/mgr/StoreIoAction.cc +++ b/src/mgr/StoreIoAction.cc @@ -33,8 +33,8 @@ Mgr::StoreIoAction::Create(const CommandPointer &cmd) return new StoreIoAction(cmd); } -Mgr::StoreIoAction::StoreIoAction(const CommandPointer &cmd): - Action(cmd), data() +Mgr::StoreIoAction::StoreIoAction(const CommandPointer &aCmd): + Action(aCmd), data() { debugs(16, 5, HERE); } diff --git a/src/snmp_core.cc b/src/snmp_core.cc index 03da4618aa..344651c0b8 100644 --- a/src/snmp_core.cc +++ b/src/snmp_core.cc @@ -310,9 +310,9 @@ snmpOpenPorts(void) if (Ip::EnableIpv6&IPV6_SPECIAL_SPLITSTACK && snmpOutgoingConn->local.IsAnyAddr()) { snmpOutgoingConn->local.SetIPv4(); } - AsyncCall::Pointer call = asyncCall(49, 2, "snmpOutgoingConnectionOpened", - Comm::UdpOpenDialer(&snmpPortOpened)); - Ipc::StartListening(SOCK_DGRAM, IPPROTO_UDP, snmpOutgoingConn, Ipc::fdnOutSnmpSocket, call); + AsyncCall::Pointer c = asyncCall(49, 2, "snmpOutgoingConnectionOpened", + Comm::UdpOpenDialer(&snmpPortOpened)); + Ipc::StartListening(SOCK_DGRAM, IPPROTO_UDP, snmpOutgoingConn, Ipc::fdnOutSnmpSocket, c); } else { snmpOutgoingConn = snmpIncomingConn; debugs(1, DBG_IMPORTANT, "Sending SNMP messages from " << snmpOutgoingConn->local); @@ -651,7 +651,6 @@ snmpTreeNext(oid * Current, snint CurrentLen, oid ** Next, snint * NextLen) *NextLen = CurrentLen; *Next = (*mibTreeEntry->instancefunction) (Current, NextLen, mibTreeEntry, &Fn); if (*Next) { - MemBuf tmp; debugs(49, 6, "snmpTreeNext: Next : " << snmpDebugOid(*Next, *NextLen, tmp)); return (Fn); } @@ -695,7 +694,6 @@ snmpTreeNext(oid * Current, snint CurrentLen, oid ** Next, snint * NextLen) } if (*Next) { - MemBuf tmp; debugs(49, 6, "snmpTreeNext: Next : " << snmpDebugOid(*Next, *NextLen, tmp)); return (Fn); } else diff --git a/src/tests/stub_HttpRequest.cc b/src/tests/stub_HttpRequest.cc index 202193b831..93592a2073 100644 --- a/src/tests/stub_HttpRequest.cc +++ b/src/tests/stub_HttpRequest.cc @@ -6,7 +6,7 @@ #include "tests/STUB.h" HttpRequest::HttpRequest() : HttpMsg(hoRequest) STUB - HttpRequest::HttpRequest(const HttpRequestMethod& method, AnyP::ProtocolType protocol, const char *aUrlpath) : HttpMsg(hoRequest) STUB + HttpRequest::HttpRequest(const HttpRequestMethod& aMethod, AnyP::ProtocolType aProtocol, const char *aUrlpath) : HttpMsg(hoRequest) STUB HttpRequest::~HttpRequest() STUB void HttpRequest::packFirstLineInto(Packer * p, bool full_uri) const STUB bool HttpRequest::sanityCheckStartLine(MemBuf *buf, const size_t hdr_len, http_status *error) STUB_RETVAL(false) diff --git a/src/tests/stub_comm.cc b/src/tests/stub_comm.cc index 0c393741ca..c1760c2209 100644 --- a/src/tests/stub_comm.cc +++ b/src/tests/stub_comm.cc @@ -44,7 +44,7 @@ void comm_read(const Comm::ConnectionPointer &conn, char*, int, AsyncCall::Point /* should be in stub_CommRead */ #include "CommRead.h" -CommRead::CommRead(const Comm::ConnectionPointer &, char *buf, int len, AsyncCall::Pointer &callback) STUB +CommRead::CommRead(const Comm::ConnectionPointer &, char *, int, AsyncCall::Pointer &) STUB CommRead::CommRead() STUB DeferredReadManager::~DeferredReadManager() STUB DeferredRead::DeferredRead(DeferrableRead *, void *, CommRead const &) STUB diff --git a/src/tests/stub_libcomm.cc b/src/tests/stub_libcomm.cc index 1bb41ecb7e..4fa35172f7 100644 --- a/src/tests/stub_libcomm.cc +++ b/src/tests/stub_libcomm.cc @@ -33,7 +33,7 @@ Comm::ConnOpener::ConnOpener(Comm::ConnectionPointer &, AsyncCall::Pointer &, ti bool Comm::IsConnOpen(const Comm::ConnectionPointer &) STUB_RETVAL(false) #include "comm/IoCallback.h" - void Comm::IoCallback::setCallback(iocb_type type, AsyncCall::Pointer &cb, char *buf, FREE *func, int sz) STUB + void Comm::IoCallback::setCallback(iocb_type, AsyncCall::Pointer &, char *, FREE *, int) STUB void Comm::IoCallback::selectOrQueueWrite() STUB void Comm::IoCallback::cancel(const char *reason) STUB void Comm::IoCallback::finish(comm_err_t code, int xerrn) STUB diff --git a/src/tests/stub_store.cc b/src/tests/stub_store.cc index 50ee2f7b9c..a93cc8d3bd 100644 --- a/src/tests/stub_store.cc +++ b/src/tests/stub_store.cc @@ -16,7 +16,7 @@ StoreIoStats store_io_stats; bool StoreEntry::checkDeferRead(int fd) const STUB_RETVAL(false) const char *StoreEntry::getMD5Text() const STUB_RETVAL(NULL) StoreEntry::StoreEntry() STUB -StoreEntry::StoreEntry(const char *url, const char *log_url) STUB +StoreEntry::StoreEntry(const char *, const char *) STUB StoreEntry::~StoreEntry() STUB HttpReply const *StoreEntry::getReply() const STUB_RETVAL(NULL) void StoreEntry::write(StoreIOBuffer) STUB diff --git a/src/tests/testEventLoop.cc b/src/tests/testEventLoop.cc index 0d0ac4f956..6abcf9ace6 100644 --- a/src/tests/testEventLoop.cc +++ b/src/tests/testEventLoop.cc @@ -64,8 +64,7 @@ public: int calls; int lasttimeout; int return_timeout; - RecordingEngine(int return_timeout=0): calls(0), lasttimeout(0), - return_timeout(return_timeout) {} + RecordingEngine(int aTimeout=0): calls(0), lasttimeout(0), return_timeout(aTimeout) {} virtual int checkEvents(int timeout) { ++calls; diff --git a/src/tests/testStatHist.cc b/src/tests/testStatHist.cc index b8125bf4ae..c6254c071a 100644 --- a/src/tests/testStatHist.cc +++ b/src/tests/testStatHist.cc @@ -13,8 +13,8 @@ class InspectingStatHist : public StatHist { public: bool operator==(const InspectingStatHist &); - bins_type counter(double val) { - return bins[findBin(val)]; + bins_type counter(double v) { + return bins[findBin(v)]; } }; diff --git a/test-suite/splay.cc b/test-suite/splay.cc index ea44317b84..69b8119a6f 100644 --- a/test-suite/splay.cc +++ b/test-suite/splay.cc @@ -197,15 +197,18 @@ main(int argc, char *argv[]) SplayCheck::BeginWalk(); safeTop->walk(SplayCheck::WalkNodeRef, NULL); } + /* check the check routine */ - SplayCheck::BeginWalk(); - intnode I; - I.i = 1; - /* check we don't segfault on NULL splay calls */ - SplayCheck::WalkNodeRef(I, NULL); - I.i = 0; - SplayCheck::ExpectedFail = true; - SplayCheck::WalkNodeRef(I, NULL); + { + SplayCheck::BeginWalk(); + intnode I; + I.i = 1; + /* check we don't segfault on NULL splay calls */ + SplayCheck::WalkNodeRef(I, NULL); + I.i = 0; + SplayCheck::ExpectedFail = true; + SplayCheck::WalkNodeRef(I, NULL); + } { /* check for begin() */ diff --git a/tools/purge/purge.cc b/tools/purge/purge.cc index 36b473138f..ba8dd998fe 100644 --- a/tools/purge/purge.cc +++ b/tools/purge/purge.cc @@ -344,8 +344,8 @@ action( int fd, size_t metasize, return false; } - int size = strlen(buffer); - if ( write( sockfd, buffer, size ) != size ) { + int content_size = strlen(buffer); + if ( write( sockfd, buffer, content_size ) != content_size ) { // error while talking to squid fprintf( stderr, "unable to talk to server: %s\n", strerror(errno) ); close(sockfd); @@ -563,23 +563,23 @@ dirlevel( const char* dirname, const REList* list, bool level=false ) } int -checkForPortOnly( const char* optarg ) +checkForPortOnly( const char* arg ) // purpose: see if somebody just put in a port instead of a hostname // paramtr: optarg (IN): argument from commandline // returns: 0..65535 is the valid port number in network byte order, // -1 if not a port { // if there is a period in there, it must be a valid hostname - if ( strchr( optarg, '.' ) != 0 ) return -1; + if ( strchr( arg, '.' ) != 0 ) return -1; // if it is just a number between 0 and 65535, it must be a port char* errstr = 0; - unsigned long result = strtoul( optarg, &errstr, 0 ); - if ( result < 65536 && errstr != optarg ) return htons(result); + unsigned long result = strtoul( arg, &errstr, 0 ); + if ( result < 65536 && errstr != arg ) return htons(result); #if 0 // one last try, test for a symbolical service name - struct servent* service = getservbyname( optarg, "tcp" ); + struct servent* service = getservbyname( arg, "tcp" ); return service ? service->s_port : -1; #else return -1; @@ -618,8 +618,8 @@ helpMe( void ) void parseCommandline( int argc, char* argv[], REList*& head, - char*& conffile, char*& copydir, - struct in_addr& serverHost, unsigned short& serverPort ) + char*& conffile, char*& copyDirPath, + struct in_addr& serverHostIp, unsigned short& serverHostPort ) // paramtr: argc: see ::main(). // argv: see ::main(). // returns: Does terminate the program on errors! @@ -646,9 +646,9 @@ parseCommandline( int argc, char* argv[], REList*& head, break; case 'C': if ( optarg && *optarg ) { - if ( copydir ) xfree( (void*) copydir ); - copydir = xstrdup(optarg); - assert(copydir); + if ( copyDirPath ) xfree( (void*) copyDirPath ); + copyDirPath = xstrdup(optarg); + assert(copyDirPath); } break; case 'c': @@ -739,23 +739,23 @@ parseCommandline( int argc, char* argv[], REList*& head, port = checkForPortOnly( optarg ); if ( port == -1 ) { // assume that main() did set the default port - if ( convertHostname(optarg,serverHost) == -1 ) { + if ( convertHostname(optarg,serverHostIp) == -1 ) { fprintf( stderr, "unable to resolve host %s!\n", optarg ); exit(1); } } else { // assume that main() did set the default host - serverPort = port; + serverHostPort = port; } } else { // colon used, port is extra *colon = 0; ++colon; - if ( convertHostname(optarg,serverHost) == -1 ) { + if ( convertHostname(optarg,serverHostIp) == -1 ) { fprintf( stderr, "unable to resolve host %s!\n", optarg ); exit(1); } - if ( convertPortname(colon,serverPort) == -1 ) { + if ( convertPortname(colon,serverHostPort) == -1 ) { fprintf( stderr, "unable to resolve port %s!\n", colon ); exit(1); } @@ -793,8 +793,8 @@ parseCommandline( int argc, char* argv[], REList*& head, assert( head != 0 ); // make sure that the copy out directory is there and accessible - if ( copydir && *copydir ) - if ( assert_copydir( copydir ) != 0 ) exit(1); + if ( copyDirPath && *copyDirPath ) + if ( assert_copydir( copyDirPath ) != 0 ) exit(1); // show results if ( showme ) { @@ -807,15 +807,15 @@ parseCommandline( int argc, char* argv[], REList*& head, puts( ::verbose ? " + extra verbosity" : "" ); printf( "# Copy-out directory: %s ", - copydir ? copydir : "copy-out mode disabled" ); - if ( copydir ) + copyDirPath ? copyDirPath : "copy-out mode disabled" ); + if ( copyDirPath ) printf( "(%s HTTP header)\n", ::envelope ? "prepend" : "no" ); else puts(""); printf( "# Squid config file : %s\n", conffile ); printf( "# Cacheserveraddress: %s:%u\n", - inet_ntoa( serverHost ), ntohs( serverPort ) ); + inet_ntoa( serverHostIp ), ntohs( serverHostPort ) ); printf( "# purge mode : 0x%02x\n", ::purgeMode ); printf( "# Regular expression: " ); diff --git a/tools/purge/socket.cc b/tools/purge/socket.cc index d8884f10b8..2bd472cc14 100644 --- a/tools/purge/socket.cc +++ b/tools/purge/socket.cc @@ -218,9 +218,9 @@ serverSocket( struct in_addr host, unsigned short port, } if ( reuse ) { - int reuse = 1; + int opt = 1; if ( setsockopt( sockfd, SOL_SOCKET, SO_REUSEADDR, - (char*) &reuse, sizeof(int) ) == -1) { + (char*) &opt, sizeof(int) ) == -1) { perror( "setsockopt( SO_REUSEADDR )" ); close( sockfd ); return -1;