Commit 8f5ec0da authored by Dan Winship's avatar Dan Winship

Fix misc compiler warnings in (mostly) test programs

parent 22b3f0d4
......@@ -899,7 +899,7 @@ read_string (GMemoryInputStream *mis,
G_IO_ERROR,
G_IO_ERROR_INVALID_ARGUMENT,
_("Wanted to read %lu bytes but got EOF"),
to_read);
(gulong)to_read);
goto fail;
}
......
......@@ -101,7 +101,6 @@ g_app_info_get_default_for_uri_scheme
g_app_info_reset_type_associations
#endif
#endif
#endif
#if IN_HEADER(__G_DESKTOP_APP_INFO_H__)
......
......@@ -396,6 +396,7 @@ test_create_delete (gconstpointer d)
{
GError *error;
CreateDeleteData *data;
int tmpfd;
data = g_new0 (CreateDeleteData, 1);
......@@ -403,7 +404,12 @@ test_create_delete (gconstpointer d)
data->data = "abcdefghijklmnopqrstuvxyzABCDEFGHIJKLMNOPQRSTUVXYZ0123456789";
data->pos = 0;
data->monitor_path = tempnam ("/tmp", "g_file_create_delete_");
/* Using tempnam() would be easier here, but causes a compile warning */
tmpfd = g_file_open_tmp ("g_file_create_delete_XXXXXX",
&data->monitor_path, NULL);
g_assert_cmpint (tmpfd, !=, -1);
close (tmpfd);
remove (data->monitor_path);
data->file = g_file_new_for_path (data->monitor_path);
g_assert (!g_file_query_exists (data->file, NULL));
......@@ -521,6 +527,7 @@ test_replace_load (void)
{
ReplaceLoadData *data;
gchar *path;
int tmpfd;
data = g_new0 (ReplaceLoadData, 1);
data->again = TRUE;
......@@ -553,7 +560,13 @@ test_replace_load (void)
" * make a backup of @file.\n"
" **/\n";
path = tempnam ("/tmp", "g_file_replace_load_");
/* Using tempnam() would be easier here, but causes a compile warning */
tmpfd = g_file_open_tmp ("g_file_replace_load_XXXXXX",
&path, NULL);
g_assert_cmpint (tmpfd, !=, -1);
close (tmpfd);
remove (path);
data->file = g_file_new_for_path (path);
g_assert (!g_file_query_exists (data->file, NULL));
......
......@@ -257,7 +257,7 @@ test_themed_icon (void)
g_assert_cmpstr (names[0], ==, "first");
g_assert_cmpstr (names[1], ==, "testicon");
g_assert_cmpstr (names[2], ==, "last");
g_assert_cmpuint (g_icon_hash (icon1), ==, 3193088045);
g_assert_cmpuint (g_icon_hash (icon1), ==, 3193088045U);
icon2 = g_themed_icon_new_from_names ((gchar**)names2, -1);
g_assert (g_icon_equal (icon1, icon2));
......
......@@ -250,7 +250,7 @@ main (int argc, char** argv)
gint i;
/* Try to get all the leap year cases. */
GDateYear check_years[] = {
int check_years[] = {
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
11, 12, 13, 14, 98, 99, 100, 101, 102, 103, 397,
398, 399, 400, 401, 402, 403, 404, 405, 406,
......
......@@ -356,7 +356,7 @@ copy_up (gconstpointer src,
l = GPOINTER_TO_INT (src);
u = g_ascii_toupper (l);
return GINT_TO_POINTER (u);
return GINT_TO_POINTER ((int)u);
}
static void
......
......@@ -68,11 +68,11 @@ static CmdlineTest cmdline_tests[] =
};
static gboolean
strv_equal (const gchar **a, const gchar **b)
strv_equal (gchar **a, gchar **b)
{
gint i;
if (g_strv_length ((gchar**)a) != g_strv_length ((gchar **)b))
if (g_strv_length (a) != g_strv_length (b))
return FALSE;
for (i = 0; a[i]; i++)
......
......@@ -425,7 +425,7 @@ main (gint argc,
GObjectClass *object_class;
TestIfaceClass *iface_vtable;
GParamSpec **properties;
gint n_properties;
guint n_properties;
gint val1, val2, val3, val4;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment