std: Fix for 32bit systems

master
LemonBoy 2020-09-04 12:48:36 +02:00
parent 90743881cf
commit 3c8e1bc25b
1 changed files with 4 additions and 1 deletions

View File

@ -1457,7 +1457,10 @@ pub const Dir = struct {
var file = try self.openFile(file_path, .{});
defer file.close();
const stat_size = size_hint orelse try file.getEndPos();
// If the file size doesn't fit a usize it'll be certainly greater than
// `max_bytes`
const stat_size = size_hint orelse math.cast(usize, try file.getEndPos()) catch
return error.FileTooBig;
return file.readToEndAllocOptions(allocator, max_bytes, stat_size, alignment, optional_sentinel);
}