Skip to content

Commit 7f876b1

Browse files
fix: add missing packed(4) for asio time structs (#1041)
1 parent a8269d3 commit 7f876b1

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- ALSA: Update `alsa` to 0.10.
1111
- ALSA(process_output): Pass `silent=true` to `PCM.try_recover`, so it doesn't write to stderr.
1212
- ASIO: Fix linker flags for MinGW cross-compilation.
13+
- ASIO: Add packed(4) to representation of ASIO time structs in bindings.
1314
- CI: Added native ARM64 Linux support in GitHub Actions.
1415
- CI: Fix cargo publish to trigger on GitHub releases instead of every master commit.
1516
- CI: Replace cargo install commands with cached tool installation for faster builds.

asio-sys/src/bindings/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ pub enum AsioSampleType {
161161
/// Gives information about buffers
162162
/// Receives pointers to buffers
163163
#[derive(Debug, Copy, Clone)]
164-
#[repr(C)]
164+
#[repr(C, packed(4))]
165165
pub struct AsioBufferInfo {
166166
/// 0 for output 1 for input
167167
pub is_input: c_long,
@@ -172,7 +172,7 @@ pub struct AsioBufferInfo {
172172
}
173173

174174
/// Callbacks that ASIO calls
175-
#[repr(C)]
175+
#[repr(C, packed(4))]
176176
struct AsioCallbacks {
177177
buffer_switch: extern "C" fn(double_buffer_index: c_long, direct_process: c_long) -> (),
178178
sample_rate_did_change: extern "C" fn(s_rate: c_double) -> (),
@@ -244,7 +244,7 @@ pub enum AsioMessageSelectors {
244244
}
245245

246246
/// A rust-usable version of the `ASIOTime` type that does not contain a binary blob for fields.
247-
#[repr(C)]
247+
#[repr(C, packed(4))]
248248
pub struct AsioTime {
249249
/// Must be `0`.
250250
pub reserved: [c_long; 4],
@@ -256,7 +256,7 @@ pub struct AsioTime {
256256

257257
/// A rust-compatible version of the `ASIOTimeInfo` type that does not contain a binary blob for
258258
/// fields.
259-
#[repr(C)]
259+
#[repr(C, packed(4))]
260260
pub struct AsioTimeInfo {
261261
/// Absolute speed (1. = nominal).
262262
pub speed: c_double,
@@ -276,7 +276,7 @@ pub struct AsioTimeInfo {
276276

277277
/// A rust-compatible version of the `ASIOTimeCode` type that does not use a binary blob for its
278278
/// fields.
279-
#[repr(C)]
279+
#[repr(C, packed(4))]
280280
pub struct AsioTimeCode {
281281
/// Speed relation (fraction of nominal speed) optional.
282282
///

0 commit comments

Comments
 (0)