Fix -Wundef warnings due to use of unguarded HAVE_PLATFORM_BACKEND
This commit is contained in:
1 parent
9bf8fbbba4
commit
cd12b35a34
1 file changed
+11
-11
+11
-11
@@ -899,7 +899,7 @@ struct hidapi_backend
|
|||||||
const wchar_t *(*hid_error)(void *device);
|
const wchar_t *(*hid_error)(void *device);
|
||||||
};
|
};
|
||||||
|
|
||||||
#if HAVE_PLATFORM_BACKEND
|
#ifdef HAVE_PLATFORM_BACKEND
|
||||||
static const struct hidapi_backend PLATFORM_Backend = {
|
static const struct hidapi_backend PLATFORM_Backend = {
|
||||||
(void *)PLATFORM_hid_write,
|
(void *)PLATFORM_hid_write,
|
||||||
(void *)PLATFORM_hid_read_timeout,
|
(void *)PLATFORM_hid_read_timeout,
|
||||||
@@ -958,7 +958,7 @@ struct SDL_hid_device_
|
|||||||
};
|
};
|
||||||
static char device_magic;
|
static char device_magic;
|
||||||
|
|
||||||
#if HAVE_PLATFORM_BACKEND || defined(HAVE_DRIVER_BACKEND) || defined(HAVE_LIBUSB)
|
#if defined(HAVE_PLATFORM_BACKEND) || defined(HAVE_DRIVER_BACKEND) || defined(HAVE_LIBUSB)
|
||||||
|
|
||||||
static SDL_hid_device *
|
static SDL_hid_device *
|
||||||
CreateHIDDeviceWrapper(void *device, const struct hidapi_backend *backend)
|
CreateHIDDeviceWrapper(void *device, const struct hidapi_backend *backend)
|
||||||
@@ -986,7 +986,7 @@ DeleteHIDDeviceWrapper(SDL_hid_device *device)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifndef SDL_HIDAPI_DISABLED
|
#ifndef SDL_HIDAPI_DISABLED
|
||||||
#if HAVE_PLATFORM_BACKEND || defined(HAVE_DRIVER_BACKEND) || defined(HAVE_LIBUSB)
|
#if defined(HAVE_PLATFORM_BACKEND) || defined(HAVE_DRIVER_BACKEND) || defined(HAVE_LIBUSB)
|
||||||
|
|
||||||
#define COPY_IF_EXISTS(var) \
|
#define COPY_IF_EXISTS(var) \
|
||||||
if (pSrc->var != NULL) { \
|
if (pSrc->var != NULL) { \
|
||||||
@@ -1134,7 +1134,7 @@ int SDL_hid_init(void)
|
|||||||
}
|
}
|
||||||
#endif /* HAVE_LIBUSB */
|
#endif /* HAVE_LIBUSB */
|
||||||
|
|
||||||
#if HAVE_PLATFORM_BACKEND
|
#ifdef HAVE_PLATFORM_BACKEND
|
||||||
++attempts;
|
++attempts;
|
||||||
#if __LINUX__
|
#if __LINUX__
|
||||||
udev_ctx = SDL_UDEV_GetUdevSyms();
|
udev_ctx = SDL_UDEV_GetUdevSyms();
|
||||||
@@ -1169,7 +1169,7 @@ int SDL_hid_exit(void)
|
|||||||
HIDAPI_ShutdownDiscovery();
|
HIDAPI_ShutdownDiscovery();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAVE_PLATFORM_BACKEND
|
#ifdef HAVE_PLATFORM_BACKEND
|
||||||
if (udev_ctx) {
|
if (udev_ctx) {
|
||||||
result |= PLATFORM_hid_exit();
|
result |= PLATFORM_hid_exit();
|
||||||
}
|
}
|
||||||
@@ -1224,7 +1224,7 @@ struct SDL_hid_device_info *SDL_hid_enumerate(unsigned short vendor_id, unsigned
|
|||||||
struct SDL_hid_device_info *driver_devs = NULL;
|
struct SDL_hid_device_info *driver_devs = NULL;
|
||||||
struct SDL_hid_device_info *driver_dev;
|
struct SDL_hid_device_info *driver_dev;
|
||||||
#endif
|
#endif
|
||||||
#if HAVE_PLATFORM_BACKEND
|
#ifdef HAVE_PLATFORM_BACKEND
|
||||||
struct SDL_hid_device_info *raw_devs = NULL;
|
struct SDL_hid_device_info *raw_devs = NULL;
|
||||||
struct SDL_hid_device_info *raw_dev;
|
struct SDL_hid_device_info *raw_dev;
|
||||||
#endif
|
#endif
|
||||||
@@ -1280,7 +1280,7 @@ struct SDL_hid_device_info *SDL_hid_enumerate(unsigned short vendor_id, unsigned
|
|||||||
}
|
}
|
||||||
#endif /* HAVE_DRIVER_BACKEND */
|
#endif /* HAVE_DRIVER_BACKEND */
|
||||||
|
|
||||||
#if HAVE_PLATFORM_BACKEND
|
#ifdef HAVE_PLATFORM_BACKEND
|
||||||
if (udev_ctx) {
|
if (udev_ctx) {
|
||||||
raw_devs = PLATFORM_hid_enumerate(vendor_id, product_id);
|
raw_devs = PLATFORM_hid_enumerate(vendor_id, product_id);
|
||||||
#ifdef DEBUG_HIDAPI
|
#ifdef DEBUG_HIDAPI
|
||||||
@@ -1368,14 +1368,14 @@ void SDL_hid_free_enumeration(struct SDL_hid_device_info *devs)
|
|||||||
|
|
||||||
SDL_hid_device *SDL_hid_open(unsigned short vendor_id, unsigned short product_id, const wchar_t *serial_number)
|
SDL_hid_device *SDL_hid_open(unsigned short vendor_id, unsigned short product_id, const wchar_t *serial_number)
|
||||||
{
|
{
|
||||||
#if HAVE_PLATFORM_BACKEND || defined(HAVE_DRIVER_BACKEND) || defined(HAVE_LIBUSB)
|
#if defined(HAVE_PLATFORM_BACKEND) || defined(HAVE_DRIVER_BACKEND) || defined(HAVE_LIBUSB)
|
||||||
void *pDevice = NULL;
|
void *pDevice = NULL;
|
||||||
|
|
||||||
if (SDL_hidapi_refcount == 0 && SDL_hid_init() != 0) {
|
if (SDL_hidapi_refcount == 0 && SDL_hid_init() != 0) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAVE_PLATFORM_BACKEND
|
#if defined(HAVE_PLATFORM_BACKEND)
|
||||||
if (udev_ctx) {
|
if (udev_ctx) {
|
||||||
pDevice = PLATFORM_hid_open(vendor_id, product_id, serial_number);
|
pDevice = PLATFORM_hid_open(vendor_id, product_id, serial_number);
|
||||||
if (pDevice != NULL) {
|
if (pDevice != NULL) {
|
||||||
@@ -1407,14 +1407,14 @@ SDL_hid_device *SDL_hid_open(unsigned short vendor_id, unsigned short product_id
|
|||||||
|
|
||||||
SDL_hid_device *SDL_hid_open_path(const char *path, int bExclusive /* = false */)
|
SDL_hid_device *SDL_hid_open_path(const char *path, int bExclusive /* = false */)
|
||||||
{
|
{
|
||||||
#if HAVE_PLATFORM_BACKEND || defined(HAVE_DRIVER_BACKEND) || defined(HAVE_LIBUSB)
|
#if defined(HAVE_PLATFORM_BACKEND) || defined(HAVE_DRIVER_BACKEND) || defined(HAVE_LIBUSB)
|
||||||
void *pDevice = NULL;
|
void *pDevice = NULL;
|
||||||
|
|
||||||
if (SDL_hidapi_refcount == 0 && SDL_hid_init() != 0) {
|
if (SDL_hidapi_refcount == 0 && SDL_hid_init() != 0) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAVE_PLATFORM_BACKEND
|
#if defined(HAVE_PLATFORM_BACKEND)
|
||||||
if (udev_ctx) {
|
if (udev_ctx) {
|
||||||
pDevice = PLATFORM_hid_open_path(path, bExclusive);
|
pDevice = PLATFORM_hid_open_path(path, bExclusive);
|
||||||
if (pDevice != NULL) {
|
if (pDevice != NULL) {
|
||||||
|
|||||||
Reference in new issue
Block a user