Merge branch 'fix_more_warnings' into 'master'

Fix more warnings

See merge request GNOME/glib!2074
This commit is contained in:
Philip Withnall
2021-05-04 09:43:31 +00:00
6 changed files with 17 additions and 16 deletions

View File

@@ -53,7 +53,7 @@ int
main (int argc, main (int argc,
char *argv[]) char *argv[])
{ {
gint i; gsize i;
struct { struct {
gchar *filename; gchar *filename;
gchar *dirname; gchar *dirname;
@@ -100,9 +100,8 @@ main (int argc,
{ "a:\\/", "a:\\" }, { "a:\\/", "a:\\" },
#endif #endif
}; };
guint n_dirname_checks = sizeof (dirname_checks) / sizeof (dirname_checks[0]);
for (i = 0; i < n_dirname_checks; i++) for (i = 0; i < G_N_ELEMENTS (dirname_checks); i++)
{ {
gchar *dirname; gchar *dirname;

View File

@@ -197,7 +197,7 @@ static const PerformanceTest tests[] = {
}; };
static gboolean verbose = FALSE; static gboolean verbose = FALSE;
static int n_threads = 0; static guint n_threads = 0;
static gboolean list = FALSE; static gboolean list = FALSE;
static int test_length = DEFAULT_TEST_TIME; static int test_length = DEFAULT_TEST_TIME;
@@ -320,7 +320,7 @@ run_test (const PerformanceTest *test)
static const PerformanceTest * static const PerformanceTest *
find_test (const char *name) find_test (const char *name)
{ {
int i; gsize i;
for (i = 0; i < G_N_ELEMENTS (tests); i++) for (i = 0; i < G_N_ELEMENTS (tests); i++)
{ {
if (strcmp (tests[i].name, name) == 0) if (strcmp (tests[i].name, name) == 0)
@@ -336,7 +336,7 @@ main (int argc,
const PerformanceTest *test; const PerformanceTest *test;
GOptionContext *context; GOptionContext *context;
GError *error = NULL; GError *error = NULL;
int i; gsize i;
context = g_option_context_new ("GObject performance tests"); context = g_option_context_new ("GObject performance tests");
g_option_context_add_main_entries (context, cmd_entries, NULL); g_option_context_add_main_entries (context, cmd_entries, NULL);
@@ -357,9 +357,10 @@ main (int argc,
if (argc > 1) if (argc > 1)
{ {
for (i = 1; i < argc; i++) gsize k;
for (k = 1; k < argc; k++)
{ {
test = find_test (argv[i]); test = find_test (argv[k]);
if (test) if (test)
run_test (test); run_test (test);
} }

View File

@@ -1015,7 +1015,7 @@ static PerformanceTest tests[] = {
static PerformanceTest * static PerformanceTest *
find_test (const char *name) find_test (const char *name)
{ {
int i; gsize i;
for (i = 0; i < G_N_ELEMENTS (tests); i++) for (i = 0; i < G_N_ELEMENTS (tests); i++)
{ {
if (strcmp (tests[i].name, name) == 0) if (strcmp (tests[i].name, name) == 0)
@@ -1051,8 +1051,9 @@ main (int argc,
} }
else else
{ {
for (i = 0; i < G_N_ELEMENTS (tests); i++) gsize k;
run_test (&tests[i]); for (k = 0; k < G_N_ELEMENTS (tests); k++)
run_test (&tests[k]);
} }
return 0; return 0;

View File

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

View File

@@ -352,10 +352,10 @@ create_crawler (void)
static void static void
cleanup_crawlers (GMainContext *context) cleanup_crawlers (GMainContext *context)
{ {
gint i; guint i;
G_LOCK (crawler_array_lock); G_LOCK (crawler_array_lock);
for (i=0; i < crawler_array->len; i++) for (i = 0; i < crawler_array->len; i++)
{ {
if (g_source_get_context (crawler_array->pdata[i]) == context) if (g_source_get_context (crawler_array->pdata[i]) == context)
{ {

View File

@@ -115,7 +115,7 @@ run_thread (GTest * test)
int int
main (int argc, char **argv) main (int argc, char **argv)
{ {
gint i; guint i;
GTest *test1, *test2; GTest *test1, *test2;
GArray *test_threads; GArray *test_threads;
const guint n_threads = 5; const guint n_threads = 5;