[glib: 1/2] Change SkipAsyncData fields to be gsize (and not gssize)
- From: Sebastian Dröge <sdroege src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 1/2] Change SkipAsyncData fields to be gsize (and not gssize)
- Date: Sat, 20 Feb 2021 09:45:27 +0000 (UTC)
commit 23dad977d88d73bffa336f820ac1d21869bd05fe
Author: Emmanuel Fleury <emmanuel fleury gmail com>
Date: Tue Feb 16 13:17:26 2021 +0100
Change SkipAsyncData fields to be gsize (and not gssize)
gio/gbufferedinputstream.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/gio/gbufferedinputstream.c b/gio/gbufferedinputstream.c
index 14495c4a0..d9f150d33 100644
--- a/gio/gbufferedinputstream.c
+++ b/gio/gbufferedinputstream.c
@@ -1104,8 +1104,8 @@ g_buffered_input_stream_real_fill_finish (GBufferedInputStream *stream,
typedef struct
{
- gssize bytes_skipped;
- gssize count;
+ gsize bytes_skipped;
+ gsize count;
} SkipAsyncData;
static void
@@ -1186,6 +1186,7 @@ skip_fill_buffer_callback (GObject *source_object,
priv->pos += data->count;
}
+ g_assert (data->bytes_skipped <= G_MAXSSIZE);
g_task_return_int (task, data->bytes_skipped);
}
@@ -1243,9 +1244,12 @@ g_buffered_input_stream_skip_async (GInputStream *stream,
if (count > priv->len)
{
/* Large request, shortcut buffer */
-
base_stream = G_FILTER_INPUT_STREAM (stream)->base_stream;
+ /* If 'count > G_MAXSSIZE then 'g_input_stream_skip_async()'
+ * will return an error anyway before calling this.
+ * Assert that this is never called for too big `count` for clarity. */
+ g_assert ((gssize) count >= 0);
g_input_stream_skip_async (base_stream,
count,
io_priority, cancellable,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]