|
2 | 2 |
|
3 | 3 | use num_traits::Float;
|
4 | 4 |
|
| 5 | +use libloading::Library; |
5 | 6 | use std::cell::UnsafeCell;
|
6 | 7 | use std::error::Error;
|
7 | 8 | use std::ffi::CString;
|
| 9 | +use std::mem::MaybeUninit; |
| 10 | +use std::os::raw::c_void; |
8 | 11 | use std::path::Path;
|
9 | 12 | use std::sync::{Arc, Mutex};
|
10 |
| -use std::{fmt, mem, ptr, slice}; |
11 |
| - |
12 |
| -use libloading::Library; |
13 |
| -use std::os::raw::c_void; |
| 13 | +use std::{fmt, ptr, slice}; |
14 | 14 |
|
15 | 15 | use api::consts::*;
|
16 | 16 | use api::{self, AEffect, PluginFlags, PluginMain, Supported, TimeInfo};
|
@@ -563,21 +563,21 @@ impl Plugin for PluginInstance {
|
563 | 563 | }
|
564 | 564 |
|
565 | 565 | fn get_input_info(&self, input: i32) -> ChannelInfo {
|
566 |
| - let mut props = unsafe { mem::uninitialized() }; |
567 |
| - let ptr = &mut props as *mut api::ChannelProperties as *mut c_void; |
| 566 | + let mut props: MaybeUninit<api::ChannelProperties> = MaybeUninit::uninit(); |
| 567 | + let ptr = props.as_mut_ptr() as *mut c_void; |
568 | 568 |
|
569 | 569 | self.dispatch(plugin::OpCode::GetInputInfo, input, 0, ptr, 0.0);
|
570 | 570 |
|
571 |
| - ChannelInfo::from(props) |
| 571 | + ChannelInfo::from(unsafe { props.assume_init() }) |
572 | 572 | }
|
573 | 573 |
|
574 | 574 | fn get_output_info(&self, output: i32) -> ChannelInfo {
|
575 |
| - let mut props = unsafe { mem::uninitialized() }; |
576 |
| - let ptr = &mut props as *mut api::ChannelProperties as *mut c_void; |
| 575 | + let mut props: MaybeUninit<api::ChannelProperties> = MaybeUninit::uninit(); |
| 576 | + let ptr = props.as_mut_ptr() as *mut c_void; |
577 | 577 |
|
578 | 578 | self.dispatch(plugin::OpCode::GetOutputInfo, output, 0, ptr, 0.0);
|
579 | 579 |
|
580 |
| - ChannelInfo::from(props) |
| 580 | + ChannelInfo::from(unsafe { props.assume_init() }) |
581 | 581 | }
|
582 | 582 |
|
583 | 583 | fn get_parameter_object(&mut self) -> Arc<dyn PluginParameters> {
|
|
0 commit comments