]> 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)
committerSquid Anubis <squid-anubis@squid-cache.org>
Thu, 8 Apr 2021 12:29:50 +0000 (12:29 +0000)
Fixes -Wrange-loop-construct, -Wmismatched-tags, and -Wshadow.

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

index 8ac7e6c81031c3340eece2165c5c7720627c6e1d..0e85b9768b08da718c352b881294efa808171242 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 4347b93a58bf4f85e22227aa2967f967728fe704..a01c14129a0c4e4d371aec32ec06f9138f8858ad 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 2d41da3d0a282b98182b252854cfe9bacbb27316..3fac88be8a1b7c560f6877469b296bffd234602a 100644 (file)
@@ -258,16 +258,16 @@ Rock::Rebuild::Stats::Init(const SwapDir &dir)
 }
 
 bool
-Rock::Rebuild::Stats::completed(const SwapDir &sd) const
+Rock::Rebuild::Stats::completed(const SwapDir &dir) const
 {
-    return DoneLoading(counts.scancount, sd.slotLimitActual()) &&
-           DoneValidating(counts.validations, sd.slotLimitActual(), sd.entryLimitActual());
+    return DoneLoading(counts.scancount, dir.slotLimitActual()) &&
+           DoneValidating(counts.validations, dir.slotLimitActual(), dir.entryLimitActual());
 }
 
 /* Rebuild */
 
 bool
-Rock::Rebuild::IsResponsible(const SwapDir &sd)
+Rock::Rebuild::IsResponsible(const SwapDir &dir)
 {
     // in SMP mode, only the disker is responsible for populating the map
     return !UsingSmp() || IamDiskProcess();
index aee8c808b8832622e705fc886fabd9e84ac13569..59968f1c2783df84c2fbd78b67d0bdbd98d46c41 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 = 88,
     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
@@ -171,7 +171,7 @@ static const unsigned char lengthtable[] =
     19,  0,  0,  0, 18, 14,  0,  0, 13, 13,  0, 13
 };
 
-static const struct HeaderTableRecord HttpHeaderDefinitionsTable[] =
+static const class HeaderTableRecord HttpHeaderDefinitionsTable[] =
 {
     {""}, {""}, {""}, {""}, {""},
 #line 67 "RegisteredHeadersHash.gperf"
@@ -363,7 +363,7 @@ static const struct HeaderTableRecord HttpHeaderDefinitionsTable[] =
     {"Last-Modified", Http::HdrType::LAST_MODIFIED, Http::HdrFieldType::ftDate_1123, HdrKind::EntityHeader}
 };
 
-const struct HeaderTableRecord *
+const class HeaderTableRecord *
 HttpHeaderHashTable::lookup (const char *str, size_t len)
 {
     if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
index 1f70c2e0087d8b1b48ede133410840576d829a90..a406fe57dbd80f70a75446e89ba865732f8910aa 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 cbd48f7cb39441c474ce88cb260cec555087c595..a3a848dcd9779794ffc2a18dc2f6aef29b26bee2 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()) {