| ... | ... | @@ -85,13 +85,16 @@ pub const File = extern struct { |
| 85 | 85 | fn getEndPos(self: *const File) GetSeekPosError!u64 { |
| 86 | 86 | // preserve the old file position |
| 87 | 87 | var pos: u64 = undefined; |
| 88 | var end_pos: u64 = undefined; |
| 88 | 89 | if (.Success != self.getPosition(&pos)) return GetSeekPosError.GetSeekPosError; |
| 89 | 90 | // seek to end of file to get position = file size |
| 90 | 91 | if (.Success != self.setPosition(efi_file_position_end_of_file)) return GetSeekPosError.GetSeekPosError; |
| 92 | // get the position |
| 93 | if (.Success != self.getPosition(&end_pos)) return GetSeekPosError.GetSeekPosError; |
| 91 | 94 | // restore the old position |
| 92 | 95 | if (.Success != self.setPosition(pos)) return GetSeekPosError.GetSeekPosError; |
| 93 | 96 | // return the file size = position |
| 94 | | return pos; |
| 97 | return end_pos; |
| 95 | 98 | } |
| 96 | 99 | |
| 97 | 100 | pub fn setPosition(self: *const File, position: u64) Status { |