struct size hacking shenanigans
continuous-integration/drone/push Build is passing

Signed-off-by: Julien CLEMENT <julien.clement@epita.fr>
This commit is contained in:
juju committed 2022-12-17 20:31:14 +01:00
1 parent 96e7b1cd8e
commit c4531b5074
2 files changed
+5 -5

No files matched your search

+4 -4
View File
@@ -4,7 +4,7 @@ pub struct IsoPathTable {
ext_size: u8, // Extended attribute record length
data_blk: u8, // File data block index
parent_dir: u16, // Number of the parent dir
// idf: [char] // Directory name, of size Self::idf_len
idf: [char; 0] // Directory name, of size Self::idf_len
}
impl IsoPathTable {
@@ -16,10 +16,10 @@ impl IsoPathTable {
}
}
pub fn get_idf(&self) -> *const char {
let ptr: *const IsoPathTable = self;
#[allow(unaligned_references)]
pub fn get_idf(&self) -> &[char] {
unsafe {
ptr.offset(1) as *const char
core::slice::from_raw_parts(self.idf.as_ptr(), self.idf_len as usize)
}
}
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.