diff --git a/src/constants.rs b/src/constants.rs index 2731c33..aec9024 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -2,9 +2,7 @@ use bitmask_enum::bitmask; use serde::{Deserialize, Serialize}; /// "Magic number" used by the Carbonado file format. 12 bytes: "CARBONADO", and a version, 00, plus a newline character -pub const MAGICNO: [u8; 12] = [ - b'C', b'A', b'R', b'B', b'O', b'N', b'A', b'D', b'O', b'0', b'0', b'\n', -]; +pub const MAGICNO: &[u8; 12] = b"CARBONADO00\n"; /// Bao slice length pub const SLICE_LEN: u16 = 1024; diff --git a/src/file.rs b/src/file.rs index d59aca0..1a90622 100644 --- a/src/file.rs +++ b/src/file.rs @@ -70,7 +70,7 @@ impl TryFrom<&File> for Header { handle.read_exact(&mut padding_len)?; handle.read_exact(&mut metadata)?; - if magic_no != MAGICNO { + if &magic_no != MAGICNO { return Err(CarbonadoError::InvalidMagicNumber(format!("{magic_no:#?}"))); }