diff --git a/plib/src/lib.rs b/plib/src/lib.rs index b7308190..3d4c4b11 100644 --- a/plib/src/lib.rs +++ b/plib/src/lib.rs @@ -12,6 +12,7 @@ pub mod io; pub mod modestr; pub mod testing; pub mod utmpx; +pub mod lzw; pub const PROJECT_NAME: &'static str = "posixutils-rs"; diff --git a/xform/src/lzw.rs b/plib/src/lzw.rs similarity index 99% rename from xform/src/lzw.rs rename to plib/src/lzw.rs index f6748426..91fc55bf 100644 --- a/xform/src/lzw.rs +++ b/plib/src/lzw.rs @@ -67,10 +67,6 @@ fn max_code(n_bits: u32) -> u32 { (1 << (n_bits)) - 1 } -fn maxmax_code(max_bits: u32) -> i32 { - (1 << max_bits) as i32 -} - pub struct UnixLZWReader { /// the reader of the compressed file or the file to be compressed rdr: CompReader, diff --git a/xform/src/compress.rs b/xform/src/compress.rs index 1f1c9b54..b22b4221 100644 --- a/xform/src/compress.rs +++ b/xform/src/compress.rs @@ -7,16 +7,16 @@ // SPDX-License-Identifier: MIT // -mod lzw; - use clap::Parser; use gettextrs::{bind_textdomain_codeset, gettext, textdomain}; -use lzw::UnixLZWWriter; +use plib::lzw::UnixLZWWriter; use plib::PROJECT_NAME; use std::fs::{self, File}; use std::io::{self, Write}; use std::path::{Path, PathBuf}; + const NAME_MAX: usize = 255; + /// compress - compress data #[derive(Parser, Debug)] #[command(author, version, about, long_about)] diff --git a/xform/src/uncompress.rs b/xform/src/uncompress.rs index 4790a23a..0646075a 100644 --- a/xform/src/uncompress.rs +++ b/xform/src/uncompress.rs @@ -14,11 +14,9 @@ extern crate clap; extern crate plib; -mod lzw; - use clap::Parser; use gettextrs::{bind_textdomain_codeset, textdomain}; -use lzw::UnixLZWReader; +use plib::lzw::UnixLZWReader; use plib::PROJECT_NAME; use std::io::{self, Write}; use std::path::PathBuf; diff --git a/xform/tests/integration.rs b/xform/tests/integration.rs index e843598a..fc8b0dac 100644 --- a/xform/tests/integration.rs +++ b/xform/tests/integration.rs @@ -118,7 +118,7 @@ fn test_compression_compress_file() { fs::copy(&source_file, &file).unwrap(); let mut buf = String::new(); - let file_contents = File::open(&file).unwrap().read_to_string(&mut buf); + let _file_contents = File::open(&file).unwrap().read_to_string(&mut buf); let compressed_file_path = cargo_manifest_dir.join("tests/compress/compression.txt.Z");