From 188daac58697ff9bc78e2fd3767fdc45b4d9a1e4 Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Sun, 22 Nov 2009 00:01:43 +1300 Subject: [PATCH] Author: Francesco Chemolli Fixed some cases of linkage type mismatch and many of parameter shadowing --- helpers/basic_auth/LDAP/squid_ldap_auth.c | 12 +- helpers/basic_auth/MSNT/rfcnb-util.c | 4 +- helpers/basic_auth/MSNT/valid.c | 22 ++-- .../squid_radius_auth/squid_rad_auth.c | 16 +-- helpers/digest_auth/eDirectory/ldap_backend.c | 18 +-- helpers/digest_auth/ldap/ldap_backend.c | 18 +-- helpers/digest_auth/password/text_backend.c | 6 +- .../ldap_group/squid_ldap_group.c | 12 +- helpers/external_acl/session/squid_session.c | 14 +-- helpers/ntlm_auth/smb_lm/smbval/rfcnb-util.c | 4 +- helpers/ntlm_auth/smb_lm/smbval/valid.c | 4 +- lib/MemPool.cc | 2 +- lib/rfc1123.c | 14 +-- src/BodyPipe.cc | 44 +++---- src/CommCalls.h | 4 +- src/ConfigOption.cc | 4 +- src/ConfigOption.h | 4 +- src/DiskIO/AIO/AIODiskIOStrategy.cc | 4 +- src/DiskIO/DiskDaemon/DiskdIOStrategy.cc | 8 +- src/DiskIO/DiskDaemon/diskd.cc | 11 +- .../DiskThreads/DiskThreadsIOStrategy.cc | 6 +- src/HttpReply.cc | 8 +- src/HttpRequestMethod.cc | 4 +- src/StoreMeta.cc | 6 +- src/String.cci | 6 +- src/SwapDir.cc | 14 +-- src/acl/Ip.cc | 4 +- src/adaptation/History.cc | 8 +- src/adaptation/Iterator.cc | 4 +- src/adaptation/ServiceGroups.cc | 10 +- src/adaptation/icap/ModXact.cc | 18 +-- src/adaptation/icap/OptXact.cc | 4 +- src/adaptation/icap/ServiceRep.cc | 4 +- src/auth/basic/auth_basic.cc | 8 +- src/auth/digest/auth_digest.cc | 14 +-- src/auth/negotiate/auth_negotiate.cc | 38 +++--- src/auth/ntlm/auth_ntlm.cc | 32 +++--- src/cache_manager.cc | 8 +- src/cbdata.h | 2 +- src/client_side.cc | 32 +++--- src/client_side_reply.cc | 108 +++++++++--------- src/comm.cc | 2 +- src/errorpage.cc | 16 +-- src/esi/Esi.cc | 40 +++---- src/esi/VarState.cc | 10 +- src/event.cc | 8 +- src/forward.cc | 6 +- src/fs/ufs/store_dir_ufs.cc | 46 ++++---- src/fs/ufs/store_io_ufs.cc | 48 ++++---- src/fs/ufs/ufscommon.cc | 4 +- src/ftp.cc | 12 +- src/http.cc | 38 +++--- src/icmp/Icmp6.cc | 20 ++-- src/main.cc | 2 +- src/mem.cc | 8 +- src/protos.h | 10 +- src/stat.cc | 10 +- src/store.cc | 8 +- src/store_dir.cc | 8 +- src/unlinkd.cc | 20 ++-- src/whois.cc | 30 ++--- tools/squidclient.cc | 8 +- 62 files changed, 461 insertions(+), 456 deletions(-) diff --git a/helpers/basic_auth/LDAP/squid_ldap_auth.c b/helpers/basic_auth/LDAP/squid_ldap_auth.c index aefccc3275..b8db90e83b 100644 --- a/helpers/basic_auth/LDAP/squid_ldap_auth.c +++ b/helpers/basic_auth/LDAP/squid_ldap_auth.c @@ -181,21 +181,21 @@ squid_ldap_set_referrals(LDAP * ld, int referrals) ldap_set_option(ld, LDAP_OPT_REFERRALS, value); } static void -squid_ldap_set_timelimit(LDAP * ld, int timelimit) +squid_ldap_set_timelimit(LDAP * ld, int aTimeLimit) { - ldap_set_option(ld, LDAP_OPT_TIMELIMIT, &timelimit); + ldap_set_option(ld, LDAP_OPT_TIMELIMIT, &aTimeLimit); } static void -squid_ldap_set_connect_timeout(LDAP * ld, int timelimit) +squid_ldap_set_connect_timeout(LDAP * ld, int aTimeLimit) { #if defined(LDAP_OPT_NETWORK_TIMEOUT) struct timeval tv; - tv.tv_sec = timelimit; + tv.tv_sec = aTimeLimit; tv.tv_usec = 0; ldap_set_option(ld, LDAP_OPT_NETWORK_TIMEOUT, &tv); #elif defined(LDAP_X_OPT_CONNECT_TIMEOUT) - timelimit *= 1000; - ldap_set_option(ld, LDAP_X_OPT_CONNECT_TIMEOUT, &timelimit); + aTimeLimit *= 1000; + ldap_set_option(ld, LDAP_X_OPT_CONNECT_TIMEOUT, &aTimeLimit); #endif } static void diff --git a/helpers/basic_auth/MSNT/rfcnb-util.c b/helpers/basic_auth/MSNT/rfcnb-util.c index 1e96652855..9ec8363126 100644 --- a/helpers/basic_auth/MSNT/rfcnb-util.c +++ b/helpers/basic_auth/MSNT/rfcnb-util.c @@ -375,10 +375,10 @@ RFCNB_Name_To_IP(char *host, struct in_addr *Dest_IP) /* Disconnect the TCP connection to the server */ int -RFCNB_Close(int socket) +RFCNB_Close(int aSocket) { - close(socket); + close(aSocket); /* If we want to do error recovery, here is where we put it */ diff --git a/helpers/basic_auth/MSNT/valid.c b/helpers/basic_auth/MSNT/valid.c index 233cf3af96..a7a24ce0f2 100644 --- a/helpers/basic_auth/MSNT/valid.c +++ b/helpers/basic_auth/MSNT/valid.c @@ -9,16 +9,16 @@ int Valid_User(char *USERNAME, char *PASSWORD, char *SERVER, char *BACKUP, char *DOMAIN) { - const char *SMB_Prots[] = {"PC NETWORK PROGRAM 1.0", - "MICROSOFT NETWORKS 1.03", - "MICROSOFT NETWORKS 3.0", - "LANMAN1.0", - "LM1.2X002", - "Samba", - "NT LM 0.12", - "NT LANMAN 1.0", - NULL - }; + const char *supportedDialects[] = {"PC NETWORK PROGRAM 1.0", + "MICROSOFT NETWORKS 1.03", + "MICROSOFT NETWORKS 3.0", + "LANMAN1.0", + "LM1.2X002", + "Samba", + "NT LM 0.12", + "NT LANMAN 1.0", + NULL + }; void *con; SMB_Init(); @@ -29,7 +29,7 @@ Valid_User(char *USERNAME, char *PASSWORD, char *SERVER, char *BACKUP, char *DOM return (NTV_SERVER_ERROR); } } - if (SMB_Negotiate(con, SMB_Prots) < 0) { /* An error */ + if (SMB_Negotiate(con, supportedDialects) < 0) { /* An error */ SMB_Discon(con, 0); return (NTV_PROTOCOL_ERROR); } diff --git a/helpers/basic_auth/squid_radius_auth/squid_rad_auth.c b/helpers/basic_auth/squid_radius_auth/squid_rad_auth.c index 02bfd3014c..8e59ba464d 100644 --- a/helpers/basic_auth/squid_radius_auth/squid_rad_auth.c +++ b/helpers/basic_auth/squid_radius_auth/squid_rad_auth.c @@ -219,7 +219,7 @@ result_recv(u_int32_t host, u_short udp_port, char *buffer, int length) * Generate a random vector. */ static void -random_vector(char *vector) +random_vector(char *aVector) { int randno; int i; @@ -227,8 +227,8 @@ random_vector(char *vector) srand((time(0) ^ rand()) + rand()); for (i = 0; i < AUTH_VECTOR_LEN;) { randno = rand(); - memcpy(vector, &randno, sizeof(int)); - vector += sizeof(int); + memcpy(aVector, &randno, sizeof(int)); + aVector += sizeof(int); i += sizeof(int); } } @@ -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) diff --git a/helpers/digest_auth/eDirectory/ldap_backend.c b/helpers/digest_auth/eDirectory/ldap_backend.c index 397c0d037d..3cd5a7815a 100644 --- a/helpers/digest_auth/eDirectory/ldap_backend.c +++ b/helpers/digest_auth/eDirectory/ldap_backend.c @@ -97,21 +97,21 @@ squid_ldap_set_referrals(int referrals) ldap_set_option(ld, LDAP_OPT_REFERRALS, value); } static void -squid_ldap_set_timelimit(int timelimit) +squid_ldap_set_timelimit(int aTimeLimit) { - ldap_set_option(ld, LDAP_OPT_TIMELIMIT, &timelimit); + ldap_set_option(ld, LDAP_OPT_TIMELIMIT, &aTimeLimit); } static void -squid_ldap_set_connect_timeout(int timelimit) +squid_ldap_set_connect_timeout(int aTimeLimit) { #if defined(LDAP_OPT_NETWORK_TIMEOUT) struct timeval tv; - tv.tv_sec = timelimit; + tv.tv_sec = aTimeLimit; tv.tv_usec = 0; ldap_set_option(ld, LDAP_OPT_NETWORK_TIMEOUT, &tv); #elif defined(LDAP_X_OPT_CONNECT_TIMEOUT) - timelimit *= 1000; - ldap_set_option(ld, LDAP_X_OPT_CONNECT_TIMEOUT, &timelimit); + aTimeLimit *= 1000; + ldap_set_option(ld, LDAP_X_OPT_CONNECT_TIMEOUT, &aTimeLimit); #endif } @@ -135,12 +135,12 @@ squid_ldap_set_referrals(int referrals) ld->ld_options &= ~LDAP_OPT_REFERRALS; } static void -squid_ldap_set_timelimit(int timelimit) +squid_ldap_set_timelimit(int aTimeLimit) { - ld->ld_timelimit = timelimit; + ld->ld_timelimit = aTimeLimit; } static void -squid_ldap_set_connect_timeout(int timelimit) +squid_ldap_set_connect_timeout(int aTimeLimit) { fprintf(stderr, "Connect timeouts not supported in your LDAP library\n"); } diff --git a/helpers/digest_auth/ldap/ldap_backend.c b/helpers/digest_auth/ldap/ldap_backend.c index 47b440829c..6fa0d16375 100644 --- a/helpers/digest_auth/ldap/ldap_backend.c +++ b/helpers/digest_auth/ldap/ldap_backend.c @@ -95,21 +95,21 @@ squid_ldap_set_referrals(int referrals) ldap_set_option(ld, LDAP_OPT_REFERRALS, value); } static void -squid_ldap_set_timelimit(int timelimit) +squid_ldap_set_timelimit(int aTimeLimit) { - ldap_set_option(ld, LDAP_OPT_TIMELIMIT, &timelimit); + ldap_set_option(ld, LDAP_OPT_TIMELIMIT, &aTimeLimit); } static void -squid_ldap_set_connect_timeout(int timelimit) +squid_ldap_set_connect_timeout(int aTimeLimit) { #if defined(LDAP_OPT_NETWORK_TIMEOUT) struct timeval tv; - tv.tv_sec = timelimit; + tv.tv_sec = aTimeLimit; tv.tv_usec = 0; ldap_set_option(ld, LDAP_OPT_NETWORK_TIMEOUT, &tv); #elif defined(LDAP_X_OPT_CONNECT_TIMEOUT) - timelimit *= 1000; - ldap_set_option(ld, LDAP_X_OPT_CONNECT_TIMEOUT, &timelimit); + aTimeLimit *= 1000; + ldap_set_option(ld, LDAP_X_OPT_CONNECT_TIMEOUT, &aTimeLimit); #endif } @@ -133,12 +133,12 @@ squid_ldap_set_referrals(int referrals) ld->ld_options &= ~LDAP_OPT_REFERRALS; } static void -squid_ldap_set_timelimit(int timelimit) +squid_ldap_set_timelimit(int aTimeLimit) { - ld->ld_timelimit = timelimit; + ld->ld_timelimit = aTimeLimit; } static void -squid_ldap_set_connect_timeout(int timelimit) +squid_ldap_set_connect_timeout(int aTimeLimit) { fprintf(stderr, "Connect timeouts not supported in your LDAP library\n"); } diff --git a/helpers/digest_auth/password/text_backend.c b/helpers/digest_auth/password/text_backend.c index 384045670d..9bbaf1d479 100644 --- a/helpers/digest_auth/password/text_backend.c +++ b/helpers/digest_auth/password/text_backend.c @@ -53,7 +53,7 @@ my_free(void *p) } static void -read_passwd_file(const char *passwdfile, int ha1mode) +read_passwd_file(const char *passwordFile, int isHa1Mode) { FILE *f; char buf[8192]; @@ -72,7 +72,7 @@ read_passwd_file(const char *passwdfile, int ha1mode) fprintf(stderr, "digest_pw_auth: cannot create hash table\n"); exit(1); } - f = fopen(passwdfile, "r"); + f = fopen(passwordFile, "r"); while (fgets(buf, 8192, f) != NULL) { if ((buf[0] == '#') || (buf[0] == ' ') || (buf[0] == '\t') || (buf[0] == '\n')) @@ -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; } diff --git a/helpers/external_acl/ldap_group/squid_ldap_group.c b/helpers/external_acl/ldap_group/squid_ldap_group.c index a89c3f43aa..abf970ef04 100644 --- a/helpers/external_acl/ldap_group/squid_ldap_group.c +++ b/helpers/external_acl/ldap_group/squid_ldap_group.c @@ -141,21 +141,21 @@ squid_ldap_set_referrals(LDAP * ld, int referrals) ldap_set_option(ld, LDAP_OPT_REFERRALS, value); } static void -squid_ldap_set_timelimit(LDAP * ld, int timelimit) +squid_ldap_set_timelimit(LDAP * ld, int aTimeLimit) { - ldap_set_option(ld, LDAP_OPT_TIMELIMIT, &timelimit); + ldap_set_option(ld, LDAP_OPT_TIMELIMIT, &aTimeLimit); } static void -squid_ldap_set_connect_timeout(LDAP * ld, int timelimit) +squid_ldap_set_connect_timeout(LDAP * ld, int aTimeLimit) { #if defined(LDAP_OPT_NETWORK_TIMEOUT) struct timeval tv; - tv.tv_sec = timelimit; + tv.tv_sec = aTimeLimit; tv.tv_usec = 0; ldap_set_option(ld, LDAP_OPT_NETWORK_TIMEOUT, &tv); #elif defined(LDAP_X_OPT_CONNECT_TIMEOUT) - timelimit *= 1000; - ldap_set_option(ld, LDAP_X_OPT_CONNECT_TIMEOUT, &timelimit); + aTimeLimit *= 1000; + ldap_set_option(ld, LDAP_X_OPT_CONNECT_TIMEOUT, &aTimeLimit); #endif } static void diff --git a/helpers/external_acl/session/squid_session.c b/helpers/external_acl/session/squid_session.c index 8b5b80618b..f92c0c98c3 100644 --- a/helpers/external_acl/session/squid_session.c +++ b/helpers/external_acl/session/squid_session.c @@ -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(); diff --git a/helpers/ntlm_auth/smb_lm/smbval/rfcnb-util.c b/helpers/ntlm_auth/smb_lm/smbval/rfcnb-util.c index e12b36fc0a..50a6ce870d 100644 --- a/helpers/ntlm_auth/smb_lm/smbval/rfcnb-util.c +++ b/helpers/ntlm_auth/smb_lm/smbval/rfcnb-util.c @@ -359,10 +359,10 @@ RFCNB_Name_To_IP(char *host, struct in_addr *Dest_IP) /* Disconnect the TCP connection to the server */ int -RFCNB_Close(int socket) +RFCNB_Close(int aSocket) { - close(socket); + close(aSocket); /* If we want to do error recovery, here is where we put it */ diff --git a/helpers/ntlm_auth/smb_lm/smbval/valid.c b/helpers/ntlm_auth/smb_lm/smbval/valid.c index f481decbc2..4130dda766 100644 --- a/helpers/ntlm_auth/smb_lm/smbval/valid.c +++ b/helpers/ntlm_auth/smb_lm/smbval/valid.c @@ -22,7 +22,7 @@ int Valid_User(char *username, char *password, char *server, char *backup, char *domain) { int pass_is_precrypted_p = 0; - char const *SMB_Prots[] = { + char const *supportedDialects[] = { /* "PC NETWORK PROGRAM 1.0", */ /* "MICROSOFT NETWORKS 1.03", */ /* "MICROSOFT NETWORKS 3.0", */ @@ -43,7 +43,7 @@ Valid_User(char *username, char *password, char *server, char *backup, char *dom return (NTV_SERVER_ERROR); } } - if (SMB_Negotiate(con, SMB_Prots) < 0) { /* An error */ + if (SMB_Negotiate(con, supportedDialects) < 0) { /* An error */ SMB_Discon(con, 0); return (NTV_PROTOCOL_ERROR); } diff --git a/lib/MemPool.cc b/lib/MemPool.cc index b673b1c563..7150d4b900 100644 --- a/lib/MemPool.cc +++ b/lib/MemPool.cc @@ -848,7 +848,7 @@ size_t MemAllocator::RoundedSize(size_t s) return ((s + sizeof(void*) - 1) / sizeof(void*)) * sizeof(void*); } -MemMalloc::MemMalloc(char const *label, size_t aSize) : MemImplementingAllocator(label, aSize) { inuse = 0; } +MemMalloc::MemMalloc(char const *aLabel, size_t aSize) : MemImplementingAllocator(aLabel, aSize) { inuse = 0; } bool MemMalloc::idleTrigger(int shift) const diff --git a/lib/rfc1123.c b/lib/rfc1123.c index 9bd85a8bc6..dd98d360ae 100644 --- a/lib/rfc1123.c +++ b/lib/rfc1123.c @@ -119,12 +119,12 @@ tmSaneValues(struct tm *tm) static struct tm * parse_date_elements(const char *day, const char *month, const char *year, - const char *time, const char *zone) { + const char *aTime, const char *zone) { static struct tm tm; char *t; memset(&tm, 0, sizeof(tm)); - if (!day || !month || !year || !time) + if (!day || !month || !year || !aTime) return NULL; tm.tm_mday = atoi(day); tm.tm_mon = make_month(month); @@ -137,8 +137,8 @@ parse_date_elements(const char *day, const char *month, const char *year, tm.tm_year += 100; else if (tm.tm_year > 19000) tm.tm_year -= 19000; - tm.tm_hour = make_num(time); - t = strchr(time, ':'); + tm.tm_hour = make_num(aTime); + t = strchr(aTime, ':'); if (!t) return NULL; t++; @@ -158,7 +158,7 @@ parse_date(const char *str) { char *day = NULL; char *month = NULL; char *year = NULL; - char *time = NULL; + char *timestr = NULL; char *zone = NULL; xstrncpy(tmp, str, 64); @@ -178,7 +178,7 @@ parse_date(const char *str) { year = t; } } else if (strchr(t, ':')) - time = t; + timestr = t; else if (!year) year = t; } else if (!wday) @@ -188,7 +188,7 @@ parse_date(const char *str) { else if (!zone) zone = t; } - tm = parse_date_elements(day, month, year, time, zone); + tm = parse_date_elements(day, month, year, timestr, zone); return tm; } diff --git a/src/BodyPipe.cc b/src/BodyPipe.cc index 501f17b52b..eb0a7e52d4 100644 --- a/src/BodyPipe.cc +++ b/src/BodyPipe.cc @@ -200,14 +200,14 @@ BodyPipe::clearProducer(bool atEof) } size_t -BodyPipe::putMoreData(const char *buf, size_t size) +BodyPipe::putMoreData(const char *aBuffer, size_t size) { if (bodySizeKnown()) size = min((uint64_t)size, unproducedSize()); const size_t spaceSize = static_cast(theBuf.potentialSpaceSize()); if ((size = min(size, spaceSize))) { - theBuf.append(buf, size); + theBuf.append(aBuffer, size); postAppend(size); return size; } @@ -261,15 +261,15 @@ BodyPipe::clearConsumer() } size_t -BodyPipe::getMoreData(MemBuf &buf) +BodyPipe::getMoreData(MemBuf &aMemBuffer) { if (!theBuf.hasContent()) return 0; // did not touch the possibly uninitialized buf - if (buf.isNull()) - buf.init(); - const size_t size = min(theBuf.contentSize(), buf.potentialSpaceSize()); - buf.append(theBuf.content(), size); + if (aMemBuffer.isNull()) + aMemBuffer.init(); + const size_t size = min(theBuf.contentSize(), aMemBuffer.potentialSpaceSize()); + aMemBuffer.append(theBuf.content(), size); theBuf.consume(size); postConsume(size); return size; // cannot be zero if we called buf.init above @@ -409,35 +409,35 @@ BodyPipe::scheduleBodyEndNotification() // a short temporary string describing buffer status for debugging const char *BodyPipe::status() const { - static MemBuf buf; - buf.reset(); + static MemBuf outputBuffer; + outputBuffer.reset(); - buf.append(" [", 2); + outputBuffer.append(" [", 2); - buf.Printf("%"PRIu64"<=%"PRIu64, theGetSize, thePutSize); + outputBuffer.Printf("%"PRIu64"<=%"PRIu64, theGetSize, thePutSize); if (theBodySize >= 0) - buf.Printf("<=%"PRId64, theBodySize); + outputBuffer.Printf("<=%"PRId64, theBodySize); else - buf.append("<=?", 3); + outputBuffer.append("<=?", 3); - buf.Printf(" %d+%d", (int)theBuf.contentSize(), (int)theBuf.spaceSize()); + outputBuffer.Printf(" %d+%d", (int)theBuf.contentSize(), (int)theBuf.spaceSize()); - buf.Printf(" pipe%p", this); + outputBuffer.Printf(" pipe%p", this); if (theProducer) - buf.Printf(" prod%p", theProducer); + outputBuffer.Printf(" prod%p", theProducer); if (theConsumer) - buf.Printf(" cons%p", theConsumer); + outputBuffer.Printf(" cons%p", theConsumer); if (mustAutoConsume) - buf.append(" A", 2); + outputBuffer.append(" A", 2); if (isCheckedOut) - buf.append(" L", 2); // Locked + outputBuffer.append(" L", 2); // Locked - buf.append("]", 1); + outputBuffer.append("]", 1); - buf.terminate(); + outputBuffer.terminate(); - return buf.content(); + return outputBuffer.content(); } diff --git a/src/CommCalls.h b/src/CommCalls.h index d07cbd9e24..c5b39411a1 100644 --- a/src/CommCalls.h +++ b/src/CommCalls.h @@ -290,9 +290,9 @@ CommCbFunPtrCallT *commCbCall(int debugSection, int debugLevel, /* CommCbFunPtrCallT */ template -CommCbFunPtrCallT::CommCbFunPtrCallT(int debugSection, int debugLevel, +CommCbFunPtrCallT::CommCbFunPtrCallT(int aDebugSection, int aDebugLevel, const char *callName, const Dialer &aDialer): - AsyncCall(debugSection, debugLevel, callName), + AsyncCall(aDebugSection, aDebugLevel, callName), dialer(aDialer) { } diff --git a/src/ConfigOption.cc b/src/ConfigOption.cc index de3ee2ea14..00cb31d264 100644 --- a/src/ConfigOption.cc +++ b/src/ConfigOption.cc @@ -45,12 +45,12 @@ ConfigOptionVector::~ConfigOptionVector() } bool -ConfigOptionVector::parse(char const *option, const char *value, int reconfiguring) +ConfigOptionVector::parse(char const *option, const char *value, int isaReconfig) { Vector::iterator i = options.begin(); while (i != options.end()) { - if ((*i)->parse(option,value, reconfiguring)) + if ((*i)->parse(option,value, isaReconfig)) return true; ++i; diff --git a/src/ConfigOption.h b/src/ConfigOption.h index 960ea9a8b8..786350f4a2 100644 --- a/src/ConfigOption.h +++ b/src/ConfigOption.h @@ -67,9 +67,9 @@ class ConfigOptionAdapter : public ConfigOption public: ConfigOptionAdapter(C& theObject, bool (C::*parseFP)(char const *option, const char *value, int reconfiguring), void (C::*dumpFP) (StoreEntry * e) const) : object(theObject), parser (parseFP), dumper(dumpFP) {} - bool parse(char const *option, const char *value, int reconfiguring) { + bool parse(char const *option, const char *value, int isaReconf) { if (parser) - return (object.*parser)(option, value, reconfiguring); + return (object.*parser)(option, value, isaReconf); return false; } diff --git a/src/DiskIO/AIO/AIODiskIOStrategy.cc b/src/DiskIO/AIO/AIODiskIOStrategy.cc index 291d2f07ba..61f79921ad 100644 --- a/src/DiskIO/AIO/AIODiskIOStrategy.cc +++ b/src/DiskIO/AIO/AIODiskIOStrategy.cc @@ -123,7 +123,7 @@ AIODiskIOStrategy::callback() void *cbdata; int callback_valid; void *buf; - int fd; + int filedescriptor; async_queue_entry_t *aqe; async_queue_entry_type_t type; @@ -148,7 +148,7 @@ AIODiskIOStrategy::callback() /* Get the callback parameters */ freefunc = aqe->aq_e_free; buf = aqe->aq_e_buf; - fd = aqe->aq_e_fd; + filedescriptor = aqe->aq_e_fd; type = aqe->aq_e_type; callback_valid = cbdataReferenceValidDone(aqe->aq_e_callback_data, &cbdata); AIODiskFile * theFile = NULL; diff --git a/src/DiskIO/DiskDaemon/DiskdIOStrategy.cc b/src/DiskIO/DiskDaemon/DiskdIOStrategy.cc index ac09014551..54ba1a04d0 100644 --- a/src/DiskIO/DiskDaemon/DiskdIOStrategy.cc +++ b/src/DiskIO/DiskDaemon/DiskdIOStrategy.cc @@ -439,7 +439,7 @@ DiskdIOStrategy::getOptionTree() const } bool -DiskdIOStrategy::optionQ1Parse(const char *name, const char *value, int reconfiguring) +DiskdIOStrategy::optionQ1Parse(const char *name, const char *value, int isaReconfig) { if (strcmp(name, "Q1") != 0) return false; @@ -448,7 +448,7 @@ DiskdIOStrategy::optionQ1Parse(const char *name, const char *value, int reconfig magic1 = atoi(value); - if (!reconfiguring) + if (!isaReconfig) return true; if (old_magic1 < magic1) { @@ -478,7 +478,7 @@ DiskdIOStrategy::optionQ1Dump(StoreEntry * e) const } bool -DiskdIOStrategy::optionQ2Parse(const char *name, const char *value, int reconfiguring) +DiskdIOStrategy::optionQ2Parse(const char *name, const char *value, int isaReconfig) { if (strcmp(name, "Q2") != 0) return false; @@ -487,7 +487,7 @@ DiskdIOStrategy::optionQ2Parse(const char *name, const char *value, int reconfig magic2 = atoi(value); - if (!reconfiguring) + if (!isaReconfig) return true; if (old_magic2 < magic2) { diff --git a/src/DiskIO/DiskDaemon/diskd.cc b/src/DiskIO/DiskDaemon/diskd.cc index d5703107ed..d3e39ac71f 100644 --- a/src/DiskIO/DiskDaemon/diskd.cc +++ b/src/DiskIO/DiskDaemon/diskd.cc @@ -302,11 +302,12 @@ fsHash(const void *key, unsigned int n) return (*k & (--n)); } -static void -alarm_handler(int sig) -{ - (void) 0; -} +SQUIDCEXTERN { + static void + alarm_handler(int sig) { + (void) 0; + } +}; int main(int argc, char *argv[]) diff --git a/src/DiskIO/DiskThreads/DiskThreadsIOStrategy.cc b/src/DiskIO/DiskThreads/DiskThreadsIOStrategy.cc index 9ae67dcd89..69f79c7abd 100644 --- a/src/DiskIO/DiskThreads/DiskThreadsIOStrategy.cc +++ b/src/DiskIO/DiskThreads/DiskThreadsIOStrategy.cc @@ -139,14 +139,14 @@ DiskThreadsIOStrategy::callback() dlinkDelete(&ctrlp->node, &used_list); if (ctrlp->done_handler) { - AIOCB *callback = ctrlp->done_handler; + AIOCB *done_callback = ctrlp->done_handler; void *cbdata; ctrlp->done_handler = NULL; if (cbdataReferenceValidDone(ctrlp->done_handler_data, &cbdata)) { retval = 1; /* Return that we've actually done some work */ - callback(ctrlp->fd, cbdata, ctrlp->bufp, - ctrlp->result.aio_return, ctrlp->result.aio_errno); + done_callback(ctrlp->fd, cbdata, ctrlp->bufp, + ctrlp->result.aio_return, ctrlp->result.aio_errno); } else { if (ctrlp->operation == _AIO_OPEN) { /* The open operation was aborted.. */ diff --git a/src/HttpReply.cc b/src/HttpReply.cc index 72b29313d3..50af61ba54 100644 --- a/src/HttpReply.cc +++ b/src/HttpReply.cc @@ -210,7 +210,7 @@ HttpReply::packed304Reply() void HttpReply::setHeaders(HttpVersion ver, http_status status, const char *reason, - const char *ctype, int64_t clen, time_t lmt, time_t expires) + const char *ctype, int64_t clen, time_t lmt, time_t expiresTime) { HttpHeader *hdr; httpStatusLineSet(&sline, ver, status, reason); @@ -228,8 +228,8 @@ HttpReply::setHeaders(HttpVersion ver, http_status status, const char *reason, if (clen >= 0) hdr->putInt64(HDR_CONTENT_LENGTH, clen); - if (expires >= 0) - hdr->putTime(HDR_EXPIRES, expires); + if (expiresTime >= 0) + hdr->putTime(HDR_EXPIRES, expiresTime); if (lmt > 0) /* this used to be lmt != 0 @?@ */ hdr->putTime(HDR_LAST_MODIFIED, lmt); @@ -238,7 +238,7 @@ HttpReply::setHeaders(HttpVersion ver, http_status status, const char *reason, content_length = clen; - expires = expires; + expires = expiresTime; last_modified = lmt; } diff --git a/src/HttpRequestMethod.cc b/src/HttpRequestMethod.cc index 8f4c9d1901..d98f3a9f5c 100644 --- a/src/HttpRequestMethod.cc +++ b/src/HttpRequestMethod.cc @@ -152,10 +152,10 @@ HttpRequestMethod::AddExtension(const char *mstr) } void -HttpRequestMethod::Configure(SquidConfig &Config) +HttpRequestMethod::Configure(SquidConfig &cfg) { #if 0 /* extension methods obsolete now that we have METHOD_OTHER always enabled */ - wordlist *w = Config.ext_methods; + wordlist *w = cfg.ext_methods; while (w) { char *s; diff --git a/src/StoreMeta.cc b/src/StoreMeta.cc index 0211d1973d..4065a4854c 100644 --- a/src/StoreMeta.cc +++ b/src/StoreMeta.cc @@ -101,10 +101,10 @@ const int StoreMeta::MinimumTLVLength = 0; const int StoreMeta::MaximumTLVLength = 1 << 16; bool -StoreMeta::validLength(int length) const +StoreMeta::validLength(int aLength) const { - if (!IntRange (MinimumTLVLength, MaximumTLVLength).includes(length)) { - debugs(20, 0, "storeSwapMetaUnpack: insane length (" << length << ")!"); + if (!IntRange (MinimumTLVLength, MaximumTLVLength).includes(aLength)) { + debugs(20, 0, "storeSwapMetaUnpack: insane length (" << aLength << ")!"); return false; } diff --git a/src/String.cci b/src/String.cci index 66790f3d65..085f383517 100644 --- a/src/String.cci +++ b/src/String.cci @@ -80,11 +80,11 @@ String::termedBuf() const } char -String::operator [](unsigned int pos) const +String::operator [](unsigned int aPos) const { - assert(pos < size_); + assert(aPos < size_); - return buf_[pos]; + return buf_[aPos]; } diff --git a/src/SwapDir.cc b/src/SwapDir.cc index d5d75ca1b4..581e4ba74d 100644 --- a/src/SwapDir.cc +++ b/src/SwapDir.cc @@ -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"); } diff --git a/src/acl/Ip.cc b/src/acl/Ip.cc index aa2de1c539..b0951697b3 100644 --- a/src/acl/Ip.cc +++ b/src/acl/Ip.cc @@ -508,10 +508,10 @@ ACLIP::parse() while (q != NULL) { /* pop each result off the list and add it to the data tree individually */ - acl_ip_data *next = q->next; + acl_ip_data *next_node = q->next; q->next = NULL; data = data->insert(q, acl_ip_data::NetworkCompare); - q = next; + q = next_node; } } } 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/auth/basic/auth_basic.cc b/src/auth/basic/auth_basic.cc index aae8d6a2b6..bc67847427 100644 --- a/src/auth/basic/auth_basic.cc +++ b/src/auth/basic/auth_basic.cc @@ -211,11 +211,11 @@ AuthBasicUserRequest::module_direction() } void -AuthBasicConfig::fixHeader(AuthUserRequest *auth_user_request, HttpReply *rep, http_hdr_type type, HttpRequest * request) +AuthBasicConfig::fixHeader(AuthUserRequest *auth_user_request, HttpReply *rep, http_hdr_type hdrType, HttpRequest * request) { if (authenticate) { - debugs(29, 9, HERE << "Sending type:" << type << " header: 'Basic realm=\"" << basicAuthRealm << "\"'"); - httpHeaderPutStrf(&rep->header, type, "Basic realm=\"%s\"", basicAuthRealm); + debugs(29, 9, HERE << "Sending type:" << hdrType << " header: 'Basic realm=\"" << basicAuthRealm << "\"'"); + httpHeaderPutStrf(&rep->header, hdrType, "Basic realm=\"%s\"", basicAuthRealm); } } @@ -382,7 +382,7 @@ BasicUser::deleteSelf() const delete this; } -BasicUser::BasicUser(AuthConfig *config) : AuthUser (config) , passwd (NULL), credentials_checkedtime(0), auth_queue(NULL), cleartext (NULL), currentRequest (NULL), httpAuthHeader (NULL) +BasicUser::BasicUser(AuthConfig *aConfig) : AuthUser (aConfig) , passwd (NULL), credentials_checkedtime(0), auth_queue(NULL), cleartext (NULL), currentRequest (NULL), httpAuthHeader (NULL) { flags.credentials_ok = 0; } diff --git a/src/auth/digest/auth_digest.cc b/src/auth/digest/auth_digest.cc index d482cfbae7..bf0add9313 100644 --- a/src/auth/digest/auth_digest.cc +++ b/src/auth/digest/auth_digest.cc @@ -773,7 +773,7 @@ AuthDigestUserRequest::addTrailer(HttpReply * rep, int accel) /* add the [www-|Proxy-]authenticate header on a 407 or 401 reply */ void -AuthDigestConfig::fixHeader(AuthUserRequest *auth_user_request, HttpReply *rep, http_hdr_type type, HttpRequest * request) +AuthDigestConfig::fixHeader(AuthUserRequest *auth_user_request, HttpReply *rep, http_hdr_type hdrType, HttpRequest * request) { if (!authenticate) return; @@ -791,13 +791,13 @@ AuthDigestConfig::fixHeader(AuthUserRequest *auth_user_request, HttpReply *rep, /* on a 407 or 401 we always use a new nonce */ digest_nonce_h *nonce = authenticateDigestNonceNew(); - debugs(29, 9, "authenticateFixHeader: Sending type:" << type << + debugs(29, 9, "authenticateFixHeader: Sending type:" << hdrType << " header: 'Digest realm=\"" << digestAuthRealm << "\", nonce=\"" << authenticateDigestNonceNonceb64(nonce) << "\", qop=\"" << QOP_AUTH << "\", stale=" << (stale ? "true" : "false")); /* in the future, for WWW auth we may want to support the domain entry */ - httpHeaderPutStrf(&rep->header, type, "Digest realm=\"%s\", nonce=\"%s\", qop=\"%s\", stale=%s", digestAuthRealm, authenticateDigestNonceNonceb64(nonce), QOP_AUTH, stale ? "true" : "false"); + httpHeaderPutStrf(&rep->header, hdrType, "Digest realm=\"%s\", nonce=\"%s\", qop=\"%s\", stale=%s", digestAuthRealm, authenticateDigestNonceNonceb64(nonce), QOP_AUTH, stale ? "true" : "false"); } DigestUser::~DigestUser() @@ -1375,9 +1375,9 @@ AuthDigestUserRequest::module_start(RH * handler, void *data) r->auth_user_request = this; AUTHUSERREQUESTLOCK(r->auth_user_request, "r"); if (digestConfig.utf8) { - char user[1024]; - latin1_to_utf8(user, sizeof(user), digest_user->username()); - snprintf(buf, 8192, "\"%s\":\"%s\"\n", user, realm); + char userstr[1024]; + latin1_to_utf8(userstr, sizeof(userstr), digest_user->username()); + snprintf(buf, 8192, "\"%s\":\"%s\"\n", userstr, realm); } else { snprintf(buf, 8192, "\"%s\":\"%s\"\n", digest_user->username(), realm); } @@ -1385,7 +1385,7 @@ AuthDigestUserRequest::module_start(RH * handler, void *data) helperSubmit(digestauthenticators, buf, authenticateDigestHandleReply, r); } -DigestUser::DigestUser (AuthConfig *config) : AuthUser (config), HA1created (0) +DigestUser::DigestUser (AuthConfig *aConfig) : AuthUser (aConfig), HA1created (0) {} AuthUser * diff --git a/src/auth/negotiate/auth_negotiate.cc b/src/auth/negotiate/auth_negotiate.cc index 01c2f713ba..948422083c 100644 --- a/src/auth/negotiate/auth_negotiate.cc +++ b/src/auth/negotiate/auth_negotiate.cc @@ -301,7 +301,7 @@ AuthNegotiateUserRequest::addHeader(HttpReply * rep, int accel) } void -AuthNegotiateConfig::fixHeader(AuthUserRequest *auth_user_request, HttpReply *rep, http_hdr_type type, HttpRequest * request) +AuthNegotiateConfig::fixHeader(AuthUserRequest *auth_user_request, HttpReply *rep, http_hdr_type reqType, HttpRequest * request) { AuthNegotiateUserRequest *negotiate_request; @@ -314,8 +314,8 @@ AuthNegotiateConfig::fixHeader(AuthUserRequest *auth_user_request, HttpReply *re /* New request, no user details */ if (auth_user_request == NULL) { - debugs(29, 9, "AuthNegotiateConfig::fixHeader: Sending type:" << type << " header: 'Negotiate'"); - httpHeaderPutStrf(&rep->header, type, "Negotiate"); + debugs(29, 9, "AuthNegotiateConfig::fixHeader: Sending type:" << reqType << " header: 'Negotiate'"); + httpHeaderPutStrf(&rep->header, reqType, "Negotiate"); if (!keep_alive) { /* drop the connection */ @@ -342,12 +342,12 @@ AuthNegotiateConfig::fixHeader(AuthUserRequest *auth_user_request, HttpReply *re */ if (negotiate_request->server_blob) { - debugs(29, 9, "authenticateNegotiateFixErrorHeader: Sending type:" << type << " header: 'Negotiate " << negotiate_request->server_blob << "'"); - httpHeaderPutStrf(&rep->header, type, "Negotiate %s", negotiate_request->server_blob); + debugs(29, 9, "authenticateNegotiateFixErrorHeader: Sending type:" << reqType << " header: 'Negotiate " << negotiate_request->server_blob << "'"); + httpHeaderPutStrf(&rep->header, reqType, "Negotiate %s", negotiate_request->server_blob); safe_free(negotiate_request->server_blob); } else { debugs(29, 9, "authenticateNegotiateFixErrorHeader: Connection authenticated"); - httpHeaderPutStrf(&rep->header, type, "Negotiate"); + httpHeaderPutStrf(&rep->header, reqType, "Negotiate"); } break; @@ -355,14 +355,14 @@ AuthNegotiateConfig::fixHeader(AuthUserRequest *auth_user_request, HttpReply *re case AUTHENTICATE_STATE_NONE: /* semantic change: do not drop the connection. * 2.5 implementation used to keep it open - Kinkie */ - debugs(29, 9, "AuthNegotiateConfig::fixHeader: Sending type:" << type << " header: 'Negotiate'"); - httpHeaderPutStrf(&rep->header, type, "Negotiate"); + debugs(29, 9, "AuthNegotiateConfig::fixHeader: Sending type:" << reqType << " header: 'Negotiate'"); + httpHeaderPutStrf(&rep->header, reqType, "Negotiate"); break; case AUTHENTICATE_STATE_IN_PROGRESS: /* we're waiting for a response from the client. Pass it the blob */ - debugs(29, 9, "AuthNegotiateConfig::fixHeader: Sending type:" << type << " header: 'Negotiate " << negotiate_request->server_blob << "'"); - httpHeaderPutStrf(&rep->header, type, "Negotiate %s", negotiate_request->server_blob); + debugs(29, 9, "AuthNegotiateConfig::fixHeader: Sending type:" << reqType << " header: 'Negotiate " << negotiate_request->server_blob << "'"); + httpHeaderPutStrf(&rep->header, reqType, "Negotiate %s", negotiate_request->server_blob); safe_free(negotiate_request->server_blob); break; @@ -660,7 +660,7 @@ AuthNegotiateUserRequest::authenticated() const } void -AuthNegotiateUserRequest::authenticate(HttpRequest * request, ConnStateData * conn, http_hdr_type type) +AuthNegotiateUserRequest::authenticate(HttpRequest * aRequest, ConnStateData * conn, http_hdr_type type) { const char *proxy_auth, *blob; @@ -694,7 +694,7 @@ AuthNegotiateUserRequest::authenticate(HttpRequest * request, ConnStateData * co } /* get header */ - proxy_auth = request->header.getStr(type); + proxy_auth = aRequest->header.getStr(type); /* locate second word */ blob = proxy_auth; @@ -722,8 +722,8 @@ AuthNegotiateUserRequest::authenticate(HttpRequest * request, ConnStateData * co assert(conn->auth_user_request == NULL); conn->auth_user_request = this; AUTHUSERREQUESTLOCK(conn->auth_user_request, "conn"); - this->request = request; - HTTPMSGLOCK(this->request); + request = aRequest; + HTTPMSGLOCK(request); return; break; @@ -743,10 +743,10 @@ AuthNegotiateUserRequest::authenticate(HttpRequest * request, ConnStateData * co client_blob = xstrdup (blob); - if (this->request) - HTTPMSGUNLOCK(this->request); - this->request = request; - HTTPMSGLOCK(this->request); + if (request) + HTTPMSGUNLOCK(request); + request = aRequest; + HTTPMSGLOCK(request); return; break; @@ -801,7 +801,7 @@ NegotiateUser::deleteSelf() const delete this; } -NegotiateUser::NegotiateUser (AuthConfig *config) : AuthUser (config) +NegotiateUser::NegotiateUser (AuthConfig *aConfig) : AuthUser (aConfig) { proxy_auth_list.head = proxy_auth_list.tail = NULL; } diff --git a/src/auth/ntlm/auth_ntlm.cc b/src/auth/ntlm/auth_ntlm.cc index bc1cb5e12b..a2b119bf3e 100644 --- a/src/auth/ntlm/auth_ntlm.cc +++ b/src/auth/ntlm/auth_ntlm.cc @@ -259,7 +259,7 @@ AuthNTLMUserRequest::module_direction() } void -AuthNTLMConfig::fixHeader(AuthUserRequest *auth_user_request, HttpReply *rep, http_hdr_type type, HttpRequest * request) +AuthNTLMConfig::fixHeader(AuthUserRequest *auth_user_request, HttpReply *rep, http_hdr_type hdrType, HttpRequest * request) { AuthNTLMUserRequest *ntlm_request; @@ -272,8 +272,8 @@ AuthNTLMConfig::fixHeader(AuthUserRequest *auth_user_request, HttpReply *rep, ht /* New request, no user details */ if (auth_user_request == NULL) { - debugs(29, 9, "AuthNTLMConfig::fixHeader: Sending type:" << type << " header: 'NTLM'"); - httpHeaderPutStrf(&rep->header, type, "NTLM"); + debugs(29, 9, "AuthNTLMConfig::fixHeader: Sending type:" << hdrType << " header: 'NTLM'"); + httpHeaderPutStrf(&rep->header, hdrType, "NTLM"); if (!keep_alive) { /* drop the connection */ @@ -301,14 +301,14 @@ AuthNTLMConfig::fixHeader(AuthUserRequest *auth_user_request, HttpReply *rep, ht case AUTHENTICATE_STATE_NONE: /* semantic change: do not drop the connection. * 2.5 implementation used to keep it open - Kinkie */ - debugs(29, 9, "AuthNTLMConfig::fixHeader: Sending type:" << type << " header: 'NTLM'"); - httpHeaderPutStrf(&rep->header, type, "NTLM"); + debugs(29, 9, "AuthNTLMConfig::fixHeader: Sending type:" << hdrType << " header: 'NTLM'"); + httpHeaderPutStrf(&rep->header, hdrType, "NTLM"); break; case AUTHENTICATE_STATE_IN_PROGRESS: /* we're waiting for a response from the client. Pass it the blob */ - debugs(29, 9, "AuthNTLMConfig::fixHeader: Sending type:" << type << " header: 'NTLM " << ntlm_request->server_blob << "'"); - httpHeaderPutStrf(&rep->header, type, "NTLM %s", ntlm_request->server_blob); + debugs(29, 9, "AuthNTLMConfig::fixHeader: Sending type:" << hdrType << " header: 'NTLM " << ntlm_request->server_blob << "'"); + httpHeaderPutStrf(&rep->header, hdrType, "NTLM %s", ntlm_request->server_blob); safe_free(ntlm_request->server_blob); break; @@ -577,7 +577,7 @@ AuthNTLMUserRequest::authenticated() const } void -AuthNTLMUserRequest::authenticate(HttpRequest * request, ConnStateData * conn, http_hdr_type type) +AuthNTLMUserRequest::authenticate(HttpRequest * aRequest, ConnStateData * conn, http_hdr_type type) { const char *proxy_auth, *blob; @@ -611,7 +611,7 @@ AuthNTLMUserRequest::authenticate(HttpRequest * request, ConnStateData * conn, h } /* get header */ - proxy_auth = request->header.getStr(type); + proxy_auth = aRequest->header.getStr(type); /* locate second word */ blob = proxy_auth; @@ -640,8 +640,8 @@ AuthNTLMUserRequest::authenticate(HttpRequest * request, ConnStateData * conn, h assert(conn->auth_user_request == NULL); conn->auth_user_request = this; AUTHUSERREQUESTLOCK(conn->auth_user_request, "conn"); - this->request = request; - HTTPMSGLOCK(this->request); + request = aRequest; + HTTPMSGLOCK(request); return; break; @@ -661,10 +661,10 @@ AuthNTLMUserRequest::authenticate(HttpRequest * request, ConnStateData * conn, h client_blob = xstrdup (blob); - if (this->request) - HTTPMSGUNLOCK(this->request); - this->request = request; - HTTPMSGLOCK(this->request); + if (request) + HTTPMSGUNLOCK(request); + request = aRequest; + HTTPMSGLOCK(request); return; break; @@ -716,7 +716,7 @@ NTLMUser::deleteSelf() const delete this; } -NTLMUser::NTLMUser (AuthConfig *config) : AuthUser (config) +NTLMUser::NTLMUser (AuthConfig *aConfig) : AuthUser (aConfig) { proxy_auth_list.head = proxy_auth_list.tail = NULL; } diff --git a/src/cache_manager.cc b/src/cache_manager.cc index 164bb41907..fec0086866 100644 --- a/src/cache_manager.cc +++ b/src/cache_manager.cc @@ -288,9 +288,9 @@ CacheManager::Start(int fd, HttpRequest * request, StoreEntry * entry) if (CheckPassword(mgr) != 0) { /* build error message */ - ErrorState *err; + ErrorState *errState; HttpReply *rep; - err = errorCon(ERR_CACHE_MGR_ACCESS_DENIED, HTTP_UNAUTHORIZED, request); + errState = errorCon(ERR_CACHE_MGR_ACCESS_DENIED, HTTP_UNAUTHORIZED, request); /* warn if user specified incorrect password */ if (mgr->passwd) @@ -304,9 +304,9 @@ CacheManager::Start(int fd, HttpRequest * request, StoreEntry * entry) fd_table[fd].ipaddr << ": password needed for '" << mgr->action << "'" ); - rep = err->BuildHttpReply(); + rep = errState->BuildHttpReply(); - errorStateFree(err); + errorStateFree(errState); /* * add Authenticate header, use 'action' as a realm because diff --git a/src/cbdata.h b/src/cbdata.h index 5c4b0320e5..617f3dfac8 100644 --- a/src/cbdata.h +++ b/src/cbdata.h @@ -448,7 +448,7 @@ class generic_cbdata { public: - generic_cbdata(void * data) : data(data) {} + generic_cbdata(void * aData) : data(aData) {} templatevoid unwrap(wrapped_type **output) { *output = static_cast(data); diff --git a/src/client_side.cc b/src/client_side.cc index 4d3b9a0b30..026a4f5b04 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -981,14 +981,14 @@ ClientSocketContext::packRange(StoreIOBuffer const &source, MemBuf * mb) return; } - int64_t next = getNextRangeOffset(); + int64_t nextOffset = getNextRangeOffset(); - assert (next >= http->out.offset); + assert (nextOffset >= http->out.offset); - int64_t skip = next - http->out.offset; + int64_t skip = nextOffset - http->out.offset; /* adjust for not to be transmitted bytes */ - http->out.offset = next; + http->out.offset = nextOffset; if (available.size() <= skip) return; @@ -1668,23 +1668,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; @@ -1697,7 +1697,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; @@ -3732,7 +3732,7 @@ ConnStateData::clientPinnedConnectionClosed(const CommCloseCbParams &io) * connection has gone away */ } -void ConnStateData::pinConnection(int pinning_fd, HttpRequest *request, struct peer *peer, bool auth) +void ConnStateData::pinConnection(int pinning_fd, HttpRequest *request, struct peer *aPeer, bool auth) { fde *f; char desc[FD_DESC_SZ]; @@ -3751,12 +3751,12 @@ void ConnStateData::pinConnection(int pinning_fd, HttpRequest *request, struct p pinning.pinned = true; if (pinning.peer) cbdataReferenceDone(pinning.peer); - if (peer) - pinning.peer = cbdataReference(peer); + if (aPeer) + pinning.peer = cbdataReference(aPeer); pinning.auth = auth; f = &fd_table[fd]; snprintf(desc, FD_DESC_SZ, "%s pinned connection for %s:%d (%d)", - (auth || !peer) ? request->GetHost() : peer->name, f->ipaddr, (int) f->remote_port, fd); + (auth || !aPeer) ? request->GetHost() : aPeer->name, f->ipaddr, (int) f->remote_port, fd); fd_note(pinning_fd, desc); typedef CommCbMemFunT Dialer; @@ -3766,7 +3766,7 @@ void ConnStateData::pinConnection(int pinning_fd, HttpRequest *request, struct p } -int ConnStateData::validatePinnedConnection(HttpRequest *request, const struct peer *peer) +int ConnStateData::validatePinnedConnection(HttpRequest *request, const struct peer *aPeer) { bool valid = true; if (pinning.fd < 0) @@ -3781,7 +3781,7 @@ int ConnStateData::validatePinnedConnection(HttpRequest *request, const struct p if (pinning.peer && !cbdataReferenceValid(pinning.peer)) { valid = false; } - if (peer != pinning.peer) { + if (aPeer != pinning.peer) { valid = false; } diff --git a/src/client_side_reply.cc b/src/client_side_reply.cc index 20358acdb2..3ae6af5b93 100644 --- a/src/client_side_reply.cc +++ b/src/client_side_reply.cc @@ -126,22 +126,22 @@ clientReplyContext::removeStoreReference(store_client ** scp, StoreEntry ** ep) { StoreEntry *e; - store_client *sc = *scp; + store_client *sc_tmp = *scp; if ((e = *ep) != NULL) { *ep = NULL; - storeUnregister(sc, e, this); + storeUnregister(sc_tmp, e, this); *scp = NULL; e->unlock(); } } void -clientReplyContext::removeClientStoreReference(store_client **scp, ClientHttpRequest *http) +clientReplyContext::removeClientStoreReference(store_client **scp, ClientHttpRequest *aHttpRequest) { - StoreEntry *reference = http->storeEntry(); + StoreEntry *reference = aHttpRequest->storeEntry(); removeStoreReference(scp, &reference); - http->storeEntry(reference); + aHttpRequest->storeEntry(reference); } void * @@ -217,8 +217,8 @@ clientReplyContext::triggerInitialStoreRead() * startSendProcess */ assert(reqofs == 0); - StoreIOBuffer tempBuffer (next()->readBuffer.length, 0, next()->readBuffer.data); - storeClientCopy(sc, http->storeEntry(), tempBuffer, SendMoreData, this); + StoreIOBuffer localTempBuffer (next()->readBuffer.length, 0, next()->readBuffer.data); + storeClientCopy(sc, http->storeEntry(), localTempBuffer, SendMoreData, this); } /* there is an expired entry in the store. @@ -278,8 +278,8 @@ clientReplyContext::processExpired() { /* start counting the length from 0 */ - StoreIOBuffer tempBuffer(HTTP_REQBUF_SZ, 0, tempbuf); - storeClientCopy(sc, entry, tempBuffer, HandleIMSReply, this); + StoreIOBuffer localTempBuffer(HTTP_REQBUF_SZ, 0, tempbuf); + storeClientCopy(sc, entry, localTempBuffer, HandleIMSReply, this); } } @@ -807,7 +807,7 @@ clientReplyContext::purgeFoundObject(StoreEntry *entry) return; } - StoreIOBuffer tempBuffer; + StoreIOBuffer localTempBuffer; /* Swap in the metadata */ http->storeEntry(entry); @@ -822,14 +822,14 @@ clientReplyContext::purgeFoundObject(StoreEntry *entry) reqofs = 0; - tempBuffer.offset = http->out.offset; + localTempBuffer.offset = http->out.offset; - tempBuffer.length = next()->readBuffer.length; + localTempBuffer.length = next()->readBuffer.length; - tempBuffer.data = next()->readBuffer.data; + localTempBuffer.data = next()->readBuffer.data; storeClientCopy(sc, http->storeEntry(), - tempBuffer, CacheHit, this); + localTempBuffer, CacheHit, this); } void @@ -947,15 +947,15 @@ clientReplyContext::purgeDoPurgeHead(StoreEntry *newEntry) void clientReplyContext::traceReply(clientStreamNode * node) { - clientStreamNode *next = (clientStreamNode *)node->node.next->data; - StoreIOBuffer tempBuffer; + clientStreamNode *nextNode = (clientStreamNode *)node->node.next->data; + StoreIOBuffer localTempBuffer; assert(http->request->max_forwards == 0); createStoreEntry(http->request->method, request_flags()); - tempBuffer.offset = next->readBuffer.offset + headers_sz; - tempBuffer.length = next->readBuffer.length; - tempBuffer.data = next->readBuffer.data; + localTempBuffer.offset = nextNode->readBuffer.offset + headers_sz; + localTempBuffer.length = nextNode->readBuffer.length; + localTempBuffer.data = nextNode->readBuffer.data; storeClientCopy(sc, http->storeEntry(), - tempBuffer, SendMoreData, this); + localTempBuffer, SendMoreData, this); http->storeEntry()->releaseRequest(); http->storeEntry()->buffer(); HttpReply *rep = new HttpReply; @@ -1021,7 +1021,7 @@ clientReplyContext::storeNotOKTransferDone() const assert(mem != NULL); assert(http->request != NULL); /* mem->reply was wrong because it uses the UPSTREAM header length!!! */ - HttpReply const *reply = mem->getReply(); + HttpReply const *curReply = mem->getReply(); if (headers_sz == 0) /* haven't found end of headers yet */ @@ -1029,9 +1029,9 @@ clientReplyContext::storeNotOKTransferDone() const int sending = SENDING_BODY; - if (reply->sline.status == HTTP_NO_CONTENT || - reply->sline.status == HTTP_NOT_MODIFIED || - reply->sline.status < HTTP_OK || + if (curReply->sline.status == HTTP_NO_CONTENT || + curReply->sline.status == HTTP_NOT_MODIFIED || + curReply->sline.status < HTTP_OK || http->request->method == METHOD_HEAD) sending = SENDING_HDRSONLY; @@ -1040,10 +1040,10 @@ clientReplyContext::storeNotOKTransferDone() const * If we are sending a body and we don't have a content-length, * then we must wait for the object to become STORE_OK. */ - if (reply->content_length < 0) + if (curReply->content_length < 0) return 0; - int64_t expectedLength = reply->content_length + http->out.headers_sz; + int64_t expectedLength = curReply->content_length + http->out.headers_sz; if (http->out.size < expectedLength) return 0; @@ -1277,11 +1277,11 @@ clientReplyContext::buildReplyHeader() /* TODO: if maxage or s-maxage is present, don't do this */ if (squid_curtime - http->storeEntry()->timestamp >= 86400) { - char tempbuf[512]; - snprintf (tempbuf, sizeof(tempbuf), "%s %s %s", + char tbuf[512]; + snprintf (tbuf, sizeof(tbuf), "%s %s %s", "113", ThisCache, "This cache hit is still fresh and more than 1 day old"); - hdr->putStr(HDR_WARNING, tempbuf); + hdr->putStr(HDR_WARNING, tbuf); } } } @@ -1642,7 +1642,7 @@ clientReplyContext::doGetMoreData() /* We still have to do store logic processing - vary, cache hit etc */ if (http->storeEntry() != NULL) { /* someone found the object in the cache for us */ - StoreIOBuffer tempBuffer; + StoreIOBuffer localTempBuffer; http->storeEntry()->lock(); @@ -1675,10 +1675,10 @@ clientReplyContext::doGetMoreData() comm_set_tos(http->getConn()->fd, Config.zph.tos_local_hit); } #endif /* USE_ZPH_QOS */ - tempBuffer.offset = reqofs; - tempBuffer.length = getNextNode()->readBuffer.length; - tempBuffer.data = getNextNode()->readBuffer.data; - storeClientCopy(sc, http->storeEntry(), tempBuffer, CacheHit, this); + localTempBuffer.offset = reqofs; + localTempBuffer.length = getNextNode()->readBuffer.length; + localTempBuffer.data = getNextNode()->readBuffer.data; + storeClientCopy(sc, http->storeEntry(), localTempBuffer, CacheHit, this); } else { /* MISS CASE, http->logType is already set! */ processMiss(); @@ -1730,17 +1730,17 @@ clientReplyContext::sendStreamError(StoreIOBuffer const &result) * client socket! */ debugs(88, 5, "clientReplyContext::sendStreamError: A stream error has occured, marking as complete and sending no data."); - StoreIOBuffer tempBuffer; + StoreIOBuffer localTempBuffer; flags.complete = 1; - tempBuffer.flags.error = result.flags.error; + localTempBuffer.flags.error = result.flags.error; clientStreamCallback((clientStreamNode*)http->client_stream.head->data, http, NULL, - tempBuffer); + localTempBuffer); } void clientReplyContext::pushStreamData(StoreIOBuffer const &result, char *source) { - StoreIOBuffer tempBuffer; + StoreIOBuffer localTempBuffer; if (result.length == 0) { debugs(88, 5, "clientReplyContext::pushStreamData: marking request as complete due to 0 length store result"); @@ -1748,14 +1748,14 @@ clientReplyContext::pushStreamData(StoreIOBuffer const &result, char *source) } assert(result.offset - headers_sz == next()->readBuffer.offset); - tempBuffer.offset = result.offset - headers_sz; - tempBuffer.length = result.length; + localTempBuffer.offset = result.offset - headers_sz; + localTempBuffer.length = result.length; - if (tempBuffer.length) - tempBuffer.data = source; + if (localTempBuffer.length) + localTempBuffer.data = source; clientStreamCallback((clientStreamNode*)http->client_stream.head->data, http, NULL, - tempBuffer); + localTempBuffer); } clientStreamNode * @@ -1893,7 +1893,7 @@ clientReplyContext::processReplyAccessResult(bool accessAllowed) assert (!flags.headersSent); flags.headersSent = true; - StoreIOBuffer tempBuffer; + StoreIOBuffer localTempBuffer; char *buf = next()->readBuffer.data; char *body_buf = buf + reply->hdr_sz; @@ -1907,20 +1907,20 @@ clientReplyContext::processReplyAccessResult(bool accessAllowed) if (next()->readBuffer.offset != 0) { if (next()->readBuffer.offset > body_size) { /* Can't use any of the body we received. send nothing */ - tempBuffer.length = 0; - tempBuffer.data = NULL; + localTempBuffer.length = 0; + localTempBuffer.data = NULL; } else { - tempBuffer.length = body_size - next()->readBuffer.offset; - tempBuffer.data = body_buf + next()->readBuffer.offset; + localTempBuffer.length = body_size - next()->readBuffer.offset; + localTempBuffer.data = body_buf + next()->readBuffer.offset; } } else { - tempBuffer.length = body_size; - tempBuffer.data = body_buf; + localTempBuffer.length = body_size; + localTempBuffer.data = body_buf; } /* TODO??: move the data in the buffer back by the request header size */ clientStreamCallback((clientStreamNode *)http->client_stream.head->data, - http, reply, tempBuffer); + http, reply, localTempBuffer); return; } @@ -2031,7 +2031,7 @@ clientReplyContext::sendMoreData (StoreIOBuffer result) /* Using this breaks the client layering just a little! */ void -clientReplyContext::createStoreEntry(const HttpRequestMethod& m, request_flags flags) +clientReplyContext::createStoreEntry(const HttpRequestMethod& m, request_flags reqFlags) { assert(http != NULL); /* @@ -2042,7 +2042,7 @@ clientReplyContext::createStoreEntry(const HttpRequestMethod& m, request_flags f if (http->request == NULL) http->request = HTTPMSGLOCK(new HttpRequest(m, PROTO_NONE, null_string)); - StoreEntry *e = storeCreateEntry(http->uri, http->log_uri, flags, m); + StoreEntry *e = storeCreateEntry(http->uri, http->log_uri, reqFlags, m); sc = storeClientListAdd(e, this); @@ -2065,7 +2065,7 @@ clientReplyContext::createStoreEntry(const HttpRequestMethod& m, request_flags f // storeClientCopy(http->sc, e, 0, HTTP_REQBUF_SZ, http->reqbuf, // SendMoreData, this); /* So, we mark the store logic as complete */ - this->flags.storelogiccomplete = 1; + flags.storelogiccomplete = 1; /* and get the caller to request a read, from whereever they are */ /* NOTE: after ANY data flows down the pipe, even one step, diff --git a/src/comm.cc b/src/comm.cc index b1fc8786cc..e6a9228e6f 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -265,7 +265,7 @@ private: typedef enum { COMM_CB_READ = 1, - COMM_CB_DERIVED, + COMM_CB_DERIVED } comm_callback_t; struct _fd_debug_t { diff --git a/src/errorpage.cc b/src/errorpage.cc index da68d6c12e..cdc541a8ac 100644 --- a/src/errorpage.cc +++ b/src/errorpage.cc @@ -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 { @@ -738,7 +738,7 @@ ErrorState::Convert(char token) case 'R': if (NULL != request) { - Packer p; + Packer pck; String urlpath_or_slash; if (request->urlpath.size() != 0) @@ -750,9 +750,9 @@ ErrorState::Convert(char token) RequestMethodStr(request->method), SQUIDSTRINGPRINT(urlpath_or_slash), request->http_ver.major, request->http_ver.minor); - packerToMemInit(&p, &mb); - request->header.packInto(&p); - packerClean(&p); + packerToMemInit(&pck, &mb); + request->header.packInto(&pck); + packerClean(&pck); } else if (request_hdrs) { p = request_hdrs; } else { 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/event.cc b/src/event.cc index f07437e986..612b8fcd71 100644 --- a/src/event.cc +++ b/src/event.cc @@ -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 evWhen, + int aWeight, bool haveArgument) : name(aName), func(aFunction), + arg(haveArgument ? cbdataReference(aArgument) : aArgument), when(evWhen), weight(aWeight), + cbdata(haveArgument) { } diff --git a/src/forward.cc b/src/forward.cc index 0817679251..fe1e7ed959 100644 --- a/src/forward.cc +++ b/src/forward.cc @@ -868,14 +868,14 @@ FwdState::connectStart() debugs(17, 3, "fwdConnectStart: got outgoing addr " << outgoing << ", tos " << tos); - int flags = COMM_NONBLOCKING; + int commFlags = COMM_NONBLOCKING; if (request->flags.spoof_client_ip) { if (!fs->_peer || !fs->_peer->options.no_tproxy) - flags |= COMM_TRANSPARENT; + commFlags |= COMM_TRANSPARENT; // else no tproxy today ... } - fd = comm_openex(SOCK_STREAM, IPPROTO_TCP, outgoing, flags, tos, url); + fd = comm_openex(SOCK_STREAM, IPPROTO_TCP, outgoing, commFlags, tos, url); debugs(17, 3, "fwdConnectStart: got TCP FD " << fd); diff --git a/src/fs/ufs/store_dir_ufs.cc b/src/fs/ufs/store_dir_ufs.cc index 5b09fcf3eb..0de9f1255c 100644 --- a/src/fs/ufs/store_dir_ufs.cc +++ b/src/fs/ufs/store_dir_ufs.cc @@ -107,7 +107,7 @@ UFSSwapDir::parseSizeL1L2() */ void -UFSSwapDir::reconfigure(int index, char *path) +UFSSwapDir::reconfigure(int aIndex, char *aPath) { parseSizeL1L2(); parseOptions(1); @@ -154,12 +154,12 @@ UFSSwapDir::changeIO(DiskIOModule *module) } bool -UFSSwapDir::optionIOParse(char const *option, const char *value, int reconfiguring) +UFSSwapDir::optionIOParse(char const *option, const char *value, int isaReconfig) { if (strcmp(option, "IOEngine") != 0) return false; - if (reconfiguring) + if (isaReconfig) /* silently ignore this */ return true; @@ -431,15 +431,15 @@ UFSSwapDir::dereference(StoreEntry & e) } StoreIOState::Pointer -UFSSwapDir::createStoreIO(StoreEntry &e, StoreIOState::STFNCB * file_callback, StoreIOState::STIOCB * callback, void *callback_data) +UFSSwapDir::createStoreIO(StoreEntry &e, StoreIOState::STFNCB * file_callback, StoreIOState::STIOCB * aCallback, void *callback_data) { - return IO->create (this, &e, file_callback, callback, callback_data); + return IO->create (this, &e, file_callback, aCallback, callback_data); } StoreIOState::Pointer -UFSSwapDir::openStoreIO(StoreEntry &e, StoreIOState::STFNCB * file_callback, StoreIOState::STIOCB * callback, void *callback_data) +UFSSwapDir::openStoreIO(StoreEntry &e, StoreIOState::STFNCB * file_callback, StoreIOState::STIOCB * aCallback, void *callback_data) { - return IO->open (this, &e, file_callback, callback, callback_data); + return IO->open (this, &e, file_callback, aCallback, callback_data); } int @@ -489,50 +489,50 @@ UFSSwapDir::swapSubDir(int subdirn)const } int -UFSSwapDir::createDirectory(const char *path, int should_exist) +UFSSwapDir::createDirectory(const char *aPath, int should_exist) { int created = 0; struct stat st; getCurrentTime(); - if (0 == ::stat(path, &st)) { + if (0 == ::stat(aPath, &st)) { if (S_ISDIR(st.st_mode)) { - debugs(47, (should_exist ? 3 : 1), path << " exists"); + debugs(47, (should_exist ? 3 : 1), aPath << " exists"); } else { - fatalf("Swap directory %s is not a directory.", path); + fatalf("Swap directory %s is not a directory.", aPath); } #ifdef _SQUID_MSWIN_ - } else if (0 == mkdir(path)) { + } else if (0 == mkdir(aPath)) { #else - } else if (0 == mkdir(path, 0755)) { + } else if (0 == mkdir(aPath, 0755)) { #endif - debugs(47, (should_exist ? 1 : 3), path << " created"); + debugs(47, (should_exist ? 1 : 3), aPath << " created"); created = 1; } else { fatalf("Failed to make swap directory %s: %s", - path, xstrerror()); + aPath, xstrerror()); } return created; } bool -UFSSwapDir::pathIsDirectory(const char *path)const +UFSSwapDir::pathIsDirectory(const char *aPath)const { struct stat sb; - if (::stat(path, &sb) < 0) { - debugs(47, 0, "" << path << ": " << xstrerror()); + if (::stat(aPath, &sb) < 0) { + debugs(47, 0, "" << aPath << ": " << xstrerror()); return false; } if (S_ISDIR(sb.st_mode) == 0) { - debugs(47, 0, "" << path << " is not a directory"); + debugs(47, 0, "" << aPath << " is not a directory"); return false; } @@ -686,7 +686,7 @@ UFSSwapDir::addDiskRestore(const cache_key * key, time_t lastref, time_t lastmod, u_int32_t refcount, - u_int16_t flags, + u_int16_t newFlags, int clean) { StoreEntry *e = NULL; @@ -707,7 +707,7 @@ UFSSwapDir::addDiskRestore(const cache_key * key, e->expires = expires; e->lastmod = lastmod; e->refcount = refcount; - e->flags = flags; + e->flags = newFlags; EBIT_SET(e->flags, ENTRY_CACHABLE); EBIT_CLR(e->flags, RELEASE_REQUEST); EBIT_CLR(e->flags, KEY_PRIVATE); @@ -1388,10 +1388,10 @@ StoreSearchUFS::~StoreSearchUFS() } void -StoreSearchUFS::next(void (callback)(void *cbdata), void *cbdata) +StoreSearchUFS::next(void (aCallback)(void *cbdata), void *aCallbackArgs) { next(); - callback (cbdata); + aCallback(aCallbackArgs); } bool diff --git a/src/fs/ufs/store_io_ufs.cc b/src/fs/ufs/store_io_ufs.cc index 1f86970dee..035e6935fa 100644 --- a/src/fs/ufs/store_io_ufs.cc +++ b/src/fs/ufs/store_io_ufs.cc @@ -65,9 +65,9 @@ UFSStrategy::~UFSStrategy () } StoreIOState::Pointer -UFSStrategy::createState(SwapDir *SD, StoreEntry *e, StoreIOState::STIOCB * callback, void *callback_data) const +UFSStrategy::createState(SwapDir *SD, StoreEntry *e, StoreIOState::STIOCB * aCallback, void *callback_data) const { - return new UFSStoreState (SD, e, callback, callback_data); + return new UFSStoreState (SD, e, aCallback, callback_data); } DiskFile::Pointer @@ -198,28 +198,28 @@ UFSStoreState::close() } void -UFSStoreState::read_(char *buf, size_t size, off_t offset, STRCB * callback, void *callback_data) +UFSStoreState::read_(char *buf, size_t size, off_t aOffset, STRCB * aCallback, void *aCallbackData) { assert(read.callback == NULL); assert(read.callback_data == NULL); assert(!reading); assert(!closing); - assert (callback); + assert (aCallback); if (!theFile->canRead()) { debugs(79, 3, "UFSStoreState::read_: queueing read because theFile can't read"); - queueRead (buf, size, offset, callback, callback_data); + queueRead (buf, size, aOffset, aCallback, aCallbackData); return; } - read.callback = callback; - read.callback_data = cbdataReference(callback_data); + read.callback = aCallback; + read.callback_data = cbdataReference(aCallbackData); debugs(79, 3, "UFSStoreState::read_: dirno " << swap_dirn << ", fileno "<< std::setfill('0') << std::hex << std::uppercase << std::setw(8) << swap_filen); - offset_ = offset; + offset_ = aOffset; read_buf = buf; reading = true; - theFile->read(new ReadRequest(buf,offset,size)); + theFile->read(new ReadRequest(buf,aOffset,size)); } @@ -232,7 +232,7 @@ UFSStoreState::read_(char *buf, size_t size, off_t offset, STRCB * callback, voi * code simpler and always go through the pending_writes queue. */ void -UFSStoreState::write(char const *buf, size_t size, off_t offset, FREE * free_func) +UFSStoreState::write(char const *buf, size_t size, off_t aOffset, FREE * free_func) { debugs(79, 3, "UFSStoreState::write: dirn " << swap_dirn << ", fileno "<< std::setfill('0') << std::hex << std::uppercase << std::setw(8) << swap_filen); @@ -244,7 +244,7 @@ UFSStoreState::write(char const *buf, size_t size, off_t offset, FREE * free_fun return; } - queueWrite(buf, size, offset, free_func); + queueWrite(buf, size, aOffset, free_func); drainWriteQueue(); } @@ -311,9 +311,9 @@ UFSStoreState::readCompleted(const char *buf, int len, int errflag, RefCount 0) offset_ += len; - STRCB *callback = read.callback; + STRCB *callback_ = read.callback; - assert(callback); + assert(callback_); read.callback = NULL; @@ -335,7 +335,7 @@ UFSStoreState::readCompleted(const char *buf, int len, int errflag, RefCount 0 && read_buf != buf) memcpy(read_buf, buf, len); - callback(cbdata, read_buf, len, this); + callback_(cbdata, read_buf, len, this); } if (flags.try_closing || (theFile != NULL && theFile->error()) ) @@ -461,7 +461,7 @@ UFSStoreState::kickReadQueue() } void -UFSStoreState::queueRead(char *buf, size_t size, off_t offset, STRCB *callback, void *callback_data) +UFSStoreState::queueRead(char *buf, size_t size, off_t aOffset, STRCB *callback_, void *callback_data_) { debugs(79, 3, "UFSStoreState::queueRead: queueing read"); assert(opening); @@ -469,9 +469,9 @@ UFSStoreState::queueRead(char *buf, size_t size, off_t offset, STRCB *callback, _queued_read *q = new _queued_read; q->buf = buf; q->size = size; - q->offset = offset; - q->callback = callback; - q->callback_data = cbdataReference(callback_data); + q->offset = aOffset; + q->callback = callback_; + q->callback_data = cbdataReference(callback_data_); linklistPush(&pending_reads, q); } @@ -537,7 +537,7 @@ UFSStoreState::tryClosing() } void -UFSStoreState::queueWrite(char const *buf, size_t size, off_t offset, FREE * free_func) +UFSStoreState::queueWrite(char const *buf, size_t size, off_t aOffset, FREE * free_func) { debugs(79, 3, HERE << this << " UFSStoreState::queueWrite: queueing write of size " << size); @@ -545,20 +545,20 @@ UFSStoreState::queueWrite(char const *buf, size_t size, off_t offset, FREE * fre q = new _queued_write; q->buf = buf; q->size = size; - q->offset = offset; + q->offset = aOffset; q->free_func = free_func; linklistPush(&pending_writes, q); } StoreIOState::Pointer UFSStrategy::open(SwapDir * SD, StoreEntry * e, StoreIOState::STFNCB * file_callback, - StoreIOState::STIOCB * callback, void *callback_data) + StoreIOState::STIOCB * aCallback, void *callback_data) { assert (((UFSSwapDir *)SD)->IO == this); debugs(79, 3, "UFSStrategy::open: fileno "<< std::setfill('0') << std::hex << std::uppercase << std::setw(8) << e->swap_filen); /* to consider: make createstate a private UFSStrategy call */ - StoreIOState::Pointer sio = createState (SD, e, callback, callback_data); + StoreIOState::Pointer sio = createState (SD, e, aCallback, callback_data); sio->mode |= O_RDONLY; @@ -587,7 +587,7 @@ UFSStrategy::open(SwapDir * SD, StoreEntry * e, StoreIOState::STFNCB * file_call StoreIOState::Pointer UFSStrategy::create(SwapDir * SD, StoreEntry * e, StoreIOState::STFNCB * file_callback, - StoreIOState::STIOCB * callback, void *callback_data) + StoreIOState::STIOCB * aCallback, void *callback_data) { assert (((UFSSwapDir *)SD)->IO == this); /* Allocate a number */ @@ -596,7 +596,7 @@ UFSStrategy::create(SwapDir * SD, StoreEntry * e, StoreIOState::STFNCB * file_ca /* Shouldn't we handle a 'bitmap full' error here? */ - StoreIOState::Pointer sio = createState (SD, e, callback, callback_data); + StoreIOState::Pointer sio = createState (SD, e, aCallback, callback_data); sio->mode |= O_WRONLY | O_CREAT | O_TRUNC; diff --git a/src/fs/ufs/ufscommon.cc b/src/fs/ufs/ufscommon.cc index 558410e68b..02d66c4c98 100644 --- a/src/fs/ufs/ufscommon.cc +++ b/src/fs/ufs/ufscommon.cc @@ -783,7 +783,7 @@ RebuildState::getNextFile(sfileno * filn_p, int *size) } void -RebuildState::next(void (callback)(void *cbdata), void *cbdata) +RebuildState::next(void (aCallback)(void *aCallbackDataarg), void *aCallbackData) { /* for now, we don't cache at all */ speed = 1; @@ -792,7 +792,7 @@ RebuildState::next(void (callback)(void *cbdata), void *cbdata) while (!isDone() && currentEntry() == NULL) rebuildStep(); - callback(cbdata); + aCallback(aCallbackData); } bool diff --git a/src/ftp.cc b/src/ftp.cc index f1e2fb4a17..7aebd10ad2 100644 --- a/src/ftp.cc +++ b/src/ftp.cc @@ -898,7 +898,7 @@ ftpListParseParts(const char *buf, struct _ftp_flags flags) p->type = 0; while (ct && *ct) { - time_t t; + time_t tm; int l = strcspn(ct, ","); char *tmp; @@ -916,12 +916,12 @@ ftpListParseParts(const char *buf, struct _ftp_flags flags) break; case 'm': - t = (time_t) strtol(ct + 1, &tmp, 0); + tm = (time_t) strtol(ct + 1, &tmp, 0); if (tmp != ct + 1) break; /* not a valid integer */ - p->date = xstrdup(ctime(&t)); + p->date = xstrdup(ctime(&tm)); *(strstr(p->date, "\n")) = '\0'; @@ -3924,10 +3924,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); } /** diff --git a/src/http.cc b/src/http.cc index c97d572f4b..74264b3a66 100644 --- a/src/http.cc +++ b/src/http.cc @@ -1221,22 +1221,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; } /** @@ -1350,10 +1350,10 @@ HttpStateData::maybeReadVirginBody() { // we may need to grow the buffer if headers do not fit const int minRead = flags.headers_parsed ? 0 :1024; - const int read_sz = replyBodySpace(*readBuf, minRead); + const int read_size = replyBodySpace(*readBuf, minRead); debugs(11,9, HERE << (flags.do_next_read ? "may" : "wont") << - " read up to " << read_sz << " bytes from FD " << fd); + " read up to " << read_size << " bytes from FD " << fd); /* * why <2? Because delayAwareRead() won't actually read if @@ -1363,13 +1363,13 @@ HttpStateData::maybeReadVirginBody() * handler until we get a notification from someone that * its okay to read again. */ - if (read_sz < 2) + if (read_size < 2) return; if (flags.do_next_read) { flags.do_next_read = 0; typedef CommCbMemFunT Dialer; - entry->delayAwareRead(fd, readBuf->space(read_sz), read_sz, + entry->delayAwareRead(fd, readBuf->space(read_size), read_size, asyncCall(11, 5, "HttpStateData::readReply", Dialer(this, &HttpStateData::readReply))); } @@ -1895,28 +1895,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); 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); diff --git a/src/main.cc b/src/main.cc index 554e4e4880..5ef34a034c 100644 --- a/src/main.cc +++ b/src/main.cc @@ -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: diff --git a/src/mem.cc b/src/mem.cc index 334304506b..226712b880 100644 --- a/src/mem.cc +++ b/src/mem.cc @@ -504,7 +504,7 @@ memInUse(mem_type type) /* ick */ -static void +void memFree2K(void *p) { memFree(p, MEM_2K_BUF); @@ -522,19 +522,19 @@ memFree8K(void *p) memFree(p, MEM_8K_BUF); } -static void +void memFree16K(void *p) { memFree(p, MEM_16K_BUF); } -static void +void memFree32K(void *p) { memFree(p, MEM_32K_BUF); } -static void +void memFree64K(void *p) { memFree(p, MEM_64K_BUF); diff --git a/src/protos.h b/src/protos.h index 8caeb03341..fb8dc73614 100644 --- a/src/protos.h +++ b/src/protos.h @@ -83,7 +83,7 @@ SQUIDCEXTERN void clientdbInit(void); SQUIDCEXTERN void clientdbUpdate(const IpAddress &, log_type, protocol_t, size_t); SQUIDCEXTERN int clientdbCutoffDenied(const IpAddress &); -SQUIDCEXTERN void clientdbDump(StoreEntry *); +void clientdbDump(StoreEntry *); SQUIDCEXTERN void clientdbFreeMemory(void); SQUIDCEXTERN int clientdbEstablished(const IpAddress &, int); @@ -473,8 +473,12 @@ SQUIDCEXTERN void *memAllocString(size_t net_size, size_t * gross_size); SQUIDCEXTERN void *memAllocBuf(size_t net_size, size_t * gross_size); SQUIDCEXTERN void *memReallocBuf(void *buf, size_t net_size, size_t * gross_size); SQUIDCEXTERN void memFree(void *, int type); -SQUIDCEXTERN void memFree4K(void *); -SQUIDCEXTERN void memFree8K(void *); +void memFree2K(void *); +void memFree4K(void *); +void memFree8K(void *); +void memFree16K(void *); +void memFree32K(void *); +void memFree64K(void *); SQUIDCEXTERN void memFreeString(size_t size, void *); SQUIDCEXTERN void memFreeBuf(size_t size, void *); SQUIDCEXTERN FREE *memFreeBufFunc(size_t size); diff --git a/src/stat.cc b/src/stat.cc index cb67d2cd27..693032fea3 100644 --- a/src/stat.cc +++ b/src/stat.cc @@ -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++; } diff --git a/src/store.cc b/src/store.cc index 5d0baa815f..6db9e320f7 100644 --- a/src/store.cc +++ b/src/store.cc @@ -355,10 +355,10 @@ StoreEntry::StoreEntry() swap_dirn = -1; } -StoreEntry::StoreEntry(const char *url, const char *log_url) +StoreEntry::StoreEntry(const char *aUrl, const char *aLogUrl) { debugs(20, 3, HERE << "new StoreEntry " << this); - mem_obj = new MemObject(url, log_url); + mem_obj = new MemObject(aUrl, aLogUrl); expires = lastmod = lastref = timestamp = -1; @@ -1609,12 +1609,12 @@ StoreEntry::url() const } void -StoreEntry::createMemObject(const char *url, const char *log_url) +StoreEntry::createMemObject(const char *aUrl, const char *aLogUrl) { if (mem_obj) return; - mem_obj = new MemObject(url, log_url); + mem_obj = new MemObject(aUrl, aLogUrl); } /* this just sets DELAY_SENDING */ diff --git a/src/store_dir.cc b/src/store_dir.cc index f699cdd2a0..13592577e2 100644 --- a/src/store_dir.cc +++ b/src/store_dir.cc @@ -704,7 +704,7 @@ StoreController::get void StoreController::get -(String const key, STOREGETCLIENT callback, void *cbdata) +(String const key, STOREGETCLIENT aCallback, void *aCallbackData) { fatal("not implemented"); } @@ -781,7 +781,7 @@ StoreHashIndex::get void StoreHashIndex::get -(String const key, STOREGETCLIENT callback, void *cbdata) +(String const key, STOREGETCLIENT aCallback, void *aCallbackData) { fatal("not implemented"); } @@ -918,10 +918,10 @@ StoreSearchHashIndex::~StoreSearchHashIndex() {} void -StoreSearchHashIndex::next(void (callback)(void *cbdata), void *cbdata) +StoreSearchHashIndex::next(void (aCallback)(void *), void *aCallbackData) { next(); - callback (cbdata); + aCallback (aCallbackData); } bool diff --git a/src/unlinkd.cc b/src/unlinkd.cc index 1486450ee0..f3b16aec26 100644 --- a/src/unlinkd.cc +++ b/src/unlinkd.cc @@ -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; } diff --git a/src/whois.cc b/src/whois.cc index 34fcf7f076..ff7f52c25a 100644 --- a/src/whois.cc +++ b/src/whois.cc @@ -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 diff --git a/tools/squidclient.cc b/tools/squidclient.cc index 3e2f99461b..25325c6f7d 100644 --- a/tools/squidclient.cc +++ b/tools/squidclient.cc @@ -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); -- 2.47.3