zig

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

commit 1f4c7d5ebfd4ae88d57b6c923d9ef4d2154e193d (tree)
parent 0a880d5e6034ab35778e4f4db33a385b2a5ad7cc
Author: Jimmi HC <jimmiholstchristensen@gmail.com>
Date:   Fri, 20 Jul 2018 23:05:53 +0200

Fixed windows getPos

Diffstat:
Mstd/os/file.zig | 10++--------
1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/std/os/file.zig b/std/os/file.zig @@ -242,7 +242,7 @@ pub const File = struct { }, Os.windows => { var pos: windows.LARGE_INTEGER = undefined; - if (windows.SetFilePointerEx(self.handle, 0, *pos, windows.FILE_CURRENT) == 0) { + if (windows.SetFilePointerEx(self.handle, 0, &pos, windows.FILE_CURRENT) == 0) { const err = windows.GetLastError(); return switch (err) { windows.ERROR.INVALID_PARAMETER => error.BadFd, @@ -251,13 +251,7 @@ pub const File = struct { } assert(pos >= 0); - if (@sizeOf(@typeOf(pos)) > @sizeOf(usize)) { - if (pos > @maxValue(usize)) { - return error.FilePosLargerThanPointerRange; - } - } - - return usize(pos); + return math.cast(usize, pos) catch error.FilePosLargerThanPointerRange; }, else => @compileError("unsupported OS"), }