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>2020-01-06 22:18:52 +0300
committerOmer Ben-Amram <omerbenamram@gmail.com>2020-01-06 22:18:52 +0300
commit7aedab4838fd74d4eb64f7ab5900cd35a5c45a6b (patch)
treef5ed446391cc1d337949ec3145aa4e748534ddf5
parentaea96c09d0581f7b289d1f1da06cd0191e87ace3 (diff)
fmt
-rw-r--r--Cargo.toml12
-rw-r--r--src/attribute/raw.rs2
-rw-r--r--src/attribute/x80.rs2
-rw-r--r--src/csv.rs5
-rw-r--r--src/utils.rs3
-rw-r--r--tests/fixtures.rs2
-rw-r--r--tests/test_cli_interactive.rs7
7 files changed, 14 insertions, 19 deletions
diff --git a/Cargo.toml b/Cargo.toml
index d889597..26ecdab 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -20,7 +20,6 @@ serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
csv = "1.1.1"
thiserror = "1.0"
-anyhow = "1.0"
num-traits = "0.2.10"
num-derive = "0.3.0"
winstructs = "0.2.3"
@@ -29,9 +28,14 @@ itertools = "0.8.2"
rand = "0.7.2"
# `mft_dump` dependencies
-simplelog = "0.7.4"
-dialoguer = "0.5.0"
-indoc = "0.3.4"
+anyhow = {version = "1.0", optional = true}
+simplelog = {version = "0.7.4", optional = true}
+dialoguer = {version = "0.5.0", optional = true}
+indoc = {version = "0.3.4", optional = true}
+
+[features]
+default = ["mft-dump"]
+mft-dump = ["anyhow", "simplelog", "dialoguer", "indoc"]
[dependencies.chrono]
version = "0.4.10"
diff --git a/src/attribute/raw.rs b/src/attribute/raw.rs
index d416340..2482455 100644
--- a/src/attribute/raw.rs
+++ b/src/attribute/raw.rs
@@ -1,5 +1,5 @@
use crate::attribute::MftAttributeType;
-use crate::err::{Result};
+use crate::err::Result;
use crate::{utils, ReadSeek};
use serde::{ser, Serialize};
diff --git a/src/attribute/x80.rs b/src/attribute/x80.rs
index d295e16..81918c7 100644
--- a/src/attribute/x80.rs
+++ b/src/attribute/x80.rs
@@ -1,4 +1,4 @@
-use crate::err::{Result};
+use crate::err::Result;
use crate::{utils, ReadSeek};
use serde::ser;
diff --git a/src/csv.rs b/src/csv.rs
index 1a3aca8..3420b6e 100644
--- a/src/csv.rs
+++ b/src/csv.rs
@@ -92,10 +92,7 @@ impl FlatMftEntryWithName {
let has_ads = entry_attributes
.iter()
- .any(|a| {
- a.header.type_code == MftAttributeType::DATA && !a.header.name.is_empty()
- });
-
+ .any(|a| a.header.type_code == MftAttributeType::DATA && !a.header.name.is_empty());
FlatMftEntryWithName {
entry_id: entry.header.record_number,
diff --git a/src/utils.rs b/src/utils.rs
index 25470e7..559c70c 100644
--- a/src/utils.rs
+++ b/src/utils.rs
@@ -43,7 +43,8 @@ pub fn read_utf16_string<T: ReadSeek>(stream: &mut T, len: Option<usize>) -> io:
},
}
- decode_utf16(buffer.into_iter())
+ // We need to stop if we see a NUL byte, even if asked for more bytes.
+ decode_utf16(buffer.into_iter().take_while(|&byte| byte != 0x00))
.map(|r| r.map_err(|_e| io::Error::from(io::ErrorKind::InvalidData)))
.collect()
}
diff --git a/tests/fixtures.rs b/tests/fixtures.rs
index 580c4e8..bc831b3 100644
--- a/tests/fixtures.rs
+++ b/tests/fixtures.rs
@@ -1,7 +1,7 @@
#![allow(dead_code)]
use std::path::PathBuf;
-use std::sync::{Once};
+use std::sync::Once;
static LOGGER_INIT: Once = Once::new();
diff --git a/tests/test_cli_interactive.rs b/tests/test_cli_interactive.rs
index 987f54a..2366454 100644
--- a/tests/test_cli_interactive.rs
+++ b/tests/test_cli_interactive.rs
@@ -4,13 +4,6 @@
mod fixtures;
-
-
-
-
-
-
-
#[cfg(not(target_os = "windows"))]
use rexpect::spawn;