Commit ff913a22f48fa26cbbdaa3c88c431d65d1fea4a7

Sam Lantinga 2020-12-23T16:16:55

Fixed compile warnings on platforms without hidapi support

diff --git a/src/hidapi/SDL_hidapi.c b/src/hidapi/SDL_hidapi.c
index dc2bc49..a5c9440 100644
--- a/src/hidapi/SDL_hidapi.c
+++ b/src/hidapi/SDL_hidapi.c
@@ -804,6 +804,7 @@ void  HID_API_EXPORT HID_API_CALL hid_free_enumeration(struct hid_device_info *d
 
 HID_API_EXPORT hid_device * HID_API_CALL hid_open(unsigned short vendor_id, unsigned short product_id, const wchar_t *serial_number)
 {
+#if HAVE_PLATFORM_BACKEND || HAVE_DRIVER_BACKEND || SDL_LIBUSB_DYNAMIC
     hid_device *pDevice = NULL;
 
     if (hid_init() != 0) {
@@ -836,11 +837,14 @@ HID_API_EXPORT hid_device * HID_API_CALL hid_open(unsigned short vendor_id, unsi
     }
 #endif /* SDL_LIBUSB_DYNAMIC */
 
+#endif /* HAVE_PLATFORM_BACKEND || HAVE_DRIVER_BACKEND || SDL_LIBUSB_DYNAMIC */
+
     return NULL;
 }
 
 HID_API_EXPORT hid_device * HID_API_CALL hid_open_path(const char *path, int bExclusive /* = false */)
 {
+#if HAVE_PLATFORM_BACKEND || HAVE_DRIVER_BACKEND || SDL_LIBUSB_DYNAMIC
     hid_device *pDevice = NULL;
 
     if (hid_init() != 0) {
@@ -873,6 +877,8 @@ HID_API_EXPORT hid_device * HID_API_CALL hid_open_path(const char *path, int bEx
     }
 #endif /* SDL_LIBUSB_DYNAMIC */
 
+#endif /* HAVE_PLATFORM_BACKEND || HAVE_DRIVER_BACKEND || SDL_LIBUSB_DYNAMIC */
+
     return NULL;
 }