mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-21 16:38:54 +02:00
tests: Fix various straightforward -Wsign-conversion warnings
In the gobject tests. Signed-off-by: Philip Withnall <pwithnall@gnome.org> Helps: #3405
This commit is contained in:
@@ -396,9 +396,9 @@ static DEFINE_TYPE (DerivedObject, derived_object,
|
||||
static void
|
||||
assert_in_properties (GParamSpec *param_spec,
|
||||
GParamSpec **properties,
|
||||
gint n_properties)
|
||||
size_t n_properties)
|
||||
{
|
||||
gint i;
|
||||
size_t i;
|
||||
gboolean found = FALSE;
|
||||
|
||||
for (i = 0; i < n_properties; i++)
|
||||
|
@@ -1376,10 +1376,10 @@ static void test_implementation_class_init (TestImplementationClass *class)
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
gint change_this_flag;
|
||||
gint change_this_type;
|
||||
gint use_this_flag;
|
||||
gint use_this_type;
|
||||
guint change_this_flag;
|
||||
guint change_this_type;
|
||||
guint use_this_flag;
|
||||
guint use_this_type;
|
||||
} TestParamImplementData;
|
||||
|
||||
static void
|
||||
@@ -1433,7 +1433,7 @@ test_param_implement (void)
|
||||
continue;
|
||||
}
|
||||
|
||||
test_path = g_strdup_printf ("/param/implement/subprocess/%d-%d-%d-%d",
|
||||
test_path = g_strdup_printf ("/param/implement/subprocess/%u-%u-%u-%u",
|
||||
change_this_flag, change_this_type,
|
||||
use_this_flag, use_this_type);
|
||||
g_test_trap_subprocess (test_path, G_TIME_SPAN_SECOND,
|
||||
@@ -1545,8 +1545,8 @@ param_int_init (GParamSpec *pspec)
|
||||
{
|
||||
GParamSpecInt *ispec = (GParamSpecInt *)pspec;
|
||||
|
||||
ispec->minimum = 0x7fffffff;
|
||||
ispec->maximum = 0x80000000;
|
||||
ispec->minimum = (int) 0x7fffffff;
|
||||
ispec->maximum = (int) 0x80000000;
|
||||
ispec->default_value = 0;
|
||||
}
|
||||
|
||||
@@ -1686,7 +1686,7 @@ main (int argc, char *argv[])
|
||||
for (data.use_this_flag = 0; data.use_this_flag < 16; data.use_this_flag++)
|
||||
for (data.use_this_type = 0; data.use_this_type < 4; data.use_this_type++)
|
||||
{
|
||||
test_path = g_strdup_printf ("/param/implement/subprocess/%d-%d-%d-%d",
|
||||
test_path = g_strdup_printf ("/param/implement/subprocess/%u-%u-%u-%u",
|
||||
data.change_this_flag, data.change_this_type,
|
||||
data.use_this_flag, data.use_this_type);
|
||||
test_data = g_memdup2 (&data, sizeof (TestParamImplementData));
|
||||
|
@@ -23,7 +23,7 @@ typedef struct _GTestClass GTestClass;
|
||||
struct _GTest
|
||||
{
|
||||
GObject object;
|
||||
gint id;
|
||||
unsigned int id;
|
||||
gint dummy;
|
||||
|
||||
gint count;
|
||||
|
@@ -19,7 +19,7 @@ typedef struct _GTestClass GTestClass;
|
||||
struct _GTest
|
||||
{
|
||||
GObject object;
|
||||
gint id;
|
||||
unsigned int id;
|
||||
gint dummy;
|
||||
|
||||
gint count;
|
||||
|
@@ -1705,7 +1705,7 @@ test_clear_signal_handler (void)
|
||||
|
||||
if (g_test_undefined ())
|
||||
{
|
||||
handler = g_random_int_range (0x01, 0xFF);
|
||||
handler = (gulong) g_random_int_range (0x01, 0xFF);
|
||||
g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL,
|
||||
"*instance '* has no handler with id *'");
|
||||
g_clear_signal_handler (&handler, test_obj);
|
||||
|
@@ -220,8 +220,8 @@ test_threaded_object_init (void)
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
MyTester0 *strong;
|
||||
guint unref_delay;
|
||||
MyTester0 *strong;
|
||||
gulong unref_delay;
|
||||
} UnrefInThreadData;
|
||||
|
||||
static gpointer
|
||||
@@ -269,7 +269,7 @@ test_threaded_weak_ref (void)
|
||||
gpointer weak;
|
||||
#endif
|
||||
MyTester0 *strengthened;
|
||||
guint get_delay;
|
||||
gulong get_delay;
|
||||
GThread *thread;
|
||||
GError *error = NULL;
|
||||
|
||||
@@ -290,8 +290,8 @@ test_threaded_weak_ref (void)
|
||||
* timing. Ideally, we want each side to win half the races; on
|
||||
* smcv's laptop, these timings are about right.
|
||||
*/
|
||||
data.unref_delay = g_random_int_range (SLEEP_MIN_USEC / 2, SLEEP_MAX_USEC / 2);
|
||||
get_delay = g_random_int_range (SLEEP_MIN_USEC, SLEEP_MAX_USEC);
|
||||
data.unref_delay = (gulong) g_random_int_range (SLEEP_MIN_USEC / 2, SLEEP_MAX_USEC / 2);
|
||||
get_delay = (gulong) g_random_int_range (SLEEP_MIN_USEC, SLEEP_MAX_USEC);
|
||||
|
||||
/* One half of the race is to unref the shared object */
|
||||
thread = g_thread_create (unref_in_thread, &data, TRUE, &error);
|
||||
|
@@ -3,7 +3,7 @@
|
||||
static void
|
||||
test_registration_serial (void)
|
||||
{
|
||||
gint serial1, serial2, serial3;
|
||||
guint serial1, serial2, serial3;
|
||||
|
||||
serial1 = g_type_get_type_registration_serial ();
|
||||
g_pointer_type_register_static ("my+pointer");
|
||||
|
@@ -633,9 +633,9 @@ test_valuearray_basic (void)
|
||||
a = g_value_array_new (20);
|
||||
|
||||
g_value_init (&v, G_TYPE_INT);
|
||||
for (i = 0; i < 100; i++)
|
||||
for (int j = 0; j < 100; j++)
|
||||
{
|
||||
g_value_set_int (&v, i);
|
||||
g_value_set_int (&v, j);
|
||||
g_value_array_append (a, &v);
|
||||
}
|
||||
|
||||
@@ -646,9 +646,9 @@ test_valuearray_basic (void)
|
||||
for (i = 20; i < 100; i+= 5)
|
||||
g_value_array_remove (a, 100 - i);
|
||||
|
||||
for (i = 100; i < 150; i++)
|
||||
for (int j = 100; j < 150; j++)
|
||||
{
|
||||
g_value_set_int (&v, i);
|
||||
g_value_set_int (&v, j);
|
||||
g_value_array_prepend (a, &v);
|
||||
}
|
||||
|
||||
@@ -692,7 +692,7 @@ test_value_array_sort_with_data (void)
|
||||
|
||||
/* Add some values and try sorting them. */
|
||||
g_value_init (&v, G_TYPE_INT);
|
||||
for (unsigned int i = 0; i < 100; i++)
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
g_value_set_int (&v, 100 - i);
|
||||
g_value_array_append (a, &v);
|
||||
|
Reference in New Issue
Block a user