fix: use NativeEndian to work also on big endian systems like s390x

This commit is contained in:
Skia 2025-09-19 23:21:16 +02:00
parent 9dd0fd6831
commit 59333d6804

View file

@ -8,7 +8,7 @@ use std::mem;
use std::os::unix::net::UnixStream;
use std::path::Path;
use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
use byteorder::{NativeEndian, ReadBytesExt, WriteBytesExt};
// Maximum workspaces per group. This will determine the naming.
// Examples:
@ -99,12 +99,12 @@ impl SwaySome {
msg_prefix[6..]
.as_mut()
.write_u32::<LittleEndian>(payload_length)
.write_u32::<NativeEndian>(payload_length)
.expect("Unable to write");
msg_prefix[10..]
.as_mut()
.write_u32::<LittleEndian>(msg_type)
.write_u32::<NativeEndian>(msg_type)
.expect("Unable to write");
let mut msg: Vec<u8> = msg_prefix[..].to_vec();
@ -142,7 +142,7 @@ impl SwaySome {
response_header[8],
response_header[9],
]);
let payload_length = v.read_u32::<LittleEndian>().unwrap();
let payload_length = v.read_u32::<NativeEndian>().unwrap();
let mut payload = vec![0; payload_length as usize];
socket.read_exact(&mut payload[..]).unwrap();