mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Begin mapping os.Error in the rest of the codebase
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user