| ... | @@ -26,12 +26,10 @@ pub const DevicePath = extern struct { | ... | @@ -26,12 +26,10 @@ pub const DevicePath = extern struct { |
| 26 | | 26 | |
| 27 | /// Returns the next DevicePath node in the sequence, if any. | 27 | /// Returns the next DevicePath node in the sequence, if any. |
| 28 | pub fn next(self: *const DevicePath) ?*const DevicePath { | 28 | pub fn next(self: *const DevicePath) ?*const DevicePath { |
| | 29 | const subtype: uefi.DevicePath.End.Subtype = @enumFromInt(self.subtype); |
| | 30 | if (self.type == .end and subtype == .end_entire) return null; |
| 29 | const bytes: [*]const u8 = @ptrCast(self); | 31 | const bytes: [*]const u8 = @ptrCast(self); |
| 30 | const next_node: *const DevicePath = @ptrCast(bytes + self.length); | 32 | return @ptrCast(bytes + self.length); |
| 31 | if (next_node.type == .end and @as(uefi.DevicePath.End.Subtype, @enumFromInt(next_node.subtype)) == .end_entire) | | |
| 32 | return null; | | |
| 33 | | | |
| 34 | return next_node; | | |
| 35 | } | 33 | } |
| 36 | | 34 | |
| 37 | /// Calculates the total length of the device path structure in bytes, including the end of device path node. | 35 | /// Calculates the total length of the device path structure in bytes, including the end of device path node. |