[Libosinfo] [libosinfo PATCH v2 4/8] media: Use GInpuStream directly in on_location_read()

Fabiano Fidêncio fidencio at redhat.com
Tue Jul 2 19:52:20 UTC 2019


Let's do this in order to always deal with a GInputStream directly and
avoid dealing with a GFileInputStream or something else when we start
using libsoup to deal with non-local files.

Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
---
 osinfo/osinfo_media.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/osinfo/osinfo_media.c b/osinfo/osinfo_media.c
index 8cd4929..aba3e20 100644
--- a/osinfo/osinfo_media.c
+++ b/osinfo/osinfo_media.c
@@ -1293,13 +1293,13 @@ static void on_location_read(GObject *source,
                              GAsyncResult *res,
                              gpointer user_data)
 {
-    GFileInputStream *stream;
+    GInputStream *stream;
     CreateFromLocationAsyncData *data;
     GError *error = NULL;
 
     data = (CreateFromLocationAsyncData *)user_data;
 
-    stream = g_file_read_finish(G_FILE(source), res, &error);
+    stream = G_INPUT_STREAM(g_file_read_finish(G_FILE(source), res, &error));
     if (error != NULL) {
         g_prefix_error(&error, _("Failed to open file: "));
         g_task_return_error(data->res, error);
@@ -1308,7 +1308,7 @@ static void on_location_read(GObject *source,
         return;
     }
 
-    g_input_stream_skip_async(G_INPUT_STREAM(stream),
+    g_input_stream_skip_async(stream,
                               PVD_OFFSET,
                               g_task_get_priority(data->res),
                               g_task_get_cancellable(data->res),
-- 
2.21.0




More information about the Libosinfo mailing list