Skip to content

Commit

Permalink
warnings cleanup: Wsign-compare: array: int32_t -> size_t
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
  • Loading branch information
jnpkrn committed Dec 20, 2017
1 parent df3e266 commit fe7a401
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/array.c
Expand Up @@ -57,9 +57,9 @@ qb_array_create(size_t max_elements, size_t element_size)
}

static int32_t
_grow_bin_array(struct qb_array * a, int32_t new_bin_size)
_grow_bin_array(struct qb_array * a, size_t new_bin_size)
{
int32_t b;
size_t b;

a->bin = realloc(a->bin, sizeof(void*) * new_bin_size);
if (a->bin == NULL) {
Expand All @@ -78,7 +78,7 @@ qb_array_create_2(size_t max_elements, size_t element_size,
size_t autogrow_elements)
{
struct qb_array *a = NULL;
int32_t b;
size_t b;

if (max_elements > QB_ARRAY_MAX_ELEMENTS) {
errno = -EINVAL;
Expand Down Expand Up @@ -112,7 +112,7 @@ qb_array_create_2(size_t max_elements, size_t element_size,
int32_t
qb_array_index(struct qb_array * a, int32_t idx, void **element_out)
{
int32_t b;
size_t b;
int32_t elem;
char *bin;
int32_t rc = 0;
Expand All @@ -123,7 +123,7 @@ qb_array_index(struct qb_array * a, int32_t idx, void **element_out)
if (idx < 0) {
return -ERANGE;
}
if (idx >= a->max_elements) {
if ((uint32_t) idx >= a->max_elements) {
if (a->autogrow_elements == 0) {
return -ERANGE;
} else {
Expand All @@ -133,7 +133,7 @@ qb_array_index(struct qb_array * a, int32_t idx, void **element_out)
}
}
}
b = BIN_NUM_GET(idx);
b = BIN_NUM_GET((uint32_t) idx);
assert(b < MAX_BINS);

if (b >= a->num_bins || a->bin[b] == NULL) {
Expand Down Expand Up @@ -207,7 +207,7 @@ qb_array_elems_per_bin_get(struct qb_array * a)
int32_t
qb_array_grow(struct qb_array * a, size_t max_elements)
{
int32_t b;
size_t b;
int32_t rc = 0;

if (a == NULL || max_elements > QB_ARRAY_MAX_ELEMENTS) {
Expand All @@ -231,7 +231,7 @@ qb_array_grow(struct qb_array * a, size_t max_elements)
void
qb_array_free(struct qb_array *a)
{
int32_t i;
size_t i;
for (i = 0; i < a->num_bins; i++) {
free(a->bin[i]);
}
Expand Down

0 comments on commit fe7a401

Please sign in to comment.