aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cpp
diff options
context:
space:
mode:
authorGravatar yang-g <yangg@google.com>2016-12-27 15:31:57 -0800
committerGravatar yang-g <yangg@google.com>2016-12-27 15:37:59 -0800
commit9bef0740a4ad649b6eb7438fc9575dfc1e98250e (patch)
treef2a9340f27ab1f28db9d1fe2dca852b12c676d95 /src/cpp
parent4eaf96920f7949cdf7f0d81973769cb6bc42bcaf (diff)
Add test for explicit option
Diffstat (limited to 'src/cpp')
-rw-r--r--src/cpp/server/health/default_health_check_service.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/cpp/server/health/default_health_check_service.cc b/src/cpp/server/health/default_health_check_service.cc
index bc7d576741..cec7ecce70 100644
--- a/src/cpp/server/health/default_health_check_service.cc
+++ b/src/cpp/server/health/default_health_check_service.cc
@@ -35,6 +35,7 @@
#include <mutex>
#include <grpc++/impl/codegen/method_handler_impl.h>
+#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include "src/cpp/server/health/default_health_check_service.h"
@@ -65,18 +66,18 @@ Status DefaultHealthCheckService::SyncHealthCheckServiceImpl::Check(
// Decode request.
std::vector<Slice> slices;
request->Dump(&slices);
- const uint8_t* request_bytes = nullptr;
+ uint8_t* request_bytes = nullptr;
bool request_bytes_owned = false;
size_t request_size = 0;
grpc_health_v1_HealthCheckRequest request_struct;
if (slices.empty()) {
request_struct.has_service = false;
} else if (slices.size() == 1) {
- request_bytes = slices[0].begin();
+ request_bytes = const_cast<uint8_t*>(slices[0].begin());
request_size = slices[0].size();
} else {
request_bytes_owned = true;
- request_bytes = gpr_malloc(request->Length());
+ request_bytes = static_cast<uint8_t*>(gpr_malloc(request->Length()));
uint8_t* copy_to = request_bytes;
for (size_t i = 0; i < slices.size(); i++) {
memcpy(copy_to, slices[i].begin(), slices[i].size());