Skip to content
Snippets Groups Projects
Commit 00b35e71 authored by jiangtaoli2016's avatar jiangtaoli2016
Browse files

Make tsi handshaker result unused bytes const

parent d885d241
No related branches found
No related tags found
No related merge requests found
...@@ -147,7 +147,7 @@ static void on_peer_checked(grpc_exec_ctx *exec_ctx, void *arg, ...@@ -147,7 +147,7 @@ static void on_peer_checked(grpc_exec_ctx *exec_ctx, void *arg,
goto done; goto done;
} }
// Get unused bytes. // Get unused bytes.
unsigned char *unused_bytes = NULL; const unsigned char *unused_bytes = NULL;
size_t unused_bytes_size = 0; size_t unused_bytes_size = 0;
result = tsi_handshaker_result_get_unused_bytes( result = tsi_handshaker_result_get_unused_bytes(
h->handshaker_result, &unused_bytes, &unused_bytes_size); h->handshaker_result, &unused_bytes, &unused_bytes_size);
......
...@@ -391,7 +391,7 @@ static tsi_result fake_handshaker_result_create_frame_protector( ...@@ -391,7 +391,7 @@ static tsi_result fake_handshaker_result_create_frame_protector(
} }
static tsi_result fake_handshaker_result_get_unused_bytes( static tsi_result fake_handshaker_result_get_unused_bytes(
const tsi_handshaker_result *self, unsigned char **bytes, const tsi_handshaker_result *self, const unsigned char **bytes,
size_t *bytes_size) { size_t *bytes_size) {
fake_handshaker_result *result = (fake_handshaker_result *)self; fake_handshaker_result *result = (fake_handshaker_result *)self;
*bytes_size = result->unused_bytes_size; *bytes_size = result->unused_bytes_size;
......
...@@ -240,7 +240,7 @@ tsi_result tsi_handshaker_result_create_frame_protector( ...@@ -240,7 +240,7 @@ tsi_result tsi_handshaker_result_create_frame_protector(
} }
tsi_result tsi_handshaker_result_get_unused_bytes( tsi_result tsi_handshaker_result_get_unused_bytes(
const tsi_handshaker_result *self, unsigned char **bytes, const tsi_handshaker_result *self, const unsigned char **bytes,
size_t *bytes_size) { size_t *bytes_size) {
if (self == NULL || bytes == NULL || bytes_size == NULL) { if (self == NULL || bytes == NULL || bytes_size == NULL) {
return TSI_INVALID_ARGUMENT; return TSI_INVALID_ARGUMENT;
......
...@@ -90,7 +90,8 @@ typedef struct { ...@@ -90,7 +90,8 @@ typedef struct {
size_t *max_output_protected_frame_size, size_t *max_output_protected_frame_size,
tsi_frame_protector **protector); tsi_frame_protector **protector);
tsi_result (*get_unused_bytes)(const tsi_handshaker_result *self, tsi_result (*get_unused_bytes)(const tsi_handshaker_result *self,
unsigned char **bytes, size_t *bytes_size); const unsigned char **bytes,
size_t *bytes_size);
void (*destroy)(tsi_handshaker_result *self); void (*destroy)(tsi_handshaker_result *self);
} tsi_handshaker_result_vtable; } tsi_handshaker_result_vtable;
......
...@@ -50,7 +50,7 @@ static tsi_result adapter_result_create_frame_protector( ...@@ -50,7 +50,7 @@ static tsi_result adapter_result_create_frame_protector(
} }
static tsi_result adapter_result_get_unused_bytes( static tsi_result adapter_result_get_unused_bytes(
const tsi_handshaker_result *self, unsigned char **bytes, const tsi_handshaker_result *self, const unsigned char **bytes,
size_t *byte_size) { size_t *byte_size) {
tsi_adapter_handshaker_result *impl = (tsi_adapter_handshaker_result *)self; tsi_adapter_handshaker_result *impl = (tsi_adapter_handshaker_result *)self;
*bytes = impl->unused_bytes; *bytes = impl->unused_bytes;
......
...@@ -221,7 +221,7 @@ tsi_result tsi_handshaker_result_create_frame_protector( ...@@ -221,7 +221,7 @@ tsi_result tsi_handshaker_result_create_frame_protector(
Ownership of the bytes is retained by the handshaker result. As a Ownership of the bytes is retained by the handshaker result. As a
consequence, the caller must not free the bytes. */ consequence, the caller must not free the bytes. */
tsi_result tsi_handshaker_result_get_unused_bytes( tsi_result tsi_handshaker_result_get_unused_bytes(
const tsi_handshaker_result *self, unsigned char **bytes, const tsi_handshaker_result *self, const unsigned char **bytes,
size_t *byte_size); size_t *byte_size);
/* This method releases the tsi_handshaker_handshaker object. After this method /* This method releases the tsi_handshaker_handshaker object. After this method
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment