zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 077216b58205fc3fa4920a6e2cbcf9565b2c7116 (tree)
parent fbcc559cdbe67b711ea24a152aa7bb3a10bb06c7
Author: LemonBoy <thatlemon@gmail.com>
Date:   Fri,  3 May 2019 22:23:08 +0200

Address the comments of the first review round

Diffstat:
Mstd/io.zig | 4++--
Mstd/os/file.zig | 8++------
2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/std/io.zig b/std/io.zig @@ -232,9 +232,9 @@ pub fn OutStream(comptime WriteError: type) type { return self.writeFn(self, slice); } - pub fn writeByteNTimes(self: *Self, byte: u8, n: u64) Error!void { + pub fn writeByteNTimes(self: *Self, byte: u8, n: usize) Error!void { const slice = (*const [1]u8)(&byte)[0..]; - var i: u64 = 0; + var i: usize = 0; while (i < n) : (i += 1) { try self.writeFn(self, slice); } diff --git a/std/os/file.zig b/std/os/file.zig @@ -301,7 +301,6 @@ pub const File = struct { } pub const GetSeekPosError = error{ - Overflow, SystemResources, Unseekable, Unexpected, @@ -324,7 +323,7 @@ pub const File = struct { else => os.unexpectedErrorPosix(err), }; } - return @intCast(u64, result); + return u64(result); }, Os.windows => { var pos: windows.LARGE_INTEGER = undefined; @@ -336,8 +335,7 @@ pub const File = struct { }; } - assert(pos >= 0); - return math.cast(u64, pos); + return @intCast(u64, pos); }, else => @compileError("unsupported OS"), } @@ -355,8 +353,6 @@ pub const File = struct { else => os.unexpectedErrorWindows(err), }; } - if (file_size < 0) - return error.Overflow; return @intCast(u64, file_size); } else { @compileError("TODO support getEndPos on this OS");