Skip to content

Commit

Permalink
Fix RxStream::read API to not write through a shared reference (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinmehall committed Sep 13, 2023
1 parent b0b1828 commit 4d61a64
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/bin/soapy-sdr-stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ fn main() {

while num > 0 && !sb.caught() {
let read_size = min(num as usize, buf.len());
let len = stream.read(&[&mut buf[..read_size]], 1_000_000).expect("read failed");
let len = stream.read(&mut [&mut buf[..read_size]], 1_000_000).expect("read failed");
write_cfile(&buf[..len], &mut outfile).unwrap();
num -= len as i64;
}
Expand Down
2 changes: 1 addition & 1 deletion src/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@ impl<E: StreamSample> RxStream<E> {
///
/// # Panics
/// * If `buffers` is not the same length as the `channels` array passed to `Device::rx_stream`.
pub fn read(&mut self, buffers: &[&mut[E]], timeout_us: i64) -> Result<usize, Error> {
pub fn read(&mut self, buffers: &mut [&mut [E]], timeout_us: i64) -> Result<usize, Error> {
unsafe {
assert!(buffers.len() == self.nchannels);

Expand Down

0 comments on commit 4d61a64

Please sign in to comment.