From: Vitaly Lipatov <lav@etersoft.ru> DBUS_MESSAGE_ITER_INIT_CLOSED and dbus_message_iter_abandon_container_if_open were added in dbus 1.12. Provide a fallback definition for the macro and load the function optionally via dlsym to allow building on systems with older dbus. --- dlls/winebth.sys/dbus.c | 15 ++++++++++++++- dlls/winebth.sys/dbus.h | 1 - 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/dlls/winebth.sys/dbus.c b/dlls/winebth.sys/dbus.c index aa2cef1cc0a..8cd72d85092 100644 --- a/dlls/winebth.sys/dbus.c +++ b/dlls/winebth.sys/dbus.c @@ -35,6 +35,11 @@ #ifdef SONAME_LIBDBUS_1 #include <dbus/dbus.h> + +/* DBUS_MESSAGE_ITER_INIT_CLOSED was added in dbus 1.12. */ +#ifndef DBUS_MESSAGE_ITER_INIT_CLOSED +#define DBUS_MESSAGE_ITER_INIT_CLOSED { {0} } +#endif #endif #include <ntstatus.h> @@ -129,6 +134,9 @@ const int bluez_timeout = -1; DBUS_FUNCS; #undef DO_FUNC +/* dbus_message_iter_abandon_container_if_open was added in dbus 1.12. */ +static typeof(dbus_message_iter_abandon_container) *p_dbus_message_iter_abandon_container_if_open; + static BOOL load_dbus_functions( void ) { void *handle = dlopen( SONAME_LIBDBUS_1, RTLD_NOW ); @@ -143,6 +151,10 @@ static BOOL load_dbus_functions( void ) } DBUS_FUNCS; #undef DO_FUNC + + /* dbus_message_iter_abandon_container_if_open is optional (dbus >= 1.12). */ + p_dbus_message_iter_abandon_container_if_open = dlsym( handle, "dbus_message_iter_abandon_container_if_open" ); + return TRUE; failed: @@ -1163,7 +1175,8 @@ NTSTATUS bluez_gatt_characteristic_read( void *connection, void *watcher_ctx, st p_dbus_message_unref( request ); return STATUS_PENDING; failed: - p_dbus_message_iter_abandon_container_if_open( &args_iter, &dict_iter ); + if (p_dbus_message_iter_abandon_container_if_open) + p_dbus_message_iter_abandon_container_if_open( &args_iter, &dict_iter ); p_dbus_message_unref( request ); return status; } diff --git a/dlls/winebth.sys/dbus.h b/dlls/winebth.sys/dbus.h index 511e8caf25b..4cbf37883df 100644 --- a/dlls/winebth.sys/dbus.h +++ b/dlls/winebth.sys/dbus.h @@ -84,7 +84,6 @@ DO_FUNC(dbus_message_is_signal); \ DO_FUNC(dbus_message_iter_append_basic); \ DO_FUNC(dbus_message_iter_abandon_container); \ - DO_FUNC(dbus_message_iter_abandon_container_if_open); \ DO_FUNC(dbus_message_iter_close_container); \ DO_FUNC(dbus_message_iter_get_arg_type); \ DO_FUNC(dbus_message_iter_get_element_type); \ -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10591