diff --git a/lib/std/os/uefi/protocols/device_path_protocol.zig b/lib/std/os/uefi/protocols/device_path_protocol.zig index a083959521..5f15004c24 100644 --- a/lib/std/os/uefi/protocols/device_path_protocol.zig +++ b/lib/std/os/uefi/protocols/device_path_protocol.zig @@ -48,7 +48,7 @@ pub const DevicePathProtocol = extern struct { // DevicePathProtocol for the extra node before the end var buf = try allocator.alloc(u8, path_size + 2 * (path.len + 1) + @sizeOf(DevicePathProtocol)); - @memcpy(buf[0..path_size.len], @as([*]const u8, @ptrCast(self))[0..path_size]); + @memcpy(buf[0..path_size], @as([*]const u8, @ptrCast(self))[0..path_size]); // Pointer to the copy of the end node of the current chain, which is - 4 from the buffer // as the end node itself is 4 bytes (type: u8 + subtype: u8 + length: u16). diff --git a/lib/std/os/uefi/protocols/hii.zig b/lib/std/os/uefi/protocols/hii.zig index c7199d2950..d1db5028a6 100644 --- a/lib/std/os/uefi/protocols/hii.zig +++ b/lib/std/os/uefi/protocols/hii.zig @@ -39,7 +39,7 @@ pub const HIISimplifiedFontPackage = extern struct { number_of_wide_glyphs: u16, pub fn getNarrowGlyphs(self: *HIISimplifiedFontPackage) []NarrowGlyph { - return @as([*]NarrowGlyph, @ptrCast(@as([*]u8, @ptrCast(self)) + @sizeOf(HIISimplifiedFontPackage)))[0..self.number_of_narrow_glyphs]; + return @as([*]NarrowGlyph, @ptrCast(@alignCast(@as([*]u8, @ptrCast(self)) + @sizeOf(HIISimplifiedFontPackage))))[0..self.number_of_narrow_glyphs]; } }; diff --git a/lib/std/os/uefi/protocols/managed_network_protocol.zig b/lib/std/os/uefi/protocols/managed_network_protocol.zig index 3dca6f5103..c71c408d04 100644 --- a/lib/std/os/uefi/protocols/managed_network_protocol.zig +++ b/lib/std/os/uefi/protocols/managed_network_protocol.zig @@ -119,7 +119,7 @@ pub const ManagedNetworkTransmitData = extern struct { fragment_count: u16, pub fn getFragments(self: *ManagedNetworkTransmitData) []ManagedNetworkFragmentData { - return @as([*]ManagedNetworkFragmentData, @ptrCast(@as([*]u8, @ptrCast(self)) + @sizeOf(ManagedNetworkTransmitData)))[0..self.fragment_count]; + return @as([*]ManagedNetworkFragmentData, @ptrCast(@alignCast(@as([*]u8, @ptrCast(self)) + @sizeOf(ManagedNetworkTransmitData))))[0..self.fragment_count]; } }; diff --git a/lib/std/os/uefi/protocols/udp6_protocol.zig b/lib/std/os/uefi/protocols/udp6_protocol.zig index a629836fd7..91ee603ae9 100644 --- a/lib/std/os/uefi/protocols/udp6_protocol.zig +++ b/lib/std/os/uefi/protocols/udp6_protocol.zig @@ -88,7 +88,7 @@ pub const Udp6ReceiveData = extern struct { fragment_count: u32, pub fn getFragments(self: *Udp6ReceiveData) []Udp6FragmentData { - return @as([*]Udp6FragmentData, @ptrCast(@as([*]u8, @ptrCast(self)) + @sizeOf(Udp6ReceiveData)))[0..self.fragment_count]; + return @as([*]Udp6FragmentData, @ptrCast(@alignCast(@as([*]u8, @ptrCast(self)) + @sizeOf(Udp6ReceiveData))))[0..self.fragment_count]; } }; @@ -98,7 +98,7 @@ pub const Udp6TransmitData = extern struct { fragment_count: u32, pub fn getFragments(self: *Udp6TransmitData) []Udp6FragmentData { - return @as([*]Udp6FragmentData, @ptrCast(@as([*]u8, @ptrCast(self)) + @sizeOf(Udp6TransmitData)))[0..self.fragment_count]; + return @as([*]Udp6FragmentData, @ptrCast(@alignCast(@as([*]u8, @ptrCast(self)) + @sizeOf(Udp6TransmitData))))[0..self.fragment_count]; } };