[PATCH 00/10] reftable: fix -Wsign-compare warnings
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Jan 16, 2025, 10:08 UTC
- Message-ID
- <20250116-b4-pks-reftable-sign-compare-v1-0-bd30e2ee96e7@pks.im>
Hi,
during the last steps of converting the reftable codebase to become a standalone library I noticed that the new -Wsign-compare warnings created a bit of a problem due to the `DISABLE_SIGN_COMPARE_WARNINGS` macro that we started using. As a consequence I wasn't able to easily drop "git-compat-util.h" anymore. This patch series is thus addresses the issue by fixing all sign comparison warnings in the reftable library.
Thanks!
Patrick
---
Patrick Steinhardt (10):
meson: stop disabling -Wsign-compare
reftable/record: drop unused `print` function pointer
reftable/record: handle overflows when decoding varints
reftable/basics: adjust `common_prefix_size()` to return `size_t`
reftable/basics: adjust `hash_size()` to return `uint32_t`
reftable/block: adapt header and footer size to return a `size_t`
reftable/block: adjust type of the restart length
reftable/blocksource: adjust type of the block length
reftable/blocksource: adjust `read_block()` to return `ssize_t`
reftable: address trivial -Wsign-compare warningsmeson.build | 1 - reftable/basics.c | 10 ++-- reftable/basics.h | 4 +- reftable/block.c | 20 +++---- reftable/block.h | 14 ++--- reftable/blocksource.c | 8 +-- reftable/reader.c | 32 +++++----- reftable/reader.h | 6 +- reftable/record.c | 116 ++++++++++++++++-------------------- reftable/record.h | 23 +++---- reftable/reftable-blocksource.h | 13 ++-- reftable/reftable-record.h | 4 +- reftable/reftable-writer.h | 2 +- reftable/stack.c | 12 ++-- reftable/system.h | 2 - reftable/writer.c | 7 +-- t/unit-tests/t-reftable-basics.c | 2 +- t/unit-tests/t-reftable-readwrite.c | 2 +- t/unit-tests/t-reftable-record.c | 19 +++++- 19 files changed, 148 insertions(+), 149 deletions(-)
--- base-commit: 757161efcca150a9a96b312d9e780a071e601a03 change-id: 20250116-b4-pks-reftable-sign-compare-8eaabae74c06