gio: Fix various implicit conversions from size_t to smaller types

Basically various trivial instances of the following MSVC compiler
warning:
```
../gio/gio-tool-set.c(50): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
```

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
This commit is contained in:
Philip Withnall
2024-04-25 00:37:47 +01:00
parent c378a5a049
commit 6e362ce3b6
20 changed files with 44 additions and 37 deletions

View File

@@ -63,7 +63,7 @@ test_read_lines (GDataStreamNewlineType newline_type)
GError *error = NULL;
gpointer data;
char *lines;
int size;
size_t size;
int i;
#define TEST_STRING "some_text"
@@ -99,7 +99,7 @@ test_read_lines (GDataStreamNewlineType newline_type)
/* compare data */
size = strlen (data);
g_assert_cmpint (size, <, MAX_LINES_BUFF);
g_assert_cmpuint (size, <, MAX_LINES_BUFF);
g_assert_cmpstr ((char*)data, ==, lines);
g_object_unref (base_stream);

View File

@@ -1470,7 +1470,7 @@ test_run_in_thread_overflow (void)
GCancellable *cancellable;
GTask *task;
gchar buf[NUM_OVERFLOW_TASKS + 1];
gint i;
size_t i;
/* Queue way too many tasks and then sleep for a bit. The first 10
* tasks will be dispatched to threads and will then block on
@@ -1516,13 +1516,13 @@ test_run_in_thread_overflow (void)
* plausibly get (and we hope that if gtask is actually broken then
* it will exceed those limits).
*/
g_assert_cmpint (i, >=, 10);
g_assert_cmpuint (i, >=, 10);
if (g_test_slow ())
g_assert_cmpint (i, <, 50);
g_assert_cmpuint (i, <, 50);
else
g_assert_cmpint (i, <, 20);
g_assert_cmpuint (i, <, 20);
g_assert_cmpint (i + strspn (buf + i, "X"), ==, NUM_OVERFLOW_TASKS);
g_assert_cmpuint (i + strspn (buf + i, "X"), ==, NUM_OVERFLOW_TASKS);
}
/* test_return_on_cancel */