diff options
| author | gingerBill <bill@gingerbill.org> | 2018-01-17 14:02:19 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2018-01-17 14:02:19 +0000 |
| commit | 4b14d608f49eae90e683cf114bf2a7215a7e857f (patch) | |
| tree | 0eb7297c3483d1da27383eaac5d3e3373b839a55 | |
| parent | 9428d86f2b5cb1eea5e4f6e50d3ba72a5dc1769b (diff) | |
Update sys/windows.odin to use `Bool :: b32;` rather than `i32`
| -rw-r--r-- | core/os_windows.odin | 10 | ||||
| -rw-r--r-- | core/sys/windows.odin | 4 |
2 files changed, 6 insertions, 8 deletions
diff --git a/core/os_windows.odin b/core/os_windows.odin index b62cd7419..da737d39a 100644 --- a/core/os_windows.odin +++ b/core/os_windows.odin @@ -76,7 +76,7 @@ open :: proc(path: string, mode: int = O_RDONLY, perm: u32 = 0) -> (Handle, Errn share_mode := u32(win32.FILE_SHARE_READ|win32.FILE_SHARE_WRITE); sa: ^win32.Security_Attributes = nil; - sa_inherit := win32.Security_Attributes{length = size_of(win32.Security_Attributes), inherit_handle = 1}; + sa_inherit := win32.Security_Attributes{length = size_of(win32.Security_Attributes), inherit_handle = true}; if mode&O_CLOEXEC == 0 { sa = &sa_inherit; } @@ -123,7 +123,7 @@ write :: proc(fd: Handle, data: []byte) -> (int, Errno) { to_write: i32 = min(i32(remaining), MAX); e := win32.write_file(win32.Handle(fd), &data[total_write], to_write, &single_write_length, nil); - if single_write_length <= 0 || e == win32.FALSE { + if single_write_length <= 0 || !e { err := Errno(win32.get_last_error()); return int(total_write), err; } @@ -145,7 +145,7 @@ read :: proc(fd: Handle, data: []byte) -> (int, Errno) { to_read: u32 = min(u32(remaining), MAX); e := win32.read_file(win32.Handle(fd), &data[total_read], to_read, &single_read_length, nil); - if single_read_length <= 0 || e == win32.FALSE { + if single_read_length <= 0 || !e { err := Errno(win32.get_last_error()); return int(total_read), err; } @@ -177,7 +177,7 @@ seek :: proc(fd: Handle, offset: i64, whence: int) -> (i64, Errno) { file_size :: proc(fd: Handle) -> (i64, Errno) { length: i64; err: Errno; - if win32.get_file_size_ex(win32.Handle(fd), &length) == 0 { + if !win32.get_file_size_ex(win32.Handle(fd), &length) { err = Errno(win32.get_last_error()); } return length, err; @@ -219,7 +219,7 @@ last_write_time_by_name :: proc(name: string) -> File_Time { copy(buf[..], cast([]byte)name); - if win32.get_file_attributes_ex_a(&buf[0], win32.GetFileExInfoStandard, &data) != 0 { + if win32.get_file_attributes_ex_a(&buf[0], win32.GetFileExInfoStandard, &data) { last_write_time = data.last_write_time; } diff --git a/core/sys/windows.odin b/core/sys/windows.odin index 6bff7c2a6..55b131d16 100644 --- a/core/sys/windows.odin +++ b/core/sys/windows.odin @@ -26,9 +26,7 @@ Wnd_Proc :: #type proc "c" (Hwnd, u32, Wparam, Lparam) -> Lresult; Long_Ptr :: int; -Bool :: i32; -FALSE: Bool : 0; -TRUE: Bool : 1; +Bool :: b32; Point :: struct { x, y: i32, |