mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-30 03:10:06 +00:00
Merge branch 'master' into llvm-integration
This commit is contained in:
+7
-7
@@ -87,11 +87,11 @@ read_entire_file :: proc(name: string) -> (data: []byte, success: bool) {
|
||||
}
|
||||
|
||||
bytes_read, read_err := read(fd, data);
|
||||
if read_err != 0 {
|
||||
if read_err != ERROR_NONE {
|
||||
delete(data);
|
||||
return nil, false;
|
||||
}
|
||||
return data[0:bytes_read], true;
|
||||
return data[:bytes_read], true;
|
||||
}
|
||||
|
||||
write_entire_file :: proc(name: string, data: []byte, truncate := true) -> (success: bool) {
|
||||
@@ -100,11 +100,11 @@ write_entire_file :: proc(name: string, data: []byte, truncate := true) -> (succ
|
||||
flags |= O_TRUNC;
|
||||
}
|
||||
|
||||
mode: int = 0;
|
||||
when OS == "linux" {
|
||||
// NOTE(justasd): 644 (owner read, write; group read; others read)
|
||||
mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
|
||||
}
|
||||
mode: int = 0;
|
||||
when OS == "linux" {
|
||||
// NOTE(justasd): 644 (owner read, write; group read; others read)
|
||||
mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
|
||||
}
|
||||
|
||||
fd, err := open(name, flags, mode);
|
||||
if err != 0 {
|
||||
|
||||
@@ -124,7 +124,7 @@ default_temp_allocator_proc :: proc(allocator_data: rawptr, mode: Allocator_Mode
|
||||
clear(&allocator.leaked_allocations);
|
||||
|
||||
case .Resize:
|
||||
last_ptr := rawptr(&allocator.data[allocator.prev_offset]);
|
||||
last_ptr := #no_bounds_check rawptr(&allocator.data[allocator.prev_offset]);
|
||||
if old_memory == last_ptr && len(allocator.data)-allocator.prev_offset >= size {
|
||||
allocator.curr_offset = allocator.prev_offset+size;
|
||||
return old_memory;
|
||||
|
||||
@@ -10,11 +10,11 @@ foreign kernel32 {
|
||||
inherit_handle: Bool, creation_flags: u32, environment: rawptr,
|
||||
current_direcotry: cstring, startup_info: ^Startup_Info,
|
||||
process_information: ^Process_Information) -> Bool ---;
|
||||
@(link_name="CreateProcessW") create_process_w :: proc(application_name, command_line: Wstring,
|
||||
process_attributes, thread_attributes: ^Security_Attributes,
|
||||
inherit_handle: Bool, creation_flags: u32, environment: rawptr,
|
||||
current_direcotry: cstring, startup_info: ^Startup_Info,
|
||||
process_information: ^Process_Information) -> Bool ---;
|
||||
@(link_name="CreateProcessW") create_process_w :: proc(application_name, command_line: Wstring,
|
||||
process_attributes, thread_attributes: ^Security_Attributes,
|
||||
inherit_handle: Bool, creation_flags: u32, environment: rawptr,
|
||||
current_direcotry: cstring, startup_info: ^Startup_Info,
|
||||
process_information: ^Process_Information) -> Bool ---;
|
||||
@(link_name="GetExitCodeProcess") get_exit_code_process :: proc(process: Handle, exit: ^u32) -> Bool ---;
|
||||
@(link_name="ExitProcess") exit_process :: proc(exit_code: u32) ---;
|
||||
@(link_name="GetModuleHandleA") get_module_handle_a :: proc(module_name: cstring) -> Hmodule ---;
|
||||
|
||||
Reference in New Issue
Block a user