Fix clang-tidy modernize-return-braced-init-list warnings in headers

This commit is contained in:
Tim Wojtulewicz 2025-06-09 19:54:42 -07:00
parent 157c488b9d
commit ed202b36b2
4 changed files with 7 additions and 7 deletions

View file

@ -549,7 +549,7 @@ inline ::hilti::rt::Address as_address(const ValPtr& v) {
/** Converts a Zeek `bool` value to its Spicy equivalent. Throws on error. */
inline ::hilti::rt::Bool as_bool(const ValPtr& v) {
detail::check_type(v, TYPE_BOOL, "bool");
return ::hilti::rt::Bool(v->AsBool());
return {v->AsBool()};
}
/** Converts a Zeek `count` value to its Spicy equivalent. Throws on error. */
@ -592,7 +592,7 @@ inline ::hilti::rt::Port as_port(const ValPtr& v) {
auto p = v->AsPortVal();
// Wrap port number into safe integer to catch any overflows (Zeek returns
// an uint32, while HILTI wants an uint16).
return ::hilti::rt::Port(hilti::rt::integer::safe<uint16_t>(p->Port()), p->PortType());
return {hilti::rt::integer::safe<uint16_t>(p->Port()), p->PortType()};
}
/** Converts a Zeek `record` value to its Spicy equivalent. Throws on error. */
@ -615,14 +615,14 @@ inline ValSetPtr as_set(const ValPtr& v) {
inline hilti::rt::Bytes as_string(const ValPtr& v) {
detail::check_type(v, TYPE_STRING, "string");
auto str = v->AsString();
return hilti::rt::Bytes(reinterpret_cast<const char*>(str->Bytes()), str->Len());
return {reinterpret_cast<const char*>(str->Bytes()), static_cast<size_t>(str->Len())};
}
/** Converts a Zeek `subnet` value to its Spicy equivalent. Throws on error. */
inline ::hilti::rt::Network as_subnet(const ValPtr& v) {
detail::check_type(v, TYPE_SUBNET, "subnet");
auto subnet = v->AsSubNet();
return ::hilti::rt::Network(subnet.Prefix(), subnet.Length());
return {subnet.Prefix(), subnet.Length()};
}
/** Converts a Zeek `table` value to its Spicy equivalent. Throws on error. */