Commit 077216b582

LemonBoy <thatlemon@gmail.com>
2019-05-03 22:23:08
Address the comments of the first review round
1 parent fbcc559
Changed files (2)
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");
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);
             }