summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Borges <felipeborges@gnome.org>2021-10-04 15:33:11 +0200
committerFelipe Borges <felipeborges@gnome.org>2021-10-06 13:17:34 +0200
commit7c20768adee1dace6c0d6d9a52d601970f6dc0e0 (patch)
tree9693c575725f097ec6e7e9bb3ab48396901d3b6a
parent97504bf77ddd85e1c59816e2c004d87d82501f21 (diff)
downloadlibosinfo-7c20768adee1dace6c0d6d9a52d601970f6dc0e0.tar.gz
tree, media: SoupMessage is a private struct in libsoup3
You can no longer directly access various structs such as SoupMessage. These are now accessed by getters and setters. See https://libsoup.org/libsoup-3.0/ch02.html Signed-off-by: Felipe Borges <felipeborges@gnome.org>
-rw-r--r--osinfo/osinfo_media.c6
-rw-r--r--osinfo/osinfo_tree.c8
-rw-r--r--osinfo/osinfo_util_private.h5
3 files changed, 12 insertions, 7 deletions
diff --git a/osinfo/osinfo_media.c b/osinfo/osinfo_media.c
index b2019f4..35bc257 100644
--- a/osinfo/osinfo_media.c
+++ b/osinfo/osinfo_media.c
@@ -20,12 +20,12 @@
#include <osinfo/osinfo.h>
#include "osinfo_media_private.h"
-#include "osinfo_util_private.h"
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.h>
#include <libsoup/soup.h>
+#include "osinfo_util_private.h"
#define MAX_VOLUME 32
#define MAX_SYSTEM 32
@@ -1286,11 +1286,11 @@ static void on_location_read(GObject *source,
stream = G_INPUT_STREAM(g_file_read_finish(G_FILE(source), res, &error));
} else {
stream = soup_session_send_finish(SOUP_SESSION(source), res, &error);
- if (!SOUP_STATUS_IS_SUCCESSFUL(data->message->status_code) && error == NULL) {
+ if (!SOUP_STATUS_IS_SUCCESSFUL(soup_message_get_status(data->message)) && error == NULL) {
g_set_error_literal(&error,
OSINFO_MEDIA_ERROR,
OSINFO_MEDIA_ERROR_NO_DESCRIPTORS,
- soup_status_get_phrase(data->message->status_code));
+ soup_status_get_phrase(soup_message_get_status(data->message)));
}
}
if (error != NULL) {
diff --git a/osinfo/osinfo_tree.c b/osinfo/osinfo_tree.c
index e19d73f..7455f94 100644
--- a/osinfo/osinfo_tree.c
+++ b/osinfo/osinfo_tree.c
@@ -19,12 +19,12 @@
*/
#include <osinfo/osinfo.h>
-#include "osinfo_util_private.h"
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.h>
#include <libsoup/soup.h>
+#include "osinfo_util_private.h"
typedef struct _CreateFromLocationAsyncData CreateFromLocationAsyncData;
struct _CreateFromLocationAsyncData {
@@ -715,7 +715,7 @@ static void on_soup_location_read(GObject *source,
res,
&error);
if (stream == NULL ||
- !SOUP_STATUS_IS_SUCCESSFUL(data->message->status_code)) {
+ !SOUP_STATUS_IS_SUCCESSFUL(soup_message_get_status(data->message))) {
/* It means no ".treeinfo" file has been found. Try again, this time
* looking for a "treeinfo" file. */
if (g_str_equal(data->treeinfo, ".treeinfo")) {
@@ -727,7 +727,7 @@ static void on_soup_location_read(GObject *source,
g_set_error_literal(&error,
OSINFO_TREE_ERROR,
OSINFO_TREE_ERROR_NO_TREEINFO,
- soup_status_get_phrase(data->message->status_code));
+ soup_status_get_phrase(soup_message_get_status(data->message)));
}
g_prefix_error(&error, _("Failed to load .treeinfo|treeinfo file: "));
g_task_return_error(data->res, error);
@@ -735,7 +735,7 @@ static void on_soup_location_read(GObject *source,
return;
}
- content_size = soup_message_headers_get_content_length(data->message->response_headers);
+ content_size = soup_message_headers_get_content_length(soup_message_get_response_headers(data->message));
data->content = g_malloc0(content_size);
g_input_stream_read_all_async(stream,
diff --git a/osinfo/osinfo_util_private.h b/osinfo/osinfo_util_private.h
index 6d449d4..2bb3f30 100644
--- a/osinfo/osinfo_util_private.h
+++ b/osinfo/osinfo_util_private.h
@@ -25,4 +25,9 @@
gboolean osinfo_util_requires_soup(const gchar *location);
+#if SOUP_MAJOR_VERSION < 3
+#define soup_message_get_status(message) message->status_code
+#define soup_message_get_response_headers(message) message->response_headers
+#endif
+
#endif /* __OSINFO_UTIL_PRIVATE_H__ */