Fix clippy::ptr_offset_with_cast

This commit is contained in:
Zhiming Wang
2021-03-19 15:41:43 +01:00
committed by meh
parent 0f389660c3
commit 808a92fb2e
5 changed files with 5 additions and 11 deletions
+1 -3
View File
@@ -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)
}
}
+1 -3
View File
@@ -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)
}
}
+1 -1
View File
@@ -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)
}
}
+1 -3
View File
@@ -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)
}
}
+1 -1
View File
@@ -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) }
}
}