[core/os2]: Reading from unsized files

This commit is contained in:
flysand7
2024-03-24 10:52:48 +11:00
parent 7d6e9ef39c
commit 0f944bc0a1
3 changed files with 54 additions and 12 deletions
+3 -1
View File
@@ -434,6 +434,9 @@ _write_at :: proc(f: ^File, p: []byte, offset: i64) -> (n: i64, err: Error) {
_file_size :: proc(f: ^File) -> (n: i64, err: Error) {
length: win32.LARGE_INTEGER
if f.impl.kind == .Pipe {
return 0, .No_Size
}
handle := _handle(f)
if !win32.GetFileSizeEx(handle, &length) {
err = _get_platform_error()
@@ -766,7 +769,6 @@ _is_dir :: proc(path: string) -> bool {
_file_stream_proc :: proc(stream_data: rawptr, mode: io.Stream_Mode, p: []byte, offset: i64, whence: io.Seek_From) -> (n: i64, err: io.Error) {
f := (^File)(stream_data)
ferr: Error
i: int
switch mode {
case .Read:
n, ferr = _read(f, p)