Skip to content

Commit e313584

Browse files
xdBronchandrewrk
authored andcommitted
more UEFI alignment fixes
1 parent 17255be commit e313584

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

lib/std/os/uefi/protocols/device_path_protocol.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ pub const DevicePathProtocol = extern struct {
4848
// DevicePathProtocol for the extra node before the end
4949
var buf = try allocator.alloc(u8, path_size + 2 * (path.len + 1) + @sizeOf(DevicePathProtocol));
5050

51-
@memcpy(buf[0..path_size.len], @as([*]const u8, @ptrCast(self))[0..path_size]);
51+
@memcpy(buf[0..path_size], @as([*]const u8, @ptrCast(self))[0..path_size]);
5252

5353
// Pointer to the copy of the end node of the current chain, which is - 4 from the buffer
5454
// as the end node itself is 4 bytes (type: u8 + subtype: u8 + length: u16).

lib/std/os/uefi/protocols/hii.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pub const HIISimplifiedFontPackage = extern struct {
3939
number_of_wide_glyphs: u16,
4040

4141
pub fn getNarrowGlyphs(self: *HIISimplifiedFontPackage) []NarrowGlyph {
42-
return @as([*]NarrowGlyph, @ptrCast(@as([*]u8, @ptrCast(self)) + @sizeOf(HIISimplifiedFontPackage)))[0..self.number_of_narrow_glyphs];
42+
return @as([*]NarrowGlyph, @ptrCast(@alignCast(@as([*]u8, @ptrCast(self)) + @sizeOf(HIISimplifiedFontPackage))))[0..self.number_of_narrow_glyphs];
4343
}
4444
};
4545

lib/std/os/uefi/protocols/managed_network_protocol.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ pub const ManagedNetworkTransmitData = extern struct {
119119
fragment_count: u16,
120120

121121
pub fn getFragments(self: *ManagedNetworkTransmitData) []ManagedNetworkFragmentData {
122-
return @as([*]ManagedNetworkFragmentData, @ptrCast(@as([*]u8, @ptrCast(self)) + @sizeOf(ManagedNetworkTransmitData)))[0..self.fragment_count];
122+
return @as([*]ManagedNetworkFragmentData, @ptrCast(@alignCast(@as([*]u8, @ptrCast(self)) + @sizeOf(ManagedNetworkTransmitData))))[0..self.fragment_count];
123123
}
124124
};
125125

lib/std/os/uefi/protocols/udp6_protocol.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ pub const Udp6ReceiveData = extern struct {
8888
fragment_count: u32,
8989

9090
pub fn getFragments(self: *Udp6ReceiveData) []Udp6FragmentData {
91-
return @as([*]Udp6FragmentData, @ptrCast(@as([*]u8, @ptrCast(self)) + @sizeOf(Udp6ReceiveData)))[0..self.fragment_count];
91+
return @as([*]Udp6FragmentData, @ptrCast(@alignCast(@as([*]u8, @ptrCast(self)) + @sizeOf(Udp6ReceiveData))))[0..self.fragment_count];
9292
}
9393
};
9494

@@ -98,7 +98,7 @@ pub const Udp6TransmitData = extern struct {
9898
fragment_count: u32,
9999

100100
pub fn getFragments(self: *Udp6TransmitData) []Udp6FragmentData {
101-
return @as([*]Udp6FragmentData, @ptrCast(@as([*]u8, @ptrCast(self)) + @sizeOf(Udp6TransmitData)))[0..self.fragment_count];
101+
return @as([*]Udp6FragmentData, @ptrCast(@alignCast(@as([*]u8, @ptrCast(self)) + @sizeOf(Udp6TransmitData))))[0..self.fragment_count];
102102
}
103103
};
104104

0 commit comments

Comments
 (0)