Begin mapping os.Error in the rest of the codebase

This commit is contained in:
gingerBill
2024-08-04 11:58:04 +01:00
parent 1d75a612d5
commit 97c499dbb4
18 changed files with 231 additions and 222 deletions
+3 -4
View File
@@ -12,7 +12,7 @@ MAX_RW :: 1<<30
@(no_instrumentation)
_write :: proc "contextless" (fd: os.Handle, data: []byte) -> (int, os.Error) #no_bounds_check /* bounds check would segfault instrumentation */ {
if len(data) == 0 {
return 0, os.ERROR_NONE
return 0, nil
}
single_write_length: win32.DWORD
@@ -25,12 +25,11 @@ _write :: proc "contextless" (fd: os.Handle, data: []byte) -> (int, os.Error) #n
e := win32.WriteFile(win32.HANDLE(fd), &data[total_write], to_write, &single_write_length, nil)
if single_write_length <= 0 || !e {
err := os.Platform_Error(win32.GetLastError())
return int(total_write), err
return int(total_write), os.get_last_error()
}
total_write += i64(single_write_length)
}
return int(total_write), os.ERROR_NONE
return int(total_write), nil
}
@(no_instrumentation)