aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Muxi Yan <mxyan@google.com>2017-09-07 09:47:58 -0700
committerGravatar Muxi Yan <mxyan@google.com>2017-09-07 09:47:58 -0700
commit1e99b2388bf5e13c79143463f6d503275fd63cb7 (patch)
treeaeb006996a12dd64cc2f854035e620a9a13cff51
parentc2a61a2780e56c474a12f5570133fe166ec9840f (diff)
clang-format
-rw-r--r--src/core/ext/transport/chttp2/transport/chttp2_transport.c27
-rw-r--r--src/core/ext/transport/chttp2/transport/hpack_parser.c7
-rw-r--r--src/core/lib/compression/stream_compression_identity.c3
-rw-r--r--test/core/compression/stream_compression_test.c19
4 files changed, 32 insertions, 24 deletions
diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c
index 9b80e1d336..721f694506 100644
--- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c
+++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c
@@ -1732,11 +1732,12 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_exec_ctx *exec_ctx,
grpc_stream_compression_context_create(
s->stream_decompression_method);
}
- if (!grpc_stream_decompress(s->stream_decompression_ctx,
- &s->unprocessed_incoming_frames_buffer,
- &s->decompressed_data_buffer, NULL,
- GRPC_HEADER_SIZE_IN_BYTES - s->decompressed_header_bytes,
- &end_of_context)) {
+ if (!grpc_stream_decompress(
+ s->stream_decompression_ctx,
+ &s->unprocessed_incoming_frames_buffer,
+ &s->decompressed_data_buffer, NULL,
+ GRPC_HEADER_SIZE_IN_BYTES - s->decompressed_header_bytes,
+ &end_of_context)) {
grpc_slice_buffer_reset_and_unref_internal(exec_ctx,
&s->frame_storage);
grpc_slice_buffer_reset_and_unref_internal(
@@ -1749,8 +1750,8 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_exec_ctx *exec_ctx,
s->decompressed_header_bytes = 0;
}
error = grpc_deframe_unprocessed_incoming_frames(
- exec_ctx, &s->data_parser, s, &s->decompressed_data_buffer, NULL,
- s->recv_message);
+ exec_ctx, &s->data_parser, s, &s->decompressed_data_buffer,
+ NULL, s->recv_message);
if (end_of_context) {
grpc_stream_compression_context_destroy(
s->stream_decompression_ctx);
@@ -1759,7 +1760,8 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_exec_ctx *exec_ctx,
}
} else {
error = grpc_deframe_unprocessed_incoming_frames(
- exec_ctx, &s->data_parser, s, &s->unprocessed_incoming_frames_buffer, NULL, s->recv_message);
+ exec_ctx, &s->data_parser, s,
+ &s->unprocessed_incoming_frames_buffer, NULL, s->recv_message);
}
if (error != GRPC_ERROR_NONE) {
s->seen_error = true;
@@ -1798,9 +1800,8 @@ void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_exec_ctx *exec_ctx,
}
bool pending_data = s->pending_byte_stream ||
s->unprocessed_incoming_frames_buffer.length > 0;
- if (s->read_closed &&
- s->frame_storage.length > 0 && !pending_data && !s->seen_error &&
- s->recv_trailing_metadata_finished != NULL) {
+ if (s->read_closed && s->frame_storage.length > 0 && !pending_data &&
+ !s->seen_error && s->recv_trailing_metadata_finished != NULL) {
/* Maybe some SYNC_FLUSH data is left in frame_storage. Consume them and
* maybe decompress the next 5 bytes in the stream. */
bool end_of_context;
@@ -2700,8 +2701,8 @@ static grpc_error *incoming_byte_stream_pull(grpc_exec_ctx *exec_ctx,
}
if (!grpc_stream_decompress(s->stream_decompression_ctx,
&s->unprocessed_incoming_frames_buffer,
- &s->decompressed_data_buffer, NULL, MAX_SIZE_T,
- &end_of_context)) {
+ &s->decompressed_data_buffer, NULL,
+ MAX_SIZE_T, &end_of_context)) {
error =
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Stream decompression error.");
return error;
diff --git a/src/core/ext/transport/chttp2/transport/hpack_parser.c b/src/core/ext/transport/chttp2/transport/hpack_parser.c
index 3b338da288..2028877cac 100644
--- a/src/core/ext/transport/chttp2/transport/hpack_parser.c
+++ b/src/core/ext/transport/chttp2/transport/hpack_parser.c
@@ -1660,8 +1660,11 @@ static void parse_stream_compression_md(grpc_exec_ctx *exec_ctx,
grpc_chttp2_stream *s,
grpc_metadata_batch *initial_metadata) {
if (initial_metadata->idx.named.content_encoding == NULL ||
- grpc_stream_compression_method_parse(GRPC_MDVALUE(initial_metadata->idx.named.content_encoding->md), false, &s->stream_decompression_method) == 0) {
- s->stream_decompression_method = GRPC_STREAM_COMPRESSION_IDENTITY_DECOMPRESS;
+ grpc_stream_compression_method_parse(
+ GRPC_MDVALUE(initial_metadata->idx.named.content_encoding->md), false,
+ &s->stream_decompression_method) == 0) {
+ s->stream_decompression_method =
+ GRPC_STREAM_COMPRESSION_IDENTITY_DECOMPRESS;
}
}
diff --git a/src/core/lib/compression/stream_compression_identity.c b/src/core/lib/compression/stream_compression_identity.c
index 19eb6a9a00..3dfcf53b85 100644
--- a/src/core/lib/compression/stream_compression_identity.c
+++ b/src/core/lib/compression/stream_compression_identity.c
@@ -27,8 +27,7 @@
/* Singleton context used for all identity streams. */
static grpc_stream_compression_context identity_ctx = {
- .vtable = &grpc_stream_compression_identity_vtable
-};
+ .vtable = &grpc_stream_compression_identity_vtable};
static void grpc_stream_compression_pass_through(grpc_slice_buffer *in,
grpc_slice_buffer *out,
diff --git a/test/core/compression/stream_compression_test.c b/test/core/compression/stream_compression_test.c
index 26c957ded4..afed6cd6b5 100644
--- a/test/core/compression/stream_compression_test.c
+++ b/test/core/compression/stream_compression_test.c
@@ -59,7 +59,8 @@ static void test_stream_compression_simple_compress_decompress() {
grpc_slice_buffer_init(&relay);
grpc_slice_buffer_init(&sink);
grpc_stream_compression_context *compress_ctx =
- grpc_stream_compression_context_create(GRPC_STREAM_COMPRESSION_GZIP_COMPRESS);
+ grpc_stream_compression_context_create(
+ GRPC_STREAM_COMPRESSION_GZIP_COMPRESS);
grpc_stream_compression_context *decompress_ctx =
grpc_stream_compression_context_create(
GRPC_STREAM_COMPRESSION_GZIP_DECOMPRESS);
@@ -91,7 +92,8 @@ test_stream_compression_simple_compress_decompress_with_output_size_constraint()
grpc_slice_buffer_init(&relay);
grpc_slice_buffer_init(&sink);
grpc_stream_compression_context *compress_ctx =
- grpc_stream_compression_context_create(GRPC_STREAM_COMPRESSION_GZIP_COMPRESS);
+ grpc_stream_compression_context_create(
+ GRPC_STREAM_COMPRESSION_GZIP_COMPRESS);
grpc_stream_compression_context *decompress_ctx =
grpc_stream_compression_context_create(
GRPC_STREAM_COMPRESSION_GZIP_DECOMPRESS);
@@ -139,7 +141,8 @@ test_stream_compression_simple_compress_decompress_with_large_data() {
grpc_slice_buffer_init(&relay);
grpc_slice_buffer_init(&sink);
grpc_stream_compression_context *compress_ctx =
- grpc_stream_compression_context_create(GRPC_STREAM_COMPRESSION_GZIP_COMPRESS);
+ grpc_stream_compression_context_create(
+ GRPC_STREAM_COMPRESSION_GZIP_COMPRESS);
grpc_stream_compression_context *decompress_ctx =
grpc_stream_compression_context_create(
GRPC_STREAM_COMPRESSION_GZIP_DECOMPRESS);
@@ -172,7 +175,8 @@ static void test_stream_compression_drop_context() {
grpc_slice_buffer_init(&relay);
grpc_slice_buffer_init(&sink);
grpc_stream_compression_context *compress_ctx =
- grpc_stream_compression_context_create(GRPC_STREAM_COMPRESSION_GZIP_COMPRESS);
+ grpc_stream_compression_context_create(
+ GRPC_STREAM_COMPRESSION_GZIP_COMPRESS);
grpc_slice slice = grpc_slice_from_static_string(test_str);
grpc_slice_buffer_add(&source, slice);
GPR_ASSERT(grpc_stream_compress(compress_ctx, &source, &relay, NULL,
@@ -180,8 +184,8 @@ static void test_stream_compression_drop_context() {
GRPC_STREAM_COMPRESSION_FLUSH_FINISH));
grpc_stream_compression_context_destroy(compress_ctx);
- compress_ctx =
- grpc_stream_compression_context_create(GRPC_STREAM_COMPRESSION_GZIP_COMPRESS);
+ compress_ctx = grpc_stream_compression_context_create(
+ GRPC_STREAM_COMPRESSION_GZIP_COMPRESS);
slice = grpc_slice_from_static_string(test_str2);
grpc_slice_buffer_add(&source, slice);
GPR_ASSERT(grpc_stream_compress(compress_ctx, &source, &relay, NULL,
@@ -240,7 +244,8 @@ static void test_stream_compression_sync_flush() {
grpc_slice_buffer_init(&relay);
grpc_slice_buffer_init(&sink);
grpc_stream_compression_context *compress_ctx =
- grpc_stream_compression_context_create(GRPC_STREAM_COMPRESSION_GZIP_COMPRESS);
+ grpc_stream_compression_context_create(
+ GRPC_STREAM_COMPRESSION_GZIP_COMPRESS);
grpc_slice slice = grpc_slice_from_static_string(test_str);
grpc_slice_buffer_add(&source, slice);
GPR_ASSERT(grpc_stream_compress(compress_ctx, &source, &relay, NULL,