Hi Amos,

here is an updated version of the patch from Ismail.

Kind Regards
 Chris

Am 02.05.2011 03:49, schrieb Amos Jeffries:
On Sun, 01 May 2011 20:56:20 +0200, Christian wrote:
Hi,

perhaps you're interested in this patch:
coming originally from fedora.

remove write only variables to fix compilation with gcc 4.6
Kind Regards

Thank you.
most of these chunks appear fine. There are several which erase whole function calls though.

src/comm.cc:
  comm_set_tos() removal breaks QoS.

src/dns_internal.cc:
  comm_local_port() removal breaks DNS local port logging and retries.

src/fqdncache.cc:
  "++FqdncacheStats.replies" removal breaks DNS accounting.

Amos


--

Christian
---------------------------------------------------
Der ultimative shop für Sportbekleidung und Zubehör

http://www.sc24.de
---------------------------------------------------

diff -ur squid-3.1.12/helpers/external_acl/ldap_group/squid_ldap_group.c squid-3.1.12-fixed/helpers/external_acl/ldap_group/squid_ldap_group.c
--- squid-3.1.12/helpers/external_acl/ldap_group/squid_ldap_group.c	2011-04-04 03:24:06.000000000 +0200
+++ squid-3.1.12-fixed/helpers/external_acl/ldap_group/squid_ldap_group.c	2011-05-03 15:47:49.120934481 +0200
@@ -219,7 +219,6 @@
     int use_extension_dn = 0;
     int strip_nt_domain = 0;
     int strip_kerberos_realm = 0;
-    int err = 0;
 
     setbuf(stdout, NULL);
 
@@ -602,7 +601,6 @@
                 tryagain = 1;
             }
         }
-        err = 0;
     }
     if (ld)
         ldap_unbind(ld);
diff -ur squid-3.1.12/helpers/ntlm_auth/fakeauth/fakeauth_auth.c squid-3.1.12-fixed/helpers/ntlm_auth/fakeauth/fakeauth_auth.c
--- squid-3.1.12/helpers/ntlm_auth/fakeauth/fakeauth_auth.c	2011-04-04 03:24:06.000000000 +0200
+++ squid-3.1.12-fixed/helpers/ntlm_auth/fakeauth/fakeauth_auth.c	2011-05-03 15:47:49.121934482 +0200
@@ -141,7 +141,6 @@
 {
     static unsigned hash;
     int r;
-    char *d;
     int i;
 
     debug("ntlmMakeChallenge: flg %08x\n", flags);
@@ -158,7 +157,6 @@
     chal->flags = flags;
     chal->unknown[6] = htole16(0x003a);
 
-    d = (char *) chal + 48;
     i = 0;
 
     if (authenticate_ntlm_domain != NULL)
diff -ur squid-3.1.12/src/auth/negotiate/auth_negotiate.cc squid-3.1.12-fixed/src/auth/negotiate/auth_negotiate.cc
--- squid-3.1.12/src/auth/negotiate/auth_negotiate.cc	2011-04-04 03:24:06.000000000 +0200
+++ squid-3.1.12-fixed/src/auth/negotiate/auth_negotiate.cc	2011-05-03 15:47:49.121934482 +0200
@@ -544,7 +544,6 @@
 {
     authenticateStateData *r = NULL;
     static char buf[MAX_AUTHTOKEN_LEN];
-    negotiate_user_t *negotiate_user;
     AuthUser *auth_user = user();
 
     assert(data);
@@ -552,8 +551,6 @@
     assert(auth_user);
     assert(auth_user->auth_type == AUTH_NEGOTIATE);
 
-    negotiate_user = dynamic_cast<negotiate_user_t *>(user());
-
     debugs(29, 8, "AuthNegotiateUserRequest::module_start: auth state is '" << auth_state << "'");
 
     if (negotiateConfig.authenticate == NULL) {
@@ -655,12 +652,10 @@
 
     /** \todo rename this!! */
     AuthUser *local_auth_user;
-    negotiate_user_t *negotiate_user;
 
     local_auth_user = user();
     assert(local_auth_user);
     assert(local_auth_user->auth_type == AUTH_NEGOTIATE);
-    negotiate_user = dynamic_cast<negotiate_user_t *>(local_auth_user);
     assert (this);
 
     /** Check that we are in the client side, where we can generate
diff -ur squid-3.1.12/src/auth/ntlm/auth_ntlm.cc squid-3.1.12-fixed/src/auth/ntlm/auth_ntlm.cc
--- squid-3.1.12/src/auth/ntlm/auth_ntlm.cc	2011-04-04 03:24:06.000000000 +0200
+++ squid-3.1.12-fixed/src/auth/ntlm/auth_ntlm.cc	2011-05-03 15:47:49.121934482 +0200
@@ -460,7 +460,6 @@
 {
     authenticateStateData *r = NULL;
     static char buf[8192];
-    ntlm_user_t *ntlm_user;
     AuthUser *auth_user = user();
 
     assert(data);
@@ -468,8 +467,6 @@
     assert(auth_user);
     assert(auth_user->auth_type == AUTH_NTLM);
 
-    ntlm_user = dynamic_cast<ntlm_user_t *>(user());
-
     debugs(29, 8, "AuthNTLMUserRequest::module_start: auth state is '" << auth_state << "'");
 
     if (ntlmConfig.authenticate == NULL) {
@@ -572,12 +569,10 @@
 
     /* TODO: rename this!! */
     AuthUser *local_auth_user;
-    ntlm_user_t *ntlm_user;
 
     local_auth_user = user();
     assert(local_auth_user);
     assert(local_auth_user->auth_type == AUTH_NTLM);
-    ntlm_user = dynamic_cast<ntlm_user_t *>(local_auth_user);
     assert (this);
 
     /* Check that we are in the client side, where we can generate
diff -ur squid-3.1.12/src/auth/User.cc squid-3.1.12-fixed/src/auth/User.cc
--- squid-3.1.12/src/auth/User.cc	2011-04-04 03:24:06.000000000 +0200
+++ squid-3.1.12-fixed/src/auth/User.cc	2011-05-03 15:47:49.122934483 +0200
@@ -158,13 +158,11 @@
      */
     AuthUserHashPointer *usernamehash;
     AuthUser *auth_user;
-    char const *username = NULL;
     debugs(29, 3, "AuthUser::CachedACLsReset: Flushing the ACL caches for all users.");
     hash_first(proxy_auth_username_cache);
 
     while ((usernamehash = ((AuthUserHashPointer *) hash_next(proxy_auth_username_cache)))) {
         auth_user = usernamehash->user();
-        username = auth_user->username();
         /* free cached acl results */
         aclCacheMatchFlush(&auth_user->proxy_match_cache);
 
diff -ur squid-3.1.12/src/client_side_reply.cc squid-3.1.12-fixed/src/client_side_reply.cc
--- squid-3.1.12/src/client_side_reply.cc	2011-04-04 03:24:06.000000000 +0200
+++ squid-3.1.12-fixed/src/client_side_reply.cc	2011-05-03 15:47:49.122934483 +0200
@@ -1056,14 +1056,6 @@
         /* haven't found end of headers yet */
         return 0;
 
-    int sending = SENDING_BODY;
-
-    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;
-
     /*
      * Figure out how much data we are supposed to send.
      * If we are sending a body and we don't have a content-length,
@@ -2029,13 +2021,10 @@
 
     char *buf = next()->readBuffer.data;
 
-    char *body_buf = buf;
-
     if (buf != result.data) {
         /* we've got to copy some data */
         assert(result.length <= next()->readBuffer.length);
         xmemcpy(buf, result.data, result.length);
-        body_buf = buf;
     }
 
 #if USE_ZPH_QOS
Only in squid-3.1.12-fixed/src: client_side_reply.cc.orig
diff -ur squid-3.1.12/src/comm.cc squid-3.1.12-fixed/src/comm.cc
--- squid-3.1.12/src/comm.cc	2011-04-04 03:24:06.000000000 +0200
+++ squid-3.1.12-fixed/src/comm.cc	2011-05-03 15:48:48.638934477 +0200
@@ -759,6 +759,7 @@
     /* set TOS if needed */
     if (TOS && comm_set_tos(new_socket, TOS) ) {
         tos = TOS;
+        (void)tos;
     }
 
     if ( Ip::EnableIpv6&IPV6_SPECIAL_SPLITSTACK && addr.IsIPv6() )
diff -ur squid-3.1.12/src/DiskIO/AIO/AIODiskIOStrategy.cc squid-3.1.12-fixed/src/DiskIO/AIO/AIODiskIOStrategy.cc
--- squid-3.1.12/src/DiskIO/AIO/AIODiskIOStrategy.cc	2011-04-04 03:24:06.000000000 +0200
+++ squid-3.1.12-fixed/src/DiskIO/AIO/AIODiskIOStrategy.cc	2011-05-03 15:47:49.123934483 +0200
@@ -123,7 +123,6 @@
     void *cbdata;
     int callback_valid;
     void *buf;
-    int filedescriptor;
     async_queue_entry_t *aqe;
     async_queue_entry_type_t type;
 
@@ -148,7 +147,6 @@
                 /* Get the callback parameters */
                 freefunc = aqe->aq_e_free;
                 buf = aqe->aq_e_buf;
-                filedescriptor = aqe->aq_e_fd;
                 type = aqe->aq_e_type;
                 callback_valid = cbdataReferenceValidDone(aqe->aq_e_callback_data, &cbdata);
                 AIODiskFile * theFile = NULL;
diff -ur squid-3.1.12/src/dns_internal.cc squid-3.1.12-fixed/src/dns_internal.cc
--- squid-3.1.12/src/dns_internal.cc	2011-04-04 03:24:06.000000000 +0200
+++ squid-3.1.12-fixed/src/dns_internal.cc	2011-05-03 15:49:31.198934469 +0200
@@ -1376,8 +1376,6 @@
     CBDATA_INIT_TYPE(idns_query);
 
     if (DnsSocketA < 0 && DnsSocketB < 0) {
-        int port;
-
         IpAddress addrA; // since we don't want to alter Config.Addrs.udp_* and dont have one of our own.
 
         if (!Config.Addrs.udp_outgoing.IsNoAddr())
@@ -1413,12 +1411,12 @@
          * statement. Doing so messes up the internal Debug::level
          */
         if (DnsSocketB >= 0) {
-            port = comm_local_port(DnsSocketB);
+            comm_local_port(DnsSocketB);
             debugs(78, 1, "DNS Socket created at " << addrB << ", FD " << DnsSocketB);
             commSetSelect(DnsSocketB, COMM_SELECT_READ, idnsRead, NULL, 0);
         }
         if (DnsSocketA >= 0) {
-            port = comm_local_port(DnsSocketA);
+            comm_local_port(DnsSocketA);
             debugs(78, 1, "DNS Socket created at " << addrA << ", FD " << DnsSocketA);
             commSetSelect(DnsSocketA, COMM_SELECT_READ, idnsRead, NULL, 0);
         }
diff -ur squid-3.1.12/src/errorpage.cc squid-3.1.12-fixed/src/errorpage.cc
--- squid-3.1.12/src/errorpage.cc	2011-04-04 03:24:06.000000000 +0200
+++ squid-3.1.12-fixed/src/errorpage.cc	2011-05-03 15:47:49.123934483 +0200
@@ -515,7 +515,6 @@
 ErrorState::Dump(MemBuf * mb)
 {
     MemBuf str;
-    const char *p = NULL;	/* takes priority over mb if set */
     char ntoabuf[MAX_IPSTRLEN];
 
     str.reset();
@@ -570,10 +569,6 @@
         packerToMemInit(&pck, &str);
         request->header.packInto(&pck);
         packerClean(&pck);
-    } else if (request_hdrs) {
-        p = request_hdrs;
-    } else {
-        p = "[none]";
     }
 
     str.Printf("\r\n");
diff -ur squid-3.1.12/src/fqdncache.cc squid-3.1.12-fixed/src/fqdncache.cc
--- squid-3.1.12/src/fqdncache.cc	2011-04-04 03:24:06.000000000 +0200
+++ squid-3.1.12-fixed/src/fqdncache.cc	2011-05-03 15:49:55.533934460 +0200
@@ -497,10 +497,9 @@
 fqdncacheHandleReply(void *data, rfc1035_rr * answers, int na, const char *error_message)
 #endif
 {
-    int n;
     fqdncache_entry *f;
     static_cast<generic_cbdata *>(data)->unwrap(&f);
-    n = ++FqdncacheStats.replies;
+    ++FqdncacheStats.replies;
     const int age = f->age();
     statHistCount(&statCounter.dns.svc_time, age);
 #if USE_DNSSERVERS
diff -ur squid-3.1.12/src/ftp.cc squid-3.1.12-fixed/src/ftp.cc
--- squid-3.1.12/src/ftp.cc	2011-04-04 03:24:06.000000000 +0200
+++ squid-3.1.12-fixed/src/ftp.cc	2011-05-03 15:47:49.124934483 +0200
@@ -2453,7 +2453,6 @@
 {
     int code = ftpState->ctrl.replycode;
     char h1, h2, h3, h4;
-    int n;
     u_short port;
     IpAddress ipa_remote;
     int fd = ftpState->data.fd;
@@ -2521,7 +2520,7 @@
 
     buf = ftpState->ctrl.last_reply + strcspn(ftpState->ctrl.last_reply, "(");
 
-    n = sscanf(buf, "(%c%c%c%hu%c)", &h1, &h2, &h3, &port, &h4);
+    sscanf(buf, "(%c%c%c%hu%c)", &h1, &h2, &h3, &port, &h4);
 
     if (h1 != h2 || h1 != h3 || h1 != h4) {
         debugs(9, DBG_IMPORTANT, "Invalid EPSV reply from " <<
diff -ur squid-3.1.12/src/neighbors.cc squid-3.1.12-fixed/src/neighbors.cc
--- squid-3.1.12/src/neighbors.cc	2011-04-04 03:24:06.000000000 +0200
+++ squid-3.1.12-fixed/src/neighbors.cc	2011-05-03 15:51:08.221934455 +0200
@@ -832,7 +832,6 @@
     peer *best_p = NULL;
 #if USE_CACHE_DIGESTS
 
-    const cache_key *key;
     int best_rtt = 0;
     int choice_count = 0;
     int ichoice_count = 0;
@@ -843,7 +842,7 @@
     if (!request->flags.hierarchical)
         return NULL;
 
-    key = storeKeyPublicByRequest(request);
+    storeKeyPublicByRequest(request);
 
     for (i = 0, p = first_ping; i++ < Config.npeers; p = p->next) {
         lookup_t lookup;

Reply via email to