| ... | @@ -990,6 +990,8 @@ pub const File = struct { | ... | @@ -990,6 +990,8 @@ pub const File = struct { |
| 990 | return index; | 990 | return index; |
| 991 | } | 991 | } |
| 992 | | 992 | |
| | 993 | /// On Windows, this function currently does alter the file pointer. |
| | 994 | /// https://github.com/ziglang/zig/issues/12783 |
| 993 | pub fn pread(self: File, buffer: []u8, offset: u64) PReadError!usize { | 995 | pub fn pread(self: File, buffer: []u8, offset: u64) PReadError!usize { |
| 994 | if (is_windows) { | 996 | if (is_windows) { |
| 995 | return windows.ReadFile(self.handle, buffer, offset, self.intended_io_mode); | 997 | return windows.ReadFile(self.handle, buffer, offset, self.intended_io_mode); |
| ... | @@ -1004,6 +1006,8 @@ pub const File = struct { | ... | @@ -1004,6 +1006,8 @@ pub const File = struct { |
| 1004 | | 1006 | |
| 1005 | /// Returns the number of bytes read. If the number read is smaller than `buffer.len`, it | 1007 | /// Returns the number of bytes read. If the number read is smaller than `buffer.len`, it |
| 1006 | /// means the file reached the end. Reaching the end of a file is not an error condition. | 1008 | /// means the file reached the end. Reaching the end of a file is not an error condition. |
| | 1009 | /// On Windows, this function currently does alter the file pointer. |
| | 1010 | /// https://github.com/ziglang/zig/issues/12783 |
| 1007 | pub fn preadAll(self: File, buffer: []u8, offset: u64) PReadError!usize { | 1011 | pub fn preadAll(self: File, buffer: []u8, offset: u64) PReadError!usize { |
| 1008 | var index: usize = 0; | 1012 | var index: usize = 0; |
| 1009 | while (index != buffer.len) { | 1013 | while (index != buffer.len) { |
| ... | @@ -1058,6 +1062,8 @@ pub const File = struct { | ... | @@ -1058,6 +1062,8 @@ pub const File = struct { |
| 1058 | } | 1062 | } |
| 1059 | | 1063 | |
| 1060 | /// See https://github.com/ziglang/zig/issues/7699 | 1064 | /// See https://github.com/ziglang/zig/issues/7699 |
| | 1065 | /// On Windows, this function currently does alter the file pointer. |
| | 1066 | /// https://github.com/ziglang/zig/issues/12783 |
| 1061 | pub fn preadv(self: File, iovecs: []const os.iovec, offset: u64) PReadError!usize { | 1067 | pub fn preadv(self: File, iovecs: []const os.iovec, offset: u64) PReadError!usize { |
| 1062 | if (is_windows) { | 1068 | if (is_windows) { |
| 1063 | // TODO improve this to use ReadFileScatter | 1069 | // TODO improve this to use ReadFileScatter |
| ... | @@ -1079,6 +1085,8 @@ pub const File = struct { | ... | @@ -1079,6 +1085,8 @@ pub const File = struct { |
| 1079 | /// The `iovecs` parameter is mutable because this function needs to mutate the fields in | 1085 | /// The `iovecs` parameter is mutable because this function needs to mutate the fields in |
| 1080 | /// order to handle partial reads from the underlying OS layer. | 1086 | /// order to handle partial reads from the underlying OS layer. |
| 1081 | /// See https://github.com/ziglang/zig/issues/7699 | 1087 | /// See https://github.com/ziglang/zig/issues/7699 |
| | 1088 | /// On Windows, this function currently does alter the file pointer. |
| | 1089 | /// https://github.com/ziglang/zig/issues/12783 |
| 1082 | pub fn preadvAll(self: File, iovecs: []os.iovec, offset: u64) PReadError!usize { | 1090 | pub fn preadvAll(self: File, iovecs: []os.iovec, offset: u64) PReadError!usize { |
| 1083 | if (iovecs.len == 0) return 0; | 1091 | if (iovecs.len == 0) return 0; |
| 1084 | | 1092 | |
| ... | @@ -1122,6 +1130,8 @@ pub const File = struct { | ... | @@ -1122,6 +1130,8 @@ pub const File = struct { |
| 1122 | } | 1130 | } |
| 1123 | } | 1131 | } |
| 1124 | | 1132 | |
| | 1133 | /// On Windows, this function currently does alter the file pointer. |
| | 1134 | /// https://github.com/ziglang/zig/issues/12783 |
| 1125 | pub fn pwrite(self: File, bytes: []const u8, offset: u64) PWriteError!usize { | 1135 | pub fn pwrite(self: File, bytes: []const u8, offset: u64) PWriteError!usize { |
| 1126 | if (is_windows) { | 1136 | if (is_windows) { |
| 1127 | return windows.WriteFile(self.handle, bytes, offset, self.intended_io_mode); | 1137 | return windows.WriteFile(self.handle, bytes, offset, self.intended_io_mode); |
| ... | @@ -1134,6 +1144,8 @@ pub const File = struct { | ... | @@ -1134,6 +1144,8 @@ pub const File = struct { |
| 1134 | } | 1144 | } |
| 1135 | } | 1145 | } |
| 1136 | | 1146 | |
| | 1147 | /// On Windows, this function currently does alter the file pointer. |
| | 1148 | /// https://github.com/ziglang/zig/issues/12783 |
| 1137 | pub fn pwriteAll(self: File, bytes: []const u8, offset: u64) PWriteError!void { | 1149 | pub fn pwriteAll(self: File, bytes: []const u8, offset: u64) PWriteError!void { |
| 1138 | var index: usize = 0; | 1150 | var index: usize = 0; |
| 1139 | while (index < bytes.len) { | 1151 | while (index < bytes.len) { |
| ... | @@ -1179,6 +1191,8 @@ pub const File = struct { | ... | @@ -1179,6 +1191,8 @@ pub const File = struct { |
| 1179 | } | 1191 | } |
| 1180 | | 1192 | |
| 1181 | /// See https://github.com/ziglang/zig/issues/7699 | 1193 | /// See https://github.com/ziglang/zig/issues/7699 |
| | 1194 | /// On Windows, this function currently does alter the file pointer. |
| | 1195 | /// https://github.com/ziglang/zig/issues/12783 |
| 1182 | pub fn pwritev(self: File, iovecs: []os.iovec_const, offset: u64) PWriteError!usize { | 1196 | pub fn pwritev(self: File, iovecs: []os.iovec_const, offset: u64) PWriteError!usize { |
| 1183 | if (is_windows) { | 1197 | if (is_windows) { |
| 1184 | // TODO improve this to use WriteFileScatter | 1198 | // TODO improve this to use WriteFileScatter |
| ... | @@ -1197,6 +1211,8 @@ pub const File = struct { | ... | @@ -1197,6 +1211,8 @@ pub const File = struct { |
| 1197 | /// The `iovecs` parameter is mutable because this function needs to mutate the fields in | 1211 | /// The `iovecs` parameter is mutable because this function needs to mutate the fields in |
| 1198 | /// order to handle partial writes from the underlying OS layer. | 1212 | /// order to handle partial writes from the underlying OS layer. |
| 1199 | /// See https://github.com/ziglang/zig/issues/7699 | 1213 | /// See https://github.com/ziglang/zig/issues/7699 |
| | 1214 | /// On Windows, this function currently does alter the file pointer. |
| | 1215 | /// https://github.com/ziglang/zig/issues/12783 |
| 1200 | pub fn pwritevAll(self: File, iovecs: []os.iovec_const, offset: u64) PWriteError!void { | 1216 | pub fn pwritevAll(self: File, iovecs: []os.iovec_const, offset: u64) PWriteError!void { |
| 1201 | if (iovecs.len == 0) return; | 1217 | if (iovecs.len == 0) return; |
| 1202 | | 1218 | |