mirror of
https://github.com/encounter/rust-ffmpeg-zmwangx.git
synced 2026-07-10 21:18:40 -07:00
Fix clippy::transmute_ptr_to_ptr
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
use std::{
|
||||
ffi::{CStr, CString},
|
||||
mem,
|
||||
ops::Index,
|
||||
ptr, slice,
|
||||
str::from_utf8_unchecked,
|
||||
};
|
||||
|
||||
use libc::c_int;
|
||||
use libc::{c_int, c_void};
|
||||
|
||||
use crate::ffi::{AVSampleFormat::*, *};
|
||||
|
||||
@@ -208,7 +207,7 @@ impl Clone for Buffer {
|
||||
unsafe {
|
||||
av_samples_copy(
|
||||
self.buffer,
|
||||
mem::transmute(source.buffer),
|
||||
source.buffer as *const *mut u8,
|
||||
0,
|
||||
0,
|
||||
source.samples as c_int,
|
||||
@@ -223,7 +222,7 @@ impl Drop for Buffer {
|
||||
#[inline]
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
av_freep(mem::transmute(self.buffer));
|
||||
av_freep(self.buffer as *mut c_void);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ impl Audio {
|
||||
panic!("unsupported type");
|
||||
}
|
||||
|
||||
unsafe { slice::from_raw_parts(mem::transmute((*self.as_ptr()).data[index]), self.samples()) }
|
||||
unsafe { slice::from_raw_parts((*self.as_ptr()).data[index] as *const T, self.samples()) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@@ -162,12 +162,7 @@ impl Audio {
|
||||
panic!("unsupported type");
|
||||
}
|
||||
|
||||
unsafe {
|
||||
slice::from_raw_parts_mut(
|
||||
mem::transmute((*self.as_mut_ptr()).data[index]),
|
||||
self.samples(),
|
||||
)
|
||||
}
|
||||
unsafe { slice::from_raw_parts_mut((*self.as_mut_ptr()).data[index] as *mut T, self.samples()) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
||||
@@ -267,7 +267,7 @@ impl Video {
|
||||
|
||||
unsafe {
|
||||
slice::from_raw_parts(
|
||||
mem::transmute((*self.as_ptr()).data[index]),
|
||||
(*self.as_ptr()).data[index] as *const T,
|
||||
self.stride(index) * self.plane_height(index) as usize / mem::size_of::<T>(),
|
||||
)
|
||||
}
|
||||
@@ -285,7 +285,7 @@ impl Video {
|
||||
|
||||
unsafe {
|
||||
slice::from_raw_parts_mut(
|
||||
mem::transmute((*self.as_mut_ptr()).data[index]),
|
||||
(*self.as_mut_ptr()).data[index] as *mut T,
|
||||
self.stride(index) * self.plane_height(index) as usize / mem::size_of::<T>(),
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user