From 1826b0c700f4a4ae524c249bf761a6d274a0dd6e Mon Sep 17 00:00:00 2001 From: gingerBill Date: Sun, 4 Aug 2024 11:10:17 +0100 Subject: [PATCH] Fix copy-replace errors --- core/os/os2/errors.odin | 8 ++++---- core/os/os2/errors_linux.odin | 2 +- core/os/os2/errors_windows.odin | 2 +- core/os/os2/file_stream.odin | 2 +- core/os/os2/process_windows.odin | 14 +++++++------- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/core/os/os2/errors.odin b/core/os/os2/errors.odin index e5a0bb722..2b9b3528e 100644 --- a/core/os/os2/errors.odin +++ b/core/os/os2/errors.odin @@ -3,7 +3,7 @@ package os2 import "core:io" import "base:runtime" -General_Platform_Error :: enum u32 { +General_Error :: enum u32 { None, Permission_Denied, @@ -29,7 +29,7 @@ General_Platform_Error :: enum u32 { Unsupported, } -Platform_Platform_Error :: enum i32 {None=0} +Platform_Error :: enum i32 {None=0} Error :: union #shared_nil { General_Error, @@ -43,7 +43,7 @@ ERROR_NONE :: Error{} -is_platform_Platform_Error :: proc(ferr: Error) -> (err: i32, ok: bool) { +is_platform_error :: proc(ferr: Error) -> (err: i32, ok: bool) { v := ferr.(Platform_Error) or_else {} return i32(v), i32(v) != 0 } @@ -104,7 +104,7 @@ error_string :: proc(ferr: Error) -> string { return "unknown error" } -print_Platform_Error :: proc(f: ^File, ferr: Error, msg: string) { +print_error :: proc(f: ^File, ferr: Error, msg: string) { TEMP_ALLOCATOR_GUARD() err_str := error_string(ferr) diff --git a/core/os/os2/errors_linux.odin b/core/os/os2/errors_linux.odin index 0da9e1452..d7234ce8b 100644 --- a/core/os/os2/errors_linux.odin +++ b/core/os/os2/errors_linux.odin @@ -142,7 +142,7 @@ _errno_strings : [linux.Errno]string = { } -_get_platform_Platform_Error :: proc(errno: linux.Errno) -> Error { +_get_platform_error :: proc(errno: linux.Errno) -> Error { #partial switch errno { case .NONE: return nil diff --git a/core/os/os2/errors_windows.odin b/core/os/os2/errors_windows.odin index 00dacd491..6421d26ee 100644 --- a/core/os/os2/errors_windows.odin +++ b/core/os/os2/errors_windows.odin @@ -20,7 +20,7 @@ _error_string :: proc(errno: i32) -> string { return "" } -_get_platform_Platform_Error :: proc() -> Error { +_get_platform_error :: proc() -> Error { err := win32.GetLastError() if err == 0 { return nil diff --git a/core/os/os2/file_stream.odin b/core/os/os2/file_stream.odin index 89bd59809..84176928d 100644 --- a/core/os/os2/file_stream.odin +++ b/core/os/os2/file_stream.odin @@ -15,7 +15,7 @@ to_reader :: to_stream @(private) -error_to_io_Platform_Error :: proc(ferr: Error) -> io.Error { +error_to_io_error :: proc(ferr: Error) -> io.Error { if ferr == nil { return .None } diff --git a/core/os/os2/process_windows.odin b/core/os/os2/process_windows.odin index 57f162eab..47fd62401 100644 --- a/core/os/os2/process_windows.odin +++ b/core/os/os2/process_windows.odin @@ -101,7 +101,7 @@ _process_info_by_pid :: proc(pid: int, selection: Process_Info_Fields, allocator if selection >= {.PPid, .Priority} { entry, entry_err := _process_entry_by_pid(info.pid) if entry_err != nil { - err = GeneralPlatform_Error.Not_Exist + err = General_Error.Not_Exist return } if .PPid in selection { @@ -147,7 +147,7 @@ _process_info_by_pid :: proc(pid: int, selection: Process_Info_Fields, allocator } if process_info.PebBaseAddress == nil { // Not sure what the error is - err = GeneralPlatform_Error.Unsupported + err = General_Error.Unsupported return } process_peb: win32.PEB @@ -210,7 +210,7 @@ _process_info_by_handle :: proc(process: Process, selection: Process_Info_Fields if selection >= {.PPid, .Priority} { // snap process entry, entry_err := _process_entry_by_pid(info.pid) if entry_err != nil { - err = GeneralPlatform_Error.Not_Exist + err = General_Error.Not_Exist return } if .PPid in selection { @@ -239,7 +239,7 @@ _process_info_by_handle :: proc(process: Process, selection: Process_Info_Fields } if process_info.PebBaseAddress == nil { // Not sure what the error is - err = GeneralPlatform_Error.Unsupported + err = General_Error.Unsupported return } @@ -301,7 +301,7 @@ _current_process_info :: proc(selection: Process_Info_Fields, allocator: runtime if selection >= {.PPid, .Priority} { // snap process entry, entry_err := _process_entry_by_pid(info.pid) if entry_err != nil { - err = GeneralPlatform_Error.Not_Exist + err = General_Error.Not_Exist return } if .PPid in selection { @@ -459,7 +459,7 @@ _process_wait :: proc(process: Process, timeout: time.Duration) -> (process_stat } return case win32.WAIT_TIMEOUT: - err = GeneralPlatform_Error.Timeout + err = General_Error.Timeout return case: err = _get_platform_error() @@ -508,7 +508,7 @@ _process_entry_by_pid :: proc(pid: int) -> (entry: win32.PROCESSENTRY32W, err: E } status = win32.Process32NextW(snap, &entry) } - err = GeneralPlatform_Error.Not_Exist + err = General_Error.Not_Exist return }