Commit 36996dd
committed
fix(dxinput): fix property reading and button mapping data processing
logic
- Replaced custom uchar array conversion function with C.GoBytes
to simplify data copying
- Modified get_prop function implementation to first obtain the
attribute data size, then read the data completely
- Corrected get_prop function parameters and comments; nbytes now
indicates byte length rather than item count
- Added free_prop_data function to release memory returned by
get_prop, preventing memory leaks
- Ensured proper release of C-allocated data after calling get_prop
to retrieve properties in the Go layer
- Removed unused maxBufferLen constant and the old ucharArrayToByte
implementation
Influence: Input Device Management
---
fix(dxinput): 修正属性读取和按钮映射数据处理逻辑
- 使用 C.GoBytes 替代自定义 uchar
数组转换函数简化数据拷贝
- 修改 get_prop
函数实现,先获取属性数据大小,再完整读取数据
- 修正 get_prop 函数参数和注释,nbytes
表示字节长度而非项目数
- 添加 free_prop_data 函数用于释放 get_prop
返回的内存,避免内存泄漏
- 在 Go 层调用 get_prop 获取属性后正确释放 C
分配的数据
- 删除无用的 maxBufferLen 常量和 ucharArrayToByte 旧实现
Influence: 输入设备管理功能1 parent f24ebfc commit 36996dd
4 files changed
+70
-45
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | | - | |
17 | 15 | | |
18 | 16 | | |
19 | 17 | | |
20 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | | - | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
30 | | - | |
31 | | - | |
| 31 | + | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| 36 | + | |
| 37 | + | |
35 | 38 | | |
36 | 39 | | |
37 | 40 | | |
| |||
54 | 57 | | |
55 | 58 | | |
56 | 59 | | |
57 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
58 | 63 | | |
59 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
60 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
61 | 97 | | |
62 | 98 | | |
63 | 99 | | |
64 | 100 | | |
65 | 101 | | |
66 | 102 | | |
67 | | - | |
68 | | - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
69 | 106 | | |
| 107 | + | |
70 | 108 | | |
71 | 109 | | |
72 | 110 | | |
73 | 111 | | |
74 | 112 | | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
75 | 125 | | |
76 | 126 | | |
77 | 127 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | 26 | | |
32 | 27 | | |
33 | 28 | | |
| |||
103 | 98 | | |
104 | 99 | | |
105 | 100 | | |
| 101 | + | |
106 | 102 | | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
116 | 107 | | |
117 | 108 | | |
| 109 | + | |
| 110 | + | |
118 | 111 | | |
119 | | - | |
120 | | - | |
| 112 | + | |
| 113 | + | |
121 | 114 | | |
122 | 115 | | |
123 | 116 | | |
| |||
196 | 189 | | |
197 | 190 | | |
198 | 191 | | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | 192 | | |
219 | 193 | | |
220 | 194 | | |
| |||
0 commit comments