]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fixed some cases of variable shadowing
authorFrancesco Chemolli <kinkie@squid-cache.org>
Wed, 18 Nov 2009 12:37:56 +0000 (13:37 +0100)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Wed, 18 Nov 2009 12:37:56 +0000 (13:37 +0100)
15 files changed:
helpers/basic_auth/squid_radius_auth/squid_rad_auth.c
helpers/digest_auth/password/text_backend.c
helpers/external_acl/session/squid_session.c
src/SwapDir.cc
src/client_side.cc
src/errorpage.cc
src/event.cc
src/ftp.cc
src/http.cc
src/main.cc
src/stat.cc
src/store_dir.cc
src/unlinkd.cc
src/whois.cc
tools/squidclient.cc

index 02bfd3014cb7c61c337586757096a51de32ecefc..67e5cefb1d8b6522d14cf12f831557f49d8518cc 100644 (file)
@@ -288,7 +288,7 @@ urldecode(char *dst, const char *src, int size)
 }
 
 static int
-authenticate(int sockfd, const char *username, const char *passwd)
+authenticate(int socket_fd, const char *username, const char *passwd)
 {
     AUTH_HDR *auth;
     u_short total_length;
@@ -414,7 +414,7 @@ authenticate(int sockfd, const char *username, const char *passwd)
          *    Send the request we've built.
          */
         gettimeofday(&sent, NULL);
-        send(sockfd, (char *) auth, total_length, 0);
+        send(socket_fd, (char *) auth, total_length, 0);
         while ((time_spent = time_since(&sent)) < 1000000) {
             struct timeval tv;
             int rc, len;
@@ -426,11 +426,11 @@ authenticate(int sockfd, const char *username, const char *passwd)
                 tv.tv_usec = 1000000 - time_spent;
             }
             FD_ZERO(&readfds);
-            FD_SET(sockfd, &readfds);
-            if (select(sockfd + 1, &readfds, NULL, NULL, &tv) == 0)    /* Select timeout */
+            FD_SET(socket_fd, &readfds);
+            if (select(socket_fd + 1, &readfds, NULL, NULL, &tv) == 0) /* Select timeout */
                 break;
             salen = sizeof(saremote);
-            len = recvfrom(sockfd, recv_buffer, sizeof(i_recv_buffer),
+            len = recvfrom(socket_fd, recv_buffer, sizeof(i_recv_buffer),
                            0, (struct sockaddr *) &saremote, &salen);
 
             if (len < 0)
index 384045670db2ef6009624cb6efd623f9c147bff6..0662555c7272a67a63bf420d5f99d70b70fb42a5 100644 (file)
@@ -53,7 +53,7 @@ my_free(void *p)
 }
 
 static void
-read_passwd_file(const char *passwdfile, int ha1mode)
+read_passwd_file(const char *passwdfile, int isHa1Mode)
 {
     FILE *f;
     char buf[8192];
@@ -88,7 +88,7 @@ read_passwd_file(const char *passwdfile, int ha1mode)
             if (strncmp(passwd, "{HHA1}", 6) == 0) {
                 ha1 = passwd + 6;
                 passwd = NULL;
-            } else if (ha1mode) {
+            } else if (isHa1Mode) {
                 ha1 = passwd;
                 passwd = NULL;
             }
index 8b5b80618b44afc927cfd772b92221cd58f698cb..f92c0c98c322af69d9eee9e23b1c529451587d41 100644 (file)
@@ -149,10 +149,10 @@ int main(int argc, char **argv)
     init_db();
 
     while (fgets(request, sizeof(request), stdin)) {
-        const char *index, *detail;
+        const char *user_key, *detail;
         char *lastdetail;
         int action = 0;
-        index = strtok(request, " \n");
+        user_key = strtok(request, " \n");
         detail = strtok(NULL, "\n");
         lastdetail = strrchr(detail, ' ');
         if (lastdetail) {
@@ -166,18 +166,18 @@ int main(int argc, char **argv)
         }
         if (action == -1) {
             session_logout(detail);
-            printf("%s OK message=\"Bye\"\n", index);
+            printf("%s OK message=\"Bye\"\n", user_key);
         } else if (action == 1) {
             session_login(detail);
-            printf("%s OK message=\"Welcome\"\n", index);
+            printf("%s OK message=\"Welcome\"\n", user_key);
         } else if (session_active(detail)) {
             session_login(detail);
-            printf("%s OK\n", index);
+            printf("%s OK\n", user_key);
         } else if (default_action == 1) {
             session_login(detail);
-            printf("%s ERR message=\"Welcome\"\n", index);
+            printf("%s ERR message=\"Welcome\"\n", user_key);
         } else {
-            printf("%s ERR message=\"No session available\"\n", index);
+            printf("%s ERR message=\"No session available\"\n", user_key);
         }
     }
     shutdown_db();
index d5d75ca1b4fcbc3ac2594284f2c0df58ae969c9a..581e4ba74dd5d7a167ac10cff7c557bf3e8ee943 100644 (file)
@@ -165,7 +165,7 @@ SwapDir::getOptionTree() const
 }
 
 void
-SwapDir::parseOptions(int reconfiguring)
+SwapDir::parseOptions(int isaReconfig)
 {
     unsigned int old_read_only = flags.read_only;
     char *name, *value;
@@ -181,7 +181,7 @@ SwapDir::parseOptions(int reconfiguring)
         debugs(3,2, "SwapDir::parseOptions: parsing store option '" << name << "'='" << (value ? value : "") << "'");
 
         if (newOption)
-            if (!newOption->parse(name, value, reconfiguring))
+            if (!newOption->parse(name, value, isaReconfig))
                 self_destruct();
     }
 
@@ -193,7 +193,7 @@ SwapDir::parseOptions(int reconfiguring)
      * parsing...
      */
 
-    if (reconfiguring) {
+    if (isaReconfig) {
         if (old_read_only != flags.read_only) {
             debugs(3, 1, "Cache dir '" << path << "' now " << (flags.read_only ? "No-Store" : "Read-Write"));
         }
@@ -212,7 +212,7 @@ SwapDir::dumpOptions(StoreEntry * entry) const
 }
 
 bool
-SwapDir::optionReadOnlyParse(char const *option, const char *value, int reconfiguring)
+SwapDir::optionReadOnlyParse(char const *option, const char *value, int isaReconfig)
 {
     if (strcmp(option, "no-store") != 0 && strcmp(option, "read-only") != 0)
         return false;
@@ -237,7 +237,7 @@ SwapDir::optionReadOnlyDump(StoreEntry * e) const
 }
 
 bool
-SwapDir::optionMaxSizeParse(char const *option, const char *value, int reconfiguring)
+SwapDir::optionMaxSizeParse(char const *option, const char *value, int isaReconfig)
 {
     if (strcmp(option, "max-size") != 0)
         return false;
@@ -247,7 +247,7 @@ SwapDir::optionMaxSizeParse(char const *option, const char *value, int reconfigu
 
     int64_t size = strtoll(value, NULL, 10);
 
-    if (reconfiguring && max_objsize != size)
+    if (isaReconfig && max_objsize != size)
         debugs(3, 1, "Cache dir '" << path << "' max object size now " << size);
 
     max_objsize = size;
@@ -276,7 +276,7 @@ SwapDir::get
 void
 
 SwapDir::get
-(String const key, STOREGETCLIENT callback, void *cbdata)
+(String const key, STOREGETCLIENT aCallback, void *aCallbackData)
 {
     fatal("not implemented");
 }
index 661abefcf98070e9e5f0c4093eb124365c3f43f8..45a13d09c90bd79cc1f86c9d81a39611bc068028 100644 (file)
@@ -1669,23 +1669,23 @@ ClientSocketContext::initiateClose(const char *reason)
 }
 
 void
-ClientSocketContext::writeComplete(int fd, char *bufnotused, size_t size, comm_err_t errflag)
+ClientSocketContext::writeComplete(int aFileDescriptor, char *bufnotused, size_t size, comm_err_t errflag)
 {
     StoreEntry *entry = http->storeEntry();
     http->out.size += size;
-    assert(fd > -1);
-    debugs(33, 5, "clientWriteComplete: FD " << fd << ", sz " << size <<
+    assert(aFileDescriptor > -1);
+    debugs(33, 5, "clientWriteComplete: FD " << aFileDescriptor << ", sz " << size <<
            ", err " << errflag << ", off " << http->out.size << ", len " <<
            entry ? entry->objectLen() : 0);
     clientUpdateSocketStats(http->logType, size);
-    assert (this->fd() == fd);
+    assert (this->fd() == aFileDescriptor);
 
     /* Bail out quickly on COMM_ERR_CLOSING - close handlers will tidy up */
 
     if (errflag == COMM_ERR_CLOSING)
         return;
 
-    if (errflag || clientHttpRequestStatus(fd, http)) {
+    if (errflag || clientHttpRequestStatus(aFileDescriptor, http)) {
         initiateClose("failure or true request status");
         /* Do we leak here ? */
         return;
@@ -1698,7 +1698,7 @@ ClientSocketContext::writeComplete(int fd, char *bufnotused, size_t size, comm_e
         break;
 
     case STREAM_COMPLETE:
-        debugs(33, 5, "clientWriteComplete: FD " << fd << " Keeping Alive");
+        debugs(33, 5, "clientWriteComplete: FD " << aFileDescriptor << " Keeping Alive");
         keepaliveNextRequest();
         return;
 
index f0424f2b048011010e206f2266207db0ccd011b5..a3382e97d169f6f5ecfd15554226bcbbfa8316c5 100644 (file)
@@ -554,7 +554,7 @@ ErrorState::Dump(MemBuf * mb)
     str.Printf("HTTP Request:\r\n");
 
     if (NULL != request) {
-        Packer p;
+        Packer pck;
         String urlpath_or_slash;
 
         if (request->urlpath.size() != 0)
@@ -566,9 +566,9 @@ ErrorState::Dump(MemBuf * mb)
                    RequestMethodStr(request->method),
                    SQUIDSTRINGPRINT(urlpath_or_slash),
                    request->http_ver.major, request->http_ver.minor);
-        packerToMemInit(&p, &str);
-        request->header.packInto(&p);
-        packerClean(&p);
+        packerToMemInit(&pck, &str);
+        request->header.packInto(&pck);
+        packerClean(&pck);
     } else if (request_hdrs) {
         p = request_hdrs;
     } else {
index f07437e986d6744f381af66c0f32aa4d8a86b4ff..6dc15dba40bb5015a1a23711044568f847eceb3f 100644 (file)
@@ -108,10 +108,10 @@ EventDialer::print(std::ostream &os) const
 }
 
 
-ev_entry::ev_entry(char const * name, EVH * func, void * arg, double when,
-                   int weight, bool cbdata) : name(name), func(func),
-        arg(cbdata ? cbdataReference(arg) : arg), when(when), weight(weight),
-        cbdata(cbdata)
+ev_entry::ev_entry(char const * aName, EVH * aFunction, void * aArgument, double when,
+                   int weight, bool haveArgument) : name(aName), func(aFunction),
+        arg(haveArgument ? cbdataReference(aArgument) : aArgument), when(when), weight(weight),
+        cbdata(haveArgument)
 {
 }
 
index c8a48e4ca903f70907d53dd620bd5aad8c96d18a..e8e05eb8c70aae6fd39d8897180550901875c653 100644 (file)
@@ -3786,10 +3786,10 @@ FtpStateData::printfReplyBody(const char *fmt, ...)
  * which should be sent to either StoreEntry, or to ICAP...
  */
 void
-FtpStateData::writeReplyBody(const char *data, size_t len)
+FtpStateData::writeReplyBody(const char *dataToWrite, size_t dataLength)
 {
-    debugs(9, 5, HERE << "writing " << len << " bytes to the reply");
-    addVirginReplyBody(data, len);
+    debugs(9, 5, HERE << "writing " << dataLength << " bytes to the reply");
+    addVirginReplyBody(dataToWrite, dataLength);
 }
 
 /**
index 749a070424fac73d303a2d8eedb68a95369ecc7a..263444a37776cdc6b29dd07fc12bc639674719cc 100644 (file)
@@ -1224,22 +1224,22 @@ HttpStateData::decodeAndWriteReplyBody()
 {
     const char *data = NULL;
     int len;
-    bool status = false;
+    bool wasThereAnException = false;
     assert(flags.chunked);
     assert(httpChunkDecoder);
     SQUID_ENTER_THROWING_CODE();
     MemBuf decodedData;
     decodedData.init();
-    const bool done = httpChunkDecoder->parse(readBuf,&decodedData);
+    const bool doneParsing = httpChunkDecoder->parse(readBuf,&decodedData);
     len = decodedData.contentSize();
     data=decodedData.content();
     addVirginReplyBody(data, len);
-    if (done) {
+    if (doneParsing) {
         lastChunk = 1;
         flags.do_next_read = 0;
     }
-    SQUID_EXIT_THROWING_CODE(status);
-    return status;
+    SQUID_EXIT_THROWING_CODE(wasThereAnException);
+    return wasThereAnException;
 }
 
 /**
@@ -1911,28 +1911,28 @@ HttpStateData::decideIfWeDoRanges (HttpRequest * orig_request)
 /* build request prefix and append it to a given MemBuf;
  * return the length of the prefix */
 mb_size_t
-HttpStateData::buildRequestPrefix(HttpRequest * request,
-                                  HttpRequest * orig_request,
-                                  StoreEntry * entry,
+HttpStateData::buildRequestPrefix(HttpRequest * aRequest,
+                                  HttpRequest * original_request,
+                                  StoreEntry * sentry,
                                   MemBuf * mb,
-                                  http_state_flags flags)
+                                  http_state_flags stateFlags)
 {
     const int offset = mb->size;
     HttpVersion httpver(1, 0);
     mb->Printf("%s %s HTTP/%d.%d\r\n",
-               RequestMethodStr(request->method),
-               request->urlpath.size() ? request->urlpath.termedBuf() : "/",
+               RequestMethodStr(aRequest->method),
+               aRequest->urlpath.size() ? aRequest->urlpath.termedBuf() : "/",
                httpver.major,httpver.minor);
     /* build and pack headers */
     {
         HttpHeader hdr(hoRequest);
         Packer p;
-        httpBuildRequestHeader(request, orig_request, entry, &hdr, flags);
+        httpBuildRequestHeader(aRequest, original_request, sentry, &hdr, stateFlags);
 
-        if (request->flags.pinned && request->flags.connection_auth)
-            request->flags.auth_sent = 1;
+        if (aRequest->flags.pinned && aRequest->flags.connection_auth)
+            aRequest->flags.auth_sent = 1;
         else if (hdr.has(HDR_AUTHORIZATION))
-            request->flags.auth_sent = 1;
+            aRequest->flags.auth_sent = 1;
 
         packerToMemInit(&p, mb);
         hdr.packInto(&p);
index 554e4e4880e16a50e668eb400a6216adf2239f16..5ef34a034cbd6b9276975460798da0a6330dcac0 100644 (file)
@@ -167,7 +167,7 @@ class SignalEngine: public AsyncEngine
 {
 
 public:
-    SignalEngine(EventLoop &loop) : loop(loop) {}
+    SignalEngine(EventLoop &evtLoop) : loop(evtLoop) {}
     virtual int checkEvents(int timeout);
 
 private:
index cb67d2cd272645bedbb854677a3265572165f425..693032fea3797f5fa24e7befae7202d11bfcd41c 100644 (file)
@@ -1094,12 +1094,12 @@ statAvgTick(void *notused)
 
     if ((NCountHist % COUNT_INTERVAL) == 0) {
         /* we have an hours worth of readings.  store previous hour */
-        StatCounters *t = &CountHourHist[0];
-        StatCounters *p = &CountHourHist[1];
-        StatCounters *c = &CountHist[N_COUNT_HIST - 1];
+        StatCounters *t2 = &CountHourHist[0];
+        StatCounters *p2 = &CountHourHist[1];
+        StatCounters *c2 = &CountHist[N_COUNT_HIST - 1];
         statCountersClean(CountHourHist + N_COUNT_HOUR_HIST - 1);
-        xmemmove(p, t, (N_COUNT_HOUR_HIST - 1) * sizeof(StatCounters));
-        statCountersCopy(t, c);
+        xmemmove(p2, t2, (N_COUNT_HOUR_HIST - 1) * sizeof(StatCounters));
+        statCountersCopy(t2, c2);
         NCountHourHist++;
     }
 
index 55368f551a8cdc54106f03d219134cf9a1790017..18d641ed563563b5e27454ad4b08646c286aa0b7 100644 (file)
@@ -705,7 +705,7 @@ StoreController::get
 void
 
 StoreController::get
-(String const key, STOREGETCLIENT callback, void *cbdata)
+(String const key, STOREGETCLIENT aCallback, void *aCallbackData)
 {
     fatal("not implemented");
 }
@@ -782,7 +782,7 @@ StoreHashIndex::get
 void
 
 StoreHashIndex::get
-(String const key, STOREGETCLIENT callback, void *cbdata)
+(String const key, STOREGETCLIENT aCallback, void *aCallbackData)
 {
     fatal("not implemented");
 }
index 1486450ee08cd8b7cf94eea259e1ee37eadf259b..f3b16aec26ffa56d99d1c6a9891187307e23556e 100644 (file)
@@ -53,7 +53,7 @@ unlinkdUnlink(const char *path)
 {
     char buf[MAXPATHLEN];
     int l;
-    int x;
+    int bytes_written;
     static int queuelen = 0;
 
     if (unlinkd_wfd < 0) {
@@ -98,15 +98,15 @@ unlinkdUnlink(const char *path)
     * decrement the queue size by the number of newlines read.
     */
     if (queuelen > 0) {
-        int x;
+        int bytes_read;
         int i;
         char rbuf[512];
-        x = read(unlinkd_rfd, rbuf, 511);
+        bytes_read = read(unlinkd_rfd, rbuf, 511);
 
-        if (x > 0) {
-            rbuf[x] = '\0';
+        if (bytes_read > 0) {
+            rbuf[bytes_read] = '\0';
 
-            for (i = 0; i < x; i++)
+            for (i = 0; i < bytes_read; i++)
                 if ('\n' == rbuf[i])
                     queuelen--;
 
@@ -118,14 +118,14 @@ unlinkdUnlink(const char *path)
     assert(l < MAXPATHLEN);
     xstrncpy(buf, path, MAXPATHLEN);
     buf[l++] = '\n';
-    x = write(unlinkd_wfd, buf, l);
+    bytes_written = write(unlinkd_wfd, buf, l);
 
-    if (x < 0) {
+    if (bytes_written < 0) {
         debugs(2, 1, "unlinkdUnlink: write FD " << unlinkd_wfd << " failed: " << xstrerror());
         safeunlink(path, 0);
         return;
-    } else if (x != l) {
-        debugs(2, 1, "unlinkdUnlink: FD " << unlinkd_wfd << " only wrote " << x << " of " << l << " bytes");
+    } else if (bytes_written != l) {
+        debugs(2, 1, "unlinkdUnlink: FD " << unlinkd_wfd << " only wrote " << bytes_written << " of " << l << " bytes");
         safeunlink(path, 0);
         return;
     }
index 34fcf7f0768471572438a8cbcd0e18bc7e60a756..ff7f52c25aad69e08347f644340de40b61a47e89 100644 (file)
@@ -49,8 +49,8 @@ class WhoisState
 
 public:
     ~WhoisState();
-    void readReply (int fd, char *buf, size_t len, comm_err_t flag, int xerrno);
-    void setReplyToOK(StoreEntry *entry);
+    void readReply (int fd, char *aBuffer, size_t aBufferLength, comm_err_t flag, int xerrno);
+    void setReplyToOK(StoreEntry *sentry);
     StoreEntry *entry;
     HttpRequest *request;
     FwdState::Pointer fwd;
@@ -124,17 +124,17 @@ whoisReadReply(int fd, char *buf, size_t len, comm_err_t flag, int xerrno, void
 }
 
 void
-WhoisState::setReplyToOK(StoreEntry *entry)
+WhoisState::setReplyToOK(StoreEntry *sentry)
 {
     HttpReply *reply = new HttpReply;
-    entry->buffer();
+    sentry->buffer();
     HttpVersion version(1, 0);
     reply->setHeaders(version, HTTP_OK, "Gatewaying", "text/plain", -1, -1, -2);
-    entry->replaceHttpReply(reply);
+    sentry->replaceHttpReply(reply);
 }
 
 void
-WhoisState::readReply (int fd, char *buf, size_t len, comm_err_t flag, int xerrno)
+WhoisState::readReply (int fd, char *aBuffer, size_t aBufferLength, comm_err_t flag, int xerrno)
 {
     int do_next_read = 0;
 
@@ -144,27 +144,27 @@ WhoisState::readReply (int fd, char *buf, size_t len, comm_err_t flag, int xerrn
         return;
     }
 
-    buf[len] = '\0';
-    debugs(75, 3, "whoisReadReply: FD " << fd << " read " << len << " bytes");
-    debugs(75, 5, "{" << buf << "}");
+    aBuffer[aBufferLength] = '\0';
+    debugs(75, 3, "whoisReadReply: FD " << fd << " read " << aBufferLength << " bytes");
+    debugs(75, 5, "{" << aBuffer << "}");
 
-    if (flag == COMM_OK && len > 0) {
+    if (flag == COMM_OK && aBufferLength > 0) {
         if (!dataWritten)
             setReplyToOK(entry);
 
-        kb_incr(&statCounter.server.all.kbytes_in, len);
+        kb_incr(&statCounter.server.all.kbytes_in, aBufferLength);
 
-        kb_incr(&statCounter.server.http.kbytes_in, len);
+        kb_incr(&statCounter.server.http.kbytes_in, aBufferLength);
 
         /* No range support, we always grab it all */
         dataWritten = true;
 
-        entry->append(buf, len);
+        entry->append(aBuffer, aBufferLength);
 
         entry->flush();
 
         do_next_read = 1;
-    } else if (flag != COMM_OK || len < 0) {
+    } else if (flag != COMM_OK || aBufferLength < 0) {
         debugs(50, 2, "whoisReadReply: FD " << fd << ": read failure: " << xstrerror() << ".");
 
         if (ignoreErrno(errno)) {
@@ -194,7 +194,7 @@ WhoisState::readReply (int fd, char *buf, size_t len, comm_err_t flag, int xerrn
     }
 
     if (do_next_read)
-        comm_read(fd, buf, BUFSIZ, whoisReadReply, this);
+        comm_read(fd, aBuffer, BUFSIZ, whoisReadReply, this);
 }
 
 static void
index 3e2f99461b192d02380796e4c6810adc788fd448..25325c6f7d71f636e9c79d8bd4676ae43294d9be 100644 (file)
@@ -520,13 +520,13 @@ main(int argc, char *argv[])
         iaddr.SetPort(port);
 
         if (client_comm_connect(conn, iaddr, ping ? &tv1 : NULL) < 0) {
-            char buf[MAX_IPSTRLEN];
-            iaddr.ToURL(buf, MAX_IPSTRLEN);
+            char hostnameBuf[MAX_IPSTRLEN];
+            iaddr.ToURL(hostnameBuf, MAX_IPSTRLEN);
             if (errno == 0) {
-                fprintf(stderr, "client: ERROR: Cannot connect to %s: Host unknown.\n", buf);
+                fprintf(stderr, "client: ERROR: Cannot connect to %s: Host unknown.\n", hostnameBuf);
             } else {
                 char tbuf[BUFSIZ];
-                snprintf(tbuf, BUFSIZ, "client: ERROR: Cannot connect to %s", buf);
+                snprintf(tbuf, BUFSIZ, "client: ERROR: Cannot connect to %s", hostnameBuf);
                 perror(tbuf);
             }
             exit(1);