mirror of
https://github.com/encounter/rust-ffmpeg-zmwangx.git
synced 2026-07-10 21:18:40 -07:00
Fix clippy::ptr_offset_with_cast
This commit is contained in:
@@ -13,9 +13,7 @@ impl<'a> Chapter<'a> {
|
||||
}
|
||||
|
||||
pub unsafe fn as_ptr(&self) -> *const AVChapter {
|
||||
*(*self.context.as_ptr())
|
||||
.chapters
|
||||
.offset(self.index as isize)
|
||||
*(*self.context.as_ptr()).chapters.add(self.index)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,9 +23,7 @@ impl<'a> ChapterMut<'a> {
|
||||
}
|
||||
|
||||
pub unsafe fn as_mut_ptr(&mut self) -> *mut AVChapter {
|
||||
*(*self.context.as_mut_ptr())
|
||||
.chapters
|
||||
.offset(self.index as isize)
|
||||
*(*self.context.as_mut_ptr()).chapters.add(self.index)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ impl<'a> Stream<'a> {
|
||||
}
|
||||
|
||||
pub unsafe fn as_ptr(&self) -> *const AVStream {
|
||||
*(*self.context.as_ptr()).streams.offset(self.index as isize)
|
||||
*(*self.context.as_ptr()).streams.add(self.index)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,9 +21,7 @@ impl<'a> StreamMut<'a> {
|
||||
}
|
||||
|
||||
pub unsafe fn as_mut_ptr(&mut self) -> *mut AVStream {
|
||||
*(*self.context.as_mut_ptr())
|
||||
.streams
|
||||
.offset(self.index as isize)
|
||||
*(*self.context.as_mut_ptr()).streams.add(self.index)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -190,7 +190,7 @@ impl Index<usize> for Buffer {
|
||||
panic!("out of bounds");
|
||||
}
|
||||
|
||||
unsafe { slice::from_raw_parts(*self.buffer.offset(index as isize), self.size as usize) }
|
||||
unsafe { slice::from_raw_parts(*self.buffer.add(index), self.size as usize) }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user