Merge branch 'fix_more_warnings' into 'master'

Fix more warnings

See merge request GNOME/glib!2081
This commit is contained in:
Philip Withnall 2021-05-06 16:43:21 +00:00
commit 45cc35c5cc
6 changed files with 15 additions and 14 deletions

View File

@ -130,7 +130,8 @@ recv_message (GIOChannel *channel,
char buf[BUFSIZE];
guint nbytes;
guint nb;
int i, j, seq;
guint j;
int i, seq;
GIOError error;
error = read_all (fd, channel, (gchar *) &seq, sizeof (seq), &nb);
@ -169,7 +170,7 @@ recv_message (GIOChannel *channel,
g_assert (nb == sizeof (nbytes));
g_assert_cmpint (nbytes, <, BUFSIZE);
g_assert (nbytes >= 0 && nbytes < BUFSIZE);
g_assert (nbytes < BUFSIZE);
g_debug ("gio-test: ...from %d: %d bytes", fd, nbytes);
if (nbytes > 0)
{
@ -186,7 +187,7 @@ recv_message (GIOChannel *channel,
}
for (j = 0; j < nbytes; j++)
g_assert (buf[j] == ' ' + ((nbytes + j) % 95));
g_assert (buf[j] == ' ' + (char) ((nbytes + j) % 95));
g_debug ("gio-test: ...from %d: OK", fd);
}
}

View File

@ -357,7 +357,7 @@ main (int argc,
if (argc > 1)
{
gsize k;
int k;
for (k = 1; k < argc; k++)
{
test = find_test (argv[k]);

View File

@ -70,7 +70,7 @@ int
main (int argc,
char *argv[])
{
int j, n_pages = 0;
gsize j, n_pages = 0;
void *mps[N_MAGAZINE_PROBES];
/* probe some magazine sizes */

View File

@ -78,7 +78,7 @@ static void
glist_test (void)
{
GList *list = NULL;
guint i;
gint i;
for (i = 0; i < 10; i++)
list = g_list_append (list, &test_nums[i]);
@ -158,7 +158,7 @@ static void
gslist_test (void)
{
GSList *slist = NULL;
guint i;
gint i;
for (i = 0; i < 10; i++)
slist = g_slist_append (slist, &test_nums[i]);
@ -299,11 +299,11 @@ gnode_test (void)
for (i = 0; i < g_node_n_children (node_B); i++)
{
node = g_node_nth_child (node_B, i);
g_assert (P2C (node->data) == ('C' + i));
g_assert (P2C (node->data) == (gchar) ('C' + i));
}
for (i = 0; i < g_node_n_children (node_G); i++)
g_assert (g_node_child_position (node_G, g_node_nth_child (node_G, i)) == i);
g_assert (g_node_child_position (node_G, g_node_nth_child (node_G, i)) == (gint) i);
/* we have built: A
* / \
@ -1313,7 +1313,7 @@ test_arrays (void)
for (i = 0; i < 10000; i++)
g_array_append_val (garray, i);
for (i = 0; i < 10000; i++)
if (g_array_index (garray, gint, i) != i)
if (g_array_index (garray, gint, i) != (gint) i)
g_error ("failure: %d ( %d )", g_array_index (garray, gint, i), i);
g_array_free (garray, TRUE);
@ -1321,7 +1321,7 @@ test_arrays (void)
for (i = 0; i < 100; i++)
g_array_prepend_val (garray, i);
for (i = 0; i < 100; i++)
if (g_array_index (garray, gint, i) != (100 - i - 1))
if (g_array_index (garray, gint, i) != (gint) (100 - i - 1))
g_error ("failure: %d ( %d )", g_array_index (garray, gint, i), 100 - i - 1);
g_array_free (garray, TRUE);
}

View File

@ -32,7 +32,7 @@ io_pipe (GIOChannel **channels)
}
static gboolean
read_all (GIOChannel *channel, char *buf, int len)
read_all (GIOChannel *channel, char *buf, gsize len)
{
gsize bytes_read = 0;
gsize count;
@ -56,7 +56,7 @@ read_all (GIOChannel *channel, char *buf, int len)
}
static gboolean
write_all (GIOChannel *channel, char *buf, int len)
write_all (GIOChannel *channel, char *buf, gsize len)
{
gsize bytes_written = 0;
gsize count;

View File

@ -74,7 +74,7 @@ int main (int argc, char **argv)
}
}
if (argc > i)
if (argc > (gint) i)
{
in = g_io_channel_new_file (argv[i], "r", &error);
if (!in)