authorgravatar for thatlemon@gmail.comLemonBoy <thatlemon@gmail.com> 2019-05-03 22:23:08+02:00
committergravatar for thatlemon@gmail.comLemonBoy <thatlemon@gmail.com> 2019-05-03 22:42:45+02:00
log077216b58205fc3fa4920a6e2cbcf9565b2c7116
treecafa29c6c66a640f7838c982991e2e6b947f40eb
parentfbcc559cdbe67b711ea24a152aa7bb3a10bb06c7

Address the comments of the first review round


2 files changed, 4 insertions(+), 8 deletions(-)

std/io.zig+2-2
...@@ -232,9 +232,9 @@ pub fn OutStream(comptime WriteError: type) type {...@@ -232,9 +232,9 @@ pub fn OutStream(comptime WriteError: type) type {
232 return self.writeFn(self, slice);232 return self.writeFn(self, slice);
233 }233 }
234234
235 pub fn writeByteNTimes(self: *Self, byte: u8, n: u64) Error!void {235 pub fn writeByteNTimes(self: *Self, byte: u8, n: usize) Error!void {
236 const slice = (*const [1]u8)(&byte)[0..];236 const slice = (*const [1]u8)(&byte)[0..];
237 var i: u64 = 0;237 var i: usize = 0;
238 while (i < n) : (i += 1) {238 while (i < n) : (i += 1) {
239 try self.writeFn(self, slice);239 try self.writeFn(self, slice);
240 }240 }
std/os/file.zig+2-6
...@@ -301,7 +301,6 @@ pub const File = struct {...@@ -301,7 +301,6 @@ pub const File = struct {
301 }301 }
302302
303 pub const GetSeekPosError = error{303 pub const GetSeekPosError = error{
304 Overflow,
305 SystemResources,304 SystemResources,
306 Unseekable,305 Unseekable,
307 Unexpected,306 Unexpected,
...@@ -324,7 +323,7 @@ pub const File = struct {...@@ -324,7 +323,7 @@ pub const File = struct {
324 else => os.unexpectedErrorPosix(err),323 else => os.unexpectedErrorPosix(err),
325 };324 };
326 }325 }
327 return @intCast(u64, result);326 return u64(result);
328 },327 },
329 Os.windows => {328 Os.windows => {
330 var pos: windows.LARGE_INTEGER = undefined;329 var pos: windows.LARGE_INTEGER = undefined;
...@@ -336,8 +335,7 @@ pub const File = struct {...@@ -336,8 +335,7 @@ pub const File = struct {
336 };335 };
337 }336 }
338337
339 assert(pos >= 0);338 return @intCast(u64, pos);
340 return math.cast(u64, pos);
341 },339 },
342 else => @compileError("unsupported OS"),340 else => @compileError("unsupported OS"),
343 }341 }
...@@ -355,8 +353,6 @@ pub const File = struct {...@@ -355,8 +353,6 @@ pub const File = struct {
355 else => os.unexpectedErrorWindows(err),353 else => os.unexpectedErrorWindows(err),
356 };354 };
357 }355 }
358 if (file_size < 0)
359 return error.Overflow;
360 return @intCast(u64, file_size);356 return @intCast(u64, file_size);
361 } else {357 } else {
362 @compileError("TODO support getEndPos on this OS");358 @compileError("TODO support getEndPos on this OS");