Fix uses of undefined macro identifiers (-Wundef)

* Fix -Wundef warnings due to use of unguarded SDL_LOADSO_DISABLED

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_WINDOWS

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_ANDROID

* Fix -Wundef warnings due to use of unguarded SDL_LOADSO_DUMMY

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_COCOA

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_UIKIT

* Fix -Wundef warnings due to use of unguarded SDL_TIMERS_DISABLED

* Fix -Wundef warnings due to use of unguarded SDL_EVENTS_DISABLED

* Fix -Wundef warnings due to use of unguarded SDL_TIMER_DUMMY

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DISABLED

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DISABLED

* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_DISABLED

* Fix -Wundef warnings due to use of unguarded SDL_HAPTIC_DISABLED

* Fix -Wundef warnings due to use of unguarded SDL_SENSOR_DISABLED

* Fix -Wundef warnings due to use of unguarded __ANDROID__

* Fix -Wundef warnings due to use of unguarded __IOS__

* Fix -Wundef warnings due to use of unguarded EMULATE_CAS

* Fix -Wundef warnings due to use of unguarded SDL_ATOMIC_DISABLED

* Fix -Wundef warnings due to use of unguarded SDL_THREADS_DISABLED

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_SNDIO

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_NETBSD

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_WASAPI

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_DSOUND

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_HAIKU

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_COREAUDIO

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_AAUDIO

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_OPENSLES

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_ANDROID

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_PS2

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_PSP

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_VITA

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_N3DS

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_EMSCRIPTEN

* Fix -Wundef warnings due to use of unguarded SDL_NEON_INTRINSICS

* Fix -Wundef warnings due to use of unguarded SDL_ALTIVEC_BLITTERS

* Fix -Wundef warnings due to use of unguarded __VITA__

* Fix -Wundef warnings due to use of unguarded __3DS__

* Fix -Wundef warnings due to use of unguarded SDL_DYNAPI_PROC_NO_VARARGS

* Fix -Wundef warnings due to use of unguarded __APPLE__

* Fix -Wundef warnings due to use of unguarded __WINRT__

* Fix -Wundef warnings due to use of unguarded SDL_HIDAPI_DISABLED

* Fix -Wundef warnings due to use of unguarded __TVOS__

* Fix -Wundef warnings due to use of unguarded HAVE_DRIVER_BACKEND

* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_XINPUT

* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_WGI

* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_DINPUT

* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_MFI

* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_EMSCRIPTEN

* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_PS2

* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_PSP

* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_VITA

* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_N3DS

* Fix -Wundef warnings due to use of unguarded __MACOS__

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_D3D

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_WINRT

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_RPI

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_VITA_PVR_OGL

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_VIVANTE

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_D3D11

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_D3D12

* Fix -Wundef warnings due to use of unguarded SDL_RENDER_DISABLED

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_METAL

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_PS2

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_PSP

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_VITA_GXM

* Fix -Wundef warnings due to use of unguarded SDL_ARM_SIMD_BLITTERS

* Fix -Wundef warnings due to use of unguarded SDL_ARM_NEON_BLITTERS

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_HAIKU

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_PS2

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_PSP

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_VITA

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_N3DS

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_KMSDRM

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_RISCOS

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_EMSCRIPTEN

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_NGAGE

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_METAL

* Fix -Wundef warnings due to use of unguarded SDL_LSX_INTRINSICS

* Fix -Wundef warnings due to use of unguarded HAVE_PTHREAD_NP_H

* Fix -Wundef warnings due to use of unguarded __RISCOS__

* Fix -Wundef warnings due to use of unguarded FAKE_RECURSIVE_MUTEX

* Fix -Wundef warnings due to use of unguarded USE_POSIX_SPAWN

* textureData is only needed when SDL is built with YUV support

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_ALSA

* Fix -Wundef warnings due to use of unguarded SDL_SSE3_INTRINSICS

* Fix -Wundef warnings due to use of unguarded SDL_SSE4_2_INTRINSICS

* Fix -Wundef warnings due to use of unguarded SDL_SSE4_1_INTRINSICS

* Fix -Wundef warnings due to use of unguarded SDL_AVX512F_INTRINSICS

* Fix -Wundef warnings due to use of unguarded SDL_SSE2_INTRINSICS

* Fix -Wundef warnings due to use of unguarded SDL_AVX_INTRINSICS

* Fix -Wundef warnings due to use of unguarded SDL_AVX2_INTRINSICS

* Fix -Wundef warnings due to use of unguarded SDL_SSE_INTRINSICS

* Fix -Wundef warnings due to use of unguarded SDL_MMX_INTRINSICS

* Fix -Wundef warnings due to use of unguarded HAVE_CLOCK_GETTIME

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_DISK

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_DUMMY

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_DUMMY

* Fix -Wundef warnings due to use of unguarded HAVE_GCC_ATOMICS

* Fix -Wundef warnings due to use of unguarded HAVE_GCC_SYNC_LOCK_TEST_AND_SET

* Fix -Wundef warnings due to use of unguarded SDL_USE_LIBDBUS

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_JACK

* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_VIRTUAL

* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_LINUX

* Fix -Wundef warnings due to use of unguarded HAVE_LIBC

* Fix -Wundef warnings due to disabling SDL_LIBC

* Fix -Wundef warnings due to use of unguarded HAVE_PLATFORM_BACKEND

* Fix -Wundef warnings due to use of unguarded DEBUG

* Fix -Wundef warnings due to use of unguarded HAVE_LINUX_INPUT_H

* Fix -Werror=unused-variable when building with SDL_LIBC=OFF

* Fix -Wundef warnings due to use of unguqrded SDL_USE_LIBUDEV

* Use SDL alloc functions in libusb/hid.c

* Fix -Wundef warnings due to use of unguarded HAVE_LIBUDEV_H

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_VULKAN

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_OFFSCREEN

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_OGL

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL_GLX

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL_ES

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL_ES2

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_OGL_ES2

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_OSS

* Remove SDL_AUDIO_DRIVER_SUNAUDIO reference since it is never set

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_PIPEWIRE

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_PULSEAUDIO

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_X11_XCURSOR

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_X11_XDBE

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_X11_XFIXES

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_X11_XINPUT2

* Fix -Wundef warnings due to use of unguarded #if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH

* Fix -Wundef warnings due to use of unguarded #if SDL_VIDEO_DRIVER_X11_XRANDR

* Fix -Wundef warnings due to use of unguarded #if SDL_VIDEO_DRIVER_X11_XSCRNSAVER

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_X11_XSHAPE

* Don't call XShape functions when XShape is diabled

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_WAYLAND

* Fix -Wundef warnings due to use of unuarded SDL_VIDEO_DRIVER_X11

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_RISCOS

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL_EGL

* Disable array when compiled with SDL_EVENTS=OFF

* Fix -Wundef warnings due to use of unguarded SDL_INPUT_LINUXEV

* Fix -Wundef warnings due to use of unguarded SDL_THREAD_PTHREAD

* Fix -Wundef warnings due to use of unguarded SDL_THREAD_WINDOWS

* Fix -Wundef warnings due to use of unguarded SDL_THREAD_PS2

* Fix -Wundef warnings due to use of unguarded SDL_THREAD_PSP

* Fix -Wundef warnings due to use of unguarded SDL_THREAD_VITA

* Fix -Wundef warnings due to use of unguarded SDL_THREAD_N3DS

* Fix -Wundef warnings due to use of unguarded SDL_THREAD_STDCPP

* Fix -Wundef warnings due to use of unguarded SDL_THREAD_NGAGE

* Fix -Wundef warnings due to use of unguarded __WINDOWS__

* Fix -Wundef warnings due to use of unguarded __WINGDK__

* Fix -Wundef warnings due to use of unguarded __ANDROID__

* Fix -Wundef warnings due to use of unguarded SDL_THREAD_GENERIC_COND_SUFFIX

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_VITA_PIB

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_VITA_PVR

* Fix -Wundef warnings due to use of unguarded SDL_FILE_DISABLED

* Fix -Wundef warnings due to use of unguarded __XBOXONE__

* Fix -Wundef warnings due to use of unguarded __XBOXSERIES__

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL_WGL

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_QNX

* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_DISK

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_QNX

* Fix -Wundef warnings due to use of unguarded DEBUG_RAZOR

* Fix -Wundef warnings due to use of unguarded WINAPI_FAMILY_PHONE_APP

* Fix -Wundef warnings due to use of unguarded SDL_MAC_NO_SANDBOX

* Fix -Wundef warnings due to use of unguarded __(IPHONE|APPLETV|MAC)_OS_VERSION_MAX_ALLOWED

* Fix C4090 warning ('function': different 'const' qualifiers)

* ci: use -isystem for include dirs of pspdev toolchain

* cmake: add -Wundef option

* Fix remaining -Wundef warnings due to use of unguarded SDL_VIDEO_VULKAN and SDL_VIDEO_METAL

* Fix -Wundef warnings due to use of unguarded __MACOS__

* DEBUG_CONVERT is guaranteed to be defined in src/audio/SDL_audiocvt.c

* Fix -Wundef warnings due to use of unguarded HAVE_NANOSLEEP

* Fix -Wundef warnings due to use of unguarded HAVE_DXGI_H

* Fix -Wundef warnings due to use of unguarded HAVE_LINUX_INPUT_H

* fix SDL_VIDEO_DRIVER_WAYLAND

* fix SDL_VIDEO_DRIVER_X11

* Fix -Wundef warnings due to use of unguarded HAVE_MMDEVICEAPI_H

* Fix -Wundef warnings due to use of unguarded HAVE_PTHREAD_SETNAME_NP

* Fix -Wundef warnings due to use of unguarded HAVE_PTHREAD_SET_NAME_NP

* Fix -Wundef warnings due to use of unguarded HAVE_SETJMP

* Fix -Wundef warnings due to use of unguarded HAVE_SIGNAL_H

* Fix -Wundef warnings due to use of unguarded HAVE_TPCSHRD_H

* Fix -Wundef warnings due to use of unguarded MACOSX_COREAUDIO

* Fix -Wundef warnings due to use of unguarded SDL_HAPTIC_DINPUT

* Fix -Wundef warnings due to use of unguarded SDL_HAPTIC_IOKIT

* Fix -Wundef warnings due to use of unguarded SDL_HAPTIC_XINPUT

* Fix -Wundef warnings due to use of unguarded SDL_IPHONE_KEYBOARD

* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_RAWINPUT

* Fix -Wundef warnings due to use of unguarded SDL_POWER_ANDROID

* Fix -Wundef warnings due to use of unguarded SDL_POWER_EMSCRIPTEN

* Fix -Wundef warnings due to use of unguarded SDL_POWER_HAIKU

* Fix -Wundef warnings due to use of unguarded SDL_POWER_LINUX

* Fix -Wundef warnings due to use of unguarded SDL_POWER_MACOSX

* Fix -Wundef warnings due to use of unguarded SDL_POWER_PSP

* Fix -Wundef warnings due to use of unguarded SDL_POWER_UIKIT

* Fix -Wundef warnings due to use of unguarded SDL_POWER_VITA

* Fix -Wundef warnings due to use of unguarded SDL_POWER_WINDOWS

* Fix -Wundef warnings due to use of unguarded SDL_THREAD_PTHREAD_RECURSIVE_MUTEX

* Fix -Wundef warnings due to use of unguarded SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_VIVANTE_VDK

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_WAYLAND

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL_CGL

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL_EGL

* Fix -Wundef warnings due to use of unguarded __MACOS__

* Fix -Wundef warnings due to use of unguarded __OpenBSD__

* Fix -Wundef warnings due to use of unguarded __FreeBSD__

* Fix -Wundef warnings due to use of unguarded __MWERKS__

* Fix -Wundef warnings due to use of unguarded __WIN32__

* Fix -Wundef warnings due to use of unguarded SDL_IPHONE_LAUNCHSCREEN

* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL_ES2

* Remove unused HAVE_CONST, HAVE_INLINE and HAVE_VOLATILE

* Revert "Use SDL alloc functions in libusb/hid.c"

This reverts commit 847c64b00d.

* Handle FAKE_RECURSIVE_MUTEX in similar way as SDL2

* Don't use defined in macro
This commit is contained in:
Anonymous Maarten 2023-03-29 21:49:01 +00:00 committed by GitHub
parent c3d3c2c672
commit 3472dc11d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
382 changed files with 1222 additions and 1184 deletions

View file

@ -31,7 +31,7 @@
#include "SDL_hidapi_c.h"
#if !SDL_HIDAPI_DISABLED
#ifndef SDL_HIDAPI_DISABLED
#if defined(__WIN32__) || defined(__WINGDK__)
#include "../core/windows/SDL_windows.h"
@ -557,9 +557,9 @@ HIDAPI_ShutdownDiscovery()
#define read_thread PLATFORM_read_thread
#undef HIDAPI_H__
#if __LINUX__
#ifdef __LINUX__
#if SDL_USE_LIBUDEV
#ifdef SDL_USE_LIBUDEV
static const SDL_UDEV_Symbols *udev_ctx = NULL;
#define udev_device_get_sysattr_value udev_ctx->udev_device_get_sysattr_value
@ -582,20 +582,20 @@ static const SDL_UDEV_Symbols *udev_ctx = NULL;
#define HAVE_PLATFORM_BACKEND 1
#endif /* SDL_USE_LIBUDEV */
#elif __MACOS__
#elif defined(__MACOS__)
#include "mac/hid.c"
#define HAVE_PLATFORM_BACKEND 1
#define udev_ctx 1
#elif __WINDOWS__ || __WINGDK__
#elif defined(__WINDOWS__) || defined(__WINGDK__)
#include "windows/hid.c"
#define HAVE_PLATFORM_BACKEND 1
#define udev_ctx 1
#elif __ANDROID__
#elif defined(__ANDROID__)
/* The implementation for Android is in a separate .cpp file */
#include "hidapi/hidapi.h"
#define HAVE_PLATFORM_BACKEND 1
#define udev_ctx 1
#elif __IOS__ || __TVOS__
#elif defined(__IOS__) || defined(__TVOS__)
/* The implementation for iOS and tvOS is in a separate .m file */
#include "hidapi/hidapi.h"
#define HAVE_PLATFORM_BACKEND 1
@ -899,7 +899,7 @@ struct hidapi_backend
const wchar_t *(*hid_error)(void *device);
};
#if HAVE_PLATFORM_BACKEND
#ifdef HAVE_PLATFORM_BACKEND
static const struct hidapi_backend PLATFORM_Backend = {
(void *)PLATFORM_hid_write,
(void *)PLATFORM_hid_read_timeout,
@ -916,7 +916,7 @@ static const struct hidapi_backend PLATFORM_Backend = {
};
#endif /* HAVE_PLATFORM_BACKEND */
#if HAVE_DRIVER_BACKEND
#ifdef HAVE_DRIVER_BACKEND
static const struct hidapi_backend DRIVER_Backend = {
(void *)DRIVER_hid_write,
(void *)DRIVER_hid_read_timeout,
@ -958,7 +958,7 @@ struct SDL_hid_device_
};
static char device_magic;
#if HAVE_PLATFORM_BACKEND || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB)
#if defined(HAVE_PLATFORM_BACKEND) || defined(HAVE_DRIVER_BACKEND) || defined(HAVE_LIBUSB)
static SDL_hid_device *
CreateHIDDeviceWrapper(void *device, const struct hidapi_backend *backend)
@ -985,8 +985,8 @@ DeleteHIDDeviceWrapper(SDL_hid_device *device)
return retval; \
}
#if !SDL_HIDAPI_DISABLED
#if HAVE_PLATFORM_BACKEND || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB)
#ifndef SDL_HIDAPI_DISABLED
#if defined(HAVE_PLATFORM_BACKEND) || defined(HAVE_DRIVER_BACKEND) || defined(HAVE_LIBUSB)
#define COPY_IF_EXISTS(var) \
if (pSrc->var != NULL) { \
@ -1134,9 +1134,9 @@ int SDL_hid_init(void)
}
#endif /* HAVE_LIBUSB */
#if HAVE_PLATFORM_BACKEND
#ifdef HAVE_PLATFORM_BACKEND
++attempts;
#if __LINUX__
#ifdef __LINUX__
udev_ctx = SDL_UDEV_GetUdevSyms();
#endif /* __LINUX __ */
if (udev_ctx && PLATFORM_hid_init() == 0) {
@ -1165,15 +1165,15 @@ int SDL_hid_exit(void)
}
SDL_hidapi_refcount = 0;
#if !SDL_HIDAPI_DISABLED
#ifndef SDL_HIDAPI_DISABLED
HIDAPI_ShutdownDiscovery();
#endif
#if HAVE_PLATFORM_BACKEND
#ifdef HAVE_PLATFORM_BACKEND
if (udev_ctx) {
result |= PLATFORM_hid_exit();
}
#if __LINUX__
#ifdef __LINUX__
SDL_UDEV_ReleaseUdevSyms();
#endif /* __LINUX __ */
#endif /* HAVE_PLATFORM_BACKEND */
@ -1195,7 +1195,7 @@ Uint32 SDL_hid_device_change_count(void)
{
Uint32 counter = 0;
#if !SDL_HIDAPI_DISABLED
#ifndef SDL_HIDAPI_DISABLED
if (SDL_hidapi_refcount == 0 && SDL_hid_init() != 0) {
return 0;
}
@ -1215,16 +1215,16 @@ Uint32 SDL_hid_device_change_count(void)
struct SDL_hid_device_info *SDL_hid_enumerate(unsigned short vendor_id, unsigned short product_id)
{
#if HAVE_PLATFORM_BACKEND || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB)
#if defined(HAVE_PLATFORM_BACKEND) || defined(HAVE_DRIVER_BACKEND) || defined(HAVE_LIBUSB)
#ifdef HAVE_LIBUSB
struct SDL_hid_device_info *usb_devs = NULL;
struct SDL_hid_device_info *usb_dev;
#endif
#if HAVE_DRIVER_BACKEND
#ifdef HAVE_DRIVER_BACKEND
struct SDL_hid_device_info *driver_devs = NULL;
struct SDL_hid_device_info *driver_dev;
#endif
#if HAVE_PLATFORM_BACKEND
#ifdef HAVE_PLATFORM_BACKEND
struct SDL_hid_device_info *raw_devs = NULL;
struct SDL_hid_device_info *raw_dev;
#endif
@ -1280,7 +1280,7 @@ struct SDL_hid_device_info *SDL_hid_enumerate(unsigned short vendor_id, unsigned
}
#endif /* HAVE_DRIVER_BACKEND */
#if HAVE_PLATFORM_BACKEND
#ifdef HAVE_PLATFORM_BACKEND
if (udev_ctx) {
raw_devs = PLATFORM_hid_enumerate(vendor_id, product_id);
#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)
{
#if HAVE_PLATFORM_BACKEND || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB)
#if defined(HAVE_PLATFORM_BACKEND) || defined(HAVE_DRIVER_BACKEND) || defined(HAVE_LIBUSB)
void *pDevice = NULL;
if (SDL_hidapi_refcount == 0 && SDL_hid_init() != 0) {
return NULL;
}
#if HAVE_PLATFORM_BACKEND
#if defined(HAVE_PLATFORM_BACKEND)
if (udev_ctx) {
pDevice = PLATFORM_hid_open(vendor_id, product_id, serial_number);
if (pDevice != NULL) {
@ -1384,7 +1384,7 @@ SDL_hid_device *SDL_hid_open(unsigned short vendor_id, unsigned short product_id
}
#endif /* HAVE_PLATFORM_BACKEND */
#if HAVE_DRIVER_BACKEND
#ifdef HAVE_DRIVER_BACKEND
pDevice = DRIVER_hid_open(vendor_id, product_id, serial_number);
if (pDevice != NULL) {
return CreateHIDDeviceWrapper(pDevice, &DRIVER_Backend);
@ -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 */)
{
#if HAVE_PLATFORM_BACKEND || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB)
#if defined(HAVE_PLATFORM_BACKEND) || defined(HAVE_DRIVER_BACKEND) || defined(HAVE_LIBUSB)
void *pDevice = NULL;
if (SDL_hidapi_refcount == 0 && SDL_hid_init() != 0) {
return NULL;
}
#if HAVE_PLATFORM_BACKEND
#if defined(HAVE_PLATFORM_BACKEND)
if (udev_ctx) {
pDevice = PLATFORM_hid_open_path(path, bExclusive);
if (pDevice != NULL) {
@ -1423,7 +1423,7 @@ SDL_hid_device *SDL_hid_open_path(const char *path, int bExclusive /* = false */
}
#endif /* HAVE_PLATFORM_BACKEND */
#if HAVE_DRIVER_BACKEND
#ifdef HAVE_DRIVER_BACKEND
pDevice = DRIVER_hid_open_path(path, bExclusive);
if (pDevice != NULL) {
return CreateHIDDeviceWrapper(pDevice, &DRIVER_Backend);
@ -1585,7 +1585,7 @@ int SDL_hid_get_indexed_string(SDL_hid_device *device, int string_index, wchar_t
void SDL_hid_ble_scan(SDL_bool active)
{
#if !SDL_HIDAPI_DISABLED && (__IOS__ || __TVOS__)
#if !defined(SDL_HIDAPI_DISABLED) && (defined(__IOS__) || defined(__TVOS__))
hid_ble_scan(active);
#endif
}