Fix clippy::ptr_offset_with_cast

This commit is contained in:
Zhiming Wang 2020-07-26 01:01:21 +08:00
parent 73b66ea438
commit c9c6031a53
No known key found for this signature in database
GPG Key ID: 5B58F95EC95965D8
5 changed files with 5 additions and 11 deletions

View File

@ -16,9 +16,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)
}
}

View File

@ -26,9 +26,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)
}
}

View File

@ -16,7 +16,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)
}
}

View File

@ -24,9 +24,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)
}
}

View File

@ -185,7 +185,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) }
}
}