glib/tests/shell.c: In function ‘main’:
glib/tests/shell.c:194:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’
194 | for (i = 0; i < G_N_ELEMENTS (cmdline_tests); i++)
| ^
glib/tests/shell.c:201:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’
201 | for (i = 0; i < G_N_ELEMENTS (quote_tests); i++)
| ^
glib/tests/shell.c:208:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’
208 | for (i = 0; i < G_N_ELEMENTS (unquote_tests); i++)
| ^
glib/tests/slice.c: In function ‘test_allocate’:
glib/tests/slice.c:146:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’
146 | for (i = 0; i < G_N_ELEMENTS(threads); i++)
| ^
glib/tests/slice.c:149:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’
149 | for (i = 0; i < G_N_ELEMENTS(threads); i++)
| ^
glib/tests/spawn-singlethread.c: In function ‘test_spawn_async_with_fds’:
glib/tests/spawn-singlethread.c:204:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’
204 | for (i = 0; i < G_N_ELEMENTS (tests); i++)
| ^
glib/guri.c: In function ‘should_normalize_empty_path’:
glib/guri.c:756:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’
756 | for (i = 0; i < G_N_ELEMENTS (schemes); ++i)
| ^
Since the loop variable changed signedness, it’s now possible for there
to be an infinite loop if `get_match_count()` returns an error. Guard
against that.
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
Coverity CID: #1436405
The macro wrapper to `g_assertion_message_cmpstrv()` makes sure that
neither array is `NULL`, so there’s no need for a second `NULL` check.
Additionally, this check happens after the arrays have already been
dereferenced, at which point the program would have crashed if the
arrays were `NULL`.
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
Coverity CID: #1436406, #1436407
Set counters for the number of running tasks and
for the max. threadpool size. These are meant to
get a sense for whether G_TASK_POOL_SIZE and related
constants are still suitable for current gio and
GTask usage patterns.
Previously it was considered a programming error to call these on
subprocesses created without the correct flags, but for bindings this
distinction is difficult to handle automatically.
Returning NULL instead does not cause any inconsistent behaviour and
simplifies the API.
We can’t do anything differently based on whether removing a file fails.
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
Coverity CID: #1354857
glib/tests/mainloop.c:55:1: error: missing initializer for field ‘closure_callback’ of ‘GSourceFuncs’ {aka ‘struct _GSourceFuncs’}
55 | };
| ^
In file included from glib/giochannel.h:33,
from glib/glib.h:54,
from glib/tests/mainloop.c:23:
glib/gmain.h:276:19: note: ‘closure_callback’ declared here
276 | GSourceFunc closure_callback;
| ^~~~~~~~~~~~~~~~
glib/tests/mainloop.c:422:1: error: missing initializer for field ‘closure_callback’ of ‘GSourceFuncs’ {aka ‘struct _GSourceFuncs’}
422 | };
| ^
In file included from glib/giochannel.h:33,
from glib/glib.h:54,
from glib/tests/mainloop.c:23:
glib/gmain.h:276:19: note: ‘closure_callback’ declared here
276 | GSourceFunc closure_callback;
| ^~~~~~~~~~~~~~~~
glib/tests/mainloop.c: In function ‘test_ready_time’:
glib/tests/mainloop.c:946:3: error: missing initializer for field ‘finalize’ of ‘GSourceFuncs’ {aka ‘struct _GSourceFuncs’}
946 | };
| ^
In file included from glib/giochannel.h:33,
from glib/glib.h:54,
from glib/tests/mainloop.c:23:
glib/gmain.h:272:14: note: ‘finalize’ declared here
272 | void (*finalize) (GSource *source); /* Can be NULL */
| ^~~~~~~~
glib/tests/mainloop.c: In function ‘test_unref_while_pending’:
glib/tests/mainloop.c:1088:3: error: missing initializer for field ‘closure_callback’ of ‘GSourceFuncs’ {aka ‘struct _GSourceFuncs’}
1088 | static GSourceFuncs funcs = { trivial_prepare, NULL, NULL, trivial_finalize };
| ^~~~~~
In file included from glib/giochannel.h:33,
from glib/glib.h:54,
from glib/tests/mainloop.c:23:
glib/gmain.h:276:19: note: ‘closure_callback’ declared here
276 | GSourceFunc closure_callback;
| ^~~~~~~~~~~~~~~~
In file included from glib/glibconfig.h:9,
from glib/gtypes.h:32,
from glib/galloca.h:32,
from glib/glib.h:30,
from glib/tests/mainloop.c:23:
glib/tests/mainloop.c: In function ‘test_source_unix_fd_api’:
glib/tests/mainloop.c:1403:3: error: missing initializer for field ‘finalize’ of ‘GSourceFuncs’ {aka ‘struct _GSourceFuncs’}
1403 | };
| ^
In file included from glib/giochannel.h:33,
from glib/glib.h:54,
from glib/tests/mainloop.c:23:
glib/gmain.h:272:14: note: ‘finalize’ declared here
272 | void (*finalize) (GSource *source); /* Can be NULL */
| ^~~~~~~~
glib/tests/mainloop.c: At top level:
glib/tests/mainloop.c:1843:1: error: missing initializer for field ‘closure_callback’ of ‘GSourceFuncs’ {aka ‘struct _GSourceFuncs’}
1843 | };
| ^
In file included from glib/giochannel.h:33,
from glib/glib.h:54,
from glib/tests/mainloop.c:23:
glib/gmain.h:276:19: note: ‘closure_callback’ declared here
276 | GSourceFunc closure_callback;
| ^~~~~~~~~~~~~~~~
glib/tests/mainloop.c:1919:1: error: missing initializer for field ‘closure_callback’ of ‘GSourceFuncs’ {aka ‘struct _GSourceFuncs’}
1919 | };
| ^
In file included from glib/giochannel.h:33,
from glib/glib.h:54,
from glib/tests/mainloop.c:23:
glib/gmain.h:276:19: note: ‘closure_callback’ declared here
276 | GSourceFunc closure_callback;
| ^~~~~~~~~~~~~~~~
glib/tests/mainloop.c:2002:1: error: missing initializer for field ‘closure_callback’ of ‘GSourceFuncs’ {aka ‘struct _GSourceFuncs’}
2002 | };
| ^
In file included from glib/giochannel.h:33,
from glib/glib.h:54,
from glib/tests/mainloop.c:23:
glib/gmain.h:276:19: note: ‘closure_callback’ declared here
276 | GSourceFunc closure_callback;
| ^~~~~~~~~~~~~~~~
glib/tests/option-context.c: In function ‘callback_test_optional_5’:
glib/tests/option-context.c:945:5: error: missing initializer for field ‘arg_description’ of ‘GOptionEntry’ {aka ‘struct _GOptionEntry’}
945 | { { "dummy", 'd', 0, G_OPTION_ARG_NONE, &dummy, NULL },
| ^
In file included from glib/glib.h:64,
from glib/tests/option-context.c:23:
glib/goption.h:268:16: note: ‘arg_description’ declared here
268 | const gchar *arg_description;
| ^~~~~~~~~~~~~~~
glib/tests/option-context.c: In function ‘callback_test_optional_6’:
glib/tests/option-context.c:983:5: error: missing initializer for field ‘arg_description’ of ‘GOptionEntry’ {aka ‘struct _GOptionEntry’}
983 | { { "dummy", 'd', 0, G_OPTION_ARG_NONE, &dummy, NULL },
| ^
In file included from glib/glib.h:64,
from glib/tests/option-context.c:23:
glib/goption.h:268:16: note: ‘arg_description’ declared here
268 | const gchar *arg_description;
| ^~~~~~~~~~~~~~~
glib/tests/option-context.c: In function ‘callback_test_optional_7’:
glib/tests/option-context.c:1021:5: error: missing initializer for field ‘arg_description’ of ‘GOptionEntry’ {aka ‘struct _GOptionEntry’}
1021 | { { "dummy", 'd', 0, G_OPTION_ARG_NONE, &dummy, NULL },
| ^
In file included from glib/glib.h:64,
from glib/tests/option-context.c:23:
glib/goption.h:268:16: note: ‘arg_description’ declared here
268 | const gchar *arg_description;
| ^~~~~~~~~~~~~~~
glib/tests/option-context.c: In function ‘callback_test_optional_8’:
glib/tests/option-context.c:1059:5: error: missing initializer for field ‘arg_description’ of ‘GOptionEntry’ {aka ‘struct _GOptionEntry’}
1059 | { { "dummy", 'd', 0, G_OPTION_ARG_NONE, &dummy, NULL },
| ^
In file included from glib/glib.h:64,
from glib/tests/option-context.c:23:
glib/goption.h:268:16: note: ‘arg_description’ declared here
268 | const gchar *arg_description;
| ^~~~~~~~~~~~~~~
glib/tests/option-context.c: In function ‘test_group_captions’:
glib/tests/option-context.c:123:21: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’
123 | for (j = 0; j < G_N_ELEMENTS (test_name_base); ++j)
| ^
glib/tests/option-context.c: In function ‘option_context_parse_command_line’:
glib/tests/option-context.c:2364:46: error: operand of ‘?:’ changes signedness from ‘int’ to ‘guint’ {aka ‘unsigned int’} due to unsignedness of other operand
2364 | return success ? argv_len - argv_new_len : -1;
| ^~
glib/gtestutils.h:134:96: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘GMarkupError’
134 | if (!err || (err)->domain != dom || (err)->code != c) \
| ^~
glib/tests/markup-collect.c:168:7: note: in expansion of macro ‘g_assert_error’
168 | g_assert_error (error, G_MARKUP_ERROR, test->error_code);
| ^~~~~~~~~~~~~~
glib/tests/spawn-multithreaded.c: In function ‘multithreaded_test_run’:
glib/tests/spawn-multithreaded.c:41:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’}
41 | for (i = 0; i < n_threads; i++)
| ^
glib/tests/spawn-multithreaded.c:49:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’}
49 | for (i = 0; i < n_threads; i++)
| ^
glib/tests/tree.c: In function ‘test_tree_traverse’:
glib/tests/tree.c:394:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’
394 | for (i = 0; i < G_N_ELEMENTS (orders); i++)
| ^
glib/tests/markup-collect.c: In function ‘main’:
glib/tests/markup-collect.c:227:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’
227 | for (i = 0; i < G_N_ELEMENTS (tests); i++)
| ^
glib/tests/scannerapi.c: In function ‘test_scanner_tokens’:
glib/tests/scannerapi.c:124:17: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘gint’ {aka ‘const int’}
124 | for (i = 1; i < tokbuflen; i++)
| ^
glib/tests/regex.c: In function ‘test_match_all’:
glib/tests/regex.c:1317:19: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’}
1317 | if (match_count != g_slist_length (data->expected))
| ^~