Skip to content

Commit

Permalink
util/stringops: constify hexdigest()
Browse files Browse the repository at this point in the history
  • Loading branch information
Akaricchi committed Aug 30, 2024
1 parent 7e5a7fa commit c73aa60
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/util/stringops.c
Original file line number Diff line number Diff line change
Expand Up @@ -364,11 +364,11 @@ void format_huge_num(uint digits, uint64_t num, size_t bufsize, char buf[bufsize
assert(p == buf + len - 1);
}

void hexdigest(uint8_t *input, size_t input_size, char *output, size_t output_size) {
void hexdigest(const uint8_t *input, size_t input_size, char *output, size_t output_size) {
assert(output_size > input_size * 2);

static char charmap[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
uint8_t *end = input + input_size;
const uint8_t *end = input + input_size;

while(input < end) {
uint8_t byte = *input++;
Expand Down
2 changes: 1 addition & 1 deletion src/util/stringops.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ char* ucs4_to_utf8_alloc(const uint32_t *ucs4) attr_nonnull(1) attr_returns_allo
uint32_t utf8_getch(const char **src) attr_nonnull(1);

void format_huge_num(uint digits, uint64_t num, size_t bufsize, char buf[bufsize]);
void hexdigest(uint8_t *input, size_t input_size, char *output, size_t output_size);
void hexdigest(const uint8_t *input, size_t input_size, char *output, size_t output_size);

#define FILENAME_TIMESTAMP_MIN_BUF_SIZE 23
size_t filename_timestamp(char *buf, size_t buf_size, const SystemTime time) attr_nonnull(1);
Expand Down

0 comments on commit c73aa60

Please sign in to comment.