From: Zejun Zhao Date: Sun, 16 Feb 2025 07:28:40 GMT Subject: [PATCH v3 3/6] apply: do a typecast to eliminate warnings Message-ID: <20250216072843.72385-4-jelly.zhao.42@gmail.com> In-Reply-To: <20250216072843.72385-1-jelly.zhao.42@gmail.com> `git_hdr_len` is an `int` variable that can be negative and is used to compare against a `len` of `size_t`, which will trigger -Wsign-comparison warnings Cast `git_hdr_len` to `size_t` after an above-zero check. Signed-off-by: Zejun Zhao --- apply.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apply.c b/apply.c index 4aa47a22b9..ac3e599bdf 100644 --- a/apply.c +++ b/apply.c @@ -1592,7 +1592,7 @@ static int find_header(struct apply_state *state, size, patch); if (git_hdr_len < 0) return -128; - if (git_hdr_len <= len) + if ((size_t) git_hdr_len <= len) continue; *hdrsize = git_hdr_len; return offset; -- 2.43.0