From b255da9d0036aa7d88804bb048a30ccf461b028e Mon Sep 17 00:00:00 2001 From: Yuval Dolev Date: Sun, 19 Jan 2020 05:30:04 +0200 Subject: [PATCH] Fixed path length sent to proc_pidpath because it seems to expect a maximum path length which was previously exceeded. Opening 4coder now works from anywhere. --- platform_mac/mac_4ed.mm | 8 ++++---- platform_mac/mac_4ed_functions.mm | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/platform_mac/mac_4ed.mm b/platform_mac/mac_4ed.mm index 3239cca2..6275f6d9 100644 --- a/platform_mac/mac_4ed.mm +++ b/platform_mac/mac_4ed.mm @@ -952,13 +952,13 @@ mac_toggle_fullscreen(void){ float dx = event.scrollingDeltaX; float dy = event.scrollingDeltaY; - i8 scroll_speed = 0; + i8 wheel_delta = 0; if (dy > 0){ - scroll_speed = -100; + wheel_delta = -100; } else if (dy < 0){ - scroll_speed = 100; + wheel_delta = 100; } - mac_vars.input_chunk.trans.mouse_wheel = scroll_speed; + mac_vars.input_chunk.trans.mouse_wheel = wheel_delta; system_signal_step(0); } diff --git a/platform_mac/mac_4ed_functions.mm b/platform_mac/mac_4ed_functions.mm index 85a6c0f4..dbfc11b0 100644 --- a/platform_mac/mac_4ed_functions.mm +++ b/platform_mac/mac_4ed_functions.mm @@ -29,12 +29,12 @@ system_get_path_sig(){ { local_persist b32 has_stashed_4ed_path = false; if (!has_stashed_4ed_path){ - local_const i32 binary_path_capacity = KB(32); + local_const u32 binary_path_capacity = PATH_MAX; u8 *memory = (u8*)system_memory_allocate(binary_path_capacity, file_name_line_number_lit_u8); pid_t pid = getpid(); i32 size = proc_pidpath(pid, memory, binary_path_capacity); - Assert(size <= binary_path_capacity - 1); + Assert(size < binary_path_capacity); mac_vars.binary_path = SCu8(memory, size); mac_vars.binary_path = string_remove_last_folder(mac_vars.binary_path); @@ -742,6 +742,7 @@ function void* mac_memory_allocate_extended(void *base, u64 size, String_Const_u8 location){ u64 adjusted_size = size + ALLOCATION_SIZE_ADJUSTMENT; void *memory = mmap(base, adjusted_size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + Assert(memory != MAP_FAILED); Memory_Annotation_Tracker_Node *node = (Memory_Annotation_Tracker_Node*)memory;