From eba81f9866d0814a6c3d6fe47b27d74e3111136c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Danis?= Date: Fri, 13 Jan 2023 10:01:41 +0100 Subject: Add json_object_get_*_member_with_default() helpers json library previous to version 1.6.0 doesn't provide the json_object_get_*_member_with_default() functions. --- gusb/gusb-endpoint.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'gusb/gusb-endpoint.c') diff --git a/gusb/gusb-endpoint.c b/gusb/gusb-endpoint.c index 338fb57..3898e4f 100644 --- a/gusb/gusb-endpoint.c +++ b/gusb/gusb-endpoint.c @@ -20,6 +20,7 @@ #include #include "gusb-endpoint-private.h" +#include "gusb-json-common.h" struct _GUsbEndpoint { GObject parent_instance; @@ -62,7 +63,6 @@ _g_usb_endpoint_load(GUsbEndpoint *self, JsonObject *json_object, GError **error g_return_val_if_fail(json_object != NULL, FALSE); g_return_val_if_fail(error == NULL || *error == NULL, FALSE); -#if JSON_CHECK_VERSION(1, 6, 0) /* optional properties */ self->endpoint_descriptor.bDescriptorType = json_object_get_int_member_with_default(json_object, "DescriptorType", 0x0); @@ -86,13 +86,6 @@ _g_usb_endpoint_load(GUsbEndpoint *self, JsonObject *json_object, GError **error g_bytes_unref(self->extra); self->extra = g_bytes_new_take(g_steal_pointer(&buf), bufsz); } -#else - g_set_error_literal(error, - G_IO_ERROR, - G_IO_ERROR_NOT_SUPPORTED, - "json-glib version too old"); - return FALSE; -#endif /* success */ return TRUE; -- cgit v1.2.1