Tidy up Oar Entry default data
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details

This commit is contained in:
kayomn 2022-10-11 01:15:19 +01:00
parent 6ecf6779e5
commit 287a054d22
1 changed files with 5 additions and 5 deletions

View File

@ -7,19 +7,19 @@ const sys = @import("./sys.zig");
/// Typically, following this block in memory is the file data it holds the meta-information for. /// Typically, following this block in memory is the file data it holds the meta-information for.
/// ///
pub const Entry = extern struct { pub const Entry = extern struct {
signature: [3]u8, signature: [3]u8 = signature_magic,
revision: u8, revision: u8,
name_length: u8, name_length: u8 = 0,
name_buffer: [255]u8 = std.mem.zeroes([255]u8), name_buffer: [255]u8 = std.mem.zeroes([255]u8),
file_size: u64, file_size: u64,
padding: [244]u8, padding: [244]u8 = std.mem.zeroes([244]u8),
/// ///
/// Returns `true` if `entry` correctly identifies itself as a valid Oar entry, otherwise /// Returns `true` if `entry` correctly identifies itself as a valid Oar entry, otherwise
/// `false`. /// `false`.
/// ///
pub fn isValid(entry: Entry) bool { pub fn isValid(entry: Entry) bool {
return std.mem.eql(u8, &entry.signature, "oar"); return std.mem.eql(u8, &entry.signature, signature_magic[0 ..]);
} }
/// ///
@ -44,5 +44,5 @@ pub const Entry = extern struct {
/// ///
/// Magic identifier used to validate [Entry] data. /// Magic identifier used to validate [Entry] data.
/// ///
const signature_magic = "oar"; const signature_magic = [3]u8{'o', 'a', 'r'};
}; };