forked from enlightenment/efl
Fixes ABI breakage in Eldbus for use with C++ Eldbus
Summary: This fixes the breakage when Eldbus_Service_Interface_Desc added a wrongfully methods2 field to a class that is allocated by the user. This patch adds the respective eldbus_service_interface_register2 and eldbus_service_interface_fallback_register2 for registration of Eldbus_Service_Interface_Desc2 which is now versioned. So future the functions can be backwards compatible and the struct be forward compatible and leaves the Eldbus_Service_Interface_Desc and eldbus_service_interface_register and eldbus_service_interface_fallback_register intact as it was in EFL 1.10. This fixes T1408 Reviewers: cedric, stefan_schmidt, raster Reviewed By: raster Subscribers: cedric Maniphest Tasks: T1408 Differential Revision: https://phab.enlightenment.org/D1188
This commit is contained in:
parent
831ade54fa
commit
835b8756ec
|
@ -364,13 +364,13 @@ service_interface service_interface_register(connection& c, const char* path
|
|||
(
|
||||
_create_methods_specification(std::make_tuple(args...))
|
||||
);
|
||||
Eldbus_Service_Interface_Desc description =
|
||||
Eldbus_Service_Interface_Desc2 description =
|
||||
{
|
||||
interface, 0, 0, 0, 0, 0, &(*methods)[0]
|
||||
{interface, 0, 0, 0, 0, 0}, ELDBUS_INTERFACE_DESCRIPTOR_VERSION, &(*methods)[0]
|
||||
};
|
||||
|
||||
Eldbus_Service_Interface* iface
|
||||
= ::eldbus_service_interface_register(c.native_handle(), path, &description);
|
||||
= ::eldbus_service_interface_register2(c.native_handle(), path, &description);
|
||||
return service_interface(iface);
|
||||
}
|
||||
|
||||
|
|
|
@ -928,7 +928,7 @@ fail_signature:
|
|||
}
|
||||
|
||||
static Eldbus_Service_Interface *
|
||||
_eldbus_service_interface_register(Eldbus_Connection *conn, const char *path, const Eldbus_Service_Interface_Desc *desc, Eina_Bool fallback)
|
||||
_eldbus_service_interface_register(Eldbus_Connection *conn, const char *path, const Eldbus_Service_Interface_Desc *desc, Eina_Bool fallback, unsigned int version)
|
||||
{
|
||||
Eldbus_Service_Object *obj;
|
||||
Eldbus_Service_Interface *iface;
|
||||
|
@ -966,8 +966,12 @@ _eldbus_service_interface_register(Eldbus_Connection *conn, const char *path, co
|
|||
for (method = desc->methods; method && method->member; method++)
|
||||
_eldbus_service_method_add(iface, method);
|
||||
|
||||
for (method2 = desc->methods2; method2 && method2->method.member; method2++)
|
||||
_eldbus_service_method_add(iface, &method2->method);
|
||||
if(version >= 2)
|
||||
{
|
||||
Eldbus_Service_Interface_Desc2* desc2 = (void*)desc;
|
||||
for (method2 = desc2->methods2; method2 && method2->method.member; method2++)
|
||||
_eldbus_service_method_add(iface, &method2->method);
|
||||
}
|
||||
|
||||
iface->signals = desc->signals;
|
||||
iface->sign_of_signals = signatures;
|
||||
|
@ -992,13 +996,25 @@ fail:
|
|||
EAPI Eldbus_Service_Interface *
|
||||
eldbus_service_interface_register(Eldbus_Connection *conn, const char *path, const Eldbus_Service_Interface_Desc *desc)
|
||||
{
|
||||
return _eldbus_service_interface_register(conn, path, desc, EINA_FALSE);
|
||||
return _eldbus_service_interface_register(conn, path, desc, EINA_FALSE, 1u);
|
||||
}
|
||||
|
||||
EAPI Eldbus_Service_Interface *
|
||||
eldbus_service_interface_register2(Eldbus_Connection *conn, const char *path, const Eldbus_Service_Interface_Desc2 *desc)
|
||||
{
|
||||
return _eldbus_service_interface_register(conn, path, &desc->description, EINA_FALSE, desc->version);
|
||||
}
|
||||
|
||||
EAPI Eldbus_Service_Interface *
|
||||
eldbus_service_interface_fallback_register(Eldbus_Connection *conn, const char *path, const Eldbus_Service_Interface_Desc *desc)
|
||||
{
|
||||
return _eldbus_service_interface_register(conn, path, desc, EINA_TRUE);
|
||||
return _eldbus_service_interface_register(conn, path, desc, EINA_TRUE, 1u);
|
||||
}
|
||||
|
||||
EAPI Eldbus_Service_Interface *
|
||||
eldbus_service_interface_fallback_register2(Eldbus_Connection *conn, const char *path, const Eldbus_Service_Interface_Desc2 *desc)
|
||||
{
|
||||
return _eldbus_service_interface_register(conn, path, &desc->description, EINA_TRUE, desc->version);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
|
||||
#define ELDBUS_PROPERTY_FLAG_DEPRECATED 1
|
||||
|
||||
#define ELDBUS_INTERFACE_DESCRIPTOR_VERSION 2
|
||||
|
||||
typedef struct _Eldbus_Arg_Info
|
||||
{
|
||||
const char *signature;
|
||||
|
@ -105,9 +107,15 @@ typedef struct _Eldbus_Service_Interface_Desc
|
|||
const Eldbus_Property *properties; /**< array of property that this interface have, the last item of array should be filled with NULL */
|
||||
const Eldbus_Property_Get_Cb default_get; /**< default get function, if a property don't have a get function this will be used */
|
||||
const Eldbus_Property_Set_Cb default_set; /**< default set function, if a property don't have a set function this will be used */
|
||||
const Eldbus_Method2 *methods2; /**< array of the methods that should be registered in this interface, the last item of array should be filled with NULL @since 1.11 */
|
||||
} Eldbus_Service_Interface_Desc;
|
||||
|
||||
typedef struct _Eldbus_Service_Interface_Desc2
|
||||
{
|
||||
Eldbus_Service_Interface_Desc description;
|
||||
int version; /**< version of the interface descriptor. Must be initialized with ELDBUS_INTERFACE_DESCRIPTOR_VERSION @since 1.11 >*/
|
||||
const Eldbus_Method2 *methods2; /**< array of the methods that should be registered in this interface, the last item of array should be filled with NULL @since 1.11 */
|
||||
} Eldbus_Service_Interface_Desc2;
|
||||
|
||||
/**
|
||||
* @brief Register an interface in the given path and connection.
|
||||
*
|
||||
|
@ -134,6 +142,42 @@ EAPI Eldbus_Service_Interface *eldbus_service_interface_register(Eldbus_Connecti
|
|||
EAPI Eldbus_Service_Interface *
|
||||
eldbus_service_interface_fallback_register(Eldbus_Connection *conn, const char *path, const Eldbus_Service_Interface_Desc *desc) EINA_ARG_NONNULL(1, 2, 3);
|
||||
|
||||
/**
|
||||
* @brief Register an interface in the given path and connection. This
|
||||
* extended register function allows the registration of stateful methods, with void* data.
|
||||
*
|
||||
* Note: Use eldbus_service_interface_unregister() to unregister a interface.
|
||||
*
|
||||
* @param conn where the interface should listen
|
||||
* @param path object path
|
||||
* @param desc description of interface
|
||||
*
|
||||
* @since 1.11
|
||||
*
|
||||
* @return Interface
|
||||
*/
|
||||
EAPI Eldbus_Service_Interface *eldbus_service_interface_register2(Eldbus_Connection *conn, const char *path, const Eldbus_Service_Interface_Desc2 *desc) EINA_ARG_NONNULL(1, 2, 3);
|
||||
|
||||
/**
|
||||
* @brief Register a fallback interface handler for a given subsection
|
||||
* of the object hierarchy. This extended register function allows
|
||||
* the registration of stateful methods, with void* data.
|
||||
*
|
||||
* Note: Use eldbus_service_interface_unregister() to unregister a interface.
|
||||
*
|
||||
* @param conn where the interface should listen
|
||||
* @param path a '/' delimited string of path elements
|
||||
* @param desc description of interface
|
||||
* @see eldbus_service_interface_unregister()
|
||||
*
|
||||
* @since 1.11
|
||||
*
|
||||
* @return Interface
|
||||
*/
|
||||
EAPI Eldbus_Service_Interface *
|
||||
eldbus_service_interface_fallback_register2(Eldbus_Connection *conn, const char *path, const Eldbus_Service_Interface_Desc2 *desc) EINA_ARG_NONNULL(1, 2, 3);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Unregister a interface.
|
||||
* Note: This doesn't unregister the object path if interface count reaches 0.
|
||||
|
|
Loading…
Reference in New Issue