Use pointer instead of reference parameter

pull/21505/head
Ashitha Santhosh 5 years ago
parent ef8be0ffb7
commit ec4bfdfa57
  1. 4
      src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc
  2. 2
      src/core/tsi/transport_security_grpc.cc
  3. 4
      src/core/tsi/transport_security_grpc.h
  4. 4
      test/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector_test.cc

@ -234,11 +234,11 @@ static void alts_zero_copy_grpc_protector_destroy(
}
static tsi_result alts_zero_copy_grpc_protector_max_frame_size(
tsi_zero_copy_grpc_protector* self, size_t& max_frame_size) {
tsi_zero_copy_grpc_protector* self, size_t* max_frame_size) {
if (self == nullptr) return TSI_INVALID_ARGUMENT;
alts_zero_copy_grpc_protector* protector =
reinterpret_cast<alts_zero_copy_grpc_protector*>(self);
max_frame_size = protector->max_protected_frame_size;
*max_frame_size = protector->max_protected_frame_size;
return TSI_OK;
}

@ -66,7 +66,7 @@ void tsi_zero_copy_grpc_protector_destroy(tsi_zero_copy_grpc_protector* self) {
}
tsi_result tsi_zero_copy_grpc_protector_max_frame_size(
tsi_zero_copy_grpc_protector* self, size_t& max_frame_size) {
tsi_zero_copy_grpc_protector* self, size_t* max_frame_size) {
if (self == nullptr) return TSI_INVALID_ARGUMENT;
if (self->vtable->max_frame_size == nullptr) return TSI_UNIMPLEMENTED;
return self->vtable->max_frame_size(self, max_frame_size);

@ -58,7 +58,7 @@ void tsi_zero_copy_grpc_protector_destroy(tsi_zero_copy_grpc_protector* self);
/* Returns value of max protected frame size. Useful for testing. */
tsi_result tsi_zero_copy_grpc_protector_max_frame_size(
tsi_zero_copy_grpc_protector* self, size_t& max_frame_size);
tsi_zero_copy_grpc_protector* self, size_t* max_frame_size);
/* Base for tsi_zero_copy_grpc_protector implementations. */
typedef struct {
@ -70,7 +70,7 @@ typedef struct {
grpc_slice_buffer* unprotected_slices);
void (*destroy)(tsi_zero_copy_grpc_protector* self);
tsi_result (*max_frame_size)(tsi_zero_copy_grpc_protector* self,
size_t& max_frame_size);
size_t* max_frame_size);
} tsi_zero_copy_grpc_protector_vtable;
struct tsi_zero_copy_grpc_protector {

@ -116,14 +116,14 @@ alts_zero_copy_grpc_protector_test_fixture_create(bool rekey,
enable_extra_copy, &max_protected_frame_size,
&fixture->client) == TSI_OK);
GPR_ASSERT(tsi_zero_copy_grpc_protector_max_frame_size(
fixture->client, actual_max_protected_frame_size) == TSI_OK);
fixture->client, &actual_max_protected_frame_size) == TSI_OK);
GPR_ASSERT(actual_max_protected_frame_size == max_protected_frame_size);
GPR_ASSERT(alts_zero_copy_grpc_protector_create(
key, key_length, rekey, /*is_client=*/false, integrity_only,
enable_extra_copy, &max_protected_frame_size,
&fixture->server) == TSI_OK);
GPR_ASSERT(tsi_zero_copy_grpc_protector_max_frame_size(
fixture->server, actual_max_protected_frame_size) == TSI_OK);
fixture->server, &actual_max_protected_frame_size) == TSI_OK);
GPR_ASSERT(actual_max_protected_frame_size == max_protected_frame_size);
gpr_free(key);
grpc_core::ExecCtx::Get()->Flush();

Loading…
Cancel
Save