mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Update deprecated ValManager::GetInt usages
This commit is contained in:
parent
d9edd855da
commit
0ddac4abcf
20 changed files with 49 additions and 50 deletions
|
@ -770,7 +770,7 @@ const char* CompositeHash::RecoverOneVal(const HashKey* k, const char* kp0,
|
|||
else if ( tag == TYPE_BOOL )
|
||||
*pval = val_mgr->Bool(*kp);
|
||||
else if ( tag == TYPE_INT )
|
||||
*pval = {AdoptRef{}, val_mgr->GetInt(*kp)};
|
||||
*pval = val_mgr->Int(*kp);
|
||||
else
|
||||
{
|
||||
reporter->InternalError("bad internal unsigned int in CompositeHash::RecoverOneVal()");
|
||||
|
|
|
@ -378,10 +378,10 @@ RecordVal* Connection::BuildConnVal()
|
|||
conn_val->Assign(8, encapsulation->GetVectorVal());
|
||||
|
||||
if ( vlan != 0 )
|
||||
conn_val->Assign(9, val_mgr->GetInt(vlan));
|
||||
conn_val->Assign(9, val_mgr->Int(vlan));
|
||||
|
||||
if ( inner_vlan != 0 )
|
||||
conn_val->Assign(10, val_mgr->GetInt(inner_vlan));
|
||||
conn_val->Assign(10, val_mgr->Int(inner_vlan));
|
||||
|
||||
}
|
||||
|
||||
|
|
10
src/Expr.cc
10
src/Expr.cc
|
@ -686,7 +686,7 @@ IntrusivePtr<Val> BinaryExpr::Fold(Val* v1, Val* v2) const
|
|||
else if ( ret_type->Tag() == TYPE_BOOL )
|
||||
return val_mgr->Bool(i3);
|
||||
else
|
||||
return {AdoptRef{}, val_mgr->GetInt(i3)};
|
||||
return val_mgr->Int(i3);
|
||||
}
|
||||
|
||||
IntrusivePtr<Val> BinaryExpr::StringFold(Val* v1, Val* v2) const
|
||||
|
@ -958,7 +958,7 @@ IntrusivePtr<Val> IncrExpr::DoSingleEval(Frame* f, Val* v) const
|
|||
ret_type = Type()->YieldType();
|
||||
|
||||
if ( ret_type->Tag() == TYPE_INT )
|
||||
return {AdoptRef{}, val_mgr->GetInt(k)};
|
||||
return val_mgr->Int(k);
|
||||
else
|
||||
return {AdoptRef{}, val_mgr->GetCount(k)};
|
||||
}
|
||||
|
@ -1075,7 +1075,7 @@ IntrusivePtr<Val> PosExpr::Fold(Val* v) const
|
|||
if ( t == TYPE_DOUBLE || t == TYPE_INTERVAL || t == TYPE_INT )
|
||||
return {NewRef{}, v};
|
||||
else
|
||||
return {AdoptRef{}, val_mgr->GetInt(v->CoerceToInt())};
|
||||
return val_mgr->Int(v->CoerceToInt());
|
||||
}
|
||||
|
||||
NegExpr::NegExpr(IntrusivePtr<Expr> arg_op)
|
||||
|
@ -1113,7 +1113,7 @@ IntrusivePtr<Val> NegExpr::Fold(Val* v) const
|
|||
else if ( v->Type()->Tag() == TYPE_INTERVAL )
|
||||
return make_intrusive<IntervalVal>(- v->InternalDouble(), 1.0);
|
||||
else
|
||||
return {AdoptRef{}, val_mgr->GetInt(- v->CoerceToInt())};
|
||||
return val_mgr->Int(- v->CoerceToInt());
|
||||
}
|
||||
|
||||
SizeExpr::SizeExpr(IntrusivePtr<Expr> arg_op)
|
||||
|
@ -3485,7 +3485,7 @@ IntrusivePtr<Val> ArithCoerceExpr::FoldSingleVal(Val* v, InternalTypeTag t) cons
|
|||
return make_intrusive<Val>(v->CoerceToDouble(), TYPE_DOUBLE);
|
||||
|
||||
case TYPE_INTERNAL_INT:
|
||||
return {AdoptRef{}, val_mgr->GetInt(v->CoerceToInt())};
|
||||
return val_mgr->Int(v->CoerceToInt());
|
||||
|
||||
case TYPE_INTERNAL_UNSIGNED:
|
||||
return {AdoptRef{}, val_mgr->GetCount(v->CoerceToUnsigned())};
|
||||
|
|
|
@ -374,7 +374,7 @@ void SampleLogger::SegmentProfile(const char* /* name */,
|
|||
mgr.Enqueue(load_sample,
|
||||
IntrusivePtr{NewRef{}, load_samples},
|
||||
make_intrusive<IntervalVal>(dtime, Seconds),
|
||||
IntrusivePtr{AdoptRef{}, val_mgr->GetInt(dmem)}
|
||||
val_mgr->Int(dmem)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -732,7 +732,7 @@ void IntervalVal::ValDescribe(ODesc* d) const
|
|||
|
||||
IntrusivePtr<Val> PortVal::SizeVal() const
|
||||
{
|
||||
return {AdoptRef{}, val_mgr->GetInt(val.uint_val)};
|
||||
return val_mgr->Int(val.uint_val);
|
||||
}
|
||||
|
||||
uint32_t PortVal::Mask(uint32_t port_num, TransportProto port_type)
|
||||
|
@ -2931,7 +2931,7 @@ unsigned int RecordVal::MemoryAllocation() const
|
|||
|
||||
IntrusivePtr<Val> EnumVal::SizeVal() const
|
||||
{
|
||||
return {AdoptRef{}, val_mgr->GetInt(val.int_val)};
|
||||
return val_mgr->Int(val.int_val);
|
||||
}
|
||||
|
||||
void EnumVal::ValDescribe(ODesc* d) const
|
||||
|
@ -3205,7 +3205,7 @@ IntrusivePtr<Val> check_and_promote(IntrusivePtr<Val> v, const BroType* t,
|
|||
return nullptr;
|
||||
}
|
||||
else if ( t_tag == TYPE_INT )
|
||||
promoted_v = {AdoptRef{}, val_mgr->GetInt(v->CoerceToInt())};
|
||||
promoted_v = val_mgr->Int(v->CoerceToInt());
|
||||
else // enum
|
||||
{
|
||||
reporter->InternalError("bad internal type in check_and_promote()");
|
||||
|
|
|
@ -115,7 +115,7 @@ Val* asn1_integer_to_val(const ASN1Encoding* i, TypeTag t)
|
|||
case TYPE_BOOL:
|
||||
return val_mgr->Bool(v)->Ref();
|
||||
case TYPE_INT:
|
||||
return val_mgr->GetInt(v);
|
||||
return val_mgr->Int(v).release();
|
||||
case TYPE_COUNT:
|
||||
case TYPE_COUNTER:
|
||||
return val_mgr->GetCount(v);
|
||||
|
|
|
@ -503,7 +503,7 @@ void BitTorrentTracker_Analyzer::ResponseBenc(int name_len, char* name,
|
|||
RecordVal* benc_value = new RecordVal(bittorrent_benc_value);
|
||||
StringVal* name_ = new StringVal(name_len, name);
|
||||
|
||||
benc_value->Assign(type, val_mgr->GetInt(value));
|
||||
benc_value->Assign(type, val_mgr->Int(value));
|
||||
res_val_benc->Assign(name_, benc_value);
|
||||
|
||||
Unref(name_);
|
||||
|
|
|
@ -34,7 +34,7 @@ refine casetype OptionValue += {
|
|||
refine flow DHCP_Flow += {
|
||||
function process_time_offset_option(v: OptionValue): bool
|
||||
%{
|
||||
${context.flow}->options->Assign(25, val_mgr->GetInt(${v.time_offset}));
|
||||
${context.flow}->options->Assign(25, val_mgr->Int(${v.time_offset}));
|
||||
return true;
|
||||
%}
|
||||
};
|
||||
|
|
|
@ -237,9 +237,9 @@ void IRC_Analyzer::DeliverStream(int length, const u_char* line, bool orig)
|
|||
EnqueueConnEvent(irc_network_info,
|
||||
IntrusivePtr{AdoptRef{}, BuildConnVal()},
|
||||
val_mgr->Bool(orig),
|
||||
IntrusivePtr{AdoptRef{}, val_mgr->GetInt(users)},
|
||||
IntrusivePtr{AdoptRef{}, val_mgr->GetInt(services)},
|
||||
IntrusivePtr{AdoptRef{}, val_mgr->GetInt(servers)}
|
||||
val_mgr->Int(users),
|
||||
val_mgr->Int(services),
|
||||
val_mgr->Int(servers)
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
@ -318,9 +318,9 @@ void IRC_Analyzer::DeliverStream(int length, const u_char* line, bool orig)
|
|||
EnqueueConnEvent(irc_server_info,
|
||||
IntrusivePtr{AdoptRef{}, BuildConnVal()},
|
||||
val_mgr->Bool(orig),
|
||||
IntrusivePtr{AdoptRef{}, val_mgr->GetInt(users)},
|
||||
IntrusivePtr{AdoptRef{}, val_mgr->GetInt(services)},
|
||||
IntrusivePtr{AdoptRef{}, val_mgr->GetInt(servers)}
|
||||
val_mgr->Int(users),
|
||||
val_mgr->Int(services),
|
||||
val_mgr->Int(servers)
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
@ -340,7 +340,7 @@ void IRC_Analyzer::DeliverStream(int length, const u_char* line, bool orig)
|
|||
EnqueueConnEvent(irc_channel_info,
|
||||
IntrusivePtr{AdoptRef{}, BuildConnVal()},
|
||||
val_mgr->Bool(orig),
|
||||
IntrusivePtr{AdoptRef{}, val_mgr->GetInt(channels)}
|
||||
val_mgr->Int(channels)
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
@ -547,7 +547,7 @@ void IRC_Analyzer::DeliverStream(int length, const u_char* line, bool orig)
|
|||
make_intrusive<StringVal>(parts[4].c_str()),
|
||||
make_intrusive<StringVal>(parts[5].c_str()),
|
||||
make_intrusive<StringVal>(parts[6].c_str()),
|
||||
IntrusivePtr{AdoptRef{}, val_mgr->GetInt(atoi(parts[7].c_str()))},
|
||||
val_mgr->Int(atoi(parts[7].c_str())),
|
||||
make_intrusive<StringVal>(parts[8].c_str())
|
||||
);
|
||||
}
|
||||
|
|
|
@ -193,9 +193,9 @@ refine connection SMB_Conn += {
|
|||
if ( smb2_file_fscontrol )
|
||||
{
|
||||
RecordVal* r = new RecordVal(BifType::Record::SMB2::Fscontrol);
|
||||
r->Assign(0, val_mgr->GetInt(${val.free_space_start_filtering}));
|
||||
r->Assign(1, val_mgr->GetInt(${val.free_space_start_threshold}));
|
||||
r->Assign(2, val_mgr->GetInt(${val.free_space_stop_filtering}));
|
||||
r->Assign(0, val_mgr->Int(${val.free_space_start_filtering}));
|
||||
r->Assign(1, val_mgr->Int(${val.free_space_start_threshold}));
|
||||
r->Assign(2, val_mgr->Int(${val.free_space_stop_filtering}));
|
||||
r->Assign(3, val_mgr->GetCount(${val.default_quota_threshold}));
|
||||
r->Assign(4, val_mgr->GetCount(${val.default_quota_limit}));
|
||||
r->Assign(5, val_mgr->GetCount(${val.file_system_control_flags}));
|
||||
|
|
|
@ -135,10 +135,9 @@ void SteppingStoneEndpoint::Event(EventHandlerPtr f, int id1, int id2)
|
|||
return;
|
||||
|
||||
if ( id2 >= 0 )
|
||||
endp->TCP()->EnqueueConnEvent(f, IntrusivePtr{AdoptRef{}, val_mgr->GetInt(id1)},
|
||||
IntrusivePtr{AdoptRef{}, val_mgr->GetInt(id2)});
|
||||
endp->TCP()->EnqueueConnEvent(f, val_mgr->Int(id1), val_mgr->Int(id2));
|
||||
else
|
||||
endp->TCP()->EnqueueConnEvent(f, IntrusivePtr{AdoptRef{}, val_mgr->GetInt(id1)});
|
||||
endp->TCP()->EnqueueConnEvent(f, val_mgr->Int(id1));
|
||||
}
|
||||
|
||||
void SteppingStoneEndpoint::CreateEndpEvent(bool is_orig)
|
||||
|
@ -148,7 +147,7 @@ void SteppingStoneEndpoint::CreateEndpEvent(bool is_orig)
|
|||
|
||||
endp->TCP()->EnqueueConnEvent(stp_create_endp,
|
||||
IntrusivePtr{AdoptRef{}, endp->TCP()->BuildConnVal()},
|
||||
IntrusivePtr{AdoptRef{}, val_mgr->GetInt(stp_id)},
|
||||
val_mgr->Int(stp_id),
|
||||
val_mgr->Bool(is_orig)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ static RecordVal* build_syn_packet_val(bool is_orig, const IP_Hdr* ip,
|
|||
v->Assign(2, val_mgr->GetCount((ip->TTL())));
|
||||
v->Assign(3, val_mgr->GetCount((ip->TotalLen())));
|
||||
v->Assign(4, val_mgr->GetCount(ntohs(tcp->th_win)));
|
||||
v->Assign(5, val_mgr->GetInt(winscale));
|
||||
v->Assign(5, val_mgr->Int(winscale));
|
||||
v->Assign(6, val_mgr->GetCount(MSS));
|
||||
v->Assign(7, val_mgr->Bool(SACK));
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ struct val_converter {
|
|||
result_type operator()(int64_t a)
|
||||
{
|
||||
if ( type->Tag() == TYPE_INT )
|
||||
return val_mgr->GetInt(a);
|
||||
return val_mgr->Int(a).release();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -524,7 +524,7 @@ VectorVal* file_analysis::GenMIMEMatchesVal(const RuleMatcher::MIME_Matches& m)
|
|||
for ( set<string>::const_iterator it2 = it->second.begin();
|
||||
it2 != it->second.end(); ++it2 )
|
||||
{
|
||||
element->Assign(0, val_mgr->GetInt(it->first));
|
||||
element->Assign(0, val_mgr->Int(it->first));
|
||||
element->Assign(1, make_intrusive<StringVal>(*it2));
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ RecordVal* x509_result_record(uint64_t num, const char* reason, Val* chainVector
|
|||
{
|
||||
RecordVal* rrecord = new RecordVal(BifType::Record::X509::Result);
|
||||
|
||||
rrecord->Assign(0, val_mgr->GetInt(num));
|
||||
rrecord->Assign(0, val_mgr->Int(num));
|
||||
rrecord->Assign(1, make_intrusive<StringVal>(reason));
|
||||
if ( chainVector )
|
||||
rrecord->Assign(2, chainVector);
|
||||
|
|
|
@ -2262,7 +2262,7 @@ Val* Manager::ValueToVal(const Stream* i, const Value* val, BroType* request_typ
|
|||
return val_mgr->Bool(val->val.int_val)->Ref();
|
||||
|
||||
case TYPE_INT:
|
||||
return val_mgr->GetInt(val->val.int_val);
|
||||
return val_mgr->Int(val->val.int_val).release();
|
||||
|
||||
case TYPE_COUNT:
|
||||
case TYPE_COUNTER:
|
||||
|
@ -2410,7 +2410,7 @@ Val* Manager::ValueToVal(const Stream* i, const Value* val, bool& have_error) co
|
|||
return val_mgr->Bool(val->val.int_val)->Ref();
|
||||
|
||||
case TYPE_INT:
|
||||
return val_mgr->GetInt(val->val.int_val);
|
||||
return val_mgr->Int(val->val.int_val).release();
|
||||
|
||||
case TYPE_COUNT:
|
||||
case TYPE_COUNTER:
|
||||
|
|
|
@ -444,7 +444,7 @@ function gsub%(str: string, re: pattern, repl: string%): string
|
|||
## *s1* is greater than, equal to, or less than *s2*.
|
||||
function strcmp%(s1: string, s2: string%): int
|
||||
%{
|
||||
return val_mgr->GetInt(Bstr_cmp(s1->AsString(), s2->AsString()));
|
||||
return val_mgr->Int(Bstr_cmp(s1->AsString(), s2->AsString()));
|
||||
%}
|
||||
|
||||
## Locates the first occurrence of one string in another.
|
||||
|
|
|
@ -1121,7 +1121,7 @@ IntrusivePtr<RecordVal> Supervisor::NodeConfig::ToRecord() const
|
|||
rval->Assign(rt->FieldOffset("stderr_file"), make_intrusive<StringVal>(*stderr_file));
|
||||
|
||||
if ( cpu_affinity )
|
||||
rval->Assign(rt->FieldOffset("cpu_affinity"), val_mgr->GetInt(*cpu_affinity));
|
||||
rval->Assign(rt->FieldOffset("cpu_affinity"), val_mgr->Int(*cpu_affinity));
|
||||
|
||||
auto st = BifType::Record::Supervisor::NodeConfig->FieldType("scripts");
|
||||
auto scripts_val = new VectorVal(st->AsVectorType());
|
||||
|
@ -1163,7 +1163,7 @@ IntrusivePtr<RecordVal> Supervisor::Node::ToRecord() const
|
|||
rval->Assign(rt->FieldOffset("node"), config.ToRecord());
|
||||
|
||||
if ( pid )
|
||||
rval->Assign(rt->FieldOffset("pid"), val_mgr->GetInt(pid));
|
||||
rval->Assign(rt->FieldOffset("pid"), val_mgr->Int(pid));
|
||||
|
||||
return rval;
|
||||
}
|
||||
|
|
|
@ -102,11 +102,11 @@ function Supervisor::__is_supervisor%(%): bool
|
|||
function Supervisor::__stem_pid%(%): int
|
||||
%{
|
||||
if ( zeek::supervisor_mgr )
|
||||
return val_mgr->GetInt(zeek::supervisor_mgr->StemPID());
|
||||
return val_mgr->Int(zeek::supervisor_mgr->StemPID());
|
||||
|
||||
if ( zeek::Supervisor::ThisNode() )
|
||||
return val_mgr->GetInt(zeek::Supervisor::ThisNode()->parent_pid);
|
||||
return val_mgr->Int(zeek::Supervisor::ThisNode()->parent_pid);
|
||||
|
||||
builtin_error("supervisor mode not enabled and not a supervised node");
|
||||
return val_mgr->GetInt(-1);
|
||||
return val_mgr->Int(-1);
|
||||
%}
|
||||
|
|
16
src/zeek.bif
16
src/zeek.bif
|
@ -468,7 +468,7 @@ static int do_system(const char* s)
|
|||
function system%(str: string%): int
|
||||
%{
|
||||
int result = do_system(str->CheckString());
|
||||
return val_mgr->GetInt(result);
|
||||
return val_mgr->Int(result);
|
||||
%}
|
||||
|
||||
## Invokes a command via the ``system`` function of the OS with a prepared
|
||||
|
@ -489,17 +489,17 @@ function system_env%(str: string, env: table_string_of_string%): int
|
|||
if ( env->Type()->Tag() != TYPE_TABLE )
|
||||
{
|
||||
builtin_error("system_env() requires a table argument");
|
||||
return val_mgr->GetInt(-1);
|
||||
return val_mgr->Int(-1);
|
||||
}
|
||||
|
||||
if ( ! prepare_environment(env->AsTableVal(), true) )
|
||||
return val_mgr->GetInt(-1);
|
||||
return val_mgr->Int(-1);
|
||||
|
||||
int result = do_system(str->CheckString());
|
||||
|
||||
prepare_environment(env->AsTableVal(), false);
|
||||
|
||||
return val_mgr->GetInt(result);
|
||||
return val_mgr->Int(result);
|
||||
%}
|
||||
|
||||
## Opens a program with ``popen`` and writes a given string to the returned
|
||||
|
@ -1901,7 +1901,7 @@ function packet_source%(%): PacketSource
|
|||
{
|
||||
r->Assign(0, val_mgr->Bool(ps->IsLive()));
|
||||
r->Assign(1, make_intrusive<StringVal>(ps->Path()));
|
||||
r->Assign(2, val_mgr->GetInt(ps->LinkType()));
|
||||
r->Assign(2, val_mgr->Int(ps->LinkType()));
|
||||
r->Assign(3, val_mgr->GetCount(ps->Netmask()));
|
||||
}
|
||||
|
||||
|
@ -2273,10 +2273,10 @@ function enum_to_int%(e: any%): int
|
|||
if ( e->Type()->Tag() != TYPE_ENUM )
|
||||
{
|
||||
builtin_error("enum_to_int() requires enum value");
|
||||
return val_mgr->GetInt(-1);
|
||||
return val_mgr->Int(-1);
|
||||
}
|
||||
|
||||
return val_mgr->GetInt(e->AsEnum());
|
||||
return val_mgr->Int(e->AsEnum());
|
||||
%}
|
||||
|
||||
## Converts a :zeek:type:`string` to an :zeek:type:`int`.
|
||||
|
@ -2300,7 +2300,7 @@ function to_int%(str: string%): int
|
|||
builtin_error("bad conversion to integer", @ARG@[0]);
|
||||
#endif
|
||||
|
||||
return val_mgr->GetInt(i);
|
||||
return val_mgr->Int(i);
|
||||
%}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue