Skip to content

Commit

Permalink
MONGOCRYPT-750 change mc_#Token_new_from_buffer{_copy} arguments to c…
Browse files Browse the repository at this point in the history
…onst (#917)

* change function arguments to const

* fix formatting error

* fix another formatting error
  • Loading branch information
joshbsiegel authored Nov 27, 2024
1 parent 6910440 commit 498a31a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/mc-tokens-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@
/* Destructor */ \
extern void BSON_CONCAT(Prefix, _destroy)(T * t); \
/* Constructor for server to shallow copy tokens from raw buffer */ \
extern T *BSON_CONCAT(Prefix, _new_from_buffer)(_mongocrypt_buffer_t * buf); \
extern T *BSON_CONCAT(Prefix, _new_from_buffer)(const _mongocrypt_buffer_t *buf); \
/* Constructor for server to deep copy tokens from raw buffer */ \
extern T *BSON_CONCAT(Prefix, _new_from_buffer_copy)(_mongocrypt_buffer_t * buf); \
extern T *BSON_CONCAT(Prefix, _new_from_buffer_copy)(const _mongocrypt_buffer_t *buf); \
/* Constructor. Parameter list given as variadic args */ \
extern T *BSON_CONCAT(Prefix, _new)(_mongocrypt_crypto_t * crypto, __VA_ARGS__, mongocrypt_status_t * status)

Expand Down
4 changes: 2 additions & 2 deletions src/mc-tokens.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@
bson_free(self); \
} \
/* Constructor. Shallow copy from raw buffer */ \
T *BSON_CONCAT(Prefix, _new_from_buffer)(_mongocrypt_buffer_t * buf) { \
T *BSON_CONCAT(Prefix, _new_from_buffer)(const _mongocrypt_buffer_t *buf) { \
BSON_ASSERT(buf->len == MONGOCRYPT_HMAC_SHA256_LEN); \
T *t = bson_malloc(sizeof(T)); \
_mongocrypt_buffer_set_to(buf, &t->data); \
return t; \
} \
/* Constructor. Deep copy from raw buffer */ \
T *BSON_CONCAT(Prefix, _new_from_buffer_copy)(_mongocrypt_buffer_t * buf) { \
T *BSON_CONCAT(Prefix, _new_from_buffer_copy)(const _mongocrypt_buffer_t *buf) { \
BSON_ASSERT(buf->len == MONGOCRYPT_HMAC_SHA256_LEN); \
T *t = bson_malloc(sizeof(T)); \
_mongocrypt_buffer_init(&t->data); \
Expand Down

0 comments on commit 498a31a

Please sign in to comment.