Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions deps/crates/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions deps/crates/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ version = "=0.1.0"
default-features = false
# This is necessary to enable a spec-compliance quirk when upgrading to v0.1.2
# features = ["float64_representable_durations"]

[patch.crates-io]
resb = { path="patches/resb" }
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ fn read_u16(input: &[u8]) -> Result<(u16, &[u8]), BinaryDeserializerError> {
let bytes = get_subslice(input, ..core::mem::size_of::<u16>())?
.try_into()
.unwrap();
let value = u16::from_le_bytes(bytes);
let value = u16::from_ne_bytes(bytes);

let rest = get_subslice(input, core::mem::size_of::<u16>()..)?;
Ok((value, rest))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ const SYSTEM_CHARSET_FAMILY: CharsetFamily = CharsetFamily::Ascii;

/// Deserializes an instance of type `T` from bytes representing a binary ICU
/// resource bundle.
///
/// The input data must be in the platform's native endianness. ICU4C resource
/// bundles such as `zoneinfo64.res` are generated in both little endian and
/// big endian formats; callers must ensure the appropriate format is provided
/// for the target platform.
pub fn from_words<'a, T>(input: &'a [u32]) -> Result<T, BinaryDeserializerError>
where
T: Deserialize<'a>,
Expand Down Expand Up @@ -142,7 +147,7 @@ impl<'de> ResourceTreeDeserializer<'de> {
))
}
};
let descriptor = u32::from_le_bytes(descriptor);
let descriptor = u32::from_ne_bytes(descriptor);

ResDescriptor::try_from(descriptor)
}
Expand Down Expand Up @@ -887,7 +892,7 @@ impl<'de> Resource16BitDeserializer<'de> {
// exactly 2 bytes.
#[expect(clippy::unwrap_used)]
let bytes = <[u8; 2]>::try_from(bytes).unwrap();
u16::from_le_bytes(bytes)
u16::from_ne_bytes(bytes)
});

char::decode_utf16(units)
Expand Down Expand Up @@ -1255,7 +1260,7 @@ fn read_u32(input: &[u8]) -> Result<(u32, &[u8]), BinaryDeserializerError> {
))?
.try_into()
.unwrap();
let value = u32::from_le_bytes(bytes);
let value = u32::from_ne_bytes(bytes);

let rest =
input
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,8 @@ impl TryFrom<&[u8]> for BinReprInfo {
let (size, value) = read_u16(value)?;
let (reserved_word, value) = read_u16(value)?;

// While the consumer is responsible for verifying acceptability of most
// contents of the repr info, we explicitly depend on little endian data
// in order to ensure compatibility with `zerovec`.
let (endianness, value) = (Endianness::try_from(value[0])?, &value[1..]);
if endianness != Endianness::Little {
if (endianness == Endianness::Little) != cfg!(target_endian = "little") {
return Err(BinaryDeserializerError::unsupported_format(
"big-endian bundles are not supported",
));
Expand Down
File renamed without changes.
Loading