mirror of
https://github.com/Drop-OSS/drop.git
synced 2026-06-22 04:11:32 +10:00
fix: formatting
This commit is contained in:
@@ -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,6 +1,6 @@
|
||||
use archive;
|
||||
use std::error;
|
||||
use std::fmt;
|
||||
use archive;
|
||||
|
||||
pub type ArchiveResult<T> = Result<T, ArchiveError>;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
extern crate libc;
|
||||
extern crate libarchive3_sys;
|
||||
extern crate libc;
|
||||
|
||||
pub mod archive;
|
||||
pub mod error;
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user