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

github.com/windirstat/ntfs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Finck <colin@reactos.org>2021-12-05 21:49:42 +0300
committerColin Finck <colin@reactos.org>2021-12-05 21:49:42 +0300
commit15e288dbee06bb85cb11ca37505dcf7d5e76677d (patch)
treec467d83a63d9c2be838a897da2fce6c0bcfec92b
parent793a54305764dea63784924bcd763eaba4f286cb (diff)
Fix `NtfsAttributeListNonResidentAttributeValue::len`.
It previously returned the length reported by the current data run. This is correct for the first data run, but breaks when the reader moved to a subsequent one. Which is why we now save the length passed to us at creation time.
-rw-r--r--src/attribute_value/attribute_list_non_resident.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/attribute_value/attribute_list_non_resident.rs b/src/attribute_value/attribute_list_non_resident.rs
index f85bec6..cbf0636 100644
--- a/src/attribute_value/attribute_list_non_resident.rs
+++ b/src/attribute_value/attribute_list_non_resident.rs
@@ -27,6 +27,8 @@ pub struct NtfsAttributeListNonResidentAttributeValue<'n, 'f> {
initial_attribute_list_entries: NtfsAttributeListEntries<'n, 'f>,
/// Iterator through all connected attributes of this attribute in the AttributeList.
connected_entries: AttributeListConnectedEntries<'n, 'f>,
+ /// Total length of the value data, in bytes.
+ data_size: u64,
/// File, location, and data runs iteration state of the current attribute.
attribute_state: Option<AttributeState<'n>>,
/// Iteration state of the current data run.
@@ -48,6 +50,7 @@ impl<'n, 'f> NtfsAttributeListNonResidentAttributeValue<'n, 'f> {
ntfs,
initial_attribute_list_entries: attribute_list_entries,
connected_entries,
+ data_size,
attribute_state: None,
stream_state: StreamState::new(data_size),
}
@@ -62,7 +65,7 @@ impl<'n, 'f> NtfsAttributeListNonResidentAttributeValue<'n, 'f> {
}
pub fn len(&self) -> u64 {
- self.stream_state.data_size()
+ self.data_size
}
/// Returns whether we got another data run.