diff options
| author | Junio C Hamano <gitster@pobox.com> | 2025-01-28 13:02:24 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-01-28 13:02:24 -0800 |
| commit | a17fd7dd3ada289df8e44e64ff52a5d886dfee95 (patch) | |
| tree | bbc7b3f5eb263b1f40490bf896f38430e7f40c09 /reftable/basics.c | |
| parent | 73e055d71ea39c54e78b6e9a28ea0d8e7999a5cb (diff) | |
| parent | 33319b0976ff9975e7509b6096887370146893f4 (diff) | |
| download | git-a17fd7dd3ada289df8e44e64ff52a5d886dfee95.tar.gz | |
Merge branch 'ps/reftable-sign-compare'
The reftable/ library code has been made -Wsign-compare clean.
* ps/reftable-sign-compare:
reftable: address trivial -Wsign-compare warnings
reftable/blocksource: adjust `read_block()` to return `ssize_t`
reftable/blocksource: adjust type of the block length
reftable/block: adjust type of the restart length
reftable/block: adapt header and footer size to return a `size_t`
reftable/basics: adjust `hash_size()` to return `uint32_t`
reftable/basics: adjust `common_prefix_size()` to return `size_t`
reftable/record: handle overflows when decoding varints
reftable/record: drop unused `print` function pointer
meson: stop disabling -Wsign-compare
Diffstat (limited to 'reftable/basics.c')
| -rw-r--r-- | reftable/basics.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/reftable/basics.c b/reftable/basics.c index fe2b83ff83..3b5ea27bbd 100644 --- a/reftable/basics.c +++ b/reftable/basics.c @@ -263,18 +263,16 @@ int names_equal(const char **a, const char **b) return a[i] == b[i]; } -int common_prefix_size(struct reftable_buf *a, struct reftable_buf *b) +size_t common_prefix_size(struct reftable_buf *a, struct reftable_buf *b) { - int p = 0; - for (; p < a->len && p < b->len; p++) { + size_t p = 0; + for (; p < a->len && p < b->len; p++) if (a->buf[p] != b->buf[p]) break; - } - return p; } -int hash_size(enum reftable_hash id) +uint32_t hash_size(enum reftable_hash id) { if (!id) return REFTABLE_HASH_SIZE_SHA1; |
