]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix various Clang-12.0 compiler warnings (#800)
authorJoshua Rogers <MegaManSec@users.noreply.github.com>
Tue, 6 Apr 2021 14:01:02 +0000 (14:01 +0000)
committerAmos Jeffries <yadij@users.noreply.github.com>
Fri, 7 May 2021 12:47:58 +0000 (00:47 +1200)
Fixes -Wrange-loop-construct, -Wmismatched-tags, and -Wshadow.

src/acl/Asn.cc
src/acl/DestinationIp.cc
src/http/RegisteredHeadersHash.cci
src/http/RegisteredHeadersHash.gperf
src/multicast.cc

index 9db49f77c0435f20f8cae3aae18696a2a478923b..12853ae778160eb0b679a841e792fd82c13e77f1 100644 (file)
@@ -595,7 +595,7 @@ ACLDestinationASNStrategy::match (ACLData<MatchType> * &data, ACLFilledChecklist
     const ipcache_addrs *ia = ipcache_gethostbyname(checklist->request->url.host(), IP_LOOKUP_IF_MISS);
 
     if (ia) {
-        for (const auto ip: ia->goodAndBad()) {
+        for (const auto &ip: ia->goodAndBad()) {
             if (data->match(ip))
                 return 1;
         }
index 564c40743b2601af3931a47c3a9b8a7f416e1bd5..9db91d6a475c3d90eb851acdb4c7e3d56b9a2a7f 100644 (file)
@@ -67,7 +67,7 @@ ACLDestinationIP::match(ACLChecklist *cl)
     if (ia) {
         /* Entry in cache found */
 
-        for (const auto ip: ia->goodAndBad()) {
+        for (const auto &ip: ia->goodAndBad()) {
             if (ACLIP::match(ip))
                 return 1;
         }
index d58848f2fcf7129a746ae35e472f7ed8d8c71a24..7ac41bb640d7bf6d3f1bd45e30c37b1b6627f648 100644 (file)
@@ -41,8 +41,8 @@
  * Please see the COPYING and CONTRIBUTORS files for details.
  */
 #line 24 "RegisteredHeadersHash.gperf"
-struct HeaderTableRecord;
-        enum
+class HeaderTableRecord;
+    enum
 {
     TOTAL_KEYWORDS = 89,
     MIN_WORD_LENGTH = 2,
@@ -103,7 +103,7 @@ class HttpHeaderHashTable
 private:
     static inline unsigned int HttpHeaderHash (const char *str, size_t len);
 public:
-    static const struct HeaderTableRecord *lookup (const char *str, size_t len);
+    static const class HeaderTableRecord *lookup (const char *str, size_t len);
 };
 
 inline unsigned int
@@ -172,7 +172,7 @@ static const unsigned char lengthtable[] =
     0, 10, 15
 };
 
-static const struct HeaderTableRecord HttpHeaderDefinitionsTable[] =
+static const class HeaderTableRecord HttpHeaderDefinitionsTable[] =
 {
     {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
     {""}, {""}, {""}, {""},
@@ -365,7 +365,7 @@ static const struct HeaderTableRecord HttpHeaderDefinitionsTable[] =
     {"Accept-Encoding", Http::HdrType::ACCEPT_ENCODING, Http::HdrFieldType::ftStr, HdrKind::ListHeader|HdrKind::RequestHeader|HdrKind::ReplyHeader}
 };
 
-const struct HeaderTableRecord *
+const class HeaderTableRecord *
 HttpHeaderHashTable::lookup (const char *str, size_t len)
 {
     if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
index 898e68fed986bc571c8da685d53f45b4e219a8a7..00743f027bb8cabc70460551e836485b558e51c6 100644 (file)
@@ -21,7 +21,7 @@
 %global-table
 %ignore-case
 %struct-type 
-struct HeaderTableRecord;
+class HeaderTableRecord;
 %%
 Accept, Http::HdrType::ACCEPT, Http::HdrFieldType::ftStr, HdrKind::ListHeader|HdrKind::RequestHeader
 Accept-Charset, Http::HdrType::ACCEPT_CHARSET, Http::HdrFieldType::ftStr, HdrKind::ListHeader|HdrKind::RequestHeader
index ba2e22d078905f83ff0085e22dcc545954d77099..fed42cc3476324f5b20ab6ea7b625b1bd097efe7 100644 (file)
@@ -42,7 +42,7 @@ mcastJoinGroups(const ipcache_addrs *ia, const Dns::LookupDetails &, void *)
         return;
     }
 
-    for (const auto ip: ia->goodAndBad()) { // TODO: Consider using just good().
+    for (const auto &ip: ia->goodAndBad()) { // TODO: Consider using just good().
         debugs(7, 9, "Listening for ICP requests on " << ip);
 
         if (!ip.isIPv4()) {