From eadd5ea11093a3c3811b47dd15005df031719f79 Mon Sep 17 00:00:00 2001 From: Soheil Hassas Yeganeh Date: Mon, 12 Aug 2019 22:44:56 -0400 Subject: [PATCH] Directly use the ZeroCopyInputStream for grpc::GenericDeserialize. There is no need to use CodedInputStream, wrapping a ZeroCopyInputStream. Suggested by: Gerben Stavenga --- include/grpcpp/impl/codegen/proto_utils.h | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/include/grpcpp/impl/codegen/proto_utils.h b/include/grpcpp/impl/codegen/proto_utils.h index f9a7d3c0b34..2cf4cdcc9b5 100644 --- a/include/grpcpp/impl/codegen/proto_utils.h +++ b/include/grpcpp/impl/codegen/proto_utils.h @@ -83,14 +83,9 @@ Status GenericDeserialize(ByteBuffer* buffer, if (!reader.status().ok()) { return reader.status(); } - ::grpc::protobuf::io::CodedInputStream decoder(&reader); - decoder.SetTotalBytesLimit(INT_MAX, INT_MAX); - if (!msg->ParseFromCodedStream(&decoder)) { + if (!msg->ParseFromZeroCopyStream(&reader)) { result = Status(StatusCode::INTERNAL, msg->InitializationErrorString()); } - if (!decoder.ConsumedEntireMessage()) { - result = Status(StatusCode::INTERNAL, "Did not read entire message"); - } } buffer->Clear(); return result;