Skip to content

Commit

Permalink
replace deprecated method from_utc
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Starke committed Sep 25, 2023
1 parent 5d6ec85 commit 7eb7bb8
Show file tree
Hide file tree
Showing 20 changed files with 14 additions and 13 deletions.
1 change: 0 additions & 1 deletion src/apps/mod.rs

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
26 changes: 14 additions & 12 deletions src/registry/types/key_value_data.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
use std::{
fmt::Display,
};
use std::fmt::Display;

use binread::{BinRead, BinReaderExt};
use chrono::{DateTime, Utc};
Expand Down Expand Up @@ -51,7 +49,9 @@ impl BinRead for KeyValueData {

Ok(match data_type {
KeyValueDataType::RegNone => Self::RegNone,
KeyValueDataType::RegSZ => Self::RegSZ(reader.read_le_args::<RegistryString>(data_size)?.into()),
KeyValueDataType::RegSZ => {
Self::RegSZ(reader.read_le_args::<RegistryString>(data_size)?.into())
}
KeyValueDataType::RegExpandSZ => {
Self::RegExpandSZ(reader.read_le_args::<RegistryString>(data_size)?.into())
}
Expand All @@ -78,7 +78,9 @@ impl BinRead for KeyValueData {
}
Self::RegDWordBigEndian(reader.read_be()?)
}
KeyValueDataType::RegLink => Self::RegLink(reader.read_le_args::<RegistryString>(data_size)?.into()),
KeyValueDataType::RegLink => {
Self::RegLink(reader.read_le_args::<RegistryString>(data_size)?.into())
}
KeyValueDataType::RegMultiSZ => {
let bytes = super::read_vec(reader, data_size)?;
let strings = super::parse_reg_multi_sz(&bytes[..])?;
Expand All @@ -87,12 +89,12 @@ impl BinRead for KeyValueData {
KeyValueDataType::RegResourceList => {
Self::RegResourceList(reader.read_le_args::<RegistryString>(data_size)?.into())
}
KeyValueDataType::RegFullResourceDescriptor => {
Self::RegFullResourceDescriptor(reader.read_le_args::<RegistryString>(data_size)?.into())
}
KeyValueDataType::RegResourceRequirementsList => {
Self::RegResourceRequirementsList(reader.read_le_args::<RegistryString>(data_size)?.into())
}
KeyValueDataType::RegFullResourceDescriptor => Self::RegFullResourceDescriptor(
reader.read_le_args::<RegistryString>(data_size)?.into(),
),
KeyValueDataType::RegResourceRequirementsList => Self::RegResourceRequirementsList(
reader.read_le_args::<RegistryString>(data_size)?.into(),
),
KeyValueDataType::RegQWord => {
if data_size != 8 {
return Err(binread::Error::AssertFail {
Expand Down Expand Up @@ -206,7 +208,7 @@ mod tests {
.read_ne_args((KeyValueDataType::RegFileTime, 8))
.unwrap();

let expected = DateTime::<Utc>::from_utc(
let expected = DateTime::<Utc>::from_naive_utc_and_offset(
NaiveDate::from_ymd_opt(2014, 10, 2)
.unwrap()
.and_hms_opt(19, 29, 4)
Expand Down

0 comments on commit 7eb7bb8

Please sign in to comment.