[glib: 2/8] Fix several signedness warnings in tests/threadpool-test.c
- From: Sebastian Dröge <sdroege src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 2/8] Fix several signedness warnings in tests/threadpool-test.c
- Date: Fri, 7 May 2021 06:49:28 +0000 (UTC)
commit 951105fae5fbfef9d37db67f2612bc4e61937298
Author: Emmanuel Fleury <emmanuel fleury gmail com>
Date: Fri Nov 20 22:59:12 2020 +0100
Fix several signedness warnings in tests/threadpool-test.c
tests/threadpool-test.c: In function ‘test_thread_sort’:
tests/threadpool-test.c:283:17: error: comparison of integer expressions of different signedness: ‘gint’
{aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
283 | for (i = 0; i < limit; i++) {
| ^
tests/threadpool-test.c:296:50: error: comparison of integer expressions of different signedness: ‘gint’
{aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
296 | g_assert (g_thread_pool_get_max_threads (pool) == max_threads);
| ^~
glib/gmacros.h:941:25: note: in definition of macro ‘G_LIKELY’
941 | #define G_LIKELY(expr) (expr)
| ^~~~
tests/threadpool-test.c:296:3: note: in expansion of macro ‘g_assert’
296 | g_assert (g_thread_pool_get_max_threads (pool) == max_threads);
| ^~~~~~~~
tests/threadpool-test.c:297:50: error: comparison of integer expressions of different signedness: ‘guint’
{aka ‘unsigned int’} and ‘gint’ {aka ‘int’}
297 | g_assert (g_thread_pool_get_num_threads (pool) == g_thread_pool_get_max_threads (pool));
| ^~
glib/gmacros.h:941:25: note: in definition of macro ‘G_LIKELY’
941 | #define G_LIKELY(expr) (expr)
| ^~~~
tests/threadpool-test.c:297:3: note: in expansion of macro ‘g_assert’
297 | g_assert (g_thread_pool_get_num_threads (pool) == g_thread_pool_get_max_threads (pool));
| ^~~~~~~~
tests/threadpool-test.c: In function ‘test_thread_idle_time’:
tests/threadpool-test.c:355:17: error: comparison of integer expressions of different signedness: ‘gint’
{aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
355 | for (i = 0; i < limit; i++) {
| ^
tests/threadpool-test.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/tests/threadpool-test.c b/tests/threadpool-test.c
index dfd138212..1612e274e 100644
--- a/tests/threadpool-test.c
+++ b/tests/threadpool-test.c
@@ -248,7 +248,7 @@ test_thread_sort (gboolean sort)
GThreadPool *pool;
guint limit;
guint max_threads;
- gint i;
+ guint i;
limit = MAX_THREADS * 10;
@@ -293,8 +293,8 @@ test_thread_sort (gboolean sort)
g_thread_pool_unprocessed (pool)));
}
- g_assert (g_thread_pool_get_max_threads (pool) == max_threads);
- g_assert (g_thread_pool_get_num_threads (pool) == g_thread_pool_get_max_threads (pool));
+ g_assert (g_thread_pool_get_max_threads (pool) == (gint) max_threads);
+ g_assert (g_thread_pool_get_num_threads (pool) == (guint) g_thread_pool_get_max_threads (pool));
g_thread_pool_free (pool, TRUE, TRUE);
}
@@ -337,7 +337,7 @@ test_thread_idle_time (void)
{
guint limit = 50;
guint interval = 10000;
- gint i;
+ guint i;
idle_pool = g_thread_pool_new (test_thread_idle_time_entry_func,
NULL,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]