[Newcomer PATCH] log-tree.c: Supress Wsign-compare-warning
- From
- fernando gouveia lima fernandolimabusiness@gmail.com <fernando gouveia lima fernandolimabusiness@gmail.com>
- Date
- May 21, 2025, 20:24 UTC
- Message-ID
- <20250521202409.26879-1-fernandolimabusiness@gmail.com>
From: Fernando Gouveia Lima <fernandolimabusiness@gmail.com>
Two comparisions between int and size_t, and int and unsigned long int cause warning sign compare to fire.
Avoid this by changing the type of variable "i" in add_ref_decoration() to unsigned long int and casting the variable "filename->len" to int in fmt_output_subject().
Signed-off-by: Fernando Gouveia Lima <fernandolimabusiness@gmail.com> --- This is my first contribution and i got this idea on the Microproject page. I hope this is the first of many contributions to the git community :).
log-tree.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/log-tree.c b/log-tree.c index 1d05dc1c70..e0848fcccc 100644 --- a/log-tree.c +++ b/log-tree.c @@ -151,7 +151,7 @@ static int add_ref_decoration(const char *refname, const char *referent UNUSED, int flags UNUSED, void *cb_data) { - int i; + long unsigned int i; struct object *obj; enum object_type objtype; enum decoration_type deco_type = DECORATION_NONE; @@ -458,7 +458,7 @@ void fmt_output_subject(struct strbuf *filename, } strbuf_addf(filename, "%04d-%s", nr, subject); - if (max_len < filename->len) + if (max_len < (int) filename->len) strbuf_setlen(filename, max_len); strbuf_addstr(filename, suffix); }
-- 2.34.1