fix: formatting

This commit is contained in:
DecDuck
2026-03-02 22:11:49 +11:00
parent 69e5268410
commit b1949d952d
6 changed files with 29 additions and 16 deletions
+1 -1
View File
@@ -3,8 +3,8 @@ use std::ffi::{CStr, CString};
use std::path::PathBuf;
use std::str;
use libarchive3_sys::ffi;
use error::ErrCode;
use libarchive3_sys::ffi;
pub enum ReadCompression {
All,
+1 -1
View File
@@ -1,6 +1,6 @@
use archive;
use std::error;
use std::fmt;
use archive;
pub type ArchiveResult<T> = Result<T, ArchiveError>;
+1 -1
View File
@@ -1,5 +1,5 @@
extern crate libc;
extern crate libarchive3_sys;
extern crate libc;
pub mod archive;
pub mod error;
+11 -8
View File
@@ -1,13 +1,13 @@
use std::default::Default;
use std::ffi::CString;
use std::path::Path;
use std::ptr;
use std::ffi::CString;
use libarchive3_sys::ffi;
use archive::{Entry, ExtractOptions, Handle, WriteFilter, WriteFormat};
use error::{ArchiveError, ArchiveResult};
use reader::{Reader, ReaderEntry};
use error::{ArchiveResult, ArchiveError};
pub struct Writer {
handle: *mut ffi::Struct_archive,
@@ -159,14 +159,17 @@ impl Disk {
unsafe {
loop {
match ffi::archive_read_data_block(reader.handle(),
&mut buff,
&mut size,
&mut offset) {
match ffi::archive_read_data_block(
reader.handle(),
&mut buff,
&mut size,
&mut offset,
) {
ffi::ARCHIVE_EOF => return Ok(size),
ffi::ARCHIVE_OK => {
if ffi::archive_write_data_block(self.handle, buff, size, offset) !=
ffi::ARCHIVE_OK as isize {
if ffi::archive_write_data_block(self.handle, buff, size, offset)
!= ffi::ARCHIVE_OK as isize
{
return Err(ArchiveError::from(self as &Handle));
}
}
+7 -4
View File
@@ -2,10 +2,10 @@ extern crate libarchive;
pub mod util;
use std::fs::File;
use libarchive::archive::{self, ReadFilter, ReadFormat};
use libarchive::reader::{self, Reader};
use libarchive::writer;
use std::fs::File;
#[test]
fn reading_from_file() {
@@ -37,11 +37,14 @@ fn read_archive_from_stream() {
Ok(mut reader) => {
assert_eq!(reader.header_position(), 0);
let writer = writer::Disk::new();
let count = writer.write(&mut reader, Some("/opt/bldr/fucks")).ok().unwrap();
let count = writer
.write(&mut reader, Some("/opt/bldr/fucks"))
.ok()
.unwrap();
assert_eq!(count, 14);
assert_eq!(reader.header_position(), 1024);
assert_eq!(4, 4);
},
}
Err(e) => {
println!("{:?}", e);
}
@@ -92,7 +95,7 @@ fn extracting_a_reader_twice() {
println!("{:?}", reader.header_position());
match writer.write(&mut reader, None) {
Ok(_) => println!("oops"),
Err(_) => println!("nice")
Err(_) => println!("nice"),
}
assert_eq!(4, 4)
}
+8 -1
View File
@@ -6,7 +6,14 @@ pub fn exe_path() -> PathBuf {
}
pub fn root() -> PathBuf {
exe_path().parent().unwrap().parent().unwrap().parent().unwrap().join("tests")
exe_path()
.parent()
.unwrap()
.parent()
.unwrap()
.parent()
.unwrap()
.join("tests")
}
pub fn fixtures() -> PathBuf {