diff options
author | Sebastian Bauer <mail@sebastianbauer.info> | 2013-01-11 10:25:51 +0100 |
---|---|---|
committer | Sebastian Bauer <mail@sebastianbauer.info> | 2013-01-11 11:03:48 +0100 |
commit | d2f14df8c16a5660241f2e79cf2c6142aa3704ca (patch) | |
tree | ee8bd4185248980047bf2d5d9a806fc124c5e763 /deps | |
parent | 3a5e8faee7f4e5ede2f938d8975261cc84e27383 (diff) | |
download | libgit2-d2f14df8c16a5660241f2e79cf2c6142aa3704ca.tar.gz |
regex: Fixed several warnings about signed/unsigned conversions.
Diffstat (limited to 'deps')
-rw-r--r-- | deps/regex/regcomp.c | 5 | ||||
-rw-r--r-- | deps/regex/regex_internal.h | 5 | ||||
-rw-r--r-- | deps/regex/regexec.c | 10 |
3 files changed, 11 insertions, 9 deletions
diff --git a/deps/regex/regcomp.c b/deps/regex/regcomp.c index 7373fbc22..b18ca8f3e 100644 --- a/deps/regex/regcomp.c +++ b/deps/regex/regcomp.c @@ -1140,7 +1140,7 @@ analyze (regex_t *preg) dfa->subexp_map[i] = i; preorder (dfa->str_tree, optimize_subexps, dfa); for (i = 0; i < preg->re_nsub; i++) - if (dfa->subexp_map[i] != i) + if (dfa->subexp_map[i] != (int)i) break; if (i == preg->re_nsub) { @@ -1609,7 +1609,8 @@ calc_inveclosure (re_dfa_t *dfa) static reg_errcode_t calc_eclosure (re_dfa_t *dfa) { - int node_idx, incomplete; + size_t node_idx; + int incomplete; #ifdef DEBUG assert (dfa->nodes_len > 0); #endif diff --git a/deps/regex/regex_internal.h b/deps/regex/regex_internal.h index 9eca671dc..f76011131 100644 --- a/deps/regex/regex_internal.h +++ b/deps/regex/regex_internal.h @@ -171,8 +171,9 @@ extern const size_t __re_error_msgid_idx[] attribute_hidden; typedef unsigned long int bitset_word_t; /* All bits set in a bitset_word_t. */ #define BITSET_WORD_MAX ULONG_MAX -/* Number of bits in a bitset_word_t. */ -#define BITSET_WORD_BITS (sizeof (bitset_word_t) * CHAR_BIT) +/* Number of bits in a bitset_word_t. Cast to int as most code use it + * like that for counting */ +#define BITSET_WORD_BITS ((int)(sizeof (bitset_word_t) * CHAR_BIT)) /* Number of bitset_word_t in a bit_set. */ #define BITSET_WORDS (SBC_MAX / BITSET_WORD_BITS) typedef bitset_word_t bitset_t[BITSET_WORDS]; diff --git a/deps/regex/regexec.c b/deps/regex/regexec.c index 5eb6f1fea..0a1602e5a 100644 --- a/deps/regex/regexec.c +++ b/deps/regex/regexec.c @@ -689,7 +689,7 @@ re_search_internal (const regex_t *preg, if (nmatch > 1 || dfa->has_mb_node) { /* Avoid overflow. */ - if (BE (SIZE_MAX / sizeof (re_dfastate_t *) <= mctx.input.bufs_len, 0)) + if (BE (SIZE_MAX / sizeof (re_dfastate_t *) <= (size_t)mctx.input.bufs_len, 0)) { err = REG_ESPACE; goto free_return; @@ -920,7 +920,7 @@ re_search_internal (const regex_t *preg, if (dfa->subexp_map) for (reg_idx = 0; reg_idx + 1 < nmatch; reg_idx++) - if (dfa->subexp_map[reg_idx] != reg_idx) + if (dfa->subexp_map[reg_idx] != (int)reg_idx) { pmatch[reg_idx + 1].rm_so = pmatch[dfa->subexp_map[reg_idx] + 1].rm_so; @@ -953,7 +953,7 @@ prune_impossible_nodes (re_match_context_t *mctx) halt_node = mctx->last_node; /* Avoid overflow. */ - if (BE (SIZE_MAX / sizeof (re_dfastate_t *) <= match_last, 0)) + if (BE (SIZE_MAX / sizeof (re_dfastate_t *) <= (size_t)match_last, 0)) return REG_ESPACE; sifted_states = re_malloc (re_dfastate_t *, match_last + 1); @@ -3375,7 +3375,7 @@ build_trtable (const re_dfa_t *dfa, re_dfastate_t *state) /* Avoid arithmetic overflow in size calculation. */ if (BE ((((SIZE_MAX - (sizeof (re_node_set) + sizeof (bitset_t)) * SBC_MAX) / (3 * sizeof (re_dfastate_t *))) - < ndests), + < (size_t)ndests), 0)) goto out_free; @@ -4099,7 +4099,7 @@ extend_buffers (re_match_context_t *mctx) re_string_t *pstr = &mctx->input; /* Avoid overflow. */ - if (BE (INT_MAX / 2 / sizeof (re_dfastate_t *) <= pstr->bufs_len, 0)) + if (BE (INT_MAX / 2 / sizeof (re_dfastate_t *) <= (size_t)pstr->bufs_len, 0)) return REG_ESPACE; /* Double the lengthes of the buffers. */ |