Skip to content

Commit

Permalink
Merge 1dea596 into ca3e060
Browse files Browse the repository at this point in the history
  • Loading branch information
wcampbell0x2a authored Dec 29, 2023
2 parents ca3e060 + 1dea596 commit 1afb005
Show file tree
Hide file tree
Showing 11 changed files with 180 additions and 175 deletions.
110 changes: 54 additions & 56 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions backhand-cli/src/bin/replace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ fn main() -> ExitCode {
}

// write new file
let output = File::create(&args.out).unwrap();
filesystem.write(output).unwrap();
let mut output = File::create(&args.out).unwrap();
filesystem.write(&mut output).unwrap();
println!("replaced file and wrote to {}", args.out.display());

ExitCode::SUCCESS
Expand Down
2 changes: 1 addition & 1 deletion backhand-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ bench = false
[features]
# testing only feature for testing vs squashfs-tools/unsquashfs
__test_unsquashfs = []
default = ["backhand-cli/xz", "backhand-cli/gzip", "backhand-cli/zstd"]
default = ["xz", "gzip", "zstd"]
xz = ["backhand-cli/xz"]
xz-static = ["backhand-cli/xz-static"]
gzip = ["backhand-cli/gzip"]
Expand Down
4 changes: 2 additions & 2 deletions backhand/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ description = "Library for the reading, creating, and modification of SquashFS f

[dependencies]
# for lib
deku = "0.16.0"
deku = { git = "https://github.com/sharksforarms/deku", branch = "impl-writer" }
tracing = "0.1.40"
thiserror = "1.0.52"
flate2 = { version = "1.0.28", optional = true }
Expand Down Expand Up @@ -53,4 +53,4 @@ all-features = true
rustdoc-args = ["--cfg", "docsrs"]

[lib]
bench = false
bench = false
6 changes: 3 additions & 3 deletions backhand/src/compressor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use crate::filesystem::writer::{CompressionExtra, FilesystemCompressor};

#[derive(Copy, Clone, Debug, PartialEq, Eq, DekuRead, DekuWrite, Default)]
#[deku(endian = "endian", ctx = "endian: deku::ctx::Endian")]
#[deku(type = "u16")]
#[deku(id_type = "u16")]
#[rustfmt::skip]
pub enum Compressor {
None = 0,
Expand Down Expand Up @@ -83,9 +83,9 @@ pub struct Xz {
// TODO: in openwrt, git-hash:f97ad870e11ebe5f3dcf833dda6c83b9165b37cb shows that before
// offical squashfs-tools had xz support they had the dictionary_size field as the last field
// in this struct. If we get test images, I guess we can support this in the future.
#[deku(cond = "!deku::rest.is_empty()")]
#[deku(cond = "!deku::reader.end()")]
pub bit_opts: Option<u16>,
#[deku(cond = "!deku::rest.is_empty()")]
#[deku(cond = "!deku::reader.end()")]
pub fb: Option<u16>,
}

Expand Down
4 changes: 2 additions & 2 deletions backhand/src/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ impl<'a> DataWriter<'a> {
pub(crate) fn just_copy_it<W: WriteSeek>(
&mut self,
mut reader: SquashfsRawData,
mut writer: W,
writer: &mut W,
) -> Result<(usize, Added), BackhandError> {
//just clone it, because block sizes where never modified, just copy it
let mut block_sizes = reader.file.basic.block_sizes.clone();
Expand Down Expand Up @@ -181,7 +181,7 @@ impl<'a> DataWriter<'a> {
pub(crate) fn add_bytes<W: WriteSeek>(
&mut self,
reader: impl Read,
mut writer: W,
writer: &mut W,
) -> Result<(usize, Added), BackhandError> {
let mut chunk_reader = DataWriterChunkReader {
chunk: vec![0u8; self.block_size as usize],
Expand Down
Loading

0 comments on commit 1afb005

Please sign in to comment.