Merge pull request #419 from ely-uf/chore/cleanup-coreaudio-warnings

Fix CoreAudio warnings.
This commit is contained in:
mitchmindtree 2020-05-26 11:58:12 +02:00 committed by GitHub
commit 713eddd89a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 5 deletions

View File

@ -181,7 +181,7 @@ impl Device {
let err = BackendSpecificError { description }; let err = BackendSpecificError { description };
return Err(err.into()); return Err(err.into());
} }
let name: &CStr = unsafe { CStr::from_ptr(buf.as_ptr()) }; let name: &CStr = CStr::from_ptr(buf.as_ptr());
return Ok(name.to_str().unwrap().to_owned()); return Ok(name.to_str().unwrap().to_owned());
} }
CStr::from_ptr(c_string as *mut _) CStr::from_ptr(c_string as *mut _)
@ -327,7 +327,7 @@ impl Device {
Err(DefaultStreamConfigError::DeviceNotAvailable) Err(DefaultStreamConfigError::DeviceNotAvailable)
} }
err => { err => {
let description = format!("{}", std::error::Error::description(&err)); let description = format!("{}", err);
let err = BackendSpecificError { description }; let err = BackendSpecificError { description };
Err(err.into()) Err(err.into())
} }
@ -408,6 +408,7 @@ struct StreamInner {
// //
// We must do this so that we can avoid changing the device sample rate if there is already // We must do this so that we can avoid changing the device sample rate if there is already
// a stream associated with the device. // a stream associated with the device.
#[allow(dead_code)]
device_id: AudioDeviceID, device_id: AudioDeviceID,
} }
@ -813,7 +814,7 @@ impl StreamTrait for Stream {
if !stream.playing { if !stream.playing {
if let Err(e) = stream.audio_unit.start() { if let Err(e) = stream.audio_unit.start() {
let description = format!("{}", std::error::Error::description(&e)); let description = format!("{}", e);
let err = BackendSpecificError { description }; let err = BackendSpecificError { description };
return Err(err.into()); return Err(err.into());
} }
@ -827,7 +828,7 @@ impl StreamTrait for Stream {
if stream.playing { if stream.playing {
if let Err(e) = stream.audio_unit.stop() { if let Err(e) = stream.audio_unit.stop() {
let description = format!("{}", std::error::Error::description(&e)); let description = format!("{}", e);
let err = BackendSpecificError { description }; let err = BackendSpecificError { description };
return Err(err.into()); return Err(err.into());
} }
@ -842,7 +843,7 @@ fn check_os_status(os_status: OSStatus) -> Result<(), BackendSpecificError> {
match coreaudio::Error::from_os_status(os_status) { match coreaudio::Error::from_os_status(os_status) {
Ok(()) => Ok(()), Ok(()) => Ok(()),
Err(err) => { Err(err) => {
let description = std::error::Error::description(&err).to_string(); let description = err.to_string();
Err(BackendSpecificError { description }) Err(BackendSpecificError { description })
} }
} }