diff --git a/src/cpp/ext/proto_server_reflection.cc b/src/cpp/ext/proto_server_reflection.cc index 348a035f0f3..3973bfb58ea 100644 --- a/src/cpp/ext/proto_server_reflection.cc +++ b/src/cpp/ext/proto_server_reflection.cc @@ -197,8 +197,8 @@ Status ProtoServerReflection::GetAllExtensionNumbers( std::vector extensions; descriptor_pool_->FindAllExtensions(desc, &extensions); - for (auto extension : extensions) { - response->add_extension_number(extension->number()); + for (auto it = extensions.begin(); it != extensions.end(); it++) { + response->add_extension_number((*it)->number()); } response->set_base_type_name(type); return Status::OK; diff --git a/src/cpp/ext/proto_server_reflection_plugin.cc b/src/cpp/ext/proto_server_reflection_plugin.cc index 7f9b6673561..5b806ce1ae1 100644 --- a/src/cpp/ext/proto_server_reflection_plugin.cc +++ b/src/cpp/ext/proto_server_reflection_plugin.cc @@ -60,14 +60,14 @@ void ProtoServerReflectionPlugin::ChangeArguments(const grpc::string& name, void* value) {} bool ProtoServerReflectionPlugin::has_sync_methods() const { - if (reflection_service_ != nullptr) { + if (reflection_service_) { return reflection_service_->has_synchronous_methods(); } return false; } bool ProtoServerReflectionPlugin::has_async_methods() const { - if (reflection_service_ != nullptr) { + if (reflection_service_) { return reflection_service_->has_async_methods(); } return false; diff --git a/test/cpp/util/proto_reflection_descriptor_database.cc b/test/cpp/util/proto_reflection_descriptor_database.cc index 6907d97bd5e..25b720aee0a 100644 --- a/test/cpp/util/proto_reflection_descriptor_database.cc +++ b/test/cpp/util/proto_reflection_descriptor_database.cc @@ -298,7 +298,7 @@ void ProtoReflectionDescriptorDatabase::AddFileFromResponse( const std::shared_ptr ProtoReflectionDescriptorDatabase::GetStream() { - if (stream_ == nullptr) { + if (!stream_) { stream_ = stub_->ServerReflectionInfo(&ctx_); } return stream_;