diff options
author | Vijay Pai <vpai@google.com> | 2018-08-17 15:47:03 -0700 |
---|---|---|
committer | Vijay Pai <vpai@google.com> | 2018-08-21 07:37:11 -0700 |
commit | 9e515951ac422faec2699fd8c7d75e7dfed6e377 (patch) | |
tree | 1f9c64581886d6a168ef41ba33d460efd09d679d /src/core/lib/transport | |
parent | 5d302d1a9fd3afb486614ec34cdf643f4c5d53ac (diff) |
size_t shouldn't have the value -1; switch to int
Diffstat (limited to 'src/core/lib/transport')
-rw-r--r-- | src/core/lib/transport/service_config.cc | 4 | ||||
-rw-r--r-- | src/core/lib/transport/service_config.h | 6 |
2 files changed, 5 insertions, 5 deletions
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<char> 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<T> 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<size_t>(count); } // Populate method config table entries. entries = static_cast<typename SliceHashTable<RefCountedPtr<T>>::Entry*>( |