From 9e515951ac422faec2699fd8c7d75e7dfed6e377 Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Fri, 17 Aug 2018 15:47:03 -0700 Subject: size_t shouldn't have the value -1; switch to int --- src/core/lib/transport/service_config.cc | 4 ++-- src/core/lib/transport/service_config.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/core/lib/transport') diff --git a/src/core/lib/transport/service_config.cc b/src/core/lib/transport/service_config.cc index e1a55d98ab..405e336028 100644 --- a/src/core/lib/transport/service_config.cc +++ b/src/core/lib/transport/service_config.cc @@ -65,8 +65,8 @@ const char* ServiceConfig::GetLoadBalancingPolicyName() const { return lb_policy_name; } -size_t ServiceConfig::CountNamesInMethodConfig(grpc_json* json) { - size_t num_names = 0; +int ServiceConfig::CountNamesInMethodConfig(grpc_json* json) { + int num_names = 0; for (grpc_json* field = json->child; field != nullptr; field = field->next) { if (field->key != nullptr && strcmp(field->key, "name") == 0) { if (field->type != GRPC_JSON_ARRAY) return -1; diff --git a/src/core/lib/transport/service_config.h b/src/core/lib/transport/service_config.h index a65b267d46..2c0dd75845 100644 --- a/src/core/lib/transport/service_config.h +++ b/src/core/lib/transport/service_config.h @@ -103,7 +103,7 @@ class ServiceConfig { ServiceConfig(UniquePtr json_string, grpc_json* json_tree); // Returns the number of names specified in the method config \a json. - static size_t CountNamesInMethodConfig(grpc_json* json); + static int CountNamesInMethodConfig(grpc_json* json); // Returns a path string for the JSON name object specified by \a json. // Returns null on error. @@ -188,9 +188,9 @@ ServiceConfig::CreateMethodConfigTable(CreateValue create_value) { // Find number of entries. for (grpc_json* method = field->child; method != nullptr; method = method->next) { - size_t count = CountNamesInMethodConfig(method); + int count = CountNamesInMethodConfig(method); if (count <= 0) return nullptr; - num_entries += count; + num_entries += static_cast(count); } // Populate method config table entries. entries = static_cast>::Entry*>( -- cgit v1.2.3