Fix warnings related to undefined defines and implicit casts
This commit is contained in:
14
.gitignore
vendored
14
.gitignore
vendored
@@ -77,3 +77,17 @@ x64/
|
|||||||
|
|
||||||
# Coverage
|
# Coverage
|
||||||
[Cc]overage
|
[Cc]overage
|
||||||
|
|
||||||
|
# Visual studio user-specific files
|
||||||
|
*.rsuser
|
||||||
|
*.suo
|
||||||
|
*.user
|
||||||
|
*.userosscache
|
||||||
|
*.sln.docstates
|
||||||
|
|
||||||
|
# Visual Studio 2015/2017 cache/options directory
|
||||||
|
.vs/
|
||||||
|
|
||||||
|
# Visual Studio CMake
|
||||||
|
out
|
||||||
|
CMakeSettings.json
|
||||||
@@ -12,7 +12,7 @@ typedef float bh_float32_t;
|
|||||||
typedef double bh_float64_t;
|
typedef double bh_float64_t;
|
||||||
|
|
||||||
/* Platform specific type definition */
|
/* Platform specific type definition */
|
||||||
#if __STDC_VERSION__ >= 199901L || defined(__GNUC__)
|
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__)
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
typedef int32_t bh_int32_t;
|
typedef int32_t bh_int32_t;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include <bh/internal/buffer.h>
|
#include <bh/internal/buffer.h>
|
||||||
|
#include <bh/internal/io.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ int bh_hashmap_reserve(bh_hashmap_t *hashmap,
|
|||||||
|
|
||||||
/* Calculate hashmap max capacity and capacity threshold */
|
/* Calculate hashmap max capacity and capacity threshold */
|
||||||
capacity = hashmap->capacity;
|
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);
|
max_capacity = ((size_t)-1) / sizeof(bh_hashmap_node_t);
|
||||||
|
|
||||||
/* New capacity can't be smaller then current hashmap size */
|
/* 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)
|
while (size > threshold)
|
||||||
{
|
{
|
||||||
capacity = (capacity) ? (capacity * 2) : (16);
|
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 */
|
/* Capacity can't be bigger than max capacity and overflow */
|
||||||
if (capacity > max_capacity || capacity < 16)
|
if (capacity > max_capacity || capacity < 16)
|
||||||
@@ -145,7 +145,7 @@ int bh_hashmap_reserve(bh_hashmap_t *hashmap,
|
|||||||
while (size <= threshold / 2 && capacity > 16)
|
while (size <= threshold / 2 && capacity > 16)
|
||||||
{
|
{
|
||||||
capacity /= 2;
|
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 */
|
/* Calculate new threshold value */
|
||||||
hashmap->factor = factor;
|
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,
|
int bh_thread_pool_add(bh_thread_pool_t *pool,
|
||||||
bh_task_t *task)
|
bh_task_t *task)
|
||||||
{
|
{
|
||||||
void *iter;
|
|
||||||
bh_task_t *item;
|
|
||||||
|
|
||||||
/* Queue task for execution */
|
/* Queue task for execution */
|
||||||
bh_mutex_lock(&pool->lock);
|
bh_mutex_lock(&pool->lock);
|
||||||
if (bh_queue_insert(&pool->tasks, task))
|
if (bh_queue_insert(&pool->tasks, task))
|
||||||
|
|||||||
Reference in New Issue
Block a user