diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/cpp/qps/client.h | 8 | ||||
-rw-r--r-- | test/cpp/qps/server_async.cc | 1 | ||||
-rw-r--r-- | test/cpp/util/byte_buffer_proto_helper.h | 7 |
3 files changed, 10 insertions, 6 deletions
diff --git a/test/cpp/qps/client.h b/test/cpp/qps/client.h index 4ed34e0405..668d941916 100644 --- a/test/cpp/qps/client.h +++ b/test/cpp/qps/client.h @@ -94,9 +94,11 @@ class ClientRequestCreator<ByteBuffer> { public: ClientRequestCreator(ByteBuffer* req, const PayloadConfig& payload_config) { if (payload_config.has_bytebuf_params()) { - std::unique_ptr<char[]> buf( - new char[payload_config.bytebuf_params().req_size()]); - Slice slice(buf.get(), payload_config.bytebuf_params().req_size()); + size_t req_sz = + static_cast<size_t>(payload_config.bytebuf_params().req_size()); + std::unique_ptr<char[]> buf(new char[req_sz]); + memset(buf.get(), 0, req_sz); + Slice slice(buf.get(), req_sz); *req = ByteBuffer(&slice, 1); } else { GPR_ASSERT(false); // not appropriate for this specialization diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc index 5cd975cf74..a5f8347c26 100644 --- a/test/cpp/qps/server_async.cc +++ b/test/cpp/qps/server_async.cc @@ -562,6 +562,7 @@ static Status ProcessGenericRPC(const PayloadConfig& payload_config, request->Clear(); int resp_size = payload_config.bytebuf_params().resp_size(); std::unique_ptr<char[]> buf(new char[resp_size]); + memset(buf.get(), 0, static_cast<size_t>(resp_size)); Slice slice(buf.get(), resp_size); *response = ByteBuffer(&slice, 1); return Status::OK; diff --git a/test/cpp/util/byte_buffer_proto_helper.h b/test/cpp/util/byte_buffer_proto_helper.h index eb923eccb5..3d01fb2468 100644 --- a/test/cpp/util/byte_buffer_proto_helper.h +++ b/test/cpp/util/byte_buffer_proto_helper.h @@ -27,12 +27,13 @@ namespace grpc { namespace testing { -bool ParseFromByteBuffer(ByteBuffer* buffer, grpc::protobuf::Message* message); +bool ParseFromByteBuffer(ByteBuffer* buffer, + ::grpc::protobuf::Message* message); std::unique_ptr<ByteBuffer> SerializeToByteBuffer( - grpc::protobuf::Message* message); + ::grpc::protobuf::Message* message); -bool SerializeToByteBufferInPlace(grpc::protobuf::Message* message, +bool SerializeToByteBufferInPlace(::grpc::protobuf::Message* message, ByteBuffer* buffer); } // namespace testing |