From adb65a6a4905ee8a74e6f6cb222c0b95ed1b7b1b Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Mon, 20 Jun 2016 15:56:43 -0700 Subject: [PATCH] Fixed gpr_log format issues --- .../chttp2/transport/chttp2_transport.c | 2 +- test/core/end2end/bad_server_response_test.c | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index aad655effde..2a5b503c0c4 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -1705,7 +1705,7 @@ static void parsing_action(grpc_exec_ctx *exec_ctx, void *arg, errors[1] = grpc_chttp2_perform_read(exec_ctx, &t->parsing, t->read_buffer.slices[i]); }; - if (i != t->read_buffer.count) { + if (i != t->read_buffer.count || errors[1] != GRPC_ERROR_NONE) { gpr_slice_unref(t->optional_drop_message); errors[2] = try_http_parsing(exec_ctx, t); if (errors[2] != GRPC_ERROR_NONE) { diff --git a/test/core/end2end/bad_server_response_test.c b/test/core/end2end/bad_server_response_test.c index 6c00942fb75..c2882b62434 100644 --- a/test/core/end2end/bad_server_response_test.c +++ b/test/core/end2end/bad_server_response_test.c @@ -96,8 +96,8 @@ static grpc_closure on_write; static void *tag(intptr_t t) { return (void *)t; } -static void done_write(grpc_exec_ctx *exec_ctx, void *arg, bool success) { - GPR_ASSERT(success); +static void done_write(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { + GPR_ASSERT(error == GRPC_ERROR_NONE); gpr_atm_rel_store(&state.done_atm, 1); } @@ -111,12 +111,11 @@ static void handle_write(grpc_exec_ctx *exec_ctx) { grpc_endpoint_write(exec_ctx, state.tcp, &state.outgoing_buffer, &on_write); } -static void handle_read(grpc_exec_ctx *exec_ctx, void *arg, bool success) { - GPR_ASSERT(success); +static void handle_read(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { + GPR_ASSERT(error == GRPC_ERROR_NONE); state.incoming_data_length += state.temp_incoming_buffer.length; size_t i; - gpr_log(GPR_DEBUG, "read: success=%d", success); for (i = 0; i < state.temp_incoming_buffer.count; i++) { char *dump = gpr_dump_slice(state.temp_incoming_buffer.slices[i], GPR_DUMP_HEX | GPR_DUMP_ASCII); @@ -124,7 +123,8 @@ static void handle_read(grpc_exec_ctx *exec_ctx, void *arg, bool success) { gpr_free(dump); } - gpr_log(GPR_DEBUG, "got %d bytes, http2 connect string is %d bytes", + gpr_log(GPR_DEBUG, + "got %" PRIuPTR " bytes, http2 connect string is %" PRIuMAX " bytes", state.incoming_data_length, GRPC_CHTTP2_CLIENT_CONNECT_STRLEN); if (state.incoming_data_length > GRPC_CHTTP2_CLIENT_CONNECT_STRLEN) { handle_write(exec_ctx); @@ -239,8 +239,8 @@ static void actually_poll_server(void *arg) { bool done = gpr_atm_acq_load(&state.done_atm) != 0; gpr_timespec time_left = gpr_time_sub(deadline, gpr_now(GPR_CLOCK_REALTIME)); - gpr_log(GPR_DEBUG, "done=%d, time_left=%d.%09d", done, time_left.tv_sec, - time_left.tv_nsec); + gpr_log(GPR_DEBUG, "done=%d, time_left=%" PRId64 ".%09d", done, + time_left.tv_sec, time_left.tv_nsec); if (done || gpr_time_cmp(time_left, gpr_time_0(GPR_TIMESPAN)) < 0) { break; }