Skip to content

Commit

Permalink
use passed endian, instead of native endian
Browse files Browse the repository at this point in the history
not technically a bug, but still...
  • Loading branch information
Ryan-rsm-McKenzie committed Jan 28, 2024
1 parent 84b8ab1 commit a1f463e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/protocols.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ impl<'bytes> BinaryReadable<'bytes> for BString {
impl BinaryWriteable for BString {
type Item = ByteStr;

fn to_stream<Out>(stream: &mut Sink<Out>, item: &Self::Item, _: Endian) -> io::Result<()>
fn to_stream<Out>(stream: &mut Sink<Out>, item: &Self::Item, endian: Endian) -> io::Result<()>
where
Out: Write,
{
let len: Result<u8, _> = item.len().try_into();
match len {
Ok(len) => {
stream.write_bytes(&len.to_ne_bytes())?;
stream.write(&len, endian)?;
stream.write_bytes(item)?;
Ok(())
}
Expand Down Expand Up @@ -118,14 +118,14 @@ impl<'bytes> BinaryReadable<'bytes> for BZString {
impl BinaryWriteable for BZString {
type Item = ByteStr;

fn to_stream<Out>(stream: &mut Sink<Out>, item: &Self::Item, _: Endian) -> io::Result<()>
fn to_stream<Out>(stream: &mut Sink<Out>, item: &Self::Item, endian: Endian) -> io::Result<()>
where
Out: Write,
{
let len: Result<u8, _> = (item.len() + 1).try_into();
match len {
Ok(len) => {
stream.write_bytes(&len.to_ne_bytes())?;
stream.write(&len, endian)?;
stream.write_bytes(item)?;
stream.write_bytes(b"\0")?;
Ok(())
Expand Down

0 comments on commit a1f463e

Please sign in to comment.