aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cpp/proto/proto_utils.cc
diff options
context:
space:
mode:
authorGravatar yang-g <yangg@google.com>2015-06-23 13:01:22 -0700
committerGravatar yang-g <yangg@google.com>2015-06-23 13:01:22 -0700
commitadfed031461157dd090b4e7fc2e54c2aa6250fdb (patch)
tree63e1a854e53d64ca2de8e874c57103ec08b32688 /src/cpp/proto/proto_utils.cc
parent04da718e902fa67bbe2b3551ad88ffa636ed31b0 (diff)
Add missing headers to build.json
Diffstat (limited to 'src/cpp/proto/proto_utils.cc')
-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 268e4f6d1f..7b2a65e99b 100644
--- a/src/cpp/proto/proto_utils.cc
+++ b/src/cpp/proto/proto_utils.cc
@@ -154,13 +154,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);
@@ -168,10 +171,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;
}