Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/mft.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmer Ben-Amram <omerbenamram@gmail.com>2019-05-23 18:29:25 +0300
committerOmer Ben-Amram <omerbenamram@gmail.com>2019-05-23 18:29:25 +0300
commit92c7a80671497acad380da54f13d6ffd9d965285 (patch)
treebb8069806db5563b5e7034f3bd1d6d5210edd8da
parentdfb0d9636fe746558347c8f0dc03ea765b09603e (diff)
remove chunked behaviorfeature/csv
-rw-r--r--src/bin/mft_dump.rs56
1 files changed, 19 insertions, 37 deletions
diff --git a/src/bin/mft_dump.rs b/src/bin/mft_dump.rs
index cf26cb6..fdb1f26 100644
--- a/src/bin/mft_dump.rs
+++ b/src/bin/mft_dump.rs
@@ -4,10 +4,8 @@ use log::info;
use mft::mft::MftParser;
use mft::{MftEntry, ReadSeek};
-use serde::Serialize;
use mft::csv::FlatMftEntryWithName;
-use std::cmp::max;
use std::io;
use std::io::Write;
use std::path::PathBuf;
@@ -85,43 +83,27 @@ impl MftDump {
};
let number_of_entries = mft_handler.get_entry_count();
-
- let chunk_size = 1000;
- let mut chunk_count = 0;
- let mut entry_count = 0;
-
- while entry_count <= number_of_entries {
- let mut chunk = vec![];
-
- let start = chunk_count * chunk_size;
- let end = max(start + chunk_size, number_of_entries);
-
- for i in start..end {
- let entry = mft_handler.get_entry(i);
-
- match entry {
- Ok(entry) => chunk.push(entry),
- Err(error) => {
- eprintln!("Failed to parse MFT entry {}, failed with: [{}]", i, error);
- }
+ for i in 0..number_of_entries {
+ let entry = mft_handler.get_entry(i);
+
+ let entry = match entry {
+ Ok(entry) => entry,
+ Err(error) => {
+ eprintln!("Failed to parse MFT entry {}, failed with: [{}]", i, error);
+ continue;
}
- entry_count += 1;
+ };
+
+ match self.output_format {
+ OutputFormat::JSON => self.print_json_entry(&entry),
+ OutputFormat::CSV => self.print_csv_entry(
+ &entry,
+ &mut mft_handler,
+ csv_writer
+ .as_mut()
+ .expect("CSV Writer is for OutputFormat::CSV"),
+ ),
}
-
- for entry in chunk.iter() {
- match self.output_format {
- OutputFormat::JSON => self.print_json_entry(entry),
- OutputFormat::CSV => self.print_csv_entry(
- entry,
- &mut mft_handler,
- csv_writer
- .as_mut()
- .expect("CSV Writer is for OutputFormat::CSV"),
- ),
- }
- }
-
- chunk_count += 1;
}
}
}