diff options
author | Colin Finck <colin@reactos.org> | 2021-05-01 18:39:14 +0300 |
---|---|---|
committer | Colin Finck <colin@reactos.org> | 2021-05-01 18:39:14 +0300 |
commit | 9ff4d41d5a57c15f7f299f48ed8c2c75dd7d5fcc (patch) | |
tree | e93f88c912e1aafcf3c3b72e744cb92135413e2b /src/attribute.rs | |
parent | 08f063df590c457860831e10c9106f56e492e3c5 (diff) |
Implement `NtfsString::read_from_fs` to simplify several functions.
Diffstat (limited to 'src/attribute.rs')
-rw-r--r-- | src/attribute.rs | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/src/attribute.rs b/src/attribute.rs index 3af1d01..6536e39 100644 --- a/src/attribute.rs +++ b/src/attribute.rs @@ -214,19 +214,8 @@ impl NtfsAttribute { where T: Read + Seek, { - let name_length = self.name_length(); - if buf.len() < name_length { - return Err(NtfsError::BufferTooSmall { - expected: name_length, - actual: buf.len(), - }); - } - let name_position = self.position + self.header.name_offset as u64; - fs.seek(SeekFrom::Start(name_position))?; - fs.read_exact(&mut buf[..name_length])?; - - Ok(NtfsString(&buf[..name_length])) + NtfsString::read_from_fs(fs, name_position, self.name_length(), buf) } pub fn structured_value<T>(&self, fs: &mut T) -> Result<NtfsStructuredValue> |