From 63163a98a885cf6e830c69173df833112ee09df4 Mon Sep 17 00:00:00 2001 From: Derek Argueta Date: Thu, 1 Aug 2019 00:02:20 +0000 Subject: [PATCH 1/7] clang-tidy: modernize-loop-convert Signed-off-by: Derek Argueta --- .clang-tidy | 1 + source/common/grpc/google_grpc_utils.cc | 4 ++-- source/common/http/codec_helper.h | 6 +++--- source/common/http/codes.cc | 4 ++-- source/extensions/filters/common/rbac/engine_impl.cc | 6 +++--- .../filters/network/mysql_proxy/mysql_filter.cc | 6 +++--- .../filters/network/redis_proxy/conn_pool_impl.cc | 4 ++-- .../previous_priorities/previous_priorities.cc | 4 ++-- source/extensions/stat_sinks/hystrix/hystrix.cc | 5 ++--- .../extensions/tracers/zipkin/zipkin_core_types.cc | 12 ++++++------ source/server/http/admin.cc | 4 ++-- source/server/options_impl.cc | 4 ++-- test/common/network/lc_trie_test.cc | 4 ++-- test/common/tcp/conn_pool_test.cc | 4 ++-- test/common/upstream/outlier_detection_impl_test.cc | 4 ++-- test/common/upstream/upstream_impl_test.cc | 8 ++++---- .../clusters/redis/redis_cluster_integration_test.cc | 6 +++--- .../filters/http/jwt_authn/group_verifier_test.cc | 4 ++-- .../redis_proxy/redis_proxy_integration_test.cc | 6 +++--- test/integration/fake_upstream.cc | 4 ++-- test/integration/http2_integration_test.cc | 6 +++--- test/server/config_validation/server_test.cc | 4 ++-- 22 files changed, 55 insertions(+), 55 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 09fb39413ac8..c23f42ac2f0d 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -21,6 +21,7 @@ WarningsAsErrors: 'abseil-duration-*, bugprone-use-after-move, clang-analyzer-core.DivideZero, modernize-deprecated-headers, + modernize-loop-convert, modernize-make-shared, modernize-make-unique, modernize-return-braced-init-list, diff --git a/source/common/grpc/google_grpc_utils.cc b/source/common/grpc/google_grpc_utils.cc index cba62fc4722a..21fa7ddf29e9 100644 --- a/source/common/grpc/google_grpc_utils.cc +++ b/source/common/grpc/google_grpc_utils.cc @@ -87,8 +87,8 @@ Buffer::InstancePtr GoogleGrpcUtils::makeBufferInstance(const grpc::ByteBuffer& return nullptr; } - for (size_t i = 0; i < slices.size(); i++) { - buffer->addBufferFragment(*new GrpcSliceBufferFragmentImpl(std::move(slices[i]))); + for (auto& slice : slices) { + buffer->addBufferFragment(*new GrpcSliceBufferFragmentImpl(std::move(slice))); } return buffer; } diff --git a/source/common/http/codec_helper.h b/source/common/http/codec_helper.h index 4d2b456bbcc9..3cc6d5bd6580 100644 --- a/source/common/http/codec_helper.h +++ b/source/common/http/codec_helper.h @@ -73,9 +73,9 @@ class StreamCallbackHelper { // removed multiple times. // The vector may not be safely resized without making sure the run.*Callbacks() helper // functions above still handle removeCallbacks_() calls mid-loop. - for (size_t i = 0; i < callbacks_.size(); i++) { - if (callbacks_[i] == &callbacks) { - callbacks_[i] = nullptr; + for (auto& callback : callbacks_) { + if (callback == &callbacks) { + callback = nullptr; return; } } diff --git a/source/common/http/codes.cc b/source/common/http/codes.cc index ebe4819b077c..746b38a45c5e 100644 --- a/source/common/http/codes.cc +++ b/source/common/http/codes.cc @@ -34,8 +34,8 @@ CodeStatsImpl::CodeStatsImpl(Stats::SymbolTable& symbol_table) vcluster_(stat_name_pool_.add("vcluster")), vhost_(stat_name_pool_.add("vhost")), zone_(stat_name_pool_.add("zone")) { - for (uint32_t i = 0; i < NumHttpCodes; ++i) { - rc_stat_names_[i] = nullptr; + for (auto& rc_stat_name : rc_stat_names_) { + rc_stat_name = nullptr; } // Pre-allocate response codes 200, 404, and 503, as those seem quite likely. diff --git a/source/extensions/filters/common/rbac/engine_impl.cc b/source/extensions/filters/common/rbac/engine_impl.cc index c2b1e05cd2a1..5ba17dbcddde 100644 --- a/source/extensions/filters/common/rbac/engine_impl.cc +++ b/source/extensions/filters/common/rbac/engine_impl.cc @@ -23,11 +23,11 @@ bool RoleBasedAccessControlEngineImpl::allowed(const Network::Connection& connec std::string* effective_policy_id) const { bool matched = false; - for (auto it = policies_.begin(); it != policies_.end(); it++) { - if (it->second.matches(connection, headers, metadata)) { + for (const auto& policie : policies_) { + if (policie.second.matches(connection, headers, metadata)) { matched = true; if (effective_policy_id != nullptr) { - *effective_policy_id = it->first; + *effective_policy_id = policie.first; } break; } diff --git a/source/extensions/filters/network/mysql_proxy/mysql_filter.cc b/source/extensions/filters/network/mysql_proxy/mysql_filter.cc index 75f14d2d1de5..30d3c9b60d79 100644 --- a/source/extensions/filters/network/mysql_proxy/mysql_filter.cc +++ b/source/extensions/filters/network/mysql_proxy/mysql_filter.cc @@ -128,9 +128,9 @@ void MySQLFilter::onCommand(Command& command) { } hsql::TableAccessMap table_access_map; result.getStatement(i)->tablesAccessed(table_access_map); - for (auto it = table_access_map.begin(); it != table_access_map.end(); ++it) { - auto& operations = *fields[it->first].mutable_list_value(); - for (auto ot = it->second.begin(); ot != it->second.end(); ++ot) { + for (auto& it : table_access_map) { + auto& operations = *fields[it.first].mutable_list_value(); + for (auto ot = it.second.begin(); ot != it.second.end(); ++ot) { operations.add_values()->set_string_value(*ot); } } diff --git a/source/extensions/filters/network/redis_proxy/conn_pool_impl.cc b/source/extensions/filters/network/redis_proxy/conn_pool_impl.cc index 3f998b191efb..44f2634aa89a 100644 --- a/source/extensions/filters/network/redis_proxy/conn_pool_impl.cc +++ b/source/extensions/filters/network/redis_proxy/conn_pool_impl.cc @@ -98,8 +98,8 @@ void InstanceImpl::ThreadLocalPool::onClusterAddOrUpdateNonVirtual( }); ASSERT(host_address_map_.empty()); - for (uint32_t i = 0; i < cluster_->prioritySet().hostSetsPerPriority().size(); i++) { - for (auto& host : cluster_->prioritySet().hostSetsPerPriority()[i]->hosts()) { + for (const auto& i : cluster_->prioritySet().hostSetsPerPriority()) { + for (auto& host : i->hosts()) { host_address_map_[host->address()->asString()] = host; } } diff --git a/source/extensions/retry/priority/previous_priorities/previous_priorities.cc b/source/extensions/retry/priority/previous_priorities/previous_priorities.cc index 701567e621f6..d6aea5b7895c 100644 --- a/source/extensions/retry/priority/previous_priorities/previous_priorities.cc +++ b/source/extensions/retry/priority/previous_priorities/previous_priorities.cc @@ -47,8 +47,8 @@ bool PreviousPrioritiesRetryPriority::adjustForAttemptedPriorities( // This allows us to fall back to the unmodified priority load when we run out of priorities // instead of failing to route requests. if (total_availability == 0) { - for (size_t i = 0; i < excluded_priorities_.size(); ++i) { - excluded_priorities_[i] = false; + for (auto&& excluded_prioritie : excluded_priorities_) { + excluded_prioritie = false; } attempted_priorities_.clear(); total_availability = diff --git a/source/extensions/stat_sinks/hystrix/hystrix.cc b/source/extensions/stat_sinks/hystrix/hystrix.cc index ab54929579ab..9267e6c75680 100644 --- a/source/extensions/stat_sinks/hystrix/hystrix.cc +++ b/source/extensions/stat_sinks/hystrix/hystrix.cc @@ -39,9 +39,8 @@ void ClusterStatsCache::printToStream(std::stringstream& out_str) { void ClusterStatsCache::printRollingWindow(absl::string_view name, RollingWindow rolling_window, std::stringstream& out_str) { out_str << name << " | "; - for (auto specific_stat_vec_itr = rolling_window.begin(); - specific_stat_vec_itr != rolling_window.end(); ++specific_stat_vec_itr) { - out_str << *specific_stat_vec_itr << " | "; + for (unsigned long& specific_stat_vec_itr : rolling_window) { + out_str << specific_stat_vec_itr << " | "; } out_str << std::endl; } diff --git a/source/extensions/tracers/zipkin/zipkin_core_types.cc b/source/extensions/tracers/zipkin/zipkin_core_types.cc index e99e87312077..1730e3cd75cd 100644 --- a/source/extensions/tracers/zipkin/zipkin_core_types.cc +++ b/source/extensions/tracers/zipkin/zipkin_core_types.cc @@ -166,8 +166,8 @@ Span::Span(const Span& span) : time_source_(span.time_source_) { } void Span::setServiceName(const std::string& service_name) { - for (auto it = annotations_.begin(); it != annotations_.end(); it++) { - it->changeEndpointServiceName(service_name); + for (auto& annotation : annotations_) { + annotation.changeEndpointServiceName(service_name); } } @@ -203,15 +203,15 @@ const std::string Span::toJson() { std::vector annotation_json_vector; - for (auto it = annotations_.begin(); it != annotations_.end(); it++) { - annotation_json_vector.push_back(it->toJson()); + for (auto& annotation : annotations_) { + annotation_json_vector.push_back(annotation.toJson()); } Util::addArrayToJson(json_string, annotation_json_vector, ZipkinJsonFieldNames::get().SPAN_ANNOTATIONS); std::vector binary_annotation_json_vector; - for (auto it = binary_annotations_.begin(); it != binary_annotations_.end(); it++) { - binary_annotation_json_vector.push_back(it->toJson()); + for (auto& binary_annotation : binary_annotations_) { + binary_annotation_json_vector.push_back(binary_annotation.toJson()); } Util::addArrayToJson(json_string, binary_annotation_json_vector, ZipkinJsonFieldNames::get().SPAN_BINARY_ANNOTATIONS); diff --git a/source/server/http/admin.cc b/source/server/http/admin.cc index b7e8a22cebbb..5faacc1eb76d 100644 --- a/source/server/http/admin.cc +++ b/source/server/http/admin.cc @@ -672,8 +672,8 @@ Http::Code AdminImpl::handlerLogging(absl::string_view url, Http::HeaderMap&, response.add("usage: /logging?= (change single level)\n"); response.add("usage: /logging?level= (change all levels)\n"); response.add("levels: "); - for (size_t i = 0; i < ARRAY_SIZE(spdlog::level::level_string_views); i++) { - response.add(fmt::format("{} ", spdlog::level::level_string_views[i])); + for (auto level_string_view : spdlog::level::level_string_views) { + response.add(fmt::format("{} ", level_string_view)); } response.add("\n"); diff --git a/source/server/options_impl.cc b/source/server/options_impl.cc index 37befc6dc084..9db443e9848f 100644 --- a/source/server/options_impl.cc +++ b/source/server/options_impl.cc @@ -23,8 +23,8 @@ OptionsImpl::OptionsImpl(int argc, const char* const* argv, spdlog::level::level_enum default_log_level) : signal_handling_enabled_(true) { std::string log_levels_string = "Log levels: "; - for (size_t i = 0; i < ARRAY_SIZE(spdlog::level::level_string_views); i++) { - log_levels_string += fmt::format("[{}]", spdlog::level::level_string_views[i]); + for (auto level_string_view : spdlog::level::level_string_views) { + log_levels_string += fmt::format("[{}]", level_string_view); } log_levels_string += fmt::format("\nDefault is [{}]", spdlog::level::level_string_views[default_log_level]); diff --git a/test/common/network/lc_trie_test.cc b/test/common/network/lc_trie_test.cc index 75b93e2dee1a..e0cf9ac43532 100644 --- a/test/common/network/lc_trie_test.cc +++ b/test/common/network/lc_trie_test.cc @@ -21,8 +21,8 @@ class LcTrieTest : public testing::Test { for (size_t i = 0; i < cidr_range_strings.size(); i++) { std::pair> ip_tags; ip_tags.first = fmt::format("tag_{0}", i); - for (size_t j = 0; j < cidr_range_strings[i].size(); j++) { - ip_tags.second.push_back(Address::CidrRange::create(cidr_range_strings[i][j])); + for (const auto& j : cidr_range_strings[i]) { + ip_tags.second.push_back(Address::CidrRange::create(j)); } output.push_back(ip_tags); } diff --git a/test/common/tcp/conn_pool_test.cc b/test/common/tcp/conn_pool_test.cc index 5cf14a40a0f5..5bcb19698b39 100644 --- a/test/common/tcp/conn_pool_test.cc +++ b/test/common/tcp/conn_pool_test.cc @@ -126,8 +126,8 @@ class ConnPoolImplForTest : public ConnPoolImpl { protected: void onConnReleased(ConnPoolImpl::ActiveConn& conn) override { - for (auto i = test_conns_.begin(); i != test_conns_.end(); i++) { - if (conn.conn_.get() == i->connection_) { + for (auto& test_conn : test_conns_) { + if (conn.conn_.get() == test_conn.connection_) { onConnReleasedForTest(); break; } diff --git a/test/common/upstream/outlier_detection_impl_test.cc b/test/common/upstream/outlier_detection_impl_test.cc index c7a3cb08abf3..c585a5509855 100644 --- a/test/common/upstream/outlier_detection_impl_test.cc +++ b/test/common/upstream/outlier_detection_impl_test.cc @@ -87,8 +87,8 @@ class OutlierDetectorImplTest : public testing::Test { } template void loadRq(HostVector& hosts, int num_rq, T code) { - for (uint64_t i = 0; i < hosts.size(); i++) { - loadRq(hosts[i], num_rq, code); + for (auto& host : hosts) { + loadRq(host, num_rq, code); } } diff --git a/test/common/upstream/upstream_impl_test.cc b/test/common/upstream/upstream_impl_test.cc index d221c6d838ff..d36f1ec56d20 100644 --- a/test/common/upstream/upstream_impl_test.cc +++ b/test/common/upstream/upstream_impl_test.cc @@ -400,10 +400,10 @@ TEST_F(StrictDnsClusterImplTest, HostRemovalActiveHealthSkipped) { const auto& hosts = cluster.prioritySet().hostSetsPerPriority()[0]->hosts(); EXPECT_EQ(2UL, hosts.size()); - for (size_t i = 0; i < hosts.size(); ++i) { - EXPECT_TRUE(hosts[i]->healthFlagGet(Host::HealthFlag::FAILED_ACTIVE_HC)); - hosts[i]->healthFlagClear(Host::HealthFlag::FAILED_ACTIVE_HC); - hosts[i]->healthFlagClear(Host::HealthFlag::PENDING_ACTIVE_HC); + for (const auto& host : hosts) { + EXPECT_TRUE(host->healthFlagGet(Host::HealthFlag::FAILED_ACTIVE_HC)); + host->healthFlagClear(Host::HealthFlag::FAILED_ACTIVE_HC); + host->healthFlagClear(Host::HealthFlag::PENDING_ACTIVE_HC); } } diff --git a/test/extensions/clusters/redis/redis_cluster_integration_test.cc b/test/extensions/clusters/redis/redis_cluster_integration_test.cc index 546fee9a81c4..077dc3c9d92e 100644 --- a/test/extensions/clusters/redis/redis_cluster_integration_test.cc +++ b/test/extensions/clusters/redis/redis_cluster_integration_test.cc @@ -72,9 +72,9 @@ std::string makeBulkStringArray(std::vector&& command_strings) { std::stringstream result; result << "*" << command_strings.size() << "\r\n"; - for (uint64_t i = 0; i < command_strings.size(); i++) { - result << "$" << command_strings[i].size() << "\r\n"; - result << command_strings[i] << "\r\n"; + for (auto& command_string : command_strings) { + result << "$" << command_string.size() << "\r\n"; + result << command_string << "\r\n"; } return result.str(); diff --git a/test/extensions/filters/http/jwt_authn/group_verifier_test.cc b/test/extensions/filters/http/jwt_authn/group_verifier_test.cc index 0a9ca7f0a6bb..e58ce90d7155 100644 --- a/test/extensions/filters/http/jwt_authn/group_verifier_test.cc +++ b/test/extensions/filters/http/jwt_authn/group_verifier_test.cc @@ -113,7 +113,7 @@ class GroupVerifierTest : public testing::Test { std::unordered_map createAsyncMockAuthsAndVerifier(const std::vector& providers) { std::unordered_map callbacks; - for (std::size_t i = 0; i < providers.size(); ++i) { + for (const auto& provider : providers) { auto mock_auth = std::make_unique(); EXPECT_CALL(*mock_auth, doVerify(_, _, _, _)) .WillOnce(Invoke( @@ -122,7 +122,7 @@ class GroupVerifierTest : public testing::Test { callbacks[iss] = std::move(callback); })); EXPECT_CALL(*mock_auth, onDestroy()).Times(1); - mock_auths_[providers[i]] = std::move(mock_auth); + mock_auths_[provider] = std::move(mock_auth); } createVerifier(); return callbacks; diff --git a/test/extensions/filters/network/redis_proxy/redis_proxy_integration_test.cc b/test/extensions/filters/network/redis_proxy/redis_proxy_integration_test.cc index 444bbc4c1e47..c9f8c2ce10f7 100644 --- a/test/extensions/filters/network/redis_proxy/redis_proxy_integration_test.cc +++ b/test/extensions/filters/network/redis_proxy/redis_proxy_integration_test.cc @@ -264,9 +264,9 @@ std::string makeBulkStringArray(std::vector&& command_strings) { std::stringstream result; result << "*" << command_strings.size() << "\r\n"; - for (uint64_t i = 0; i < command_strings.size(); i++) { - result << "$" << command_strings[i].size() << "\r\n"; - result << command_strings[i] << "\r\n"; + for (auto& command_string : command_strings) { + result << "$" << command_string.size() << "\r\n"; + result << command_string << "\r\n"; } return result.str(); diff --git a/test/integration/fake_upstream.cc b/test/integration/fake_upstream.cc index e6f9ad9d4b7b..8fb6c8f01b6c 100644 --- a/test/integration/fake_upstream.cc +++ b/test/integration/fake_upstream.cc @@ -486,8 +486,8 @@ FakeUpstream::waitForHttpConnection(Event::Dispatcher& client_dispatcher, Event::TestTimeSystem& time_system = upstreams[0]->timeSystem(); auto end_time = time_system.monotonicTime() + timeout; while (time_system.monotonicTime() < end_time) { - for (auto it = upstreams.begin(); it != upstreams.end(); ++it) { - FakeUpstream& upstream = **it; + for (auto& it : upstreams) { + FakeUpstream& upstream = *it; Thread::ReleasableLockGuard lock(upstream.lock_); if (upstream.new_connections_.empty()) { time_system.waitFor(upstream.lock_, upstream.new_connection_event_, 5ms); diff --git a/test/integration/http2_integration_test.cc b/test/integration/http2_integration_test.cc index be8fc519633f..04ba4361f6cd 100644 --- a/test/integration/http2_integration_test.cc +++ b/test/integration/http2_integration_test.cc @@ -1156,10 +1156,10 @@ Http2RingHashIntegrationTest::~Http2RingHashIntegrationTest() { codec_client_->close(); codec_client_ = nullptr; } - for (auto it = fake_upstream_connections_.begin(); it != fake_upstream_connections_.end(); ++it) { - AssertionResult result = (*it)->close(); + for (auto& fake_upstream_connection : fake_upstream_connections_) { + AssertionResult result = fake_upstream_connection->close(); RELEASE_ASSERT(result, result.message()); - result = (*it)->waitForDisconnect(); + result = fake_upstream_connection->waitForDisconnect(); RELEASE_ASSERT(result, result.message()); } } diff --git a/test/server/config_validation/server_test.cc b/test/server/config_validation/server_test.cc index 89b72ac0342b..ea1d201efce2 100644 --- a/test/server/config_validation/server_test.cc +++ b/test/server/config_validation/server_test.cc @@ -42,8 +42,8 @@ class ValidationServerTest_1 : public ValidationServerTest { auto files = TestUtility::listFiles(ValidationServerTest::directory_, false); // Strip directory part. options_ adds it for each test. - for (std::vector::iterator it = files.begin(); it != files.end(); it++) { - (*it) = it->substr(directory_.length() + 1); + for (auto& file : files) { + file = file.substr(directory_.length() + 1); } return files; } From 073e67fb9311f29ba6405871b4e56d29f8fc162a Mon Sep 17 00:00:00 2001 From: Derek Argueta Date: Thu, 1 Aug 2019 01:02:20 +0000 Subject: [PATCH 2/7] fix build Signed-off-by: Derek Argueta --- test/extensions/filters/http/jwt_authn/group_verifier_test.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/extensions/filters/http/jwt_authn/group_verifier_test.cc b/test/extensions/filters/http/jwt_authn/group_verifier_test.cc index e58ce90d7155..14d6de9e2cca 100644 --- a/test/extensions/filters/http/jwt_authn/group_verifier_test.cc +++ b/test/extensions/filters/http/jwt_authn/group_verifier_test.cc @@ -117,7 +117,7 @@ class GroupVerifierTest : public testing::Test { auto mock_auth = std::make_unique(); EXPECT_CALL(*mock_auth, doVerify(_, _, _, _)) .WillOnce(Invoke( - [&callbacks, iss = providers[i]](Http::HeaderMap&, std::vector*, + [&callbacks, iss = provider](Http::HeaderMap&, std::vector*, SetPayloadCallback, AuthenticatorCallback callback) { callbacks[iss] = std::move(callback); })); From e97cf18c53817c367af801ffe3148ced0bbae242 Mon Sep 17 00:00:00 2001 From: Derek Argueta Date: Thu, 1 Aug 2019 01:07:32 +0000 Subject: [PATCH 3/7] formatting Signed-off-by: Derek Argueta --- test/extensions/filters/http/jwt_authn/group_verifier_test.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/extensions/filters/http/jwt_authn/group_verifier_test.cc b/test/extensions/filters/http/jwt_authn/group_verifier_test.cc index 14d6de9e2cca..0bc1f57ddd05 100644 --- a/test/extensions/filters/http/jwt_authn/group_verifier_test.cc +++ b/test/extensions/filters/http/jwt_authn/group_verifier_test.cc @@ -118,7 +118,7 @@ class GroupVerifierTest : public testing::Test { EXPECT_CALL(*mock_auth, doVerify(_, _, _, _)) .WillOnce(Invoke( [&callbacks, iss = provider](Http::HeaderMap&, std::vector*, - SetPayloadCallback, AuthenticatorCallback callback) { + SetPayloadCallback, AuthenticatorCallback callback) { callbacks[iss] = std::move(callback); })); EXPECT_CALL(*mock_auth, onDestroy()).Times(1); From 5203b0ec15a332ec658b88461d6598eb572a78d5 Mon Sep 17 00:00:00 2001 From: Derek Argueta Date: Thu, 1 Aug 2019 01:26:21 +0000 Subject: [PATCH 4/7] fix spelling Signed-off-by: Derek Argueta --- .../retry/priority/previous_priorities/previous_priorities.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/extensions/retry/priority/previous_priorities/previous_priorities.cc b/source/extensions/retry/priority/previous_priorities/previous_priorities.cc index d6aea5b7895c..7a1ec35d5263 100644 --- a/source/extensions/retry/priority/previous_priorities/previous_priorities.cc +++ b/source/extensions/retry/priority/previous_priorities/previous_priorities.cc @@ -47,8 +47,8 @@ bool PreviousPrioritiesRetryPriority::adjustForAttemptedPriorities( // This allows us to fall back to the unmodified priority load when we run out of priorities // instead of failing to route requests. if (total_availability == 0) { - for (auto&& excluded_prioritie : excluded_priorities_) { - excluded_prioritie = false; + for (auto&& excluded_priority : excluded_priorities_) { + excluded_priority = false; } attempted_priorities_.clear(); total_availability = From 77142e7171e60bb495c3f2626ee1e2d0ceccbcea Mon Sep 17 00:00:00 2001 From: Derek Argueta Date: Thu, 1 Aug 2019 03:09:45 +0000 Subject: [PATCH 5/7] fix clang-tidy Signed-off-by: Derek Argueta --- source/extensions/filters/network/mysql_proxy/mysql_filter.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/extensions/filters/network/mysql_proxy/mysql_filter.cc b/source/extensions/filters/network/mysql_proxy/mysql_filter.cc index 30d3c9b60d79..aae1a0ecd292 100644 --- a/source/extensions/filters/network/mysql_proxy/mysql_filter.cc +++ b/source/extensions/filters/network/mysql_proxy/mysql_filter.cc @@ -130,8 +130,8 @@ void MySQLFilter::onCommand(Command& command) { result.getStatement(i)->tablesAccessed(table_access_map); for (auto& it : table_access_map) { auto& operations = *fields[it.first].mutable_list_value(); - for (auto ot = it.second.begin(); ot != it.second.end(); ++ot) { - operations.add_values()->set_string_value(*ot); + for (const auto& ot : it.second) { + operations.add_values()->set_string_value(ot); } } } From 517606e2dc750d398da9123c799b7884ef710d55 Mon Sep 17 00:00:00 2001 From: Derek Argueta Date: Wed, 31 Jul 2019 21:26:22 -0700 Subject: [PATCH 6/7] fix MacOS build Signed-off-by: Derek Argueta --- source/extensions/stat_sinks/hystrix/hystrix.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/extensions/stat_sinks/hystrix/hystrix.cc b/source/extensions/stat_sinks/hystrix/hystrix.cc index 9267e6c75680..a0e32b90a5ea 100644 --- a/source/extensions/stat_sinks/hystrix/hystrix.cc +++ b/source/extensions/stat_sinks/hystrix/hystrix.cc @@ -39,7 +39,7 @@ void ClusterStatsCache::printToStream(std::stringstream& out_str) { void ClusterStatsCache::printRollingWindow(absl::string_view name, RollingWindow rolling_window, std::stringstream& out_str) { out_str << name << " | "; - for (unsigned long& specific_stat_vec_itr : rolling_window) { + for (uint64_t& specific_stat_vec_itr : rolling_window) { out_str << specific_stat_vec_itr << " | "; } out_str << std::endl; From 2e86064956898d696bccb6248d8b5c3ec3173d61 Mon Sep 17 00:00:00 2001 From: Derek Argueta Date: Fri, 2 Aug 2019 16:59:56 -0700 Subject: [PATCH 7/7] fix spelling Signed-off-by: Derek Argueta --- source/extensions/filters/common/rbac/engine_impl.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/extensions/filters/common/rbac/engine_impl.cc b/source/extensions/filters/common/rbac/engine_impl.cc index 5ba17dbcddde..a35697d74d5f 100644 --- a/source/extensions/filters/common/rbac/engine_impl.cc +++ b/source/extensions/filters/common/rbac/engine_impl.cc @@ -23,11 +23,11 @@ bool RoleBasedAccessControlEngineImpl::allowed(const Network::Connection& connec std::string* effective_policy_id) const { bool matched = false; - for (const auto& policie : policies_) { - if (policie.second.matches(connection, headers, metadata)) { + for (const auto& policy : policies_) { + if (policy.second.matches(connection, headers, metadata)) { matched = true; if (effective_policy_id != nullptr) { - *effective_policy_id = policie.first; + *effective_policy_id = policy.first; } break; }