Commit 3f14f6f
committed
fix: support compiling on Windows ARM64
`libc::c_char` in Rust differs by target architecture:
- On most platforms (x86-64 Windows, Linux, macOS) it is `i8`.
- On Windows ARM64 (AArch64) it is `u8`.
This change unconditionally casts pointers with `as *const _`:
- On Windows ARM64, this converts `*const i8` to `*const u8` (or vice versa), resolving the type mismatch that caused compilation to fail.
- On other platforms, the cast is effectively a no-op but ensures the code compiles everywhere.
`CStr::from_ptr` only requires a pointer to a null-terminated byte sequence.
The underlying representation of `i8` and `u8` is identical, so the cast is
sound.1 parent 4862ffb commit 3f14f6f
2 files changed
+4
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
220 | | - | |
| 220 | + | |
221 | 221 | | |
222 | 222 | | |
223 | 223 | | |
| |||
282 | 282 | | |
283 | 283 | | |
284 | 284 | | |
285 | | - | |
| 285 | + | |
286 | 286 | | |
287 | 287 | | |
288 | 288 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
259 | 259 | | |
260 | 260 | | |
261 | 261 | | |
262 | | - | |
| 262 | + | |
263 | 263 | | |
264 | 264 | | |
265 | 265 | | |
| |||
326 | 326 | | |
327 | 327 | | |
328 | 328 | | |
329 | | - | |
| 329 | + | |
330 | 330 | | |
331 | 331 | | |
332 | 332 | | |
| |||
0 commit comments