5
0
mirror of git://git.proxmox.com/git/pxar.git synced 2024-12-22 21:33:50 +03:00

use #![deny(unsafe_op_in_unsafe_fn)]

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2021-11-12 13:52:00 +01:00
parent 04eccc8e53
commit 609e3a633f
3 changed files with 12 additions and 8 deletions

View File

@ -125,7 +125,9 @@ impl<T: Clone + ReadAt> Accessor<T> {
/// This should only be used with offsets known to point to the end of a directory, otherwise
/// this usually fails, unless the data otherwise happens to look like a valid directory.
pub async unsafe fn open_dir_at_end(&self, offset: u64) -> io::Result<Directory<T>> {
Ok(Directory::new(self.inner.open_dir_at_end(offset).await?))
Ok(Directory::new(unsafe {
self.inner.open_dir_at_end(offset).await?
}))
}
/// Allow opening a regular file from a specified range.
@ -139,7 +141,7 @@ impl<T: Clone + ReadAt> Accessor<T> {
entry_range_info: &accessor::EntryRangeInfo,
) -> io::Result<FileEntry<T>> {
Ok(FileEntry {
inner: self.inner.open_file_at_range(entry_range_info).await?,
inner: unsafe { self.inner.open_file_at_range(entry_range_info).await? },
})
}
@ -151,7 +153,7 @@ impl<T: Clone + ReadAt> Accessor<T> {
/// comes from a actual file entry data, the contents might not make much sense.
pub unsafe fn open_contents_at_range(&self, range: Range<u64>) -> FileContents<T> {
FileContents {
inner: self.inner.open_contents_at_range(range),
inner: unsafe { self.inner.open_contents_at_range(range) },
at: 0,
buffer: Vec::new(),
future: None,

View File

@ -116,9 +116,9 @@ impl<T: Clone + ReadAt> Accessor<T> {
/// This should only be used with offsets known to point to the end of a directory, otherwise
/// this usually fails, unless the data otherwise happens to look like a valid directory.
pub unsafe fn open_dir_at_end(&self, offset: u64) -> io::Result<Directory<T>> {
Ok(Directory::new(poll_result_once(
self.inner.open_dir_at_end(offset),
)?))
Ok(Directory::new(poll_result_once(unsafe {
self.inner.open_dir_at_end(offset)
})?))
}
/// Allow opening a regular file from a specified range.
@ -132,7 +132,7 @@ impl<T: Clone + ReadAt> Accessor<T> {
entry_range_info: &accessor::EntryRangeInfo,
) -> io::Result<FileEntry<T>> {
Ok(FileEntry {
inner: poll_result_once(self.inner.open_file_at_range(entry_range_info))?,
inner: poll_result_once(unsafe { self.inner.open_file_at_range(entry_range_info) })?,
})
}
@ -144,7 +144,7 @@ impl<T: Clone + ReadAt> Accessor<T> {
/// comes from a actual file entry data, the contents might not make much sense.
pub unsafe fn open_contents_at_range(&self, range: Range<u64>) -> FileContents<T> {
FileContents {
inner: self.inner.open_contents_at_range(range),
inner: unsafe { self.inner.open_contents_at_range(range) },
at: 0,
}
}

View File

@ -2,6 +2,8 @@
//!
//! This implements a reader and writer for the proxmox archive format (.pxar).
#![deny(unsafe_op_in_unsafe_fn)]
use std::ffi::OsStr;
use std::mem;
use std::path::{Path, PathBuf};