Path: blob/master/thirdparty/sdl/hidapi/SDL_hidapi_windows.h
9903 views
/*1Simple DirectMedia Layer2Copyright (C) 1997-2025 Sam Lantinga <[email protected]>34This software is provided 'as-is', without any express or implied5warranty. In no event will the authors be held liable for any damages6arising from the use of this software.78Permission is granted to anyone to use this software for any purpose,9including commercial applications, and to alter it and redistribute it10freely, subject to the following restrictions:11121. The origin of this software must not be misrepresented; you must not13claim that you wrote the original software. If you use this software14in a product, an acknowledgment in the product documentation would be15appreciated but is not required.162. Altered source versions must be plainly marked as such, and must not be17misrepresented as being the original software.183. This notice may not be removed or altered from any source distribution.19*/2021/* Define standard library functions in terms of SDL */2223/* #pragma push_macro/pop_macro works correctly only as of gcc >= 4.4.324clang-3.0 _seems_ to be OK. */25#pragma push_macro("calloc")26#pragma push_macro("free")27#pragma push_macro("malloc")28#pragma push_macro("memcmp")29#pragma push_macro("swprintf")30#pragma push_macro("towupper")31#pragma push_macro("wcscmp")32#pragma push_macro("_wcsdup")33#pragma push_macro("wcslen")34#pragma push_macro("wcsncpy")35#pragma push_macro("wcsstr")36#pragma push_macro("wcstol")3738#undef calloc39#undef free40#undef malloc41#undef memcmp42#undef swprintf43#undef towupper44#undef wcscmp45#undef _wcsdup46#undef wcslen47#undef wcsncpy48#undef wcsstr49#undef wcstol5051#define calloc SDL_calloc52#define free SDL_free53#define malloc SDL_malloc54#define memcmp SDL_memcmp55#define swprintf SDL_swprintf56#define towupper (wchar_t)SDL_toupper57#define wcscmp SDL_wcscmp58#define _wcsdup SDL_wcsdup59#define wcslen SDL_wcslen60#define wcsncpy SDL_wcslcpy61#define wcsstr SDL_wcsstr62#define wcstol SDL_wcstol6364// These functions conflict when linking both SDL and hidapi statically65#define hid_winapi_descriptor_reconstruct_pp_data SDL_hid_winapi_descriptor_reconstruct_pp_data66#define hid_winapi_get_container_id SDL_hid_winapi_get_container_id6768#undef HIDAPI_H__69#include "windows/hid.c"70#define HAVE_PLATFORM_BACKEND 171#define udev_ctx 17273/* restore libc function macros */74#pragma pop_macro("calloc")75#pragma pop_macro("free")76#pragma pop_macro("malloc")77#pragma pop_macro("memcmp")78#pragma pop_macro("swprintf")79#pragma pop_macro("towupper")80#pragma pop_macro("wcscmp")81#pragma pop_macro("_wcsdup")82#pragma pop_macro("wcslen")83#pragma pop_macro("wcsncpy")84#pragma pop_macro("wcsstr")85#pragma pop_macro("wcstol")868788