From: Francesco Chemolli Date: Wed, 18 Nov 2009 16:31:08 +0000 (+0100) Subject: Fixed some cases of variable shadowing X-Git-Tag: SQUID_3_2_0_1~558 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b0365bd9f05a30d13c6ee3dadb3011b075ebcba0;p=thirdparty%2Fsquid.git Fixed some cases of variable shadowing --- diff --git a/src/adaptation/History.cc b/src/adaptation/History.cc index 70be7baaea..4733b5aef3 100644 --- a/src/adaptation/History.cc +++ b/src/adaptation/History.cc @@ -9,8 +9,8 @@ /// impossible services value to identify unset theNextServices const static char *TheNullServices = ",null,"; -Adaptation::History::Entry::Entry(const String &sid, const timeval &when): - service(sid), start(when), theRptm(-1), retried(false) +Adaptation::History::Entry::Entry(const String &serviceId, const timeval &when): + service(serviceId), start(when), theRptm(-1), retried(false) { } @@ -37,13 +37,13 @@ Adaptation::History::History(): theNextServices(TheNullServices) { } -int Adaptation::History::recordXactStart(const String &sid, const timeval &when, bool retrying) +int Adaptation::History::recordXactStart(const String &serviceId, const timeval &when, bool retrying) { if (retrying) { Must(!theEntries.empty()); // or there would be nothing to retry theEntries.back().retried = true; } - theEntries.push_back(Adaptation::History::Entry(sid, when)); + theEntries.push_back(Adaptation::History::Entry(serviceId, when)); return theEntries.size() - 1; // record position becomes history ID } diff --git a/src/adaptation/Iterator.cc b/src/adaptation/Iterator.cc index c422846031..1b903faf0a 100644 --- a/src/adaptation/Iterator.cc +++ b/src/adaptation/Iterator.cc @@ -196,10 +196,10 @@ Adaptation::ServiceFilter Adaptation::Iterator::filter() const method = methodReqmod; req = r; rep = NULL; - } else if (HttpReply *r = dynamic_cast(theMsg)) { + } else if (HttpReply *theReply = dynamic_cast(theMsg)) { method = methodRespmod; req = theCause; - rep = r; + rep = theReply; } else { Must(false); // should not happen } diff --git a/src/adaptation/ServiceGroups.cc b/src/adaptation/ServiceGroups.cc index 8787b293a4..a680b17e9c 100644 --- a/src/adaptation/ServiceGroups.cc +++ b/src/adaptation/ServiceGroups.cc @@ -45,7 +45,7 @@ Adaptation::ServiceGroup::finalize() bool baselineBypass = false; for (Pos pos = 0; has(pos); ++pos) { // TODO: quit on all errors - const String &sid = services[pos]; + const String &serviceId = services[pos]; ServicePointer service = at(pos); if (service != NULL) { if (method == methodNone) { @@ -54,9 +54,9 @@ Adaptation::ServiceGroup::finalize() point = service->cfg().point; } else { if (method != service->cfg().method) - finalizeMsg("Inconsistent service method for", sid, true); + finalizeMsg("Inconsistent service method for", serviceId, true); if (point != service->cfg().point) - finalizeMsg("Inconsistent vectoring point for", sid, true); + finalizeMsg("Inconsistent vectoring point for", serviceId, true); } checkUniqueness(pos); @@ -68,11 +68,11 @@ Adaptation::ServiceGroup::finalize() } else if (baselineBypass != service->cfg().bypass) { debugs(93,0, "WARNING: Inconsistent bypass in " << kind << ' ' << id << " may produce surprising results: " << - baselineKey << " vs. " << sid); + baselineKey << " vs. " << serviceId); } } } else { - finalizeMsg("ERROR: Unknown adaptation name", sid, true); + finalizeMsg("ERROR: Unknown adaptation name", serviceId, true); } } debugs(93,7, HERE << "finalized " << kind << ": " << id); diff --git a/src/adaptation/icap/ModXact.cc b/src/adaptation/icap/ModXact.cc index c99d33dce4..70ba8679d3 100644 --- a/src/adaptation/icap/ModXact.cc +++ b/src/adaptation/icap/ModXact.cc @@ -337,20 +337,20 @@ size_t Adaptation::Icap::ModXact::virginContentSize(const Adaptation::Icap::Virg { Must(act.active()); // asbolute start of unprocessed data - const uint64_t start = act.offset(); + const uint64_t dataStart = act.offset(); // absolute end of buffered data - const uint64_t end = virginConsumed + virgin.body_pipe->buf().contentSize(); - Must(virginConsumed <= start && start <= end); - return static_cast(end - start); + const uint64_t dataEnd = virginConsumed + virgin.body_pipe->buf().contentSize(); + Must(virginConsumed <= dataStart && dataStart <= dataEnd); + return static_cast(dataEnd - dataStart); } // pointer to buffered virgin body data available for the specified activity const char *Adaptation::Icap::ModXact::virginContentData(const Adaptation::Icap::VirginBodyAct &act) const { Must(act.active()); - const uint64_t start = act.offset(); - Must(virginConsumed <= start); - return virgin.body_pipe->buf().content() + static_cast(start-virginConsumed); + const uint64_t dataStart = act.offset(); + Must(virginConsumed <= dataStart); + return virgin.body_pipe->buf().content() + static_cast(dataStart-virginConsumed); } void Adaptation::Icap::ModXact::virginConsume() @@ -1700,7 +1700,7 @@ void Adaptation::Icap::ModXactLauncher::swanSong() Adaptation::Icap::Launcher::swanSong(); } -void Adaptation::Icap::ModXactLauncher::updateHistory(bool start) +void Adaptation::Icap::ModXactLauncher::updateHistory(bool doStart) { HttpRequest *r = virgin.cause ? virgin.cause : dynamic_cast(virgin.header); @@ -1709,7 +1709,7 @@ void Adaptation::Icap::ModXactLauncher::updateHistory(bool start) if (r) { Adaptation::Icap::History::Pointer h = r->icapHistory(); if (h != NULL) { - if (start) + if (doStart) h->start("ICAPModXactLauncher"); else h->stop("ICAPModXactLauncher"); diff --git a/src/adaptation/icap/OptXact.cc b/src/adaptation/icap/OptXact.cc index 5219cc9b0a..0eb53af1de 100644 --- a/src/adaptation/icap/OptXact.cc +++ b/src/adaptation/icap/OptXact.cc @@ -52,8 +52,8 @@ void Adaptation::Icap::OptXact::makeRequest(MemBuf &buf) buf.append(ICAP::crlf, 2); // XXX: HttpRequest cannot fully parse ICAP Request-Line - http_status status; - Must(icapRequest->parse(&buf, true, &status) > 0); + http_status reqStatus; + Must(icapRequest->parse(&buf, true, &reqStatus) > 0); } void Adaptation::Icap::OptXact::handleCommWrote(size_t size) diff --git a/src/adaptation/icap/ServiceRep.cc b/src/adaptation/icap/ServiceRep.cc index f5fd4d05a6..c6a0740050 100644 --- a/src/adaptation/icap/ServiceRep.cc +++ b/src/adaptation/icap/ServiceRep.cc @@ -15,8 +15,8 @@ CBDATA_NAMESPACED_CLASS_INIT(Adaptation::Icap, ServiceRep); -Adaptation::Icap::ServiceRep::ServiceRep(const Adaptation::ServiceConfig &cfg): - AsyncJob("Adaptation::Icap::ServiceRep"), Adaptation::Service(cfg), +Adaptation::Icap::ServiceRep::ServiceRep(const Adaptation::ServiceConfig &svcCfg): + AsyncJob("Adaptation::Icap::ServiceRep"), Adaptation::Service(svcCfg), theOptions(NULL), theOptionsFetcher(0), theLastUpdate(0), theSessionFailures(0), isSuspended(0), notifying(false), updateScheduled(false), self(NULL), diff --git a/src/esi/Esi.cc b/src/esi/Esi.cc index ebf2df411e..472887abda 100644 --- a/src/esi/Esi.cc +++ b/src/esi/Esi.cc @@ -1004,7 +1004,7 @@ ESIContext::start(const char *el, const char **attr, size_t attrCount) char localbuf [HTTP_REQBUF_SZ]; ESIElement::Pointer element; int specifiedattcount = attrCount * 2; - char *pos; + char *position; assert (ellen < sizeof (localbuf)); /* prevent unexpected overruns. */ debugs(86, 5, "ESIContext::Start: element '" << el << "' with " << specifiedattcount << " tags"); @@ -1020,33 +1020,33 @@ ESIContext::start(const char *el, const char **attr, size_t attrCount) localbuf[0] = '<'; localbuf[1] = '\0'; assert (xstrncpy (&localbuf[1], el, sizeof(localbuf) - 2)); - pos = localbuf + strlen (localbuf); + position = localbuf + strlen (localbuf); for (i = 0; i < specifiedattcount && attr[i]; i += 2) { - *pos++ = ' '; + *position++ = ' '; /* TODO: handle thisNode gracefully */ - assert (xstrncpy (pos, attr[i], sizeof(localbuf) + (pos - localbuf))); - pos += strlen (pos); - *pos++ = '='; - *pos++ = '\"'; + assert (xstrncpy (position, attr[i], sizeof(localbuf) + (position - localbuf))); + position += strlen (position); + *position++ = '='; + *position++ = '\"'; const char *chPtr = attr[i + 1]; char ch; while ((ch = *chPtr++) != '\0') { if (ch == '\"') { - assert( xstrncpy(pos, """, sizeof(localbuf) + (pos-localbuf)) ); - pos += 6; + assert( xstrncpy(position, """, sizeof(localbuf) + (position-localbuf)) ); + position += 6; } else { - *(pos++) = ch; + *(position++) = ch; } } - pos += strlen (pos); - *pos++ = '\"'; + position += strlen (position); + *position++ = '\"'; } - *pos++ = '>'; - *pos = '\0'; + *position++ = '>'; + *position = '\0'; - addLiteral (localbuf, pos - localbuf); + addLiteral (localbuf, position - localbuf); debugs(86, 5, "esi stack depth " << parserState.stackdepth); return; break; @@ -1118,7 +1118,7 @@ ESIContext::end(const char *el) { unsigned int ellen = strlen (el); char localbuf [HTTP_REQBUF_SZ]; - char *pos; + char *position; if (flags.error) /* waiting for expat to finish the buffer we gave it */ @@ -1132,10 +1132,10 @@ ESIContext::end(const char *el) localbuf[0] = '<'; localbuf[1] = '/'; assert (xstrncpy (&localbuf[2], el, sizeof(localbuf) - 3)); - pos = localbuf + strlen (localbuf); - *pos++ = '>'; - *pos = '\0'; - addLiteral (localbuf, pos - localbuf); + position = localbuf + strlen (localbuf); + *position++ = '>'; + *position = '\0'; + addLiteral (localbuf, position - localbuf); break; case ESIElement::ESI_ELEMENT_COMMENT: diff --git a/src/esi/VarState.cc b/src/esi/VarState.cc index db9181c2ba..ba414c6b1d 100644 --- a/src/esi/VarState.cc +++ b/src/esi/VarState.cc @@ -592,7 +592,7 @@ public: private: bool validChar (char c); - void eval (ESIVarState::Variable *var, char const *subref, char const *found_default ); + void eval (ESIVarState::Variable *var, char const *subref, char const *foundDefault ); void doFunction(); void identifyFunction(); char *string; @@ -611,14 +611,14 @@ private: }; void -ESIVariableProcessor::eval (ESIVarState::Variable *var, char const *subref, char const *found_default ) +ESIVariableProcessor::eval (ESIVarState::Variable *var, char const *subref, char const *foundDefault ) { assert (var); - if (!found_default) - found_default = ""; + if (!foundDefault) + foundDefault = ""; - var->eval (*varState, subref, found_default); + var->eval (*varState, subref, foundDefault); } bool diff --git a/src/icmp/Icmp6.cc b/src/icmp/Icmp6.cc index b61d4fe991..9f0e492ba0 100644 --- a/src/icmp/Icmp6.cc +++ b/src/icmp/Icmp6.cc @@ -213,7 +213,7 @@ Icmp6::Recv(void) struct addrinfo *from = NULL; // struct ip6_hdr *ip = NULL; static char *pkt = NULL; - struct icmp6_hdr *icmp6 = NULL; + struct icmp6_hdr *icmp6header = NULL; icmpEchoData *echo = NULL; struct timeval now; static pingerReplyData preply; @@ -278,12 +278,12 @@ Icmp6::Recv(void) ); */ - icmp6 = (struct icmp6_hdr *) pkt; + icmp6header = (struct icmp6_hdr *) pkt; pkt += sizeof(icmp6_hdr); - if (icmp6->icmp6_type != ICMP6_ECHO_REPLY) { + if (icmp6header->icmp6_type != ICMP6_ECHO_REPLY) { - switch (icmp6->icmp6_type) { + switch (icmp6header->icmp6_type) { case 134: case 135: case 136: @@ -291,15 +291,15 @@ Icmp6::Recv(void) break; default: - debugs(42, 8, HERE << preply.from << " said: " << icmp6->icmp6_type << "/" << (int)icmp6->icmp6_code << " " << - ( icmp6->icmp6_type&0x80 ? icmp6HighPktStr[(int)(icmp6->icmp6_type&0x7f)] : icmp6LowPktStr[(int)(icmp6->icmp6_type&0x7f)] ) + debugs(42, 8, HERE << preply.from << " said: " << icmp6header->icmp6_type << "/" << (int)icmp6header->icmp6_code << " " << + ( icmp6header->icmp6_type&0x80 ? icmp6HighPktStr[(int)(icmp6header->icmp6_type&0x7f)] : icmp6LowPktStr[(int)(icmp6header->icmp6_type&0x7f)] ) ); } return; } - if (icmp6->icmp6_id != icmp_ident) { - debugs(42, 8, HERE << "dropping Icmp6 read. IDENT check failed. ident=='" << icmp_ident << "'=='" << icmp6->icmp6_id << "'"); + if (icmp6header->icmp6_id != icmp_ident) { + debugs(42, 8, HERE << "dropping Icmp6 read. IDENT check failed. ident=='" << icmp_ident << "'=='" << icmp6header->icmp6_id << "'"); return; } @@ -329,8 +329,8 @@ Icmp6::Recv(void) } Log(preply.from, - icmp6->icmp6_type, - ( icmp6->icmp6_type&0x80 ? icmp6HighPktStr[(int)(icmp6->icmp6_type&0x7f)] : icmp6LowPktStr[(int)(icmp6->icmp6_type&0x7f)] ), + icmp6header->icmp6_type, + ( icmp6header->icmp6_type&0x80 ? icmp6HighPktStr[(int)(icmp6header->icmp6_type&0x7f)] : icmp6LowPktStr[(int)(icmp6header->icmp6_type&0x7f)] ), preply.rtt, preply.hops);