aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore14
-rw-r--r--include/bh/platform.h2
-rw-r--r--src/buffer.c1
-rw-r--r--src/hashmap.c8
-rw-r--r--src/thread.c3
5 files changed, 20 insertions, 8 deletions
diff --git a/.gitignore b/.gitignore
index 04ee206..ca53ee5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -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 \ No newline at end of file
diff --git a/include/bh/platform.h b/include/bh/platform.h
index 59d9051..f80efda 100644
--- a/include/bh/platform.h
+++ b/include/bh/platform.h
@@ -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;
diff --git a/src/buffer.c b/src/buffer.c
index 71e2ee9..3e5c062 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1,4 +1,5 @@
#include <bh/internal/buffer.h>
+#include <bh/internal/io.h>
#include <stdlib.h>
#include <string.h>
diff --git a/src/hashmap.c b/src/hashmap.c
index 256644a..fb708a1 100644
--- a/src/hashmap.c
+++ b/src/hashmap.c
@@ -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);
}
/**
diff --git a/src/thread.c b/src/thread.c
index 2744387..c3e536c 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -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))