Address the comments of the first review round
This commit is contained in:
parent
fbcc559cdb
commit
077216b582
@ -232,9 +232,9 @@ pub fn OutStream(comptime WriteError: type) type {
|
|||||||
return self.writeFn(self, slice);
|
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..];
|
const slice = (*const [1]u8)(&byte)[0..];
|
||||||
var i: u64 = 0;
|
var i: usize = 0;
|
||||||
while (i < n) : (i += 1) {
|
while (i < n) : (i += 1) {
|
||||||
try self.writeFn(self, slice);
|
try self.writeFn(self, slice);
|
||||||
}
|
}
|
||||||
|
@ -301,7 +301,6 @@ pub const File = struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub const GetSeekPosError = error{
|
pub const GetSeekPosError = error{
|
||||||
Overflow,
|
|
||||||
SystemResources,
|
SystemResources,
|
||||||
Unseekable,
|
Unseekable,
|
||||||
Unexpected,
|
Unexpected,
|
||||||
@ -324,7 +323,7 @@ pub const File = struct {
|
|||||||
else => os.unexpectedErrorPosix(err),
|
else => os.unexpectedErrorPosix(err),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return @intCast(u64, result);
|
return u64(result);
|
||||||
},
|
},
|
||||||
Os.windows => {
|
Os.windows => {
|
||||||
var pos: windows.LARGE_INTEGER = undefined;
|
var pos: windows.LARGE_INTEGER = undefined;
|
||||||
@ -336,8 +335,7 @@ pub const File = struct {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(pos >= 0);
|
return @intCast(u64, pos);
|
||||||
return math.cast(u64, pos);
|
|
||||||
},
|
},
|
||||||
else => @compileError("unsupported OS"),
|
else => @compileError("unsupported OS"),
|
||||||
}
|
}
|
||||||
@ -355,8 +353,6 @@ pub const File = struct {
|
|||||||
else => os.unexpectedErrorWindows(err),
|
else => os.unexpectedErrorWindows(err),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (file_size < 0)
|
|
||||||
return error.Overflow;
|
|
||||||
return @intCast(u64, file_size);
|
return @intCast(u64, file_size);
|
||||||
} else {
|
} else {
|
||||||
@compileError("TODO support getEndPos on this OS");
|
@compileError("TODO support getEndPos on this OS");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user