Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/thirdparty/sdl/hidapi/SDL_hidapi_windows.h
9903 views
1
/*
2
Simple DirectMedia Layer
3
Copyright (C) 1997-2025 Sam Lantinga <[email protected]>
4
5
This software is provided 'as-is', without any express or implied
6
warranty. In no event will the authors be held liable for any damages
7
arising from the use of this software.
8
9
Permission is granted to anyone to use this software for any purpose,
10
including commercial applications, and to alter it and redistribute it
11
freely, subject to the following restrictions:
12
13
1. The origin of this software must not be misrepresented; you must not
14
claim that you wrote the original software. If you use this software
15
in a product, an acknowledgment in the product documentation would be
16
appreciated but is not required.
17
2. Altered source versions must be plainly marked as such, and must not be
18
misrepresented as being the original software.
19
3. This notice may not be removed or altered from any source distribution.
20
*/
21
22
/* Define standard library functions in terms of SDL */
23
24
/* #pragma push_macro/pop_macro works correctly only as of gcc >= 4.4.3
25
clang-3.0 _seems_ to be OK. */
26
#pragma push_macro("calloc")
27
#pragma push_macro("free")
28
#pragma push_macro("malloc")
29
#pragma push_macro("memcmp")
30
#pragma push_macro("swprintf")
31
#pragma push_macro("towupper")
32
#pragma push_macro("wcscmp")
33
#pragma push_macro("_wcsdup")
34
#pragma push_macro("wcslen")
35
#pragma push_macro("wcsncpy")
36
#pragma push_macro("wcsstr")
37
#pragma push_macro("wcstol")
38
39
#undef calloc
40
#undef free
41
#undef malloc
42
#undef memcmp
43
#undef swprintf
44
#undef towupper
45
#undef wcscmp
46
#undef _wcsdup
47
#undef wcslen
48
#undef wcsncpy
49
#undef wcsstr
50
#undef wcstol
51
52
#define calloc SDL_calloc
53
#define free SDL_free
54
#define malloc SDL_malloc
55
#define memcmp SDL_memcmp
56
#define swprintf SDL_swprintf
57
#define towupper (wchar_t)SDL_toupper
58
#define wcscmp SDL_wcscmp
59
#define _wcsdup SDL_wcsdup
60
#define wcslen SDL_wcslen
61
#define wcsncpy SDL_wcslcpy
62
#define wcsstr SDL_wcsstr
63
#define wcstol SDL_wcstol
64
65
// These functions conflict when linking both SDL and hidapi statically
66
#define hid_winapi_descriptor_reconstruct_pp_data SDL_hid_winapi_descriptor_reconstruct_pp_data
67
#define hid_winapi_get_container_id SDL_hid_winapi_get_container_id
68
69
#undef HIDAPI_H__
70
#include "windows/hid.c"
71
#define HAVE_PLATFORM_BACKEND 1
72
#define udev_ctx 1
73
74
/* restore libc function macros */
75
#pragma pop_macro("calloc")
76
#pragma pop_macro("free")
77
#pragma pop_macro("malloc")
78
#pragma pop_macro("memcmp")
79
#pragma pop_macro("swprintf")
80
#pragma pop_macro("towupper")
81
#pragma pop_macro("wcscmp")
82
#pragma pop_macro("_wcsdup")
83
#pragma pop_macro("wcslen")
84
#pragma pop_macro("wcsncpy")
85
#pragma pop_macro("wcsstr")
86
#pragma pop_macro("wcstol")
87
88