From: squidadm Date: Sun, 17 Jul 2022 18:12:33 +0000 (+0000) Subject: Source Format Enforcement (#1089) X-Git-Tag: SQUID_6_0_1~151 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bb4cc8e6a993ef828a16723a3c006f7ce891cd20;p=thirdparty%2Fsquid.git Source Format Enforcement (#1089) --- diff --git a/doc/debug-messages.dox b/doc/debug-messages.dox index 3ee46d975d..f5713e964c 100644 --- a/doc/debug-messages.dox +++ b/doc/debug-messages.dox @@ -59,7 +59,6 @@ ID Message gist 58 ERROR: ALE missing ... 59 Shutdown: Digest authentication. 60 Shutdown: Negotiate authentication. -61 Shutdown: NTLM authentication. 62 ERROR: ... while accepting a TLS connection on ...: ... 63 Resuming indexing cache_dir # ... from ... 64 DNS IPv4 socket created at ..., FD ... diff --git a/src/Makefile.am b/src/Makefile.am index 47e2b6bb16..d337695b0b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -2749,10 +2749,10 @@ tests_testEventLoop_SOURCES = \ tests/testEventLoop.h nodist_tests_testEventLoop_SOURCES = \ EventLoop.cc \ + tests/stub_SBuf.cc \ tests/stub_debug.cc \ tests/stub_fatal.cc \ - tests/stub_libtime.cc \ - tests/stub_SBuf.cc + tests/stub_libtime.cc tests_testEventLoop_LDADD = \ base/libbase.la \ $(LIBCPPUNIT_LIBS) \ diff --git a/src/base/AsyncCallList.cc b/src/base/AsyncCallList.cc index faa0173111..70c0b97b36 100644 --- a/src/base/AsyncCallList.cc +++ b/src/base/AsyncCallList.cc @@ -33,7 +33,7 @@ AsyncCall::Pointer AsyncCallList::extract() { if (!head) - return AsyncCallPointer(); + return AsyncCallPointer(); Assure(tail); Assure(length); diff --git a/src/client_side.cc b/src/client_side.cc index 3dcb8eb106..e262db288c 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -3343,7 +3343,7 @@ clientHttpConnectionsOpen(void) const auto isHttps = protocol == AnyP::PROTO_HTTPS; using AcceptCall = CommCbFunPtrCallT; RefCount subCall = commCbCall(5, 5, isHttps ? "httpsAccept" : "httpAccept", - CommAcceptCbPtrFun(isHttps ? httpsAccept : httpAccept, CommAcceptCbParams(nullptr))); + CommAcceptCbPtrFun(isHttps ? httpsAccept : httpAccept, CommAcceptCbParams(nullptr))); clientStartListeningOn(s, subCall, isHttps ? Ipc::fdnHttpsSocket : Ipc::fdnHttpSocket); } CodeContext::Reset(savedContext); diff --git a/src/clients/Client.cc b/src/clients/Client.cc index ecf5392d7d..ddfd21c2a8 100644 --- a/src/clients/Client.cc +++ b/src/clients/Client.cc @@ -1030,7 +1030,7 @@ Client::delayRead() { using DeferredReadDialer = NullaryMemFunT; AsyncCall::Pointer call = asyncCall(11, 5, "Client::noteDelayAwareReadChance", - DeferredReadDialer(this, &Client::noteDelayAwareReadChance)); + DeferredReadDialer(this, &Client::noteDelayAwareReadChance)); entry->mem().delayRead(call); } diff --git a/src/fs/ufs/RebuildState.cc b/src/fs/ufs/RebuildState.cc index 22c493621c..d0d412dd09 100644 --- a/src/fs/ufs/RebuildState.cc +++ b/src/fs/ufs/RebuildState.cc @@ -378,8 +378,8 @@ Fs::Ufs::RebuildState::getNextFile(sfileno * filn_p, int *) if (0 == in_dir) { /* we need to read in a new directory */ fullpath.Printf("%s/%02X/%02X", - sd->path, - curlvl1, curlvl2); + sd->path, + curlvl1, curlvl2); if (dirs_opened) return -1; @@ -424,7 +424,7 @@ Fs::Ufs::RebuildState::getNextFile(sfileno * filn_p, int *) } fullfilename.Printf(SQUIDSBUFPH "/%s", - SQUIDSBUFPRINT(fullpath), entry->d_name); + SQUIDSBUFPRINT(fullpath), entry->d_name); debugs(47, 3, "Opening " << fullfilename); fd = file_open(fullfilename.c_str(), O_RDONLY | O_BINARY); diff --git a/src/gopher.cc b/src/gopher.cc index e58741d827..0d882a27d0 100644 --- a/src/gopher.cc +++ b/src/gopher.cc @@ -828,7 +828,7 @@ GopherStateData::DelayAwareRead(GopherStateData *gopherState) if (amountToRead <= 0) { AsyncCall::Pointer delayCall = asyncCall(10, 3, "GopherStateData::DelayAwareRead", - cbdataDialer(&GopherStateData::DelayAwareRead, gopherState)); + cbdataDialer(&GopherStateData::DelayAwareRead, gopherState)); gopherState->entry->mem().delayRead(delayCall); return; } diff --git a/src/http/RegisteredHeadersHash.cci b/src/http/RegisteredHeadersHash.cci index 3fba061b9f..46bfae91fd 100644 --- a/src/http/RegisteredHeadersHash.cci +++ b/src/http/RegisteredHeadersHash.cci @@ -3,28 +3,28 @@ /* Computed positions: -k'3,9,$' */ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ - && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ - && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ - && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ - && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ - && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ - && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ - && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ - && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ - && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ - && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ - && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ - && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ - && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ - && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ - && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ - && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ - && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ - && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ - && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ - && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ - && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ - && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) +&& ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ +&& (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ +&& ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ +&& ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ +&& ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ +&& ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ +&& ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ +&& ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ +&& ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ +&& ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ +&& ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ +&& ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ +&& ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ +&& ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ +&& ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ +&& ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ +&& ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ +&& ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ +&& ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ +&& ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ +&& ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ +&& ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) /* The character set is not based on ISO-646. */ #error "gperf generated tables don't work with this execution character set. Please report a bug to ." #endif @@ -42,26 +42,26 @@ */ #line 24 "RegisteredHeadersHash.gperf" class HeaderTableRecord; -enum - { + enum +{ TOTAL_KEYWORDS = 88, MIN_WORD_LENGTH = 2, MAX_WORD_LENGTH = 25, MIN_HASH_VALUE = 5, MAX_HASH_VALUE = 110 - }; +}; /* maximum key range = 106, duplicates = 0 */ #ifndef GPERF_DOWNCASE #define GPERF_DOWNCASE 1 static unsigned char gperf_downcase[256] = - { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, +{ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, @@ -75,7 +75,7 @@ static unsigned char gperf_downcase[256] = 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255 - }; +}; #endif #ifndef GPERF_CASE_MEMCMP @@ -83,96 +83,96 @@ static unsigned char gperf_downcase[256] = static int gperf_case_memcmp (const char *s1, const char *s2, size_t n) { - for (; n > 0;) + for (; n > 0;) { - unsigned char c1 = gperf_downcase[(unsigned char)*s1++]; - unsigned char c2 = gperf_downcase[(unsigned char)*s2++]; - if (c1 == c2) + unsigned char c1 = gperf_downcase[(unsigned char)*s1++]; + unsigned char c2 = gperf_downcase[(unsigned char)*s2++]; + if (c1 == c2) { - n--; - continue; + n--; + continue; } - return (int)c1 - (int)c2; + return (int)c1 - (int)c2; } - return 0; + return 0; } #endif class HttpHeaderHashTable { private: - static inline unsigned int HttpHeaderHash (const char *str, size_t len); + static inline unsigned int HttpHeaderHash (const char *str, size_t len); public: - static const class HeaderTableRecord *lookup (const char *str, size_t len); + static const class HeaderTableRecord *lookup (const char *str, size_t len); }; inline unsigned int HttpHeaderHashTable::HttpHeaderHash (const char *str, size_t len) { - static const unsigned char asso_values[] = + static const unsigned char asso_values[] = { - 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, - 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, - 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, - 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, - 111, 111, 42, 111, 111, 34, 111, 111, 111, 111, + 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, + 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, + 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, + 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, + 111, 111, 42, 111, 111, 34, 111, 111, 111, 111, 9, 111, 111, 1, 111, 111, 111, 111, 21, 111, - 111, 111, 111, 111, 111, 1, 57, 18, 34, 9, + 111, 111, 111, 111, 111, 1, 57, 18, 34, 9, 9, 49, 46, 35, 111, 1, 35, 5, 1, 1, - 23, 5, 33, 27, 9, 10, 6, 10, 8, 41, - 111, 111, 111, 111, 111, 111, 111, 1, 57, 18, - 34, 9, 9, 49, 46, 35, 111, 1, 35, 5, + 23, 5, 33, 27, 9, 10, 6, 10, 8, 41, + 111, 111, 111, 111, 111, 111, 111, 1, 57, 18, + 34, 9, 9, 49, 46, 35, 111, 1, 35, 5, 1, 1, 23, 5, 33, 27, 9, 10, 6, 10, 8, 41, 111, 111, 111, 111, 111, 111, 111, 111, - 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, - 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, - 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, - 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, - 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, - 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, - 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, - 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, - 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, - 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, - 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, - 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, - 111, 111, 111, 111, 111, 111 + 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, + 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, + 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, + 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, + 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, + 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, + 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, + 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, + 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, + 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, + 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, + 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, + 111, 111, 111, 111, 111, 111 }; - unsigned int hval = len; + unsigned int hval = len; - switch (hval) + switch (hval) { - default: + default: hval += asso_values[static_cast(str[8])]; - /*FALLTHROUGH*/ - case 8: - case 7: - case 6: - case 5: - case 4: - case 3: + /*FALLTHROUGH*/ + case 8: + case 7: + case 6: + case 5: + case 4: + case 3: hval += asso_values[static_cast(str[2])]; - /*FALLTHROUGH*/ - case 2: + /*FALLTHROUGH*/ + case 2: break; } - return hval + asso_values[static_cast(str[len - 1])]; + return hval + asso_values[static_cast(str[len - 1])]; } static const unsigned char lengthtable[] = - { - 0, 0, 0, 0, 0, 3, 4, 0, 6, 0, 4, 2, 0, 10, - 0, 5, 6, 7, 11, 16, 0, 3, 4, 5, 13, 0, 0, 8, - 9, 10, 19, 12, 8, 6, 10, 10, 25, 18, 6, 7, 4, 7, - 6, 15, 16, 12, 13, 19, 12, 7, 5, 8, 15, 16, 4, 19, +{ + 0, 0, 0, 0, 0, 3, 4, 0, 6, 0, 4, 2, 0, 10, + 0, 5, 6, 7, 11, 16, 0, 3, 4, 5, 13, 0, 0, 8, + 9, 10, 19, 12, 8, 6, 10, 10, 25, 18, 6, 7, 4, 7, + 6, 15, 16, 12, 13, 19, 12, 7, 5, 8, 15, 16, 4, 19, 13, 7, 12, 13, 13, 16, 11, 10, 11, 7, 21, 13, 13, 11, 10, 18, 6, 6, 10, 16, 9, 15, 4, 12, 0, 6, 13, 15, - 8, 3, 0, 14, 8, 7, 13, 15, 0, 18, 17, 17, 14, 19, + 8, 3, 0, 14, 8, 7, 13, 15, 0, 18, 17, 17, 14, 19, 13, 0, 0, 17, 0, 20, 0, 0, 0, 0, 0, 13, 9 - }; +}; static const class HeaderTableRecord HttpHeaderDefinitionsTable[] = - { +{ {""}, {""}, {""}, {""}, {""}, #line 96 "RegisteredHeadersHash.gperf" {"Via", Http::HdrType::VIA, Http::HdrFieldType::ftStr, HdrKind::ListHeader|HdrKind::GeneralHeader}, @@ -362,25 +362,25 @@ static const class HeaderTableRecord HttpHeaderDefinitionsTable[] = {"Last-Modified", Http::HdrType::LAST_MODIFIED, Http::HdrFieldType::ftDate_1123, HdrKind::EntityHeader}, #line 55 "RegisteredHeadersHash.gperf" {"Forwarded", Http::HdrType::FORWARDED, Http::HdrFieldType::ftStr, HdrKind::ListHeader|HdrKind::GeneralHeader} - }; +}; const class HeaderTableRecord * -HttpHeaderHashTable::lookup (const char *str, size_t len) + HttpHeaderHashTable::lookup (const char *str, size_t len) { - if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) + if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) { - unsigned int key = HttpHeaderHash (str, len); + unsigned int key = HttpHeaderHash (str, len); - if (key <= MAX_HASH_VALUE) - if (len == lengthtable[key]) - { - const char *s = HttpHeaderDefinitionsTable[key].name; + if (key <= MAX_HASH_VALUE) + if (len == lengthtable[key]) + { + const char *s = HttpHeaderDefinitionsTable[key].name; - if ((((unsigned char)*str ^ (unsigned char)*s) & ~32) == 0 && !gperf_case_memcmp (str, s, len)) - return &HttpHeaderDefinitionsTable[key]; - } + if ((((unsigned char)*str ^ (unsigned char)*s) & ~32) == 0 && !gperf_case_memcmp (str, s, len)) + return &HttpHeaderDefinitionsTable[key]; + } } - return nullptr; + return nullptr; } #line 114 "RegisteredHeadersHash.gperf" diff --git a/src/security/PeerConnector.cc b/src/security/PeerConnector.cc index a20551b48d..9b4b993bca 100644 --- a/src/security/PeerConnector.cc +++ b/src/security/PeerConnector.cc @@ -21,8 +21,8 @@ #include "HttpRequest.h" #include "neighbors.h" #include "pconn.h" -#include "security/Io.h" #include "security/Certificate.h" +#include "security/Io.h" #include "security/NegotiationHistory.h" #include "security/PeerConnector.h" #include "SquidConfig.h" @@ -645,8 +645,8 @@ Security::PeerConnector::startCertDownloading(SBuf &url) PeerConnectorCertDownloaderDialer(&Security::PeerConnector::certDownloadingDone, this)); const auto dl = new Downloader(url, certCallback, - MasterXaction::MakePortless(), - certDownloadNestingLevel() + 1); + MasterXaction::MakePortless(), + certDownloadNestingLevel() + 1); certDownloadWait.start(dl, certCallback); } diff --git a/src/ssl/gadgets.cc b/src/ssl/gadgets.cc index fab53b00cf..52a52883d7 100644 --- a/src/ssl/gadgets.cc +++ b/src/ssl/gadgets.cc @@ -9,8 +9,8 @@ #include "squid.h" #include "base/IoManip.h" #include "error/SysErrorDetail.h" -#include "security/Io.h" #include "sbuf/Stream.h" +#include "security/Io.h" #include "ssl/gadgets.h" void diff --git a/src/ssl/support.cc b/src/ssl/support.cc index 8e6dda270e..950d556df2 100644 --- a/src/ssl/support.cc +++ b/src/ssl/support.cc @@ -659,9 +659,9 @@ Ssl::Initialize(void) if (::Config.SSL.ssl_engine) { #if OPENSSL_VERSION_MAJOR < 3 - debugs(83, DBG_PARSE_NOTE(DBG_IMPORTANT), "WARNING: Support for ssl_engine is deprecated " << - "in Squids built with OpenSSL v1 (like this Squid). " << - "It is removed in Squids built with OpenSSL v3+."); + debugs(83, DBG_PARSE_NOTE(DBG_IMPORTANT), "WARNING: Support for ssl_engine is deprecated " << + "in Squids built with OpenSSL v1 (like this Squid). " << + "It is removed in Squids built with OpenSSL v3+."); #if !defined(OPENSSL_NO_ENGINE) ENGINE_load_builtin_engines(); ENGINE *e;