Fix most warnings

This commit is contained in:
Pierre Krieger 2016-08-12 17:57:06 +02:00
parent 71e94bb6d1
commit b1add0b12b
3 changed files with 2 additions and 9 deletions

View File

@ -1,7 +1,5 @@
extern crate cpal; extern crate cpal;
use cpal::*;
fn main() { fn main() {
let endpoints = cpal::get_endpoints_list(); let endpoints = cpal::get_endpoints_list();

View File

@ -37,7 +37,6 @@ fn check_result(result: winapi::HRESULT) -> Result<(), IoError> {
/// Wrapper because of that stupid decision to remove `Send` and `Sync` from raw pointers. /// Wrapper because of that stupid decision to remove `Send` and `Sync` from raw pointers.
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
#[allow(raw_pointer_derive)]
struct IAudioClientWrapper(*mut winapi::IAudioClient); struct IAudioClientWrapper(*mut winapi::IAudioClient);
unsafe impl Send for IAudioClientWrapper {} unsafe impl Send for IAudioClientWrapper {}
unsafe impl Sync for IAudioClientWrapper {} unsafe impl Sync for IAudioClientWrapper {}

View File

@ -5,11 +5,9 @@ use super::winapi;
use super::Endpoint; use super::Endpoint;
use super::check_result; use super::check_result;
use std::cmp;
use std::slice; use std::slice;
use std::mem; use std::mem;
use std::ptr; use std::ptr;
use std::marker::PhantomData;
use std::sync::atomic::AtomicBool; use std::sync::atomic::AtomicBool;
use std::sync::atomic::Ordering; use std::sync::atomic::Ordering;
use std::sync::Arc; use std::sync::Arc;
@ -221,7 +219,7 @@ impl Voice {
} }
match check_result((*audio_client).SetEventHandle(event)) { match check_result((*audio_client).SetEventHandle(event)) {
Err(e) => { Err(_) => {
(*audio_client).Release(); (*audio_client).Release();
panic!("Failed to call SetEventHandle") panic!("Failed to call SetEventHandle")
}, },
@ -333,7 +331,7 @@ impl Stream for SamplesStream {
type Item = UnknownTypeBuffer; type Item = UnknownTypeBuffer;
type Error = (); type Error = ();
fn poll(&mut self, task: &mut Task) -> Poll<Option<Self::Item>, Self::Error> { fn poll(&mut self, _: &mut Task) -> Poll<Option<Self::Item>, Self::Error> {
unsafe { unsafe {
if self.ready.swap(false, Ordering::Relaxed) == false { if self.ready.swap(false, Ordering::Relaxed) == false {
let result = kernel32::WaitForSingleObject(self.event, 0); let result = kernel32::WaitForSingleObject(self.event, 0);
@ -356,8 +354,6 @@ impl Stream for SamplesStream {
self.max_frames_in_buffer - padding self.max_frames_in_buffer - padding
}; };
assert!(frames_available >= 0);
// Obtaining a pointer to the buffer. // Obtaining a pointer to the buffer.
let (buffer_data, buffer_len) = { let (buffer_data, buffer_len) = {
let mut buffer: *mut winapi::BYTE = mem::uninitialized(); let mut buffer: *mut winapi::BYTE = mem::uninitialized();