clang-format

reviewable/pr8532/r1
Craig Tiller 8 years ago
parent 5b676a6b1a
commit 28b72428a8
  1. 2
      include/grpc++/impl/codegen/core_codegen.h
  2. 3
      include/grpc++/impl/codegen/core_codegen_interface.h
  3. 10
      include/grpc/slice_buffer.h
  4. 2
      src/core/ext/census/grpc_filter.c
  5. 8
      src/core/ext/client_channel/http_connect_handshaker.c
  6. 2
      src/core/ext/transport/chttp2/transport/bin_decoder.h
  7. 9
      src/core/ext/transport/chttp2/transport/bin_encoder.c
  8. 3
      src/core/ext/transport/chttp2/transport/bin_encoder.h
  9. 2
      src/core/ext/transport/chttp2/transport/frame.h
  10. 2
      src/core/ext/transport/chttp2/transport/frame_goaway.h
  11. 2
      src/core/ext/transport/chttp2/transport/frame_ping.c
  12. 2
      src/core/ext/transport/chttp2/transport/frame_rst_stream.c
  13. 2
      src/core/ext/transport/chttp2/transport/frame_rst_stream.h
  14. 2
      src/core/ext/transport/chttp2/transport/frame_settings.c
  15. 4
      src/core/ext/transport/chttp2/transport/frame_settings.h
  16. 4
      src/core/ext/transport/chttp2/transport/frame_window_update.h
  17. 5
      src/core/ext/transport/chttp2/transport/hpack_encoder.c
  18. 2
      src/core/ext/transport/chttp2/transport/hpack_encoder.h
  19. 6
      src/core/ext/transport/chttp2/transport/hpack_parser.c
  20. 2
      src/core/ext/transport/chttp2/transport/hpack_table.h
  21. 3
      src/core/ext/transport/chttp2/transport/internal.h
  22. 18
      src/core/ext/transport/chttp2/transport/parsing.c
  23. 10
      src/core/ext/transport/chttp2/transport/writing.c
  24. 4
      src/core/ext/transport/cronet/transport/cronet_transport.c
  25. 2
      src/core/lib/channel/compress_filter.c
  26. 2
      src/core/lib/channel/connected_channel.c
  27. 4
      src/core/lib/channel/handshaker.c
  28. 2
      src/core/lib/channel/http_server_filter.c
  29. 9
      src/core/lib/http/format_request.c
  30. 4
      src/core/lib/http/format_request.h
  31. 2
      src/core/lib/http/parser.h
  32. 2
      src/core/lib/iomgr/resource_quota.c
  33. 2
      src/core/lib/iomgr/tcp_client_windows.c
  34. 2
      src/core/lib/iomgr/tcp_windows.c
  35. 2
      src/core/lib/security/transport/handshake.c
  36. 2
      src/core/lib/security/transport/security_connector.c
  37. 2
      src/core/lib/security/util/b64.c
  38. 2
      src/core/lib/security/util/b64.h
  39. 10
      src/core/lib/slice/slice.c
  40. 12
      src/core/lib/slice/slice_buffer.c
  41. 3
      src/core/lib/surface/byte_buffer.c
  42. 2
      src/core/lib/surface/byte_buffer_reader.c
  43. 2
      src/core/lib/transport/metadata_batch.h
  44. 2
      src/cpp/client/channel_cc.cc
  45. 11
      src/cpp/common/core_codegen.cc
  46. 14
      test/core/compression/message_compress_test.c
  47. 3
      test/core/end2end/cq_verifier.c
  48. 3
      test/core/end2end/invalid_call_argument_test.c
  49. 6
      test/core/end2end/tests/binary_metadata.c
  50. 9
      test/core/end2end/tests/call_creds.c
  51. 6
      test/core/end2end/tests/cancel_after_accept.c
  52. 6
      test/core/end2end/tests/cancel_after_client_done.c
  53. 3
      test/core/end2end/tests/cancel_after_invoke.c
  54. 3
      test/core/end2end/tests/cancel_before_invoke.c
  55. 3
      test/core/end2end/tests/compressed_payload.c
  56. 3
      test/core/end2end/tests/filter_call_init_fails.c
  57. 3
      test/core/end2end/tests/filter_causes_close.c
  58. 3
      test/core/end2end/tests/large_metadata.c
  59. 3
      test/core/end2end/tests/load_reporting_hook.c
  60. 3
      test/core/end2end/tests/max_message_length.c
  61. 3
      test/core/end2end/tests/network_status_change.c
  62. 3
      test/core/end2end/tests/payload.c
  63. 6
      test/core/end2end/tests/ping_pong_streaming.c
  64. 3
      test/core/end2end/tests/request_with_flags.c
  65. 3
      test/core/end2end/tests/request_with_payload.c
  66. 3
      test/core/end2end/tests/resource_quota_server.c
  67. 6
      test/core/end2end/tests/simple_cacheable_request.c
  68. 6
      test/core/end2end/tests/simple_metadata.c
  69. 6
      test/core/end2end/tests/trailing_metadata.c
  70. 48
      test/core/http/format_request_test.c
  71. 6
      test/core/iomgr/endpoint_tests.c
  72. 2
      test/core/iomgr/load_file_test.c
  73. 4
      test/core/iomgr/tcp_posix_test.c
  74. 2
      test/core/security/b64_test.c
  75. 2
      test/core/security/create_jwt.c
  76. 7
      test/core/security/credentials_test.c
  77. 2
      test/core/security/fetch_oauth2.c
  78. 2
      test/core/security/json_token_test.c
  79. 6
      test/core/security/jwt_verifier_test.c
  80. 2
      test/core/security/oauth2_utils.c
  81. 2
      test/core/security/print_google_default_creds_token.c
  82. 2
      test/core/security/verify_jwt.c
  83. 2
      test/core/slice/slice_buffer_test.c
  84. 11
      test/core/slice/slice_test.c
  85. 2
      test/core/transport/chttp2/hpack_parser_test.c
  86. 5
      test/core/transport/chttp2/varint_test.c
  87. 3
      test/core/util/mock_endpoint.h
  88. 3
      test/core/util/one_corpus_entry_fuzzer.c
  89. 3
      test/cpp/grpclb/grpclb_test.cc
  90. 2
      test/cpp/util/cli_call.cc

@ -82,7 +82,7 @@ class CoreCodegen : public CoreCodegenInterface {
void grpc_slice_unref(grpc_slice slice) GRPC_OVERRIDE;
grpc_slice grpc_slice_split_tail(grpc_slice* s, size_t split) GRPC_OVERRIDE;
void grpc_slice_buffer_add(grpc_slice_buffer* sb,
grpc_slice slice) GRPC_OVERRIDE;
grpc_slice slice) GRPC_OVERRIDE;
void grpc_slice_buffer_pop(grpc_slice_buffer* sb) GRPC_OVERRIDE;
void grpc_metadata_array_init(grpc_metadata_array* array) GRPC_OVERRIDE;

@ -96,7 +96,8 @@ class CoreCodegenInterface {
virtual grpc_slice grpc_slice_malloc(size_t length) = 0;
virtual void grpc_slice_unref(grpc_slice slice) = 0;
virtual grpc_slice grpc_slice_split_tail(grpc_slice* s, size_t split) = 0;
virtual void grpc_slice_buffer_add(grpc_slice_buffer* sb, grpc_slice slice) = 0;
virtual void grpc_slice_buffer_add(grpc_slice_buffer* sb,
grpc_slice slice) = 0;
virtual void grpc_slice_buffer_pop(grpc_slice_buffer* sb) = 0;
virtual void grpc_metadata_array_init(grpc_metadata_array* array) = 0;

@ -56,9 +56,9 @@ GPRAPI void grpc_slice_buffer_add(grpc_slice_buffer *sb, grpc_slice slice);
The implementation MAY decide to concatenate data at the end of a small
slice added in this fashion. */
GPRAPI size_t grpc_slice_buffer_add_indexed(grpc_slice_buffer *sb,
grpc_slice slice);
grpc_slice slice);
GPRAPI void grpc_slice_buffer_addn(grpc_slice_buffer *sb, grpc_slice *slices,
size_t n);
size_t n);
/* add a very small (less than 8 bytes) amount of data to the end of a slice
buffer: returns a pointer into which to add the data */
GPRAPI uint8_t *grpc_slice_buffer_tiny_add(grpc_slice_buffer *sb, size_t len);
@ -70,13 +70,13 @@ GPRAPI void grpc_slice_buffer_reset_and_unref(grpc_slice_buffer *sb);
GPRAPI void grpc_slice_buffer_swap(grpc_slice_buffer *a, grpc_slice_buffer *b);
/* move all of the elements of src into dst */
GPRAPI void grpc_slice_buffer_move_into(grpc_slice_buffer *src,
grpc_slice_buffer *dst);
grpc_slice_buffer *dst);
/* remove n bytes from the end of a slice buffer */
GPRAPI void grpc_slice_buffer_trim_end(grpc_slice_buffer *src, size_t n,
grpc_slice_buffer *garbage);
grpc_slice_buffer *garbage);
/* move the first n bytes of src into dst */
GPRAPI void grpc_slice_buffer_move_first(grpc_slice_buffer *src, size_t n,
grpc_slice_buffer *dst);
grpc_slice_buffer *dst);
/* take the first slice in the slice buffer */
GPRAPI grpc_slice grpc_slice_buffer_take_first(grpc_slice_buffer *src);

@ -37,9 +37,9 @@
#include <string.h>
#include <grpc/census.h>
#include <grpc/slice.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/slice.h>
#include <grpc/support/time.h>
#include "src/core/ext/census/census_interface.h"

@ -35,9 +35,9 @@
#include <string.h>
#include <grpc/slice_buffer.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/slice_buffer.h>
#include <grpc/support/string_util.h>
#include "src/core/ext/client_channel/uri_parser.h"
@ -136,11 +136,11 @@ static void on_read_done(grpc_exec_ctx* exec_ctx, void* arg,
grpc_slice_buffer_add(
&tmp_buffer,
grpc_slice_split_tail(&handshaker->read_buffer->slices[i],
body_start_offset));
body_start_offset));
}
grpc_slice_buffer_addn(&tmp_buffer,
&handshaker->read_buffer->slices[i + 1],
handshaker->read_buffer->count - i - 1);
&handshaker->read_buffer->slices[i + 1],
handshaker->read_buffer->count - i - 1);
grpc_slice_buffer_swap(handshaker->read_buffer, &tmp_buffer);
grpc_slice_buffer_destroy(&tmp_buffer);
break;

@ -61,6 +61,6 @@ grpc_slice grpc_chttp2_base64_decode(grpc_slice input);
slice, does not take ownership of the input. Returns an empty slice if
decoding is failed. */
grpc_slice grpc_chttp2_base64_decode_with_length(grpc_slice input,
size_t output_length);
size_t output_length);
#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_BIN_DECODER_H */

@ -114,13 +114,15 @@ grpc_slice grpc_chttp2_huffman_compress(grpc_slice input) {
uint32_t temp_length = 0;
nbits = 0;
for (in = GRPC_SLICE_START_PTR(input); in != GRPC_SLICE_END_PTR(input); ++in) {
for (in = GRPC_SLICE_START_PTR(input); in != GRPC_SLICE_END_PTR(input);
++in) {
nbits += grpc_chttp2_huffsyms[*in].length;
}
output = grpc_slice_malloc(nbits / 8 + (nbits % 8 != 0));
out = GRPC_SLICE_START_PTR(output);
for (in = GRPC_SLICE_START_PTR(input); in != GRPC_SLICE_END_PTR(input); ++in) {
for (in = GRPC_SLICE_START_PTR(input); in != GRPC_SLICE_END_PTR(input);
++in) {
int sym = *in;
temp <<= grpc_chttp2_huffsyms[sym].length;
temp |= grpc_chttp2_huffsyms[sym].bits;
@ -175,7 +177,8 @@ static void enc_add1(huff_out *out, uint8_t a) {
enc_flush_some(out);
}
grpc_slice grpc_chttp2_base64_encode_and_huffman_compress_impl(grpc_slice input) {
grpc_slice grpc_chttp2_base64_encode_and_huffman_compress_impl(
grpc_slice input) {
size_t input_length = GRPC_SLICE_LENGTH(input);
size_t input_triplets = input_length / 3;
size_t tail_case = input_length % 3;

@ -49,6 +49,7 @@ grpc_slice grpc_chttp2_huffman_compress(grpc_slice input);
grpc_slice y = grpc_chttp2_huffman_compress(x);
grpc_slice_unref(x);
return y; */
grpc_slice grpc_chttp2_base64_encode_and_huffman_compress_impl(grpc_slice input);
grpc_slice grpc_chttp2_base64_encode_and_huffman_compress_impl(
grpc_slice input);
#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_BIN_ENCODER_H */

@ -34,8 +34,8 @@
#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_H
#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_H
#include <grpc/support/port_platform.h>
#include <grpc/slice.h>
#include <grpc/support/port_platform.h>
#include "src/core/lib/iomgr/error.h"

@ -34,9 +34,9 @@
#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_GOAWAY_H
#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_GOAWAY_H
#include <grpc/support/port_platform.h>
#include <grpc/slice.h>
#include <grpc/slice_buffer.h>
#include <grpc/support/port_platform.h>
#include "src/core/ext/transport/chttp2/transport/frame.h"
#include "src/core/lib/iomgr/exec_ctx.h"

@ -94,7 +94,7 @@ grpc_error *grpc_chttp2_ping_parser_parse(grpc_exec_ctx *exec_ctx, void *parser,
grpc_chttp2_ack_ping(exec_ctx, t, p->opaque_8bytes);
} else {
grpc_slice_buffer_add(&t->qbuf,
grpc_chttp2_ping_create(1, p->opaque_8bytes));
grpc_chttp2_ping_create(1, p->opaque_8bytes));
grpc_chttp2_initiate_write(exec_ctx, t, false, "ping response");
}
}

@ -43,7 +43,7 @@
#include "src/core/ext/transport/chttp2/transport/status_conversion.h"
grpc_slice grpc_chttp2_rst_stream_create(uint32_t id, uint32_t code,
grpc_transport_one_way_stats *stats) {
grpc_transport_one_way_stats *stats) {
static const size_t frame_size = 13;
grpc_slice slice = grpc_slice_malloc(frame_size);
stats->framing_bytes += frame_size;

@ -45,7 +45,7 @@ typedef struct {
} grpc_chttp2_rst_stream_parser;
grpc_slice grpc_chttp2_rst_stream_create(uint32_t stream_id, uint32_t code,
grpc_transport_one_way_stats *stats);
grpc_transport_one_way_stats *stats);
grpc_error *grpc_chttp2_rst_stream_parser_begin_frame(
grpc_chttp2_rst_stream_parser *parser, uint32_t length, uint8_t flags);

@ -83,7 +83,7 @@ static uint8_t *fill_header(uint8_t *out, uint32_t length, uint8_t flags) {
}
grpc_slice grpc_chttp2_settings_create(uint32_t *old, const uint32_t *new,
uint32_t force_mask, size_t count) {
uint32_t force_mask, size_t count) {
size_t i;
uint32_t n = 0;
grpc_slice output;

@ -34,8 +34,8 @@
#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_SETTINGS_H
#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_SETTINGS_H
#include <grpc/support/port_platform.h>
#include <grpc/slice.h>
#include <grpc/support/port_platform.h>
#include "src/core/ext/transport/chttp2/transport/frame.h"
#include "src/core/lib/iomgr/exec_ctx.h"
@ -88,7 +88,7 @@ extern const grpc_chttp2_setting_parameters
/* Create a settings frame by diffing old & new, and updating old to be new */
grpc_slice grpc_chttp2_settings_create(uint32_t *old, const uint32_t *new,
uint32_t force_mask, size_t count);
uint32_t force_mask, size_t count);
/* Create an ack settings frame */
grpc_slice grpc_chttp2_settings_ack_create(void);

@ -45,8 +45,8 @@ typedef struct {
uint32_t amount;
} grpc_chttp2_window_update_parser;
grpc_slice grpc_chttp2_window_update_create(uint32_t id, uint32_t window_delta,
grpc_transport_one_way_stats *stats);
grpc_slice grpc_chttp2_window_update_create(
uint32_t id, uint32_t window_delta, grpc_transport_one_way_stats *stats);
grpc_error *grpc_chttp2_window_update_parser_begin_frame(
grpc_chttp2_window_update_parser *parser, uint32_t length, uint8_t flags);

@ -269,8 +269,9 @@ static void emit_indexed(grpc_chttp2_hpack_compressor *c, uint32_t elem_index,
}
static grpc_slice get_wire_value(grpc_mdelem *elem, uint8_t *huffman_prefix) {
if (grpc_is_binary_header((const char *)GRPC_SLICE_START_PTR(elem->key->slice),
GRPC_SLICE_LENGTH(elem->key->slice))) {
if (grpc_is_binary_header(
(const char *)GRPC_SLICE_START_PTR(elem->key->slice),
GRPC_SLICE_LENGTH(elem->key->slice))) {
*huffman_prefix = 0x80;
return grpc_mdstr_as_base64_encoded_and_huffman_compressed(elem->value);
}

@ -34,9 +34,9 @@
#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_ENCODER_H
#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_ENCODER_H
#include <grpc/support/port_platform.h>
#include <grpc/slice.h>
#include <grpc/slice_buffer.h>
#include <grpc/support/port_platform.h>
#include "src/core/ext/transport/chttp2/transport/frame.h"
#include "src/core/lib/transport/metadata.h"
#include "src/core/lib/transport/metadata_batch.h"

@ -1501,9 +1501,9 @@ static grpc_error *is_binary_indexed_header(grpc_chttp2_hpack_parser *p,
GRPC_ERROR_INT_INDEX, (intptr_t)p->index),
GRPC_ERROR_INT_SIZE, (intptr_t)p->table.num_ents);
}
*is =
grpc_is_binary_header((const char *)GRPC_SLICE_START_PTR(elem->key->slice),
GRPC_SLICE_LENGTH(elem->key->slice));
*is = grpc_is_binary_header(
(const char *)GRPC_SLICE_START_PTR(elem->key->slice),
GRPC_SLICE_LENGTH(elem->key->slice));
return GRPC_ERROR_NONE;
}

@ -34,8 +34,8 @@
#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_TABLE_H
#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_TABLE_H
#include <grpc/support/port_platform.h>
#include <grpc/slice.h>
#include <grpc/support/port_platform.h>
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/transport/metadata.h"

@ -466,7 +466,8 @@ void grpc_chttp2_end_write(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
/** Process one slice of incoming data; return 1 if the connection is still
viable after reading, or 0 if the connection should be torn down */
grpc_error *grpc_chttp2_perform_read(grpc_exec_ctx *exec_ctx,
grpc_chttp2_transport *t, grpc_slice slice);
grpc_chttp2_transport *t,
grpc_slice slice);
bool grpc_chttp2_list_add_writable_stream(grpc_chttp2_transport *t,
grpc_chttp2_stream *s);

@ -229,10 +229,10 @@ grpc_error *grpc_chttp2_perform_read(grpc_exec_ctx *exec_ctx,
case GRPC_DTS_FRAME:
GPR_ASSERT(cur < end);
if ((uint32_t)(end - cur) == t->incoming_frame_size) {
err = parse_frame_slice(exec_ctx, t,
grpc_slice_sub_no_ref(slice, (size_t)(cur - beg),
(size_t)(end - beg)),
1);
err = parse_frame_slice(
exec_ctx, t, grpc_slice_sub_no_ref(slice, (size_t)(cur - beg),
(size_t)(end - beg)),
1);
if (err != GRPC_ERROR_NONE) {
return err;
}
@ -244,7 +244,7 @@ grpc_error *grpc_chttp2_perform_read(grpc_exec_ctx *exec_ctx,
err = parse_frame_slice(
exec_ctx, t,
grpc_slice_sub_no_ref(slice, cur_offset,
cur_offset + t->incoming_frame_size),
cur_offset + t->incoming_frame_size),
1);
if (err != GRPC_ERROR_NONE) {
return err;
@ -253,10 +253,10 @@ grpc_error *grpc_chttp2_perform_read(grpc_exec_ctx *exec_ctx,
t->incoming_stream = NULL;
goto dts_fh_0; /* loop */
} else {
err = parse_frame_slice(exec_ctx, t,
grpc_slice_sub_no_ref(slice, (size_t)(cur - beg),
(size_t)(end - beg)),
0);
err = parse_frame_slice(
exec_ctx, t, grpc_slice_sub_no_ref(slice, (size_t)(cur - beg),
(size_t)(end - beg)),
0);
if (err != GRPC_ERROR_NONE) {
return err;
}

@ -131,8 +131,8 @@ bool grpc_chttp2_begin_write(grpc_exec_ctx *exec_ctx,
if (s->announce_window > 0) {
uint32_t announce = s->announce_window;
grpc_slice_buffer_add(&t->outbuf,
grpc_chttp2_window_update_create(
s->id, s->announce_window, &s->stats.outgoing));
grpc_chttp2_window_update_create(
s->id, s->announce_window, &s->stats.outgoing));
GRPC_CHTTP2_FLOW_DEBIT_STREAM("write", t, s, announce_window, announce);
}
if (sent_initial_metadata) {
@ -163,8 +163,8 @@ bool grpc_chttp2_begin_write(grpc_exec_ctx *exec_ctx,
s->sent_trailing_metadata = true;
if (!t->is_client && !s->read_closed) {
grpc_slice_buffer_add(&t->outbuf, grpc_chttp2_rst_stream_create(
s->id, GRPC_CHTTP2_NO_ERROR,
&s->stats.outgoing));
s->id, GRPC_CHTTP2_NO_ERROR,
&s->stats.outgoing));
}
}
s->sending_bytes += send_bytes;
@ -221,7 +221,7 @@ bool grpc_chttp2_begin_write(grpc_exec_ctx *exec_ctx,
announced);
grpc_transport_one_way_stats throwaway_stats;
grpc_slice_buffer_add(&t->outbuf, grpc_chttp2_window_update_create(
0, announced, &throwaway_stats));
0, announced, &throwaway_stats));
}
GPR_TIMER_END("grpc_chttp2_begin_write", 0);

@ -34,10 +34,10 @@
#include <string.h>
#include <grpc/impl/codegen/port_platform.h>
#include <grpc/slice_buffer.h>
#include <grpc/support/alloc.h>
#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/slice_buffer.h>
#include <grpc/support/string_util.h>
#include <grpc/support/useful.h>
@ -926,7 +926,7 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx,
free_read_buffer(s);
grpc_slice_buffer_init(&stream_state->rs.read_slice_buffer);
grpc_slice_buffer_add(&stream_state->rs.read_slice_buffer,
read_data_slice);
read_data_slice);
grpc_slice_buffer_stream_init(&stream_state->rs.sbs,
&stream_state->rs.read_slice_buffer, 0);
*((grpc_byte_buffer **)stream_op->recv_message) =

@ -35,9 +35,9 @@
#include <string.h>
#include <grpc/compression.h>
#include <grpc/slice_buffer.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/slice_buffer.h>
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/channel/compress_filter.h"

@ -38,9 +38,9 @@
#include <string.h>
#include <grpc/byte_buffer.h>
#include <grpc/slice_buffer.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/slice_buffer.h>
#include "src/core/lib/profiling/timers.h"
#include "src/core/lib/support/string.h"
#include "src/core/lib/transport/transport.h"

@ -146,8 +146,8 @@ void grpc_handshake_manager_shutdown(grpc_exec_ctx* exec_ctx,
static void call_next_handshaker(grpc_exec_ctx* exec_ctx,
grpc_endpoint* endpoint,
grpc_channel_args* args,
grpc_slice_buffer* read_buffer, void* user_data,
grpc_error* error) {
grpc_slice_buffer* read_buffer,
void* user_data, grpc_error* error) {
grpc_handshake_manager* mgr = user_data;
GPR_ASSERT(mgr->state != NULL);
GPR_ASSERT(mgr->state->index < mgr->count);

@ -164,7 +164,7 @@ static grpc_mdelem *server_filter(void *user_data, grpc_mdelem *md) {
calld->seen_payload_bin = 1;
grpc_slice_buffer_init(&calld->read_slice_buffer);
grpc_slice_buffer_add(&calld->read_slice_buffer,
grpc_slice_ref(md->value->slice));
grpc_slice_ref(md->value->slice));
grpc_slice_buffer_stream_init(&calld->read_stream,
&calld->read_slice_buffer, 0);
return NULL;

@ -37,8 +37,8 @@
#include <stdio.h>
#include <string.h>
#include <grpc/support/alloc.h>
#include <grpc/slice.h>
#include <grpc/support/alloc.h>
#include <grpc/support/string_util.h>
#include <grpc/support/useful.h>
#include "src/core/lib/support/string.h"
@ -65,7 +65,8 @@ static void fill_common_header(const grpc_httpcli_request *request,
}
}
grpc_slice grpc_httpcli_format_get_request(const grpc_httpcli_request *request) {
grpc_slice grpc_httpcli_format_get_request(
const grpc_httpcli_request *request) {
gpr_strvec out;
char *flat;
size_t flat_len;
@ -82,8 +83,8 @@ grpc_slice grpc_httpcli_format_get_request(const grpc_httpcli_request *request)
}
grpc_slice grpc_httpcli_format_post_request(const grpc_httpcli_request *request,
const char *body_bytes,
size_t body_size) {
const char *body_bytes,
size_t body_size) {
gpr_strvec out;
char *tmp;
size_t out_len;

@ -39,8 +39,8 @@
grpc_slice grpc_httpcli_format_get_request(const grpc_httpcli_request *request);
grpc_slice grpc_httpcli_format_post_request(const grpc_httpcli_request *request,
const char *body_bytes,
size_t body_size);
const char *body_bytes,
size_t body_size);
grpc_slice grpc_httpcli_format_connect_request(
const grpc_httpcli_request *request);

@ -34,8 +34,8 @@
#ifndef GRPC_CORE_LIB_HTTP_PARSER_H
#define GRPC_CORE_LIB_HTTP_PARSER_H
#include <grpc/support/port_platform.h>
#include <grpc/slice.h>
#include <grpc/support/port_platform.h>
#include "src/core/lib/iomgr/error.h"
/* Maximum length of a header string of the form 'Key: Value\r\n' */

@ -300,7 +300,7 @@ static void ru_slice_unref(void *p) {
}
static grpc_slice ru_slice_create(grpc_resource_user *resource_user,
size_t size) {
size_t size) {
ru_slice_refcount *rc = gpr_malloc(sizeof(ru_slice_refcount) + size);
rc->base.ref = ru_slice_ref;
rc->base.unref = ru_slice_unref;

@ -37,10 +37,10 @@
#include "src/core/lib/iomgr/sockaddr_windows.h"
#include <grpc/slice_buffer.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/log_windows.h>
#include <grpc/slice_buffer.h>
#include <grpc/support/useful.h>
#include "src/core/lib/iomgr/iocp_windows.h"

@ -40,10 +40,10 @@
#include "src/core/lib/iomgr/network_status_tracker.h"
#include "src/core/lib/iomgr/sockaddr_windows.h"
#include <grpc/slice_buffer.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/log_windows.h>
#include <grpc/slice_buffer.h>
#include <grpc/support/string_util.h>
#include <grpc/support/useful.h>

@ -36,9 +36,9 @@
#include <stdbool.h>
#include <string.h>
#include <grpc/slice_buffer.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/slice_buffer.h>
#include "src/core/lib/iomgr/timer.h"
#include "src/core/lib/security/context/security_context.h"
#include "src/core/lib/security/transport/secure_endpoint.h"

@ -36,10 +36,10 @@
#include <stdbool.h>
#include <string.h>
#include <grpc/slice_buffer.h>
#include <grpc/support/alloc.h>
#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/slice_buffer.h>
#include <grpc/support/string_util.h>
#include "src/core/ext/transport/chttp2/alpn/alpn.h"

@ -183,7 +183,7 @@ static int decode_group(const unsigned char *codes, size_t num_codes,
}
grpc_slice grpc_base64_decode_with_len(const char *b64, size_t b64_len,
int url_safe) {
int url_safe) {
grpc_slice result = grpc_slice_malloc(b64_len);
unsigned char *current = GRPC_SLICE_START_PTR(result);
size_t result_size = 0;

@ -47,6 +47,6 @@ grpc_slice grpc_base64_decode(const char *b64, int url_safe);
/* Same as above except that the length is provided by the caller. */
grpc_slice grpc_base64_decode_with_len(const char *b64, size_t b64_len,
int url_safe);
int url_safe);
#endif /* GRPC_CORE_LIB_SECURITY_UTIL_B64_H */

@ -31,9 +31,9 @@
*
*/
#include <grpc/slice.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/slice.h>
#include <string.h>
@ -62,7 +62,7 @@ void grpc_slice_unref(grpc_slice slice) {
static void noop_ref_or_unref(void *unused) {}
static grpc_slice_refcount noop_refcount = {noop_ref_or_unref,
noop_ref_or_unref};
noop_ref_or_unref};
grpc_slice grpc_slice_from_static_string(const char *s) {
grpc_slice slice;
@ -95,8 +95,8 @@ static void new_slice_unref(void *p) {
}
grpc_slice grpc_slice_new_with_user_data(void *p, size_t len,
void (*destroy)(void *),
void *user_data) {
void (*destroy)(void *),
void *user_data) {
grpc_slice slice;
new_slice_refcount *rc = gpr_malloc(sizeof(new_slice_refcount));
gpr_ref_init(&rc->refs, 1);
@ -140,7 +140,7 @@ static void new_with_len_unref(void *p) {
}
grpc_slice grpc_slice_new_with_len(void *p, size_t len,
void (*destroy)(void *, size_t)) {
void (*destroy)(void *, size_t)) {
grpc_slice slice;
new_with_len_slice_refcount *rc =
gpr_malloc(sizeof(new_with_len_slice_refcount));

@ -31,8 +31,8 @@
*
*/
#include <grpc/support/port_platform.h>
#include <grpc/slice_buffer.h>
#include <grpc/support/port_platform.h>
#include <string.h>
@ -112,7 +112,8 @@ void grpc_slice_buffer_add(grpc_slice_buffer *sb, grpc_slice s) {
writes */
if (!s.refcount && n) {
grpc_slice *back = &sb->slices[n - 1];
if (!back->refcount && back->data.inlined.length < GRPC_SLICE_INLINED_SIZE) {
if (!back->refcount &&
back->data.inlined.length < GRPC_SLICE_INLINED_SIZE) {
if (s.data.inlined.length + back->data.inlined.length <=
GRPC_SLICE_INLINED_SIZE) {
memcpy(back->data.inlined.bytes + back->data.inlined.length,
@ -193,7 +194,8 @@ void grpc_slice_buffer_swap(grpc_slice_buffer *a, grpc_slice_buffer *b) {
}
}
void grpc_slice_buffer_move_into(grpc_slice_buffer *src, grpc_slice_buffer *dst) {
void grpc_slice_buffer_move_into(grpc_slice_buffer *src,
grpc_slice_buffer *dst) {
/* anything to move? */
if (src->count == 0) {
return;
@ -210,7 +212,7 @@ void grpc_slice_buffer_move_into(grpc_slice_buffer *src, grpc_slice_buffer *dst)
}
void grpc_slice_buffer_move_first(grpc_slice_buffer *src, size_t n,
grpc_slice_buffer *dst) {
grpc_slice_buffer *dst) {
size_t src_idx;
size_t output_len = dst->length + n;
size_t new_input_len = src->length - n;
@ -248,7 +250,7 @@ void grpc_slice_buffer_move_first(grpc_slice_buffer *src, size_t n,
}
void grpc_slice_buffer_trim_end(grpc_slice_buffer *sb, size_t n,
grpc_slice_buffer *garbage) {
grpc_slice_buffer *garbage) {
GPR_ASSERT(n <= sb->length);
sb->length -= n;
for (;;) {

@ -42,7 +42,8 @@ grpc_byte_buffer *grpc_raw_byte_buffer_create(grpc_slice *slices,
}
grpc_byte_buffer *grpc_raw_compressed_byte_buffer_create(
grpc_slice *slices, size_t nslices, grpc_compression_algorithm compression) {
grpc_slice *slices, size_t nslices,
grpc_compression_algorithm compression) {
size_t i;
grpc_byte_buffer *bb = gpr_malloc(sizeof(grpc_byte_buffer));
bb->type = GRPC_BB_RAW;

@ -37,9 +37,9 @@
#include <grpc/byte_buffer.h>
#include <grpc/compression.h>
#include <grpc/grpc.h>
#include <grpc/slice_buffer.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/slice_buffer.h>
#include "src/core/lib/compression/message_compress.h"

@ -37,8 +37,8 @@
#include <stdbool.h>
#include <grpc/grpc.h>
#include <grpc/support/port_platform.h>
#include <grpc/slice.h>
#include <grpc/support/port_platform.h>
#include <grpc/support/time.h>
#include "src/core/lib/transport/metadata.h"

@ -47,8 +47,8 @@
#include <grpc++/support/status.h>
#include <grpc++/support/time.h>
#include <grpc/grpc.h>
#include <grpc/support/log.h>
#include <grpc/slice.h>
#include <grpc/support/log.h>
#include "src/core/lib/profiling/timers.h"
namespace grpc {

@ -39,11 +39,11 @@
#include <grpc/byte_buffer.h>
#include <grpc/byte_buffer_reader.h>
#include <grpc/grpc.h>
#include <grpc/slice.h>
#include <grpc/slice_buffer.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
#include <grpc/slice.h>
#include <grpc/slice_buffer.h>
#include <grpc/support/sync.h>
#include "src/core/lib/profiling/timers.h"
@ -115,13 +115,16 @@ grpc_slice CoreCodegen::grpc_slice_malloc(size_t length) {
return ::grpc_slice_malloc(length);
}
void CoreCodegen::grpc_slice_unref(grpc_slice slice) { ::grpc_slice_unref(slice); }
void CoreCodegen::grpc_slice_unref(grpc_slice slice) {
::grpc_slice_unref(slice);
}
grpc_slice CoreCodegen::grpc_slice_split_tail(grpc_slice* s, size_t split) {
return ::grpc_slice_split_tail(s, split);
}
void CoreCodegen::grpc_slice_buffer_add(grpc_slice_buffer* sb, grpc_slice slice) {
void CoreCodegen::grpc_slice_buffer_add(grpc_slice_buffer* sb,
grpc_slice slice) {
::grpc_slice_buffer_add(sb, slice);
}

@ -70,8 +70,8 @@ static void assert_passthrough(grpc_slice value,
GPR_INFO, "assert_passthrough: value_length=%" PRIuPTR
" value_hash=0x%08x "
"algorithm='%s' uncompressed_split='%s' compressed_split='%s'",
GRPC_SLICE_LENGTH(value),
gpr_murmur_hash3(GRPC_SLICE_START_PTR(value), GRPC_SLICE_LENGTH(value), 0),
GRPC_SLICE_LENGTH(value), gpr_murmur_hash3(GRPC_SLICE_START_PTR(value),
GRPC_SLICE_LENGTH(value), 0),
algorithm_name, grpc_slice_split_mode_name(uncompressed_split_mode),
grpc_slice_split_mode_name(compressed_split_mode));
@ -221,7 +221,7 @@ static void test_bad_decompression_data_stream(void) {
grpc_slice_buffer_init(&input);
grpc_slice_buffer_init(&output);
grpc_slice_buffer_add(&input,
grpc_slice_from_copied_buffer("\x78\xda\xff\xff", 4));
grpc_slice_from_copied_buffer("\x78\xda\xff\xff", 4));
/* try (and fail) to decompress the invalid compresed buffer */
GPR_ASSERT(0 == grpc_msg_decompress(GRPC_COMPRESS_DEFLATE, &input, &output));
@ -237,8 +237,8 @@ static void test_bad_compression_algorithm(void) {
grpc_slice_buffer_init(&input);
grpc_slice_buffer_init(&output);
grpc_slice_buffer_add(&input,
grpc_slice_from_copied_string("Never gonna give you up"));
grpc_slice_buffer_add(
&input, grpc_slice_from_copied_string("Never gonna give you up"));
was_compressed =
grpc_msg_compress(GRPC_COMPRESS_ALGORITHMS_COUNT, &input, &output);
GPR_ASSERT(0 == was_compressed);
@ -259,8 +259,8 @@ static void test_bad_decompression_algorithm(void) {
grpc_slice_buffer_init(&input);
grpc_slice_buffer_init(&output);
grpc_slice_buffer_add(&input,
grpc_slice_from_copied_string(
"I'm not really compressed but it doesn't matter"));
grpc_slice_from_copied_string(
"I'm not really compressed but it doesn't matter"));
was_decompressed =
grpc_msg_decompress(GRPC_COMPRESS_ALGORITHMS_COUNT, &input, &output);
GPR_ASSERT(0 == was_decompressed);

@ -119,7 +119,8 @@ static grpc_slice merge_slices(grpc_slice *slices, size_t nslices) {
cursor = GRPC_SLICE_START_PTR(out);
for (i = 0; i < nslices; i++) {
memcpy(cursor, GRPC_SLICE_START_PTR(slices[i]), GRPC_SLICE_LENGTH(slices[i]));
memcpy(cursor, GRPC_SLICE_START_PTR(slices[i]),
GRPC_SLICE_LENGTH(slices[i]));
cursor += GRPC_SLICE_LENGTH(slices[i]);
}

@ -251,7 +251,8 @@ static void test_send_messages_at_the_same_time() {
gpr_log(GPR_INFO, "test_send_messages_at_the_same_time");
grpc_op *op;
grpc_slice request_payload_slice = grpc_slice_from_copied_string("hello world");
grpc_slice request_payload_slice =
grpc_slice_from_copied_string("hello world");
grpc_byte_buffer *request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
prepare_test(1);

@ -100,8 +100,10 @@ static void test_request_response_with_metadata_and_payload(
grpc_end2end_test_config config) {
grpc_call *c;
grpc_call *s;
grpc_slice request_payload_slice = grpc_slice_from_copied_string("hello world");
grpc_slice response_payload_slice = grpc_slice_from_copied_string("hello you");
grpc_slice request_payload_slice =
grpc_slice_from_copied_string("hello world");
grpc_slice response_payload_slice =
grpc_slice_from_copied_string("hello you");
grpc_byte_buffer *request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
grpc_byte_buffer *response_payload =

@ -135,8 +135,10 @@ static void request_response_with_payload_and_call_creds(
override_mode mode) {
grpc_call *c;
grpc_call *s;
grpc_slice request_payload_slice = grpc_slice_from_copied_string("hello world");
grpc_slice response_payload_slice = grpc_slice_from_copied_string("hello you");
grpc_slice request_payload_slice =
grpc_slice_from_copied_string("hello world");
grpc_slice response_payload_slice =
grpc_slice_from_copied_string("hello you");
grpc_byte_buffer *request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
grpc_byte_buffer *response_payload =
@ -389,7 +391,8 @@ static void test_request_with_server_rejecting_client_creds(
char *details = NULL;
size_t details_capacity = 0;
grpc_byte_buffer *response_payload_recv = NULL;
grpc_slice request_payload_slice = grpc_slice_from_copied_string("hello world");
grpc_slice request_payload_slice =
grpc_slice_from_copied_string("hello world");
grpc_byte_buffer *request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
grpc_call_credentials *creds;

@ -118,8 +118,10 @@ static void test_cancel_after_accept(grpc_end2end_test_config config,
size_t details_capacity = 0;
grpc_byte_buffer *request_payload_recv = NULL;
grpc_byte_buffer *response_payload_recv = NULL;
grpc_slice request_payload_slice = grpc_slice_from_copied_string("hello world");
grpc_slice response_payload_slice = grpc_slice_from_copied_string("hello you");
grpc_slice request_payload_slice =
grpc_slice_from_copied_string("hello world");
grpc_slice response_payload_slice =
grpc_slice_from_copied_string("hello you");
grpc_byte_buffer *request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
grpc_byte_buffer *response_payload =

@ -117,8 +117,10 @@ static void test_cancel_after_accept_and_writes_closed(
size_t details_capacity = 0;
grpc_byte_buffer *request_payload_recv = NULL;
grpc_byte_buffer *response_payload_recv = NULL;
grpc_slice request_payload_slice = grpc_slice_from_copied_string("hello world");
grpc_slice response_payload_slice = grpc_slice_from_copied_string("hello you");
grpc_slice request_payload_slice =
grpc_slice_from_copied_string("hello world");
grpc_slice response_payload_slice =
grpc_slice_from_copied_string("hello you");
grpc_byte_buffer *request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
grpc_byte_buffer *response_payload =

@ -116,7 +116,8 @@ static void test_cancel_after_invoke(grpc_end2end_test_config config,
char *details = NULL;
size_t details_capacity = 0;
grpc_byte_buffer *response_payload_recv = NULL;
grpc_slice request_payload_slice = grpc_slice_from_copied_string("hello world");
grpc_slice request_payload_slice =
grpc_slice_from_copied_string("hello world");
grpc_byte_buffer *request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);

@ -114,7 +114,8 @@ static void test_cancel_before_invoke(grpc_end2end_test_config config,
char *details = NULL;
size_t details_capacity = 0;
grpc_byte_buffer *response_payload_recv = NULL;
grpc_slice request_payload_slice = grpc_slice_from_copied_string("hello world");
grpc_slice request_payload_slice =
grpc_slice_from_copied_string("hello world");
grpc_byte_buffer *request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);

@ -308,7 +308,8 @@ static void request_with_payload_template(
response_str[1023] = '\0';
request_payload_slice = grpc_slice_from_copied_string(request_str);
grpc_slice response_payload_slice = grpc_slice_from_copied_string(response_str);
grpc_slice response_payload_slice =
grpc_slice_from_copied_string(response_str);
client_args = grpc_channel_args_set_compression_algorithm(
NULL, default_client_channel_compression_algorithm);

@ -108,7 +108,8 @@ static void end_test(grpc_end2end_test_fixture *f) {
static void test_request(grpc_end2end_test_config config) {
grpc_call *c;
grpc_call *s;
grpc_slice request_payload_slice = grpc_slice_from_copied_string("hello world");
grpc_slice request_payload_slice =
grpc_slice_from_copied_string("hello world");
grpc_byte_buffer *request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
gpr_timespec deadline = five_seconds_time();

@ -104,7 +104,8 @@ static void end_test(grpc_end2end_test_fixture *f) {
static void test_request(grpc_end2end_test_config config) {
grpc_call *c;
grpc_call *s;
grpc_slice request_payload_slice = grpc_slice_from_copied_string("hello world");
grpc_slice request_payload_slice =
grpc_slice_from_copied_string("hello world");
grpc_byte_buffer *request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
gpr_timespec deadline = five_seconds_time();

@ -99,7 +99,8 @@ static void end_test(grpc_end2end_test_fixture *f) {
static void test_request_with_large_metadata(grpc_end2end_test_config config) {
grpc_call *c;
grpc_call *s;
grpc_slice request_payload_slice = grpc_slice_from_copied_string("hello world");
grpc_slice request_payload_slice =
grpc_slice_from_copied_string("hello world");
grpc_byte_buffer *request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
gpr_timespec deadline = five_seconds_time();

@ -128,7 +128,8 @@ static void request_response_with_payload(grpc_end2end_test_fixture f,
grpc_metadata *initial_lr_metadata,
grpc_metadata *trailing_lr_metadata) {
grpc_slice request_payload_slice = grpc_slice_from_static_string(request_msg);
grpc_slice response_payload_slice = grpc_slice_from_static_string(response_msg);
grpc_slice response_payload_slice =
grpc_slice_from_static_string(response_msg);
grpc_call *c;
grpc_call *s;
grpc_byte_buffer *request_payload =

@ -116,7 +116,8 @@ static void test_max_message_length_on_request(grpc_end2end_test_config config,
cq_verifier *cqv;
grpc_op ops[6];
grpc_op *op;
grpc_slice request_payload_slice = grpc_slice_from_copied_string("hello world");
grpc_slice request_payload_slice =
grpc_slice_from_copied_string("hello world");
grpc_byte_buffer *request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
grpc_byte_buffer *recv_payload = NULL;

@ -102,7 +102,8 @@ static void end_test(grpc_end2end_test_fixture *f) {
static void test_invoke_network_status_change(grpc_end2end_test_config config) {
grpc_call *c;
grpc_call *s;
grpc_slice request_payload_slice = grpc_slice_from_copied_string("hello world");
grpc_slice request_payload_slice =
grpc_slice_from_copied_string("hello world");
grpc_byte_buffer *request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
gpr_timespec deadline = five_seconds_time();

@ -95,7 +95,8 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_destroy(f->cq);
}
/* Creates and returns a grpc_slice containing random alphanumeric characters. */
/* Creates and returns a grpc_slice containing random alphanumeric characters.
*/
static grpc_slice generate_random_slice() {
size_t i;
static const char chars[] = "abcdefghijklmnopqrstuvwxyz1234567890";

@ -120,8 +120,10 @@ static void test_pingpong_streaming(grpc_end2end_test_config config,
grpc_byte_buffer *response_payload;
grpc_byte_buffer *response_payload_recv;
int i;
grpc_slice request_payload_slice = grpc_slice_from_copied_string("hello world");
grpc_slice response_payload_slice = grpc_slice_from_copied_string("hello you");
grpc_slice request_payload_slice =
grpc_slice_from_copied_string("hello world");
grpc_slice response_payload_slice =
grpc_slice_from_copied_string("hello you");
c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
"/foo", "foo.test.google.fr:1234", deadline,

@ -100,7 +100,8 @@ static void test_invoke_request_with_flags(
grpc_end2end_test_config config, uint32_t *flags_for_op,
grpc_call_error call_start_batch_expected_result) {
grpc_call *c;
grpc_slice request_payload_slice = grpc_slice_from_copied_string("hello world");
grpc_slice request_payload_slice =
grpc_slice_from_copied_string("hello world");
grpc_byte_buffer *request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
gpr_timespec deadline = five_seconds_time();

@ -99,7 +99,8 @@ static void end_test(grpc_end2end_test_fixture *f) {
static void test_invoke_request_with_payload(grpc_end2end_test_config config) {
grpc_call *c;
grpc_call *s;
grpc_slice request_payload_slice = grpc_slice_from_copied_string("hello world");
grpc_slice request_payload_slice =
grpc_slice_from_copied_string("hello world");
grpc_byte_buffer *request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
gpr_timespec deadline = five_seconds_time();

@ -95,7 +95,8 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_destroy(f->cq);
}
/* Creates and returns a grpc_slice containing random alphanumeric characters. */
/* Creates and returns a grpc_slice containing random alphanumeric characters.
*/
static grpc_slice generate_random_slice() {
size_t i;
static const char chars[] = "abcdefghijklmnopqrstuvwxyz1234567890";

@ -102,8 +102,10 @@ static void test_cacheable_request_response_with_metadata_and_payload(
grpc_end2end_test_config config) {
grpc_call *c;
grpc_call *s;
grpc_slice request_payload_slice = grpc_slice_from_copied_string("hello world");
grpc_slice response_payload_slice = grpc_slice_from_copied_string("hello you");
grpc_slice request_payload_slice =
grpc_slice_from_copied_string("hello world");
grpc_slice response_payload_slice =
grpc_slice_from_copied_string("hello you");
grpc_byte_buffer *request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
grpc_byte_buffer *response_payload =

@ -100,8 +100,10 @@ static void test_request_response_with_metadata_and_payload(
grpc_end2end_test_config config) {
grpc_call *c;
grpc_call *s;
grpc_slice request_payload_slice = grpc_slice_from_copied_string("hello world");
grpc_slice response_payload_slice = grpc_slice_from_copied_string("hello you");
grpc_slice request_payload_slice =
grpc_slice_from_copied_string("hello world");
grpc_slice response_payload_slice =
grpc_slice_from_copied_string("hello you");
grpc_byte_buffer *request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
grpc_byte_buffer *response_payload =

@ -100,8 +100,10 @@ static void test_request_response_with_metadata_and_payload(
grpc_end2end_test_config config) {
grpc_call *c;
grpc_call *s;
grpc_slice request_payload_slice = grpc_slice_from_copied_string("hello world");
grpc_slice response_payload_slice = grpc_slice_from_copied_string("hello you");
grpc_slice request_payload_slice =
grpc_slice_from_copied_string("hello world");
grpc_slice response_payload_slice =
grpc_slice_from_copied_string("hello you");
grpc_byte_buffer *request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
grpc_byte_buffer *response_payload =

@ -52,13 +52,13 @@ static void test_format_get_request(void) {
slice = grpc_httpcli_format_get_request(&req);
GPR_ASSERT(0 == grpc_slice_str_cmp(slice,
"GET /index.html HTTP/1.0\r\n"
"Host: example.com\r\n"
"Connection: close\r\n"
"User-Agent: " GRPC_HTTPCLI_USER_AGENT
"\r\n"
"x-yz: abc\r\n"
"\r\n"));
"GET /index.html HTTP/1.0\r\n"
"Host: example.com\r\n"
"Connection: close\r\n"
"User-Agent: " GRPC_HTTPCLI_USER_AGENT
"\r\n"
"x-yz: abc\r\n"
"\r\n"));
grpc_slice_unref(slice);
}
@ -79,16 +79,16 @@ static void test_format_post_request(void) {
slice = grpc_httpcli_format_post_request(&req, body_bytes, body_len);
GPR_ASSERT(0 == grpc_slice_str_cmp(slice,
"POST /index.html HTTP/1.0\r\n"
"Host: example.com\r\n"
"Connection: close\r\n"
"User-Agent: " GRPC_HTTPCLI_USER_AGENT
"\r\n"
"x-yz: abc\r\n"
"Content-Type: text/plain\r\n"
"Content-Length: 9\r\n"
"\r\n"
"fake body"));
"POST /index.html HTTP/1.0\r\n"
"Host: example.com\r\n"
"Connection: close\r\n"
"User-Agent: " GRPC_HTTPCLI_USER_AGENT
"\r\n"
"x-yz: abc\r\n"
"Content-Type: text/plain\r\n"
"Content-Length: 9\r\n"
"\r\n"
"fake body"));
grpc_slice_unref(slice);
}
@ -107,13 +107,13 @@ static void test_format_post_request_no_body(void) {
slice = grpc_httpcli_format_post_request(&req, NULL, 0);
GPR_ASSERT(0 == grpc_slice_str_cmp(slice,
"POST /index.html HTTP/1.0\r\n"
"Host: example.com\r\n"
"Connection: close\r\n"
"User-Agent: " GRPC_HTTPCLI_USER_AGENT
"\r\n"
"x-yz: abc\r\n"
"\r\n"));
"POST /index.html HTTP/1.0\r\n"
"Host: example.com\r\n"
"Connection: close\r\n"
"User-Agent: " GRPC_HTTPCLI_USER_AGENT
"\r\n"
"x-yz: abc\r\n"
"\r\n"));
grpc_slice_unref(slice);
}

@ -36,9 +36,9 @@
#include <stdbool.h>
#include <sys/types.h>
#include <grpc/slice.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/slice.h>
#include <grpc/support/time.h>
#include <grpc/support/useful.h>
#include "test/core/util/test_config.h"
@ -88,7 +88,7 @@ static grpc_endpoint_test_fixture begin_test(grpc_endpoint_test_config config,
static void end_test(grpc_endpoint_test_config config) { config.clean_up(); }
static grpc_slice *allocate_blocks(size_t num_bytes, size_t slice_size,
size_t *num_blocks, uint8_t *current_data) {
size_t *num_blocks, uint8_t *current_data) {
size_t nslices = num_bytes / slice_size + (num_bytes % slice_size ? 1 : 0);
grpc_slice *slices = gpr_malloc(sizeof(grpc_slice) * nslices);
size_t num_bytes_left = num_bytes;
@ -99,7 +99,7 @@ static grpc_slice *allocate_blocks(size_t num_bytes, size_t slice_size,
for (i = 0; i < nslices; ++i) {
slices[i] = grpc_slice_malloc(slice_size > num_bytes_left ? num_bytes_left
: slice_size);
: slice_size);
num_bytes_left -= GRPC_SLICE_LENGTH(slices[i]);
buf = GRPC_SLICE_START_PTR(slices[i]);
for (j = 0; j < GRPC_SLICE_LENGTH(slices[i]); ++j) {

@ -34,9 +34,9 @@
#include <stdio.h>
#include <string.h>
#include <grpc/slice.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/slice.h>
#include "src/core/lib/iomgr/load_file.h"
#include "src/core/lib/support/string.h"

@ -274,7 +274,7 @@ struct write_socket_state {
};
static grpc_slice *allocate_blocks(size_t num_bytes, size_t slice_size,
size_t *num_blocks, uint8_t *current_data) {
size_t *num_blocks, uint8_t *current_data) {
size_t nslices = num_bytes / slice_size + (num_bytes % slice_size ? 1u : 0u);
grpc_slice *slices = gpr_malloc(sizeof(grpc_slice) * nslices);
size_t num_bytes_left = num_bytes;
@ -284,7 +284,7 @@ static grpc_slice *allocate_blocks(size_t num_bytes, size_t slice_size,
for (i = 0; i < nslices; ++i) {
slices[i] = grpc_slice_malloc(slice_size > num_bytes_left ? num_bytes_left
: slice_size);
: slice_size);
num_bytes_left -= GRPC_SLICE_LENGTH(slices[i]);
buf = GRPC_SLICE_START_PTR(slices[i]);
for (j = 0; j < GRPC_SLICE_LENGTH(slices[i]); ++j) {

@ -35,9 +35,9 @@
#include <string.h>
#include <grpc/slice.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/slice.h>
#include "test/core/util/test_config.h"
static int buffers_are_equal(const unsigned char *buf1,

@ -37,10 +37,10 @@
#include "src/core/lib/iomgr/load_file.h"
#include "src/core/lib/security/credentials/jwt/jwt_credentials.h"
#include <grpc/slice.h>
#include <grpc/support/alloc.h>
#include <grpc/support/cmdline.h>
#include <grpc/support/log.h>
#include <grpc/slice.h>
void create_jwt(const char *json_key_file_path, const char *service_url,
const char *scope) {

@ -243,9 +243,10 @@ static void test_oauth2_token_fetcher_creds_parsing_ok(void) {
GPR_ASSERT(token_lifetime.tv_sec == 3599);
GPR_ASSERT(token_lifetime.tv_nsec == 0);
GPR_ASSERT(token_md->num_entries == 1);
GPR_ASSERT(grpc_slice_str_cmp(token_md->entries[0].key, "authorization") == 0);
GPR_ASSERT(grpc_slice_str_cmp(token_md->entries[0].key, "authorization") ==
0);
GPR_ASSERT(grpc_slice_str_cmp(token_md->entries[0].value,
"Bearer ya29.AHES6ZRN3-HlhAPya30GnW_bHSb_") ==
"Bearer ya29.AHES6ZRN3-HlhAPya30GnW_bHSb_") ==
0);
grpc_credentials_md_store_unref(token_md);
grpc_http_response_destroy(&response);
@ -530,7 +531,7 @@ static void on_oauth2_creds_get_metadata_success(
GPR_ASSERT(num_md == 1);
GPR_ASSERT(grpc_slice_str_cmp(md_elems[0].key, "authorization") == 0);
GPR_ASSERT(grpc_slice_str_cmp(md_elems[0].value,
"Bearer ya29.AHES6ZRN3-HlhAPya30GnW_bHSb_") ==
"Bearer ya29.AHES6ZRN3-HlhAPya30GnW_bHSb_") ==
0);
GPR_ASSERT(user_data != NULL);
GPR_ASSERT(strcmp((const char *)user_data, test_user_data) == 0);

@ -36,10 +36,10 @@
#include <grpc/grpc.h>
#include <grpc/grpc_security.h>
#include <grpc/slice.h>
#include <grpc/support/alloc.h>
#include <grpc/support/cmdline.h>
#include <grpc/support/log.h>
#include <grpc/slice.h>
#include <grpc/support/sync.h>
#include "src/core/lib/iomgr/load_file.h"

@ -37,9 +37,9 @@
#include <string.h>
#include <grpc/grpc_security.h>
#include <grpc/slice.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/slice.h>
#include "src/core/lib/json/json.h"
#include "src/core/lib/security/credentials/oauth2/oauth2_credentials.h"

@ -37,9 +37,9 @@
#include <grpc/grpc.h>
#include <grpc/slice.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/slice.h>
#include <grpc/support/string_util.h>
#include "src/core/lib/http/httpcli.h"
@ -487,8 +487,8 @@ static void corrupt_jwt_sig(char *jwt) {
GPR_ASSERT(!GRPC_SLICE_IS_EMPTY(sig));
sig_bytes = GRPC_SLICE_START_PTR(sig);
(*sig_bytes)++; /* Corrupt first byte. */
bad_b64_sig =
grpc_base64_encode(GRPC_SLICE_START_PTR(sig), GRPC_SLICE_LENGTH(sig), 1, 0);
bad_b64_sig = grpc_base64_encode(GRPC_SLICE_START_PTR(sig),
GRPC_SLICE_LENGTH(sig), 1, 0);
memcpy(last_dot + 1, bad_b64_sig, strlen(bad_b64_sig));
gpr_free(bad_b64_sig);
grpc_slice_unref(sig);

@ -37,9 +37,9 @@
#include <grpc/grpc.h>
#include <grpc/grpc_security.h>
#include <grpc/slice.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/slice.h>
#include <grpc/support/sync.h>
#include "src/core/lib/security/credentials/credentials.h"

@ -36,10 +36,10 @@
#include <grpc/grpc.h>
#include <grpc/grpc_security.h>
#include <grpc/slice.h>
#include <grpc/support/alloc.h>
#include <grpc/support/cmdline.h>
#include <grpc/support/log.h>
#include <grpc/slice.h>
#include <grpc/support/sync.h>
#include "src/core/lib/security/credentials/composite/composite_credentials.h"

@ -36,10 +36,10 @@
#include <grpc/grpc.h>
#include <grpc/grpc_security.h>
#include <grpc/slice.h>
#include <grpc/support/alloc.h>
#include <grpc/support/cmdline.h>
#include <grpc/support/log.h>
#include <grpc/slice.h>
#include <grpc/support/sync.h>
#include "src/core/lib/security/credentials/jwt/jwt_verifier.h"

@ -31,8 +31,8 @@
*
*/
#include <grpc/support/log.h>
#include <grpc/slice_buffer.h>
#include <grpc/support/log.h>
#include "test/core/util/test_config.h"
void test_slice_buffer_add() {

@ -170,11 +170,12 @@ static void test_slice_sub_works(unsigned length) {
grpc_slice_unref(slice);
}
static void check_head_tail(grpc_slice slice, grpc_slice head, grpc_slice tail) {
static void check_head_tail(grpc_slice slice, grpc_slice head,
grpc_slice tail) {
GPR_ASSERT(GRPC_SLICE_LENGTH(slice) ==
GRPC_SLICE_LENGTH(head) + GRPC_SLICE_LENGTH(tail));
GPR_ASSERT(0 == memcmp(GRPC_SLICE_START_PTR(slice), GRPC_SLICE_START_PTR(head),
GRPC_SLICE_LENGTH(head)));
GPR_ASSERT(0 == memcmp(GRPC_SLICE_START_PTR(slice),
GRPC_SLICE_START_PTR(head), GRPC_SLICE_LENGTH(head)));
GPR_ASSERT(0 == memcmp(GRPC_SLICE_START_PTR(slice) + GRPC_SLICE_LENGTH(head),
GRPC_SLICE_START_PTR(tail), GRPC_SLICE_LENGTH(tail)));
}
@ -243,8 +244,8 @@ static void test_slice_from_copied_string_works(void) {
slice = grpc_slice_from_copied_string(text);
GPR_ASSERT(strlen(text) == GRPC_SLICE_LENGTH(slice));
GPR_ASSERT(0 ==
memcmp(text, GRPC_SLICE_START_PTR(slice), GRPC_SLICE_LENGTH(slice)));
GPR_ASSERT(
0 == memcmp(text, GRPC_SLICE_START_PTR(slice), GRPC_SLICE_LENGTH(slice)));
grpc_slice_unref(slice);
}

@ -36,9 +36,9 @@
#include <stdarg.h>
#include <grpc/grpc.h>
#include <grpc/slice.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/slice.h>
#include "test/core/util/parse_hexstring.h"
#include "test/core/util/slice_splitter.h"
#include "test/core/util/test_config.h"

@ -33,15 +33,16 @@
#include "src/core/ext/transport/chttp2/transport/varint.h"
#include <grpc/support/log.h>
#include <grpc/slice.h>
#include <grpc/support/log.h>
#include "test/core/util/test_config.h"
static void test_varint(uint32_t value, uint32_t prefix_bits, uint8_t prefix_or,
const char *expect_bytes, size_t expect_length) {
uint32_t nbytes = GRPC_CHTTP2_VARINT_LENGTH(value, prefix_bits);
grpc_slice expect = grpc_slice_from_copied_buffer(expect_bytes, expect_length);
grpc_slice expect =
grpc_slice_from_copied_buffer(expect_bytes, expect_length);
grpc_slice slice;
gpr_log(GPR_DEBUG, "Test: 0x%08x", value);
GPR_ASSERT(nbytes == expect_length);

@ -39,6 +39,7 @@
grpc_endpoint *grpc_mock_endpoint_create(void (*on_write)(grpc_slice slice),
grpc_resource_quota *resource_quota);
void grpc_mock_endpoint_put_read(grpc_exec_ctx *exec_ctx,
grpc_endpoint *mock_endpoint, grpc_slice slice);
grpc_endpoint *mock_endpoint,
grpc_slice slice);
#endif

@ -47,7 +47,8 @@ int main(int argc, char **argv) {
leak_check = false;
GPR_ASSERT(
GRPC_LOG_IF_ERROR("load_file", grpc_load_file(argv[1], 0, &buffer)));
LLVMFuzzerTestOneInput(GRPC_SLICE_START_PTR(buffer), GRPC_SLICE_LENGTH(buffer));
LLVMFuzzerTestOneInput(GRPC_SLICE_START_PTR(buffer),
GRPC_SLICE_LENGTH(buffer));
grpc_slice_unref(buffer);
return 0;
}

@ -456,7 +456,8 @@ static void perform_request(client_fixture *cf) {
int i;
memset(ops, 0, sizeof(ops));
grpc_slice request_payload_slice = grpc_slice_from_copied_string("hello world");
grpc_slice request_payload_slice =
grpc_slice_from_copied_string("hello world");
c = grpc_channel_create_call(cf->client, NULL, GRPC_PROPAGATE_DEFAULTS,
cf->cq, "/foo", "foo.test.google.fr:1234",

@ -41,8 +41,8 @@
#include <grpc++/generic/generic_stub.h>
#include <grpc++/support/byte_buffer.h>
#include <grpc/grpc.h>
#include <grpc/support/log.h>
#include <grpc/slice.h>
#include <grpc/support/log.h>
namespace grpc {
namespace testing {

Loading…
Cancel
Save