diff options
author | Frédéric Danis <frederic.danis@collabora.com> | 2023-01-13 10:01:41 +0100 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2023-04-26 07:31:41 +0100 |
commit | eba81f9866d0814a6c3d6fe47b27d74e3111136c (patch) | |
tree | 032824b249fae2c97e83f42b96dc4246d1ce982a /gusb/gusb-endpoint.c | |
parent | 235fec31874a90b346f1c44b3234bf43a6c06355 (diff) | |
download | gusb-eba81f9866d0814a6c3d6fe47b27d74e3111136c.tar.gz |
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.
Diffstat (limited to 'gusb/gusb-endpoint.c')
-rw-r--r-- | gusb/gusb-endpoint.c | 9 |
1 files changed, 1 insertions, 8 deletions
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 <string.h> #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; |