From abb7feafed252eefef9c8a16d0120a3017b1d934 Mon Sep 17 00:00:00 2001 From: Marc Schink Date: Thu, 28 Jul 2016 20:22:19 +0200 Subject: [PATCH] Avoid 'interface' identifier in public API Foolishly, 'interface' is a reserved keyword on Windows according to MSDN: https://msdn.microsoft.com/en-us/library/2kb28261.aspx Rename all 'interface' identifiers in the public API to avoid possible conflicts. Signed-off-by: Marc Schink --- libjaylink/device.c | 10 +++++----- libjaylink/libjaylink.h | 8 ++++---- libjaylink/target.c | 28 ++++++++++++++-------------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/libjaylink/device.c b/libjaylink/device.c index 33eb3fc..73e5537 100644 --- a/libjaylink/device.c +++ b/libjaylink/device.c @@ -186,8 +186,8 @@ JAYLINK_API void jaylink_free_devices(struct jaylink_device **devices, * Get the host interface of a device. * * @param[in] dev Device instance. - * @param[out] interface Host interface of the device on success, and undefined - * on failure. + * @param[out] iface Host interface of the device on success, and undefined on + * failure. * * @retval JAYLINK_OK Success. * @retval JAYLINK_ERR_ARG Invalid arguments. @@ -196,12 +196,12 @@ JAYLINK_API void jaylink_free_devices(struct jaylink_device **devices, */ JAYLINK_API int jaylink_device_get_host_interface( const struct jaylink_device *dev, - enum jaylink_host_interface *interface) + enum jaylink_host_interface *iface) { - if (!dev || !interface) + if (!dev || !iface) return JAYLINK_ERR_ARG; - *interface = dev->interface; + *iface = dev->interface; return JAYLINK_OK; } diff --git a/libjaylink/libjaylink.h b/libjaylink/libjaylink.h index 037cd75..a1f72a0 100644 --- a/libjaylink/libjaylink.h +++ b/libjaylink/libjaylink.h @@ -381,7 +381,7 @@ JAYLINK_API void jaylink_free_devices(struct jaylink_device **devices, bool unref); JAYLINK_API int jaylink_device_get_host_interface( const struct jaylink_device *dev, - enum jaylink_host_interface *interface); + enum jaylink_host_interface *iface); JAYLINK_API int jaylink_device_get_serial_number( const struct jaylink_device *dev, uint32_t *serial_number); JAYLINK_API int jaylink_device_get_usb_address( @@ -503,13 +503,13 @@ JAYLINK_API int jaylink_set_speed(struct jaylink_device_handle *devh, JAYLINK_API int jaylink_get_speeds(struct jaylink_device_handle *devh, struct jaylink_speed *speed); JAYLINK_API int jaylink_select_interface(struct jaylink_device_handle *devh, - enum jaylink_target_interface interface, - enum jaylink_target_interface *prev_interface); + enum jaylink_target_interface iface, + enum jaylink_target_interface *prev_iface); JAYLINK_API int jaylink_get_available_interfaces( struct jaylink_device_handle *devh, uint32_t *interfaces); JAYLINK_API int jaylink_get_selected_interface( struct jaylink_device_handle *devh, - enum jaylink_target_interface *interface); + enum jaylink_target_interface *iface); JAYLINK_API int jaylink_clear_reset(struct jaylink_device_handle *devh); JAYLINK_API int jaylink_set_reset(struct jaylink_device_handle *devh); JAYLINK_API int jaylink_set_target_power(struct jaylink_device_handle *devh, diff --git a/libjaylink/target.c b/libjaylink/target.c index fca6cc3..f64572c 100644 --- a/libjaylink/target.c +++ b/libjaylink/target.c @@ -177,9 +177,9 @@ JAYLINK_API int jaylink_get_speeds(struct jaylink_device_handle *devh, * #JAYLINK_DEV_CAP_SELECT_TIF capability. * * @param[in,out] devh Device handle. - * @param[in] interface Target interface to select. - * @param[out] prev_interface Previously selected target interface on success, - * and undefined on failure. Can be NULL. + * @param[in] iface Target interface to select. + * @param[out] prev_iface Previously selected target interface on success, and + * undefined on failure. Can be NULL. * * @retval JAYLINK_OK Success. * @retval JAYLINK_ERR_ARG Invalid arguments. @@ -191,8 +191,8 @@ JAYLINK_API int jaylink_get_speeds(struct jaylink_device_handle *devh, * @since 0.1.0 */ JAYLINK_API int jaylink_select_interface(struct jaylink_device_handle *devh, - enum jaylink_target_interface interface, - enum jaylink_target_interface *prev_interface) + enum jaylink_target_interface iface, + enum jaylink_target_interface *prev_iface) { int ret; struct jaylink_context *ctx; @@ -202,7 +202,7 @@ JAYLINK_API int jaylink_select_interface(struct jaylink_device_handle *devh, if (!devh) return JAYLINK_ERR_ARG; - if (interface > JAYLINK_TIF_MAX) + if (iface > JAYLINK_TIF_MAX) return JAYLINK_ERR_ARG; ctx = devh->dev->ctx; @@ -214,7 +214,7 @@ JAYLINK_API int jaylink_select_interface(struct jaylink_device_handle *devh, } buf[0] = CMD_SELECT_TIF; - buf[1] = interface; + buf[1] = iface; ret = transport_write(devh, buf, 2); @@ -237,8 +237,8 @@ JAYLINK_API int jaylink_select_interface(struct jaylink_device_handle *devh, return JAYLINK_ERR; } - if (prev_interface) - *prev_interface = tmp; + if (prev_iface) + *prev_iface = tmp; return JAYLINK_OK; } @@ -315,8 +315,8 @@ JAYLINK_API int jaylink_get_available_interfaces( * #JAYLINK_DEV_CAP_SELECT_TIF capability. * * @param[in,out] devh Device handle. - * @param[out] interface Selected target interface on success, and undefined on - * failure. + * @param[out] iface Selected target interface on success, and undefined on + * failure. * * @retval JAYLINK_OK Success. * @retval JAYLINK_ERR_ARG Invalid arguments. @@ -329,14 +329,14 @@ JAYLINK_API int jaylink_get_available_interfaces( */ JAYLINK_API int jaylink_get_selected_interface( struct jaylink_device_handle *devh, - enum jaylink_target_interface *interface) + enum jaylink_target_interface *iface) { int ret; struct jaylink_context *ctx; uint8_t buf[4]; uint32_t tmp; - if (!devh || !interface) + if (!devh || !iface) return JAYLINK_ERR_ARG; ctx = devh->dev->ctx; @@ -371,7 +371,7 @@ JAYLINK_API int jaylink_get_selected_interface( return JAYLINK_ERR; } - *interface = tmp; + *iface = tmp; return JAYLINK_OK; } -- 2.11.4.GIT