diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fb6b3ce34c..203773b63a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,9 +3,12 @@ # repos: - repo: https://github.com/pre-commit/mirrors-clang-format - rev: 'v13.0.0' + rev: 'v17.0.3' hooks: - id: clang-format + types_or: + - "c" + - "c++" - repo: https://github.com/maxwinterstein/shfmt-py rev: v3.7.0.1 @@ -14,7 +17,7 @@ repos: args: ["-w", "-i", "4", "-ci"] - repo: https://github.com/google/yapf - rev: v0.40.0 + rev: v0.40.2 hooks: - id: yapf @@ -25,7 +28,7 @@ repos: exclude: '^auxil/.*$' - repo: https://github.com/crate-ci/typos - rev: v1.16.8 + rev: v1.16.21 hooks: - id: typos exclude: '^(.typos.toml|src/SmithWaterman.cc|testing/.*|auxil/.*|scripts/base/frameworks/files/magic/.*|CHANGES)$' diff --git a/src/Base64.cc b/src/Base64.cc index cd6b509e3a..56d1433317 100644 --- a/src/Base64.cc +++ b/src/Base64.cc @@ -154,7 +154,7 @@ int Base64Converter::Decode(int len, const char* data, int* pblen, char** pbuf) *buf++ = char((bit32 >> 8) & 0xff); if ( --num_octets >= 0 ) - *buf++ = char((bit32)&0xff); + *buf++ = char((bit32) & 0xff); if ( base64_padding > 0 ) base64_after_padding = 1; diff --git a/src/DbgBreakpoint.cc b/src/DbgBreakpoint.cc index 92912e14e3..fe833493f3 100644 --- a/src/DbgBreakpoint.cc +++ b/src/DbgBreakpoint.cc @@ -185,8 +185,8 @@ bool DbgBreakpoint::Reset() { case BP_STMT: case BP_LINE: plr.type = PLR_FUNCTION; - //### How to deal with wildcards? - //### perhaps save user choices?--tough... + // ### How to deal with wildcards? + // ### perhaps save user choices?--tough... break; } diff --git a/src/Debug.h b/src/Debug.h index 0a818866d5..34cd81542b 100644 --- a/src/Debug.h +++ b/src/Debug.h @@ -85,7 +85,7 @@ public: // Temporary state: vanishes when execution resumes. - //### Umesh, why do these all need to be public? -- Vern + // ### Umesh, why do these all need to be public? -- Vern // Which frame we're looking at; 0 = the innermost frame. int curr_frame_idx; diff --git a/src/Dict.h b/src/Dict.h index a1162de2d2..c9ebb84a90 100644 --- a/src/Dict.h +++ b/src/Dict.h @@ -113,7 +113,7 @@ public: if ( key_size <= 8 ) { memcpy(key_here, arg_key, key_size); if ( ! copy_key ) - delete[](char*) arg_key; // own the arg_key, now don't need it. + delete[] (char*)arg_key; // own the arg_key, now don't need it. } else { if ( copy_key ) { @@ -584,7 +584,7 @@ public: v = table[position].value; table[position].value = val; if ( ! copy_key ) - delete[](char*) key; + delete[] (char*)key; if ( iterators && ! iterators->empty() ) // need to set new v for iterators too. diff --git a/src/IP.h b/src/IP.h index 8744c8b955..8e3b2bd553 100644 --- a/src/IP.h +++ b/src/IP.h @@ -307,8 +307,8 @@ public: delete ip6_hdrs; if ( del ) { - delete[](struct ip*) ip4; - delete[](struct ip6_hdr*) ip6; + delete[] (struct ip*)ip4; + delete[] (struct ip6_hdr*)ip6; } } diff --git a/src/RuleMatcher.h b/src/RuleMatcher.h index ca5a3600f6..9f3d43bfc9 100644 --- a/src/RuleMatcher.h +++ b/src/RuleMatcher.h @@ -14,7 +14,7 @@ #include "zeek/ScannedFile.h" #include "zeek/plugin/Manager.h" -//#define MATCHER_PRINT_STATS +// #define MATCHER_PRINT_STATS // Parser interface: diff --git a/src/analyzer/protocol/bittorrent/BitTorrentTracker.h b/src/analyzer/protocol/bittorrent/BitTorrentTracker.h index 65f87225a6..44768cda26 100644 --- a/src/analyzer/protocol/bittorrent/BitTorrentTracker.h +++ b/src/analyzer/protocol/bittorrent/BitTorrentTracker.h @@ -14,7 +14,7 @@ namespace analyzer::bittorrent { // If the following is defined, then the analyzer will store all of // the headers seen in tracker messages. -//#define BTTRACKER_STORE_HEADERS 1 +// #define BTTRACKER_STORE_HEADERS 1 namespace detail { diff --git a/src/analyzer/protocol/dns/DNS.cc b/src/analyzer/protocol/dns/DNS.cc index 2ea3085f31..6e0d416bee 100644 --- a/src/analyzer/protocol/dns/DNS.cc +++ b/src/analyzer/protocol/dns/DNS.cc @@ -1520,8 +1520,8 @@ void DNS_Interpreter::SendReplyOrRejectEvent(detail::DNS_MsgInfo* msg, EventHand } DNS_MsgInfo::DNS_MsgInfo(DNS_RawMsgHdr* hdr, int arg_is_query) { - //### Need to fix alignment if hdr is misaligned (not on a short - // boundary). + // ### Need to fix alignment if hdr is misaligned (not on a short + // boundary). unsigned short flags = ntohs(hdr->flags); QR = (flags & 0x8000) != 0; diff --git a/src/analyzer/protocol/login/NVT.cc b/src/analyzer/protocol/login/NVT.cc index dcdfc50534..e77e54073a 100644 --- a/src/analyzer/protocol/login/NVT.cc +++ b/src/analyzer/protocol/login/NVT.cc @@ -232,7 +232,7 @@ void TelnetEnvironmentOption::RecvSubOption(u_char* data, int len) { } if ( data[0] == ENVIRON_SEND ) - //### We should track the dialog and make sure both sides agree. + // ### We should track the dialog and make sure both sides agree. return; if ( data[0] != ENVIRON_IS && data[0] != ENVIRON_INFO ) { diff --git a/src/analyzer/protocol/tcp/TCP_Endpoint.h b/src/analyzer/protocol/tcp/TCP_Endpoint.h index 1b6a6f6b1b..993c4b826b 100644 --- a/src/analyzer/protocol/tcp/TCP_Endpoint.h +++ b/src/analyzer/protocol/tcp/TCP_Endpoint.h @@ -206,7 +206,7 @@ public: bool CheckHistory(uint32_t mask, char code); void AddHistory(char code); - //### combine into a set of flags: + // ### combine into a set of flags: EndpointState state, prev_state; TCP_Endpoint* peer; TCP_Reassembler* contents_processor; diff --git a/src/input/ReaderBackend.cc b/src/input/ReaderBackend.cc index aff87ccae7..15506fe11f 100644 --- a/src/input/ReaderBackend.cc +++ b/src/input/ReaderBackend.cc @@ -205,7 +205,7 @@ bool ReaderBackend::OnFinish(double network_time) { for ( unsigned int i = 0; i < num_fields; i++ ) delete (fields[i]); - delete[](fields); + delete[] (fields); fields = nullptr; } diff --git a/src/input/readers/binary/Binary.cc b/src/input/readers/binary/Binary.cc index 8e00edb86c..f1a9236551 100644 --- a/src/input/readers/binary/Binary.cc +++ b/src/input/readers/binary/Binary.cc @@ -140,7 +140,7 @@ streamsize Binary::GetChunk(char** chunk) { streamsize bytes_read = in->gcount(); if ( ! bytes_read ) { - delete[] * chunk; + delete[] *chunk; *chunk = nullptr; return 0; }