aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cpp/proto
diff options
context:
space:
mode:
authorGravatar David Garcia Quintas <dgq@google.com>2015-07-01 14:52:44 -0700
committerGravatar David Garcia Quintas <dgq@google.com>2015-07-01 14:52:44 -0700
commit8a187099ec8accf4f4b9c1bcea0a71d023f6389b (patch)
treeae197d56afaf80aff6a1cb6dba715dba665572bf /src/cpp/proto
parentd7d9ce27c523798384051246e18e3f00b29dd8c9 (diff)
parentf8c63562c1388262c5588e381c05cb0c02e5b406 (diff)
Merge branch 'master' of github.com:grpc/grpc into decompression
# Conflicts: # Makefile # gRPC.podspec # src/core/surface/call.c # src/core/transport/chttp2/frame_data.c # tools/doxygen/Doxyfile.core.internal # vsprojects/Grpc.mak
Diffstat (limited to 'src/cpp/proto')
-rw-r--r--src/cpp/proto/proto_utils.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/cpp/proto/proto_utils.cc b/src/cpp/proto/proto_utils.cc
index 337f680129..63f4a3a0bc 100644
--- a/src/cpp/proto/proto_utils.cc
+++ b/src/cpp/proto/proto_utils.cc
@@ -156,13 +156,16 @@ namespace grpc {
Status SerializeProto(const grpc::protobuf::Message& msg, grpc_byte_buffer** bp) {
GrpcBufferWriter writer(bp);
- return msg.SerializeToZeroCopyStream(&writer) ? Status::OK : Status(INVALID_ARGUMENT, "Failed to serialize message");
+ return msg.SerializeToZeroCopyStream(&writer)
+ ? Status::OK
+ : Status(StatusCode::INVALID_ARGUMENT,
+ "Failed to serialize message");
}
Status DeserializeProto(grpc_byte_buffer* buffer, grpc::protobuf::Message* msg,
int max_message_size) {
if (!buffer) {
- return Status(INVALID_ARGUMENT, "No payload");
+ return Status(StatusCode::INVALID_ARGUMENT, "No payload");
}
GrpcBufferReader reader(buffer);
::grpc::protobuf::io::CodedInputStream decoder(&reader);
@@ -170,10 +173,11 @@ Status DeserializeProto(grpc_byte_buffer* buffer, grpc::protobuf::Message* msg,
decoder.SetTotalBytesLimit(max_message_size, max_message_size);
}
if (!msg->ParseFromCodedStream(&decoder)) {
- return Status(INVALID_ARGUMENT, msg->InitializationErrorString());
+ return Status(StatusCode::INVALID_ARGUMENT,
+ msg->InitializationErrorString());
}
if (!decoder.ConsumedEntireMessage()) {
- return Status(INVALID_ARGUMENT, "Did not read entire message");
+ return Status(StatusCode::INVALID_ARGUMENT, "Did not read entire message");
}
return Status::OK;
}