From c9087a4c607b9408aef7bec25fec8b9fa41788d5 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Sat, 17 Aug 2019 14:48:40 +0200 Subject: [PATCH] core: fix read_XX_{be,le} funcs --- nihav-core/src/io/byteio.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nihav-core/src/io/byteio.rs b/nihav-core/src/io/byteio.rs index 545bff5..e7e63db 100644 --- a/nihav-core/src/io/byteio.rs +++ b/nihav-core/src/io/byteio.rs @@ -72,7 +72,7 @@ macro_rules! read_int_func { if src.len() < $size { return Err(ByteIOError::ReadError); } unsafe { let mut buf: $inttype = 0; - ptr::copy_nonoverlapping(src.as_ptr(), &mut buf as *mut $inttype as *mut u8, 1); + ptr::copy_nonoverlapping(src.as_ptr(), &mut buf as *mut $inttype as *mut u8, std::mem::size_of::<$inttype>()); Ok(buf.$which()) } } -- 2.30.2