Don't specify 0u for initial value of loops changed to size_t

This commit is contained in:
Tim Wojtulewicz 2020-07-30 09:57:42 -07:00
parent 300efc7e04
commit a2c3919492
4 changed files with 16 additions and 16 deletions

View file

@ -250,7 +250,7 @@ zeek::Options zeek::parse_cmdline(int argc, char** argv)
// getopt may permute the array, so need yet another array // getopt may permute the array, so need yet another array
auto zargs = std::make_unique<char*[]>(zeek_args.size()); auto zargs = std::make_unique<char*[]>(zeek_args.size());
for ( size_t i = 0u; i < zeek_args.size(); ++i ) for ( size_t i = 0; i < zeek_args.size(); ++i )
zargs[i] = zeek_args[i].data(); zargs[i] = zeek_args[i].data();
while ( (op = getopt_long(zeek_args.size(), zargs.get(), opts, long_opts, &long_optsind)) != EOF ) while ( (op = getopt_long(zeek_args.size(), zargs.get(), opts, long_opts, &long_optsind)) != EOF )

View file

@ -85,7 +85,7 @@ RPC_CallInfo::RPC_CallInfo(uint32_t arg_xid, const u_char*& buf, int& n, double
return; return;
} }
for ( size_t i = 0u; i < number_of_gids; ++i ) for ( size_t i = 0; i < number_of_gids; ++i )
auxgids.push_back(extract_XDR_uint32(cred_opaque, cred_opaque_n)); auxgids.push_back(extract_XDR_uint32(cred_opaque, cred_opaque_n));
} }

View file

@ -239,7 +239,7 @@ struct val_converter {
auto list_val = zeek::make_intrusive<zeek::ListVal>(zeek::TYPE_ANY); auto list_val = zeek::make_intrusive<zeek::ListVal>(zeek::TYPE_ANY);
for ( size_t i = 0u; i < indices->size(); ++i ) for ( size_t i = 0; i < indices->size(); ++i )
{ {
auto index_val = bro_broker::data_to_val(move((*indices)[i]), auto index_val = bro_broker::data_to_val(move((*indices)[i]),
expected_index_types[i].get()); expected_index_types[i].get());
@ -298,7 +298,7 @@ struct val_converter {
auto list_val = zeek::make_intrusive<zeek::ListVal>(zeek::TYPE_ANY); auto list_val = zeek::make_intrusive<zeek::ListVal>(zeek::TYPE_ANY);
for ( size_t i = 0u; i < indices->size(); ++i ) for ( size_t i = 0; i < indices->size(); ++i )
{ {
auto index_val = bro_broker::data_to_val(move((*indices)[i]), auto index_val = bro_broker::data_to_val(move((*indices)[i]),
expected_index_types[i].get()); expected_index_types[i].get());
@ -386,7 +386,7 @@ struct val_converter {
auto rval = zeek::make_intrusive<zeek::RecordVal>(zeek::IntrusivePtr{zeek::NewRef{}, rt}); auto rval = zeek::make_intrusive<zeek::RecordVal>(zeek::IntrusivePtr{zeek::NewRef{}, rt});
auto idx = 0u; auto idx = 0u;
for ( size_t i = 0u; i < static_cast<size_t>(rt->NumFields()); ++i ) for ( size_t i = 0; i < static_cast<size_t>(rt->NumFields()); ++i )
{ {
if ( idx >= a.size() ) if ( idx >= a.size() )
return nullptr; return nullptr;
@ -574,7 +574,7 @@ struct type_checker {
{ {
indices_to_check.reserve(indices->size()); indices_to_check.reserve(indices->size());
for ( size_t i = 0u; i < indices->size(); ++i ) for ( size_t i = 0; i < indices->size(); ++i )
indices_to_check.emplace_back(&(*indices)[i]); indices_to_check.emplace_back(&(*indices)[i]);
} }
} }
@ -582,7 +582,7 @@ struct type_checker {
{ {
indices_to_check.reserve(indices->size()); indices_to_check.reserve(indices->size());
for ( size_t i = 0u; i < indices->size(); ++i ) for ( size_t i = 0; i < indices->size(); ++i )
indices_to_check.emplace_back(&(*indices)[i]); indices_to_check.emplace_back(&(*indices)[i]);
} }
} }
@ -592,7 +592,7 @@ struct type_checker {
if ( expected_index_types.size() != indices_to_check.size() ) if ( expected_index_types.size() != indices_to_check.size() )
return false; return false;
for ( size_t i = 0u; i < indices_to_check.size(); ++i ) for ( size_t i = 0; i < indices_to_check.size(); ++i )
{ {
auto expect = expected_index_types[i].get(); auto expect = expected_index_types[i].get();
auto& index_to_check = *(indices_to_check)[i]; auto& index_to_check = *(indices_to_check)[i];
@ -633,7 +633,7 @@ struct type_checker {
{ {
indices_to_check.reserve(indices->size()); indices_to_check.reserve(indices->size());
for ( size_t i = 0u; i < indices->size(); ++i ) for ( size_t i = 0; i < indices->size(); ++i )
indices_to_check.emplace_back(&(*indices)[i]); indices_to_check.emplace_back(&(*indices)[i]);
} }
} }
@ -641,7 +641,7 @@ struct type_checker {
{ {
indices_to_check.reserve(indices->size()); indices_to_check.reserve(indices->size());
for ( size_t i = 0u; i < indices->size(); ++i ) for ( size_t i = 0; i < indices->size(); ++i )
indices_to_check.emplace_back(&(*indices)[i]); indices_to_check.emplace_back(&(*indices)[i]);
} }
} }
@ -654,7 +654,7 @@ struct type_checker {
return false; return false;
} }
for ( size_t i = 0u; i < indices_to_check.size(); ++i ) for ( size_t i = 0; i < indices_to_check.size(); ++i )
{ {
auto expect = expected_index_types[i].get(); auto expect = expected_index_types[i].get();
auto& index_to_check = *(indices_to_check)[i]; auto& index_to_check = *(indices_to_check)[i];
@ -715,7 +715,7 @@ struct type_checker {
auto rt = type->AsRecordType(); auto rt = type->AsRecordType();
auto idx = 0u; auto idx = 0u;
for ( size_t i = 0u; i < static_cast<size_t>(rt->NumFields()); ++i ) for ( size_t i = 0; i < static_cast<size_t>(rt->NumFields()); ++i )
{ {
if ( idx >= a.size() ) if ( idx >= a.size() )
return false; return false;
@ -964,7 +964,7 @@ broker::expected<broker::data> bro_broker::val_to_data(const zeek::Val* v)
size_t num_fields = v->GetType()->AsRecordType()->NumFields(); size_t num_fields = v->GetType()->AsRecordType()->NumFields();
rval.reserve(num_fields); rval.reserve(num_fields);
for ( size_t i = 0u; i < num_fields; ++i ) for ( size_t i = 0; i < num_fields; ++i )
{ {
auto item_val = rec->GetFieldOrDefault(i); auto item_val = rec->GetFieldOrDefault(i);

View file

@ -855,7 +855,7 @@ bool Manager::Forward(string topic_prefix)
bool Manager::Unsubscribe(const string& topic_prefix) bool Manager::Unsubscribe(const string& topic_prefix)
{ {
for ( size_t i = 0u; i < forwarded_prefixes.size(); ++i ) for ( size_t i = 0; i < forwarded_prefixes.size(); ++i )
if ( forwarded_prefixes[i] == topic_prefix ) if ( forwarded_prefixes[i] == topic_prefix )
{ {
DBG_LOG(DBG_BROKER, "Unforwading topic prefix %s", topic_prefix.c_str()); DBG_LOG(DBG_BROKER, "Unforwading topic prefix %s", topic_prefix.c_str());
@ -1180,7 +1180,7 @@ void Manager::ProcessEvent(const broker::topic& topic, broker::zeek::Event ev)
zeek::Args vl; zeek::Args vl;
vl.reserve(args.size()); vl.reserve(args.size());
for ( size_t i = 0u; i < args.size(); ++i ) for ( size_t i = 0; i < args.size(); ++i )
{ {
auto got_type = args[i].get_type_name(); auto got_type = args[i].get_type_name();
const auto& expected_type = arg_types[i]; const auto& expected_type = arg_types[i];
@ -1255,7 +1255,7 @@ bool bro_broker::Manager::ProcessLogCreate(broker::zeek::LogCreate lc)
auto num_fields = fields_data->size(); auto num_fields = fields_data->size();
auto fields = new threading::Field* [num_fields]; auto fields = new threading::Field* [num_fields];
for ( size_t i = 0u; i < num_fields; ++i ) for ( size_t i = 0; i < num_fields; ++i )
{ {
if ( auto field = data_to_threading_field(std::move((*fields_data)[i])) ) if ( auto field = data_to_threading_field(std::move((*fields_data)[i])) )
fields[i] = field; fields[i] = field;