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-05-01 18:39:14 +0300
committerColin Finck <colin@reactos.org>2021-05-01 18:39:14 +0300
commit9ff4d41d5a57c15f7f299f48ed8c2c75dd7d5fcc (patch)
treee93f88c912e1aafcf3c3b72e744cb92135413e2b /src/structured_values/volume_name.rs
parent08f063df590c457860831e10c9106f56e492e3c5 (diff)
Implement `NtfsString::read_from_fs` to simplify several functions.
Diffstat (limited to 'src/structured_values/volume_name.rs')
-rw-r--r--src/structured_values/volume_name.rs15
1 files changed, 2 insertions, 13 deletions
diff --git a/src/structured_values/volume_name.rs b/src/structured_values/volume_name.rs
index 72bd3bc..2f70ea7 100644
--- a/src/structured_values/volume_name.rs
+++ b/src/structured_values/volume_name.rs
@@ -5,7 +5,7 @@ use crate::attribute::NtfsAttributeType;
use crate::attribute_value::NtfsAttributeValueAttached;
use crate::error::{NtfsError, Result};
use crate::string::NtfsString;
-use binread::io::{Read, Seek, SeekFrom};
+use binread::io::{Read, Seek};
use core::mem;
/// The smallest VolumeName attribute has a name containing just a single character.
@@ -67,17 +67,6 @@ impl NtfsVolumeName {
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(),
- });
- }
-
- fs.seek(SeekFrom::Start(self.name_position))?;
- fs.read_exact(&mut buf[..name_length])?;
-
- Ok(NtfsString(&buf[..name_length]))
+ NtfsString::read_from_fs(fs, self.name_position, self.name_length(), buf)
}
}