Skip to content

Commit

Permalink
Add missing casts
Browse files Browse the repository at this point in the history
  • Loading branch information
srdja committed Feb 1, 2024
1 parent 7afc5cc commit 6e49989
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/cc_array.c
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,7 @@ static enum cc_stat expand_capacity(CC_Array *ar)
if (ar->capacity == CC_MAX_ELEMENTS)
return CC_ERR_MAX_CAPACITY;

size_t new_capacity = ar->capacity * ar->exp_factor;
size_t new_capacity = (size_t)(ar->capacity * ar->exp_factor);

/* As long as the capacity is greater that the expansion factor
* at the point of overflow, this is check is valid. */
Expand Down
4 changes: 2 additions & 2 deletions src/cc_hashtable.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ enum cc_stat cc_hashtable_new_conf(CC_HashTableConf const * const conf, CC_HashT
table->mem_alloc = conf->mem_alloc;
table->mem_calloc = conf->mem_calloc;
table->mem_free = conf->mem_free;
table->threshold = table->capacity * table->load_factor;
table->threshold = (size_t) (table->capacity * table->load_factor);

*out = table;
return CC_OK;
Expand Down Expand Up @@ -428,7 +428,7 @@ static enum cc_stat resize(CC_HashTable *t, size_t new_capacity)

t->buckets = new_buckets;
t->capacity = new_capacity;
t->threshold = t->load_factor * new_capacity;
t->threshold = (size_t) (t->load_factor * new_capacity);

t->mem_free(old_buckets);

Expand Down
2 changes: 1 addition & 1 deletion src/cc_pqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ static enum cc_stat expand_capacity(CC_PQueue *pq)
if (pq->capacity == CC_MAX_ELEMENTS)
return CC_ERR_MAX_CAPACITY;

size_t new_capacity = pq->capacity * pq->exp_factor;
size_t new_capacity = (size_t)(pq->capacity * pq->exp_factor);

/* As long as the capacity is greater that the expansion factor
* at the point of overflow, this is check is valid. */
Expand Down

0 comments on commit 6e49989

Please sign in to comment.