aboutsummaryrefslogtreecommitdiff
path: root/src/main.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2020-10-07 00:39:13 -0700
committerAndrew Kelley <andrew@ziglang.org>2020-10-07 00:39:13 -0700
commitb2b0bf0506e708e6b8c143eb438a84592310b5a9 (patch)
tree28b7a8997249dafa8b1171e789fbb0dfce2a9d56 /src/main.zig
parentbd7eab573a5e5f1366cd5dc3639fef28c4acb32a (diff)
downloadzig-b2b0bf0506e708e6b8c143eb438a84592310b5a9.tar.gz
zig-b2b0bf0506e708e6b8c143eb438a84592310b5a9.zip
fixups for the previous commit
* std.fs.File.copyRange and copyRangeAll return u64 instead of usize - the returned value is how much of the `len` is transferred, so the types should match. This removes the need for an `@intCast`. * fix typo that removed a subtraction * Fix the size of codegen.AnyMCValue which gave me a compile error when I tried to build self-hosted for i386-linux. * restore the coercion to u64 of syms_sect.sh_info. We want to make sure the multiplication happens with 64 bits and not the smaller type used by the ELF format. * fix another offset parameter in link/Elf.zig to be u64 instead of usize * add a nice little TODO note to help out Jakub * FmtError already has FileTooBig in it; we just need to return it.
Diffstat (limited to 'src/main.zig')
-rw-r--r--src/main.zig4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/main.zig b/src/main.zig
index 0b75d479d8..b89ac3768e 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -2541,7 +2541,7 @@ fn fmtPathFile(
check_mode: bool,
dir: fs.Dir,
sub_path: []const u8,
-) (FmtError || error{Overflow})!void {
+) FmtError!void {
const source_file = try dir.openFile(sub_path, .{});
var file_closed = false;
errdefer if (!file_closed) source_file.close();
@@ -2554,7 +2554,7 @@ fn fmtPathFile(
const source_code = source_file.readToEndAllocOptions(
fmt.gpa,
max_src_size,
- try std.math.cast(usize, stat.size),
+ std.math.cast(usize, stat.size) catch return error.FileTooBig,
@alignOf(u8),
null,
) catch |err| switch (err) {