diff options
author | Craig Tiller <ctiller@google.com> | 2016-07-07 21:02:08 -0700 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2016-07-07 21:02:08 -0700 |
commit | b1793a6780e48a15f72229d84b3a9c63c0b46d8e (patch) | |
tree | d7ec6a7b11ce2b4ccb3cb36908a2b18ecfdcfd74 /src/core/lib/surface/byte_buffer_reader.c | |
parent | c9d4b81dabf4dc2c262fc771c31790f2d60fe551 (diff) | |
parent | c28a6c1b3b4d68da7661997cd56d305b254a7d0b (diff) |
Merge github.com:grpc/grpc into atm2
Diffstat (limited to 'src/core/lib/surface/byte_buffer_reader.c')
-rw-r--r-- | src/core/lib/surface/byte_buffer_reader.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/core/lib/surface/byte_buffer_reader.c b/src/core/lib/surface/byte_buffer_reader.c index c97079f638..310bacb2c9 100644 --- a/src/core/lib/surface/byte_buffer_reader.c +++ b/src/core/lib/surface/byte_buffer_reader.c @@ -54,8 +54,8 @@ static int is_compressed(grpc_byte_buffer *buffer) { return 1 /* GPR_TRUE */; } -void grpc_byte_buffer_reader_init(grpc_byte_buffer_reader *reader, - grpc_byte_buffer *buffer) { +int grpc_byte_buffer_reader_init(grpc_byte_buffer_reader *reader, + grpc_byte_buffer *buffer) { gpr_slice_buffer decompressed_slices_buffer; reader->buffer_in = buffer; switch (reader->buffer_in->type) { @@ -67,9 +67,10 @@ void grpc_byte_buffer_reader_init(grpc_byte_buffer_reader *reader, &decompressed_slices_buffer) == 0) { gpr_log(GPR_ERROR, "Unexpected error decompressing data for algorithm with enum " - "value '%d'. Reading data as if it were uncompressed.", + "value '%d'.", reader->buffer_in->data.raw.compression); - reader->buffer_out = reader->buffer_in; + memset(reader, 0, sizeof(*reader)); + return 0; } else { /* all fine */ reader->buffer_out = grpc_raw_byte_buffer_create(decompressed_slices_buffer.slices, @@ -82,6 +83,7 @@ void grpc_byte_buffer_reader_init(grpc_byte_buffer_reader *reader, reader->current.index = 0; break; } + return 1; } void grpc_byte_buffer_reader_destroy(grpc_byte_buffer_reader *reader) { |