lint fixes: ensuring functions return values, robustness to nil Val's

This commit is contained in:
Vern Paxson 2021-03-18 08:21:19 -07:00
parent e21c0f1115
commit 5a8ba8c3e5
4 changed files with 8 additions and 2 deletions

View file

@ -713,6 +713,8 @@ function enable_stream(id: ID) : bool
if ( id in all_streams )
active_streams[id] = all_streams[id];
return T;
}
# convenience function to add a filter name to stream_filters

View file

@ -217,7 +217,7 @@ function set_current_threshold(c: connection, ttype: threshold_type, is_orig: bo
return set_current_conn_packets_threshold(c$id, t, T);
else if ( ttype == PACKETS && ! is_orig )
return set_current_conn_packets_threshold(c$id, t, F);
else if ( ttype == DURATION )
else # ttype == DURATION
return set_current_conn_duration_threshold(c$id, td);
}

View file

@ -33,7 +33,7 @@ function id_matches_direction(id: conn_id, d: Direction): bool
return (o_local && !r_local) || (!o_local && r_local);
else if ( d == OUTBOUND )
return o_local && !r_local;
else if ( d == INBOUND )
else # d == INBOUND
return !o_local && r_local;
}

View file

@ -68,6 +68,10 @@ static int check_fmt_type(zeek::TypeTag t, zeek::TypeTag ok[])
static void do_fmt(const char*& fmt, zeek::Val* v, zeek::ODesc* d)
{
if ( ! v )
// Help with error propagation in compiled code.
return;
zeek::TypeTag t = v->GetType()->Tag();
zeek::InternalTypeTag it = v->GetType()->InternalType();