mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Fix clang-tidy findings in embedded C++ from bif files
This commit is contained in:
parent
2e612fc493
commit
3b6a27d0a3
10 changed files with 91 additions and 78 deletions
|
@ -37,6 +37,7 @@ Checks: [-*,
|
|||
-bugprone-pointer-arithmetic-on-polymorphic-object,
|
||||
-bugprone-empty-catch,
|
||||
-bugprone-exception-escape,
|
||||
-bugprone-suspicious-include,
|
||||
-modernize-avoid-c-arrays,
|
||||
-modernize-concat-nested-namespaces,
|
||||
-modernize-raw-string-literal,
|
||||
|
|
|
@ -654,7 +654,7 @@ function Broker::__pop%(h: opaque of Broker::Store, k: any, e: interval%): bool
|
|||
return zeek::val_mgr->False();
|
||||
}
|
||||
|
||||
handle->store.pop(std::move(*key), zeek::Broker::detail::convert_expiry(e));
|
||||
handle->store.pop(*key, zeek::Broker::detail::convert_expiry(e));
|
||||
return zeek::val_mgr->True();
|
||||
%}
|
||||
|
||||
|
|
|
@ -17,8 +17,8 @@ function community_id_v1%(cid: conn_id, seed: count &default=0, do_base64: bool
|
|||
const auto *cid_rec = cid->AsRecordVal();
|
||||
|
||||
uint16_t hash_seed = htons(seed);
|
||||
const uint32_t *hash_src_addr = 0;
|
||||
const uint32_t *hash_dst_addr = 0;
|
||||
const uint32_t* hash_src_addr = nullptr;
|
||||
const uint32_t* hash_dst_addr = nullptr;
|
||||
uint8_t hash_proto = 0;
|
||||
uint8_t hash_padbyte = 0;
|
||||
uint16_t hash_src_port = 0;
|
||||
|
@ -129,10 +129,10 @@ function community_id_v1%(cid: conn_id, seed: count &default=0, do_base64: bool
|
|||
// We currently have no real versioning/hash configuration logic,
|
||||
// so we simply prefix "1:" to the hash.
|
||||
std::string ver("1:");
|
||||
zeek::String *res = 0;
|
||||
zeek::String* res = nullptr;
|
||||
|
||||
if (do_base64) {
|
||||
char *outbuf = 0;
|
||||
char* outbuf = nullptr;
|
||||
int outlen = 0;
|
||||
|
||||
zeek::detail::Base64Converter enc{nullptr};
|
||||
|
|
|
@ -186,7 +186,7 @@ function findalldevs%(%): Pcap::Interfaces
|
|||
r->Assign(1, d->description);
|
||||
|
||||
auto addrs = make_intrusive<ListVal>(TYPE_ADDR);
|
||||
for ( auto addr = d->addresses; addr != NULL; addr = addr->next )
|
||||
for ( auto addr = d->addresses; addr != nullptr; addr = addr->next )
|
||||
{
|
||||
if ( addr->addr->sa_family == AF_INET )
|
||||
{
|
||||
|
|
|
@ -122,7 +122,7 @@ function Log::__delay_finish%(id: Log::ID, rec: any, token: Log::DelayToken%): b
|
|||
if ( ! idptr || ! recptr )
|
||||
return zeek::val_mgr->Bool(false);
|
||||
|
||||
bool result = zeek::log_mgr->DelayFinish(std::move(idptr), std::move(recptr), {zeek::NewRef{}, token});
|
||||
bool result = zeek::log_mgr->DelayFinish(idptr, recptr, {zeek::NewRef{}, token});
|
||||
return zeek::val_mgr->Bool(result);
|
||||
%}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ function bloomfilter_basic_init%(fp: double, capacity: count,
|
|||
size_t cells = zeek::probabilistic::BasicBloomFilter::M(fp, capacity);
|
||||
size_t optimal_k = zeek::probabilistic::BasicBloomFilter::K(cells, capacity);
|
||||
zeek::probabilistic::detail::Hasher::seed_t seed =
|
||||
zeek::probabilistic::detail::Hasher::MakeSeed(name->Len() > 0 ? name->Bytes() : 0, name->Len());
|
||||
zeek::probabilistic::detail::Hasher::MakeSeed(name->Len() > 0 ? name->Bytes() : nullptr, name->Len());
|
||||
const zeek::probabilistic::detail::Hasher* h = new zeek::probabilistic::detail::DoubleHasher(optimal_k, seed);
|
||||
|
||||
return zeek::make_intrusive<zeek::BloomFilterVal>(new zeek::probabilistic::BasicBloomFilter(h, cells));
|
||||
|
@ -83,7 +83,7 @@ function bloomfilter_basic_init2%(k: count, cells: count,
|
|||
}
|
||||
|
||||
zeek::probabilistic::detail::Hasher::seed_t seed =
|
||||
zeek::probabilistic::detail::Hasher::MakeSeed(name->Len() > 0 ? name->Bytes() : 0, name->Len());
|
||||
zeek::probabilistic::detail::Hasher::MakeSeed(name->Len() > 0 ? name->Bytes() : nullptr, name->Len());
|
||||
const zeek::probabilistic::detail::Hasher* h = new zeek::probabilistic::detail::DoubleHasher(k, seed);
|
||||
|
||||
return zeek::make_intrusive<zeek::BloomFilterVal>(new zeek::probabilistic::BasicBloomFilter(h, cells));
|
||||
|
@ -122,7 +122,7 @@ function bloomfilter_counting_init%(k: count, cells: count, max: count,
|
|||
}
|
||||
|
||||
zeek::probabilistic::detail::Hasher::seed_t seed =
|
||||
zeek::probabilistic::detail::Hasher::MakeSeed(name->Len() > 0 ? name->Bytes() : 0, name->Len());
|
||||
zeek::probabilistic::detail::Hasher::MakeSeed(name->Len() > 0 ? name->Bytes() : nullptr, name->Len());
|
||||
|
||||
const zeek::probabilistic::detail::Hasher* h = new zeek::probabilistic::detail::DefaultHasher(k, seed);
|
||||
|
||||
|
|
|
@ -83,27 +83,29 @@ function get_conn_stats%(%): ConnStats
|
|||
|
||||
r->Assign(n++, Connection::TotalConnections());
|
||||
r->Assign(n++, Connection::CurrentConnections());
|
||||
if ( session_mgr ) {
|
||||
r->Assign(n++, static_cast<uint64_t>(session_mgr->CurrentSessions()));
|
||||
|
||||
session::Stats s;
|
||||
if ( session_mgr )
|
||||
session_mgr->GetStats(s);
|
||||
|
||||
#define ADD_STAT(x) \
|
||||
r->Assign(n++, static_cast<uint64_t>(session_mgr ? x : 0));
|
||||
|
||||
ADD_STAT(s.num_packets);
|
||||
ADD_STAT(s.num_fragments);
|
||||
ADD_STAT(s.max_fragments);
|
||||
ADD_STAT(s.num_TCP_conns);
|
||||
ADD_STAT(s.max_TCP_conns);
|
||||
ADD_STAT(s.cumulative_TCP_conns);
|
||||
ADD_STAT(s.num_UDP_conns);
|
||||
ADD_STAT(s.max_UDP_conns);
|
||||
ADD_STAT(s.cumulative_UDP_conns);
|
||||
ADD_STAT(s.num_ICMP_conns);
|
||||
ADD_STAT(s.max_ICMP_conns);
|
||||
ADD_STAT(s.cumulative_ICMP_conns);
|
||||
r->Assign(n++, static_cast<uint64_t>(s.num_packets));
|
||||
r->Assign(n++, static_cast<uint64_t>(s.num_fragments));
|
||||
r->Assign(n++, static_cast<uint64_t>(s.max_fragments));
|
||||
r->Assign(n++, static_cast<uint64_t>(s.num_TCP_conns));
|
||||
r->Assign(n++, static_cast<uint64_t>(s.max_TCP_conns));
|
||||
r->Assign(n++, static_cast<uint64_t>(s.cumulative_TCP_conns));
|
||||
r->Assign(n++, static_cast<uint64_t>(s.num_UDP_conns));
|
||||
r->Assign(n++, static_cast<uint64_t>(s.max_UDP_conns));
|
||||
r->Assign(n++, static_cast<uint64_t>(s.cumulative_UDP_conns));
|
||||
r->Assign(n++, static_cast<uint64_t>(s.num_ICMP_conns));
|
||||
r->Assign(n++, static_cast<uint64_t>(s.max_ICMP_conns));
|
||||
r->Assign(n++, static_cast<uint64_t>(s.cumulative_ICMP_conns));
|
||||
}
|
||||
else {
|
||||
// Skip all of the fields that would be set from session_mgr data.
|
||||
n += 13;
|
||||
}
|
||||
|
||||
r->Assign(n++, zeek::detail::killed_by_inactivity);
|
||||
|
||||
|
@ -154,7 +156,7 @@ function get_proc_stats%(%): ProcStats
|
|||
r->AssignInterval(n++, system_time);
|
||||
|
||||
uint64_t total_mem;
|
||||
zeek::util::get_memory_usage(&total_mem, NULL);
|
||||
zeek::util::get_memory_usage(&total_mem, nullptr);
|
||||
r->Assign(n++, static_cast<uint64_t>(total_mem));
|
||||
|
||||
r->Assign(n++, static_cast<uint64_t>(ru.ru_minflt));
|
||||
|
|
|
@ -45,8 +45,8 @@ function levenshtein_distance%(s1: string, s2: string%): count
|
|||
for ( unsigned int i = 1; i <= n; ++i )
|
||||
{
|
||||
for ( unsigned int j = 1; j <= m; ++j )
|
||||
d[i][j] = min(min(d[i-1][j] + 1, d[i][j-1] + 1),
|
||||
d[i-1][j-1] + (s1->Bytes()[i-1] == s2->Bytes()[j-1] ? 0 : 1));
|
||||
d[i][j] = std::min({d[i-1][j] + 1, d[i][j-1] + 1,
|
||||
d[i-1][j-1] + (s1->Bytes()[i-1] == s2->Bytes()[j-1] ? 0 : 1)});
|
||||
}
|
||||
|
||||
return zeek::val_mgr->Count(d[n][m]);
|
||||
|
@ -75,7 +75,7 @@ function string_cat%(...%): string
|
|||
}
|
||||
|
||||
u_char* b = new u_char[n+1];
|
||||
zeek::String* s = new zeek::String(1, b, n);
|
||||
zeek::String* s = new zeek::String(true, b, n);
|
||||
|
||||
for ( const auto& a : @ARG@ )
|
||||
{
|
||||
|
@ -121,7 +121,7 @@ function join_string_vec%(vec: string_vec, sep: string%): string
|
|||
e->Describe(&d);
|
||||
}
|
||||
|
||||
zeek::String* s = new zeek::String(1, d.TakeBytes(), d.Len());
|
||||
zeek::String* s = new zeek::String(true, d.TakeBytes(), d.Len());
|
||||
s->SetUseFreeToDelete(true);
|
||||
|
||||
return zeek::make_intrusive<zeek::StringVal>(s);
|
||||
|
@ -179,7 +179,7 @@ function join_string_set%(ss: string_set, sep: string%): string
|
|||
++i;
|
||||
}
|
||||
|
||||
zeek::String* str = new zeek::String(1, d.TakeBytes(), d.Len());
|
||||
zeek::String* str = new zeek::String(true, d.TakeBytes(), d.Len());
|
||||
str->SetUseFreeToDelete(true);
|
||||
|
||||
return zeek::make_intrusive<zeek::StringVal>(str);
|
||||
|
@ -230,7 +230,7 @@ function edit%(arg_s: string, arg_edit_char: string%): string
|
|||
|
||||
new_s[ind] = '\0';
|
||||
|
||||
return zeek::make_intrusive<zeek::StringVal>(new zeek::String(1, byte_vec(new_s), ind));
|
||||
return zeek::make_intrusive<zeek::StringVal>(new zeek::String(true, byte_vec(new_s), ind));
|
||||
%}
|
||||
|
||||
## Get a substring from a string, given a starting position and length.
|
||||
|
@ -617,7 +617,7 @@ function to_lower%(str: string%): string
|
|||
|
||||
*ls++ = '\0';
|
||||
|
||||
return zeek::make_intrusive<zeek::StringVal>(new zeek::String(1, lower_s, n));
|
||||
return zeek::make_intrusive<zeek::StringVal>(new zeek::String(true, lower_s, n));
|
||||
%}
|
||||
|
||||
## Replaces all lowercase letters in a string with their uppercase counterpart.
|
||||
|
@ -646,7 +646,7 @@ function to_upper%(str: string%): string
|
|||
|
||||
*us++ = '\0';
|
||||
|
||||
return zeek::make_intrusive<zeek::StringVal>(new zeek::String(1, upper_s, n));
|
||||
return zeek::make_intrusive<zeek::StringVal>(new zeek::String(true, upper_s, n));
|
||||
%}
|
||||
|
||||
## Replaces non-printable characters in a string with escaped sequences. The
|
||||
|
@ -666,7 +666,7 @@ function to_upper%(str: string%): string
|
|||
function clean%(str: string%): string
|
||||
%{
|
||||
char* s = str->AsString()->Render();
|
||||
return zeek::make_intrusive<zeek::StringVal>(new zeek::String(1, byte_vec(s), strlen(s)));
|
||||
return zeek::make_intrusive<zeek::StringVal>(new zeek::String(true, byte_vec(s), strlen(s)));
|
||||
%}
|
||||
|
||||
## Replaces non-printable characters in a string with escaped sequences. The
|
||||
|
@ -684,7 +684,7 @@ function clean%(str: string%): string
|
|||
function to_string_literal%(str: string%): string
|
||||
%{
|
||||
char* s = str->AsString()->Render(zeek::String::ZEEK_STRING_LITERAL);
|
||||
return zeek::make_intrusive<zeek::StringVal>(new zeek::String(1, byte_vec(s), strlen(s)));
|
||||
return zeek::make_intrusive<zeek::StringVal>(new zeek::String(true, byte_vec(s), strlen(s)));
|
||||
%}
|
||||
|
||||
## Determines whether a given string contains only ASCII characters.
|
||||
|
@ -740,10 +740,11 @@ function string_to_ascii_hex%(s: string%): string
|
|||
char* x = new char[s->Len() * 2 + 1];
|
||||
const u_char* sp = s->Bytes();
|
||||
|
||||
for ( int i = 0; i < s->Len(); ++i )
|
||||
snprintf(x + i * 2, 3, "%02x", sp[i]);
|
||||
size_t length = s->Len();
|
||||
for ( size_t i = 0; i < length; ++i )
|
||||
snprintf(&x[i*2], 3, "%02x", sp[i]);
|
||||
|
||||
return zeek::make_intrusive<zeek::StringVal>(new zeek::String(1, (u_char*) x, s->Len() * 2));
|
||||
return zeek::make_intrusive<zeek::StringVal>(new zeek::String(true, (u_char*) x, s->Len() * 2));
|
||||
%}
|
||||
|
||||
## Uses the Smith-Waterman algorithm to find similar/overlapping substrings.
|
||||
|
@ -822,7 +823,7 @@ function strip%(str: string%): string
|
|||
|
||||
if ( n == 0 )
|
||||
// Empty string.
|
||||
return zeek::make_intrusive<zeek::StringVal>(new zeek::String(s, n, 1));
|
||||
return zeek::make_intrusive<zeek::StringVal>(new zeek::String(s, n, true));
|
||||
|
||||
const u_char* sp = s;
|
||||
|
||||
|
@ -835,7 +836,7 @@ function strip%(str: string%): string
|
|||
while ( isspace(*sp) && sp <= e )
|
||||
++sp;
|
||||
|
||||
return zeek::make_intrusive<zeek::StringVal>(new zeek::String(sp, (e - sp + 1), 1));
|
||||
return zeek::make_intrusive<zeek::StringVal>(new zeek::String(sp, (e - sp + 1), true));
|
||||
%}
|
||||
|
||||
%%{
|
||||
|
@ -870,7 +871,7 @@ function lstrip%(str: string, chars: string &default=" \t\n\r\v\f"%): string
|
|||
|
||||
// empty input string
|
||||
if ( n == 0 )
|
||||
return zeek::make_intrusive<zeek::StringVal>(new zeek::String(s, n, 1));
|
||||
return zeek::make_intrusive<zeek::StringVal>(new zeek::String(s, n, true));
|
||||
|
||||
int i;
|
||||
auto bs_chars = chars->AsString();
|
||||
|
@ -879,7 +880,7 @@ function lstrip%(str: string, chars: string &default=" \t\n\r\v\f"%): string
|
|||
if ( ! should_strip(s[i], bs_chars) )
|
||||
break;
|
||||
|
||||
return zeek::make_intrusive<zeek::StringVal>(new zeek::String(s + i, n - i, 1));
|
||||
return zeek::make_intrusive<zeek::StringVal>(new zeek::String(s + i, n - i, true));
|
||||
%}
|
||||
|
||||
## Removes all combinations of characters in the *chars* argument
|
||||
|
@ -901,7 +902,7 @@ function rstrip%(str: string, chars: string &default=" \t\n\r\v\f"%): string
|
|||
|
||||
// empty input string
|
||||
if ( n == 0 )
|
||||
return zeek::make_intrusive<zeek::StringVal>(new zeek::String(s, n, 1));
|
||||
return zeek::make_intrusive<zeek::StringVal>(new zeek::String(s, n, true));
|
||||
|
||||
int n_to_remove;
|
||||
auto bs_chars = chars->AsString();
|
||||
|
@ -910,7 +911,7 @@ function rstrip%(str: string, chars: string &default=" \t\n\r\v\f"%): string
|
|||
if ( ! should_strip(s[n - n_to_remove - 1], bs_chars) )
|
||||
break;
|
||||
|
||||
return zeek::make_intrusive<zeek::StringVal>(new zeek::String(s, n - n_to_remove, 1));
|
||||
return zeek::make_intrusive<zeek::StringVal>(new zeek::String(s, n - n_to_remove, true));
|
||||
%}
|
||||
|
||||
## Generates a string of a given size and fills it with repetitions of a source
|
||||
|
@ -932,7 +933,7 @@ function string_fill%(len: int, source: string%): string
|
|||
|
||||
dst[len - 1] = 0;
|
||||
|
||||
return zeek::make_intrusive<zeek::StringVal>(new zeek::String(1, byte_vec(dst), len));
|
||||
return zeek::make_intrusive<zeek::StringVal>(new zeek::String(true, byte_vec(dst), len));
|
||||
%}
|
||||
|
||||
## Takes a string and escapes characters that would allow execution of
|
||||
|
@ -972,7 +973,7 @@ function safe_shell_quote%(source: string%): string
|
|||
|
||||
dst[j++] = '"';
|
||||
dst[j] = '\0';
|
||||
return zeek::make_intrusive<zeek::StringVal>(new zeek::String(1, dst, j));
|
||||
return zeek::make_intrusive<zeek::StringVal>(new zeek::String(true, dst, j));
|
||||
%}
|
||||
|
||||
%%{
|
||||
|
@ -1032,7 +1033,7 @@ function find_all%(str: string, re: pattern, max_str_size: int &default=-1%) : s
|
|||
if ( n >= 0 )
|
||||
{
|
||||
auto idx = zeek::make_intrusive<zeek::StringVal>(n, (const char*) t);
|
||||
a->Assign(std::move(idx), 0);
|
||||
a->Assign(std::move(idx), nullptr);
|
||||
t += n - 1;
|
||||
}
|
||||
}
|
||||
|
@ -1176,7 +1177,8 @@ function hexdump%(data_str: string%) : string
|
|||
|
||||
u_char* hex_data_ptr = hex_data;
|
||||
u_char* ascii_ptr = hex_data_ptr + 50;
|
||||
int x = 0, y = 0;
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
|
||||
for ( const u_char* data_ptr = data; data_ptr < data + data_size;
|
||||
++data_ptr )
|
||||
|
@ -1375,9 +1377,7 @@ function starts_with%(str: string, sub: string%) : bool
|
|||
|
||||
auto sub_s = sub->ToStdStringView();
|
||||
auto s = str->ToStdStringView();
|
||||
auto start_s = std::string_view{s.data(), sub_s.size()};
|
||||
|
||||
return zeek::val_mgr->Bool(start_s == sub_s);
|
||||
return zeek::val_mgr->Bool(s.starts_with(sub_s));
|
||||
%}
|
||||
|
||||
## Returns whether a string ends with a substring.
|
||||
|
@ -1527,12 +1527,12 @@ function rjust%(str: string, width: count, fill: string &default=" "%) : string
|
|||
function swap_case%(str: string%) : string
|
||||
%{
|
||||
string s = str->ToStdString();
|
||||
for ( size_t i = 0; i < s.size(); i++ )
|
||||
for ( auto& c : s )
|
||||
{
|
||||
if ( std::islower(s[i]) )
|
||||
s[i] = toupper(s[i]);
|
||||
else if ( std::isupper(s[i]) )
|
||||
s[i] = tolower(s[i]);
|
||||
if ( std::islower(c) )
|
||||
c = toupper(c);
|
||||
else if ( std::isupper(c) )
|
||||
c = tolower(c);
|
||||
}
|
||||
|
||||
return zeek::make_intrusive<zeek::StringVal>(s);
|
||||
|
|
|
@ -82,7 +82,7 @@ auto to_std_vec(zeek::VectorVal* xs)
|
|||
if( xs )
|
||||
for ( unsigned index = 0; index < xs->Size() ; ++index )
|
||||
{
|
||||
if constexpr (std::is_same<IntOrDbl, int64_t>::value)
|
||||
if constexpr (std::is_same_v<IntOrDbl, int64_t>)
|
||||
result.emplace_back(xs->ValAt(index)->AsInt());
|
||||
else
|
||||
result.emplace_back(xs->ValAt(index)->AsDouble());
|
||||
|
|
44
src/zeek.bif
44
src/zeek.bif
|
@ -1001,7 +1001,7 @@ function paraglob_init%(v: any%) : opaque of paraglob
|
|||
for ( unsigned int i = 0; i < vv->Size(); ++i )
|
||||
{
|
||||
auto s = vv->StringAt(i);
|
||||
patterns.push_back(std::string(reinterpret_cast<const char*>(s->Bytes()), s->Len()));
|
||||
patterns.emplace_back(reinterpret_cast<const char*>(s->Bytes()), s->Len());
|
||||
}
|
||||
|
||||
try
|
||||
|
@ -1053,7 +1053,7 @@ IntType fnva(zeek::Val* input, IntType offset, IntType prime) {
|
|||
zeek::ODesc desc(zeek::DESC_BINARY);
|
||||
|
||||
auto length = 0;
|
||||
const u_char* bytes = NULL;
|
||||
const u_char* bytes = nullptr;
|
||||
|
||||
if (input->GetType()->Tag() == zeek::TYPE_STRING)
|
||||
{
|
||||
|
@ -1266,8 +1266,12 @@ function file_magic%(data: string%): mime_matches
|
|||
## .. zeek:see:: entropy_test_init entropy_test_add entropy_test_finish
|
||||
function find_entropy%(data: string%): entropy_test_result
|
||||
%{
|
||||
double montepi, scc, ent, mean, chisq;
|
||||
montepi = scc = ent = mean = chisq = 0.0;
|
||||
double montepi = 0.0;
|
||||
double scc = 0.0;
|
||||
double ent = 0.0;
|
||||
double mean = 0.0;
|
||||
double chisq = 0.0;
|
||||
|
||||
EntropyVal e;
|
||||
e.Feed(data->Bytes(), data->Len());
|
||||
e.Get(&ent, &chisq, &mean, &montepi, &scc);
|
||||
|
@ -1320,8 +1324,12 @@ function entropy_test_add%(handle: opaque of entropy, data: string%): bool
|
|||
## .. zeek:see:: find_entropy entropy_test_init entropy_test_add
|
||||
function entropy_test_finish%(handle: opaque of entropy%): entropy_test_result
|
||||
%{
|
||||
double montepi, scc, ent, mean, chisq;
|
||||
montepi = scc = ent = mean = chisq = 0.0;
|
||||
double montepi = 0.0;
|
||||
double scc = 0.0;
|
||||
double ent = 0.0;
|
||||
double mean = 0.0;
|
||||
double chisq = 0.0;
|
||||
|
||||
static_cast<EntropyVal*>(handle)->Get(&ent, &chisq, &mean, &montepi, &scc);
|
||||
|
||||
static auto entropy_test_result = zeek::id::find_type<zeek::RecordType>("entropy_test_result");
|
||||
|
@ -1636,7 +1644,7 @@ function sort%(v: any, ...%) : any
|
|||
const auto& comp_type = comp->GetType();
|
||||
|
||||
if ( comp_type->Yield()->Tag() != zeek::TYPE_INT ||
|
||||
! comp_type->ParamList()->AllMatch(elt_type, 0) ||
|
||||
! comp_type->ParamList()->AllMatch(elt_type, false) ||
|
||||
comp_type->ParamList()->GetTypes().size() != 2 )
|
||||
{
|
||||
zeek::emit_builtin_error("invalid comparison function in call to sort()");
|
||||
|
@ -1700,7 +1708,7 @@ function order%(v: any, ...%) : index_vec
|
|||
|
||||
const auto& comp_type = comp->GetType();
|
||||
if ( comp_type->Yield()->Tag() != zeek::TYPE_INT ||
|
||||
! comp_type->ParamList()->AllMatch(elt_type, 0) ||
|
||||
! comp_type->ParamList()->AllMatch(elt_type, false) ||
|
||||
comp_type->ParamList()->GetTypes().size() != 2 )
|
||||
{
|
||||
zeek::emit_builtin_error("invalid comparison function in call to order()");
|
||||
|
@ -2474,8 +2482,8 @@ function is_local_interface%(ip: addr%) : bool
|
|||
if ( ent )
|
||||
{
|
||||
for ( unsigned int len = 0; ent->h_addr_list[len]; ++len )
|
||||
addrs.push_back(zeek::IPAddr(IPv4, (uint32_t*)ent->h_addr_list[len],
|
||||
zeek::IPAddr::Network));
|
||||
addrs.emplace_back(IPv4, (uint32_t*)ent->h_addr_list[len],
|
||||
zeek::IPAddr::Network);
|
||||
}
|
||||
|
||||
ent = gethostbyname2(host, AF_INET6);
|
||||
|
@ -2483,8 +2491,8 @@ function is_local_interface%(ip: addr%) : bool
|
|||
if ( ent )
|
||||
{
|
||||
for ( unsigned int len = 0; ent->h_addr_list[len]; ++len )
|
||||
addrs.push_back(zeek::IPAddr(IPv6, (uint32_t*)ent->h_addr_list[len],
|
||||
zeek::IPAddr::Network));
|
||||
addrs.emplace_back(IPv6, (uint32_t*)ent->h_addr_list[len],
|
||||
zeek::IPAddr::Network);
|
||||
}
|
||||
|
||||
list<zeek::IPAddr>::const_iterator it;
|
||||
|
@ -4023,8 +4031,10 @@ function dump_packet%(pkt: pcap_packet, file_name: string%) : bool
|
|||
if ( ! addl_pkt_dumper->IsError() )
|
||||
{
|
||||
pkt_timeval ts;
|
||||
uint32_t caplen, len, link_type;
|
||||
u_char *data;
|
||||
uint32_t caplen = 0;
|
||||
uint32_t len = 0;
|
||||
uint32_t link_type = 0;
|
||||
u_char *data = nullptr;
|
||||
|
||||
auto pkt_r = pkt->As<zeek::RecordVal*>();
|
||||
|
||||
|
@ -4057,7 +4067,7 @@ public:
|
|||
lookup_name = arg_lookup_name;
|
||||
}
|
||||
|
||||
~LookupHostCallback()
|
||||
~LookupHostCallback() override
|
||||
{
|
||||
Unref(trigger);
|
||||
}
|
||||
|
@ -4453,7 +4463,7 @@ function skip_further_processing%(cid: conn_id%): bool
|
|||
if ( ! c )
|
||||
return zeek::val_mgr->False();
|
||||
|
||||
c->GetSessionAdapter()->SetSkip(1);
|
||||
c->GetSessionAdapter()->SetSkip(true);
|
||||
return zeek::val_mgr->True();
|
||||
%}
|
||||
|
||||
|
@ -4608,7 +4618,7 @@ function set_buf%(f: file, buffered: bool%): any
|
|||
## rmdir unlink rename
|
||||
function flush_all%(%): bool
|
||||
%{
|
||||
return zeek::val_mgr->Bool(fflush(0) == 0);
|
||||
return zeek::val_mgr->Bool(fflush(nullptr) == 0);
|
||||
%}
|
||||
|
||||
## Creates a new directory.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue