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-device-event.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-device-event.c')
-rw-r--r-- | gusb/gusb-device-event.c | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/gusb/gusb-device-event.c b/gusb/gusb-device-event.c index a991971..3cd9ab5 100644 --- a/gusb/gusb-device-event.c +++ b/gusb/gusb-device-event.c @@ -13,6 +13,7 @@ #include "config.h" #include "gusb-device-event-private.h" +#include "gusb-json-common.h" struct _GUsbDeviceEvent { GObject parent_instance; @@ -57,7 +58,6 @@ _g_usb_device_event_load(GUsbDeviceEvent *self, JsonObject *json_object, GError g_return_val_if_fail(json_object != NULL, FALSE); g_return_val_if_fail(error == NULL || *error == NULL, -1); -#if JSON_CHECK_VERSION(1, 6, 0) /* optional properties */ self->id = g_strdup(json_object_get_string_member_with_default(json_object, "Id", NULL)); self->status = json_object_get_int_member_with_default(json_object, @@ -72,13 +72,6 @@ _g_usb_device_event_load(GUsbDeviceEvent *self, JsonObject *json_object, GError g_autofree guchar *buf = g_base64_decode(str, &bufsz); self->bytes = 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; |