Skip to content

uncompress/lzw warning fixes #103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions plib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
4 changes: 0 additions & 4 deletions xform/src/lzw.rs → plib/src/lzw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions xform/src/compress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
4 changes: 1 addition & 3 deletions xform/src/uncompress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion xform/tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down