diff options
| author | metamuffin <metamuffin@disroot.org> | 2026-02-18 16:37:41 +0100 |
|---|---|---|
| committer | metamuffin <metamuffin@disroot.org> | 2026-02-18 16:37:41 +0100 |
| commit | 9c9ded0eea1dd5e18151434c96715b7def9c0fd2 (patch) | |
| tree | e55d533b4e311589b5a8873d6b1bf2411e999731 | |
| parent | 70169924b611b9b68587bd9169f991e3770b7dc7 (diff) | |
| download | jellything-9c9ded0eea1dd5e18151434c96715b7def9c0fd2.tar jellything-9c9ded0eea1dd5e18151434c96715b7def9c0fd2.tar.bz2 jellything-9c9ded0eea1dd5e18151434c96715b7def9c0fd2.tar.zst | |
store tags in str byte order
| -rw-r--r-- | common/object/src/debug.rs | 4 | ||||
| -rw-r--r-- | common/object/src/json.rs | 2 | ||||
| -rw-r--r-- | common/object/src/lib.rs | 6 |
3 files changed, 6 insertions, 6 deletions
diff --git a/common/object/src/debug.rs b/common/object/src/debug.rs index 15812b1..b45d5bf 100644 --- a/common/object/src/debug.rs +++ b/common/object/src/debug.rs @@ -18,7 +18,7 @@ impl Debug for Object<'_> { let mut s = f.debug_struct("Object"); let mut nonexhaustive = false; for (i, tag) in self.keys().enumerate() { - let kbytes = tag.0.to_be_bytes(); + let kbytes = tag.0.to_le_bytes(); let k = str::from_utf8(&kbytes).unwrap(); let ty = self.offset_type(i); let sz = self.size(i); @@ -52,7 +52,7 @@ impl<T> Debug for TypedTag<T> { } impl Debug for Tag { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - let bytes = self.0.to_be_bytes(); + let bytes = self.0.to_le_bytes(); let name = str::from_utf8(&bytes).unwrap(); f.debug_tuple("Tag").field(&name).finish() } diff --git a/common/object/src/json.rs b/common/object/src/json.rs index 168c0c2..a18ecf5 100644 --- a/common/object/src/json.rs +++ b/common/object/src/json.rs @@ -11,7 +11,7 @@ pub fn object_to_json(ob: Object<'_>) -> Value { let mut o = Map::new(); let mut nonexhaustive = false; for (i, tag) in ob.keys().enumerate() { - let kbytes = tag.0.to_be_bytes(); + let kbytes = tag.0.to_le_bytes(); let k = str::from_utf8(&kbytes).unwrap().to_string(); let ty = ob.offset_type(i); let sz = ob.size(i); diff --git a/common/object/src/lib.rs b/common/object/src/lib.rs index bd00639..b197932 100644 --- a/common/object/src/lib.rs +++ b/common/object/src/lib.rs @@ -28,12 +28,12 @@ pub struct Tag(pub u32); impl Tag { pub const fn new(fourcc: &[u8; 4]) -> Self { - Self(u32::from_be_bytes(*fourcc)) + Self(u32::from_le_bytes(*fourcc)) } } impl Display for Tag { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.write_str(str::from_utf8(&self.0.to_be_bytes()).unwrap()) + f.write_str(str::from_utf8(&self.0.to_le_bytes()).unwrap()) } } @@ -219,7 +219,7 @@ impl<'a> Object<'a> { .iter() .all(|rhs| rhs.as_object().get(ident) != val.as_object().get(ident)) { - any_new = false; + any_new = true; new_vals.push(val); } } |