Fix warnings related to undefined defines and implicit casts

This commit is contained in:
2024-06-08 12:26:20 +03:00
parent fd39ee8692
commit 54c33ec67a
5 changed files with 20 additions and 8 deletions

14
.gitignore vendored
View File

@@ -77,3 +77,17 @@ x64/
# Coverage
[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

View File

@@ -12,7 +12,7 @@ typedef float bh_float32_t;
typedef double bh_float64_t;
/* Platform specific type definition */
#if __STDC_VERSION__ >= 199901L || defined(__GNUC__)
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__)
#include <stdint.h>
typedef int32_t bh_int32_t;

View File

@@ -1,4 +1,5 @@
#include <bh/internal/buffer.h>
#include <bh/internal/io.h>
#include <stdlib.h>
#include <string.h>

View File

@@ -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);
}
/**

View File

@@ -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))