authorgravatar for jhc@dismail.deJimmi Holst Christensen <jhc@dismail.de> 2018-07-20 23:05:53+02:00
committergravatar for jhc@dismail.deJimmi Holst Christensen <jhc@dismail.de> 2018-07-20 23:05:53+02:00
log1f4c7d5ebfd4ae88d57b6c923d9ef4d2154e193d
tree30e2ef54de6fa8408a399f080461d0c9d8de8251
parent0a880d5e6034ab35778e4f4db33a385b2a5ad7cc

Fixed windows getPos


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

std/os/file.zig+2-8
...@@ -242,7 +242,7 @@ pub const File = struct {...@@ -242,7 +242,7 @@ pub const File = struct {
242 },242 },
243 Os.windows => {243 Os.windows => {
244 var pos: windows.LARGE_INTEGER = undefined;244 var pos: windows.LARGE_INTEGER = undefined;
245 if (windows.SetFilePointerEx(self.handle, 0, *pos, windows.FILE_CURRENT) == 0) {245 if (windows.SetFilePointerEx(self.handle, 0, &pos, windows.FILE_CURRENT) == 0) {
246 const err = windows.GetLastError();246 const err = windows.GetLastError();
247 return switch (err) {247 return switch (err) {
248 windows.ERROR.INVALID_PARAMETER => error.BadFd,248 windows.ERROR.INVALID_PARAMETER => error.BadFd,
...@@ -251,13 +251,7 @@ pub const File = struct {...@@ -251,13 +251,7 @@ pub const File = struct {
251 }251 }
252252
253 assert(pos >= 0);253 assert(pos >= 0);
254 if (@sizeOf(@typeOf(pos)) > @sizeOf(usize)) {254 return math.cast(usize, pos) catch error.FilePosLargerThanPointerRange;
255 if (pos > @maxValue(usize)) {
256 return error.FilePosLargerThanPointerRange;
257 }
258 }
259
260 return usize(pos);
261 },255 },
262 else => @compileError("unsupported OS"),256 else => @compileError("unsupported OS"),
263 }257 }