Fix warnings related to undefined defines and implicit casts
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include <bh/internal/buffer.h>
|
||||
#include <bh/internal/io.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ int bh_hashmap_reserve(bh_hashmap_t *hashmap,
|
||||
|
||||
/* Calculate hashmap max capacity and capacity threshold */
|
||||
capacity = hashmap->capacity;
|
||||
threshold = hashmap->capacity * hashmap->factor;
|
||||
threshold = (size_t)(hashmap->capacity * hashmap->factor);
|
||||
max_capacity = ((size_t)-1) / sizeof(bh_hashmap_node_t);
|
||||
|
||||
/* New capacity can't be smaller then current hashmap size */
|
||||
@@ -132,7 +132,7 @@ int bh_hashmap_reserve(bh_hashmap_t *hashmap,
|
||||
while (size > threshold)
|
||||
{
|
||||
capacity = (capacity) ? (capacity * 2) : (16);
|
||||
threshold = capacity * hashmap->factor;
|
||||
threshold = (size_t)(capacity * hashmap->factor);
|
||||
|
||||
/* Capacity can't be bigger than max capacity and overflow */
|
||||
if (capacity > max_capacity || capacity < 16)
|
||||
@@ -145,7 +145,7 @@ int bh_hashmap_reserve(bh_hashmap_t *hashmap,
|
||||
while (size <= threshold / 2 && capacity > 16)
|
||||
{
|
||||
capacity /= 2;
|
||||
threshold = capacity * hashmap->factor;
|
||||
threshold = (size_t)(capacity * hashmap->factor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -380,7 +380,7 @@ void bh_hashmap_set_factor(bh_hashmap_t *hashmap,
|
||||
|
||||
/* Calculate new threshold value */
|
||||
hashmap->factor = factor;
|
||||
hashmap->threshold = hashmap->capacity * factor;
|
||||
hashmap->threshold = (size_t)(hashmap->capacity * factor);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -220,9 +220,6 @@ void bh_cond_free(bh_cond_t *cond)
|
||||
int bh_thread_pool_add(bh_thread_pool_t *pool,
|
||||
bh_task_t *task)
|
||||
{
|
||||
void *iter;
|
||||
bh_task_t *item;
|
||||
|
||||
/* Queue task for execution */
|
||||
bh_mutex_lock(&pool->lock);
|
||||
if (bh_queue_insert(&pool->tasks, task))
|
||||
|
||||
Reference in New Issue
Block a user