From 9e15e076c1f3e647b1f7ed7e3c12a1f23fdbe98c Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Wed, 4 Nov 2020 12:04:55 -0500 Subject: Enable -Wsign-compare to catch bugs like 726d7801 --- eval.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'eval.c') diff --git a/eval.c b/eval.c index 09c253f..a6282bf 100644 --- a/eval.c +++ b/eval.c @@ -794,7 +794,7 @@ bool eval_regex(const struct expr *expr, struct eval_state *state) { #endif int err = regexec(expr->regex, path, 1, &match, flags); if (err == 0) { - return match.rm_so == 0 && match.rm_eo == len; + return match.rm_so == 0 && (size_t)match.rm_eo == len; } else if (err != REG_NOMATCH) { char *str = xregerror(err, expr->regex); if (str) { @@ -1300,7 +1300,7 @@ static enum bftw_action eval_callback(const struct BFTW *ftwbuf, void *ptr) { goto done; } - if (ctx->maxdepth < 0 || ftwbuf->depth >= ctx->maxdepth) { + if (ctx->maxdepth < 0 || ftwbuf->depth >= (size_t)ctx->maxdepth) { state.action = BFTW_PRUNE; } @@ -1308,13 +1308,13 @@ static enum bftw_action eval_callback(const struct BFTW *ftwbuf, void *ptr) { enum bftw_visit expected_visit = BFTW_PRE; if ((ctx->flags & BFTW_POST_ORDER) && (ctx->strategy == BFTW_IDS || ftwbuf->type == BFTW_DIR) - && ftwbuf->depth < ctx->maxdepth) { + && ftwbuf->depth < (size_t)ctx->maxdepth) { expected_visit = BFTW_POST; } if (ftwbuf->visit == expected_visit - && ftwbuf->depth >= ctx->mindepth - && ftwbuf->depth <= ctx->maxdepth) { + && ftwbuf->depth >= (size_t)ctx->mindepth + && ftwbuf->depth <= (size_t)ctx->maxdepth) { eval_expr(ctx->expr, &state); } -- cgit v1.2.3