From 6721d4f0f18c71f5e4ab1cef904944185ed86b89 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Thu, 30 Jun 2016 17:17:23 -0700 Subject: Return success status of grpc_byte_buffer_reader --- src/csharp/ext/grpc_csharp_ext.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/csharp/ext/grpc_csharp_ext.c') diff --git a/src/csharp/ext/grpc_csharp_ext.c b/src/csharp/ext/grpc_csharp_ext.c index 9b8d050ea5..4009748157 100644 --- a/src/csharp/ext/grpc_csharp_ext.c +++ b/src/csharp/ext/grpc_csharp_ext.c @@ -253,6 +253,7 @@ GPR_EXPORT intptr_t GPR_CALLTYPE grpcsharp_batch_context_recv_message_length( if (!ctx->recv_message) { return -1; } + /* TODO(dgq): check the return value of grpc_byte_buffer_reader_init. */ grpc_byte_buffer_reader_init(&reader, ctx->recv_message); return (intptr_t)grpc_byte_buffer_length(reader.buffer_out); } @@ -267,6 +268,7 @@ GPR_EXPORT void GPR_CALLTYPE grpcsharp_batch_context_recv_message_to_buffer( gpr_slice slice; size_t offset = 0; + /* TODO(dgq): check the return value of grpc_byte_buffer_reader_init. */ grpc_byte_buffer_reader_init(&reader, ctx->recv_message); while (grpc_byte_buffer_reader_next(&reader, &slice)) { -- cgit v1.2.3 From 0910e4c0f6e99e621c9e11ac900d65ff7b2eeebb Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Fri, 1 Jul 2016 11:25:01 -0700 Subject: pr comments --- src/core/lib/surface/byte_buffer_reader.c | 2 +- src/csharp/ext/grpc_csharp_ext.c | 4 ++-- src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src/csharp/ext/grpc_csharp_ext.c') diff --git a/src/core/lib/surface/byte_buffer_reader.c b/src/core/lib/surface/byte_buffer_reader.c index 3a85f1f1f9..fb38bf5102 100644 --- a/src/core/lib/surface/byte_buffer_reader.c +++ b/src/core/lib/surface/byte_buffer_reader.c @@ -69,8 +69,8 @@ int grpc_byte_buffer_reader_init(grpc_byte_buffer_reader *reader, "Unexpected error decompressing data for algorithm with enum " "value '%d'. Reading data as if it were uncompressed.", reader->buffer_in->data.raw.compression); - return 0; memset(reader, 0, sizeof(*reader)); + return 0; } else { /* all fine */ reader->buffer_out = grpc_raw_byte_buffer_create(decompressed_slices_buffer.slices, diff --git a/src/csharp/ext/grpc_csharp_ext.c b/src/csharp/ext/grpc_csharp_ext.c index 4009748157..c670ea65c7 100644 --- a/src/csharp/ext/grpc_csharp_ext.c +++ b/src/csharp/ext/grpc_csharp_ext.c @@ -253,7 +253,7 @@ GPR_EXPORT intptr_t GPR_CALLTYPE grpcsharp_batch_context_recv_message_length( if (!ctx->recv_message) { return -1; } - /* TODO(dgq): check the return value of grpc_byte_buffer_reader_init. */ + /* TODO(issue:#7206): check return value of grpc_byte_buffer_reader_init. */ grpc_byte_buffer_reader_init(&reader, ctx->recv_message); return (intptr_t)grpc_byte_buffer_length(reader.buffer_out); } @@ -268,7 +268,7 @@ GPR_EXPORT void GPR_CALLTYPE grpcsharp_batch_context_recv_message_to_buffer( gpr_slice slice; size_t offset = 0; - /* TODO(dgq): check the return value of grpc_byte_buffer_reader_init. */ + /* TODO(issue:#7206): check return value of grpc_byte_buffer_reader_init. */ grpc_byte_buffer_reader_init(&reader, ctx->recv_message); while (grpc_byte_buffer_reader_next(&reader, &slice)) { diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi index 337cf7fa3b..7510cc9895 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi @@ -254,7 +254,8 @@ cdef class ByteBuffer: cdef void *data_slice_pointer if self.c_byte_buffer != NULL: with nogil: - # TODO(dgq): check the return value of grpc_byte_buffer_reader_init. + # TODO(issue:#7205): check the return value of + # grpc_byte_buffer_reader_init. grpc_byte_buffer_reader_init(&reader, self.c_byte_buffer) result = bytearray() with nogil: -- cgit v1.2.3 From 78aa4580fd02c2a8f1982aa7cf924a2fc5ff6924 Mon Sep 17 00:00:00 2001 From: Alexander Polcyn Date: Wed, 13 Jul 2016 12:57:41 -0700 Subject: Add csharp check to return val of byte_buffer_reader_init --- src/csharp/ext/grpc_csharp_ext.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/csharp/ext/grpc_csharp_ext.c') diff --git a/src/csharp/ext/grpc_csharp_ext.c b/src/csharp/ext/grpc_csharp_ext.c index c670ea65c7..3d0947c03d 100644 --- a/src/csharp/ext/grpc_csharp_ext.c +++ b/src/csharp/ext/grpc_csharp_ext.c @@ -253,8 +253,9 @@ GPR_EXPORT intptr_t GPR_CALLTYPE grpcsharp_batch_context_recv_message_length( if (!ctx->recv_message) { return -1; } - /* TODO(issue:#7206): check return value of grpc_byte_buffer_reader_init. */ - grpc_byte_buffer_reader_init(&reader, ctx->recv_message); + + GPR_ASSERT(grpc_byte_buffer_reader_init(&reader, ctx->recv_message)); + return (intptr_t)grpc_byte_buffer_length(reader.buffer_out); } @@ -268,8 +269,7 @@ GPR_EXPORT void GPR_CALLTYPE grpcsharp_batch_context_recv_message_to_buffer( gpr_slice slice; size_t offset = 0; - /* TODO(issue:#7206): check return value of grpc_byte_buffer_reader_init. */ - grpc_byte_buffer_reader_init(&reader, ctx->recv_message); + GPR_ASSERT(grpc_byte_buffer_reader_init(&reader, ctx->recv_message)); while (grpc_byte_buffer_reader_next(&reader, &slice)) { size_t len = GPR_SLICE_LENGTH(slice); -- cgit v1.2.3