From 211ece22654257aaa0130a1acbbe9e306ca6accc Mon Sep 17 00:00:00 2001 From: Trivernis Date: Sat, 14 Mar 2020 18:22:58 +0100 Subject: [PATCH] Update bdflib version --- Cargo.lock | 6 +++--- Cargo.toml | 2 +- src/main.rs | 7 ++----- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 20fae87..b4904b0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -53,7 +53,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "bdflib" -version = "0.1.5" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -222,7 +222,7 @@ name = "destools" version = "0.1.0" dependencies = [ "base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "bdflib 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "bdflib 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "cfb-mode 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "des 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -815,7 +815,7 @@ dependencies = [ "checksum atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" "checksum autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" "checksum base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" -"checksum bdflib 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ef9dbdad3b64cc71b2a43399e3ac54142bae88bc09d4e56fb9da9169b3f9ab9a" +"checksum bdflib 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3462a43309b1dcdf09f2158552e19e48b27ddf77cfdcbf28bf716153b5bcded0" "checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" "checksum blake2b_simd 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)" = "d8fb2d74254a3a0b5cac33ac9f8ed0e44aa50378d9dbb2e5d83bd21ed1dc2c8a" "checksum block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" diff --git a/Cargo.toml b/Cargo.toml index e4272ca..50c8ef5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,4 +19,4 @@ pbr = "1.0.2" spinners = "1.2.0" regex = "1.3.4" byteorder = "1.3.4" -bdflib = "0.1.0" \ No newline at end of file +bdflib = "0.2.0" \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 022ff5f..4731666 100644 --- a/src/main.rs +++ b/src/main.rs @@ -17,7 +17,6 @@ use spinners::{Spinner, Spinners}; use std::collections::HashMap; use std::fs; use std::fs::File; -use std::io::{BufReader, BufWriter}; use std::sync::mpsc::sync_channel; use std::thread; use std::time::Duration; @@ -184,7 +183,6 @@ fn create_dictionary(_opts: &Opts, args: &CreateDictionary) { let input: String = (*args.input).parse().unwrap(); // TODO: Some form of removing duplicates (without itertools) let fout = File::create(args.output.clone()).unwrap(); - let writer = BufWriter::new(fout); let handle; let content = fs::read_to_string(input).expect("Failed to read content"); @@ -196,7 +194,7 @@ fn create_dictionary(_opts: &Opts, args: &CreateDictionary) { pb.set_max_refresh_rate(Some(Duration::from_millis(200))); let (rx, tx) = sync_channel::(100_00_000); - let mut bdf_file = BDFWriter::new(writer, entry_count, args.compress != 0); + let mut bdf_file = BDFWriter::new(fout, entry_count, args.compress != 0); bdf_file.set_compression_level(args.compress); bdf_file .set_entries_per_chunk(args.entries_per_chunk) @@ -259,8 +257,7 @@ fn decrypt_with_dictionary_file( ) -> Option> { let sp = spinner("Reading dictionary..."); let f = File::open(&filename).expect("Failed to open dictionary file."); - let reader = BufReader::new(f); - let mut bdf_file = BDFReader::new(reader); + let mut bdf_file = BDFReader::new(f); bdf_file .read_metadata() .expect("failed to read the metadata of the file");