From 56f92bf4de59cdf599a5a778506924988be433ff Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Sun, 6 May 2018 21:20:59 -0700 Subject: [PATCH] Fix for variable hiding compilation errors --- 4ed.cpp | 14 +++---- 4ed_api_implementation.cpp | 6 +-- 4ed_edit.cpp | 1 - 4ed_view_ui.cpp | 81 ++++++++++++++++++------------------ platform_win32/win32_4ed.cpp | 10 ++--- 5 files changed, 56 insertions(+), 56 deletions(-) diff --git a/4ed.cpp b/4ed.cpp index 808efdc8..488c1845 100644 --- a/4ed.cpp +++ b/4ed.cpp @@ -477,15 +477,15 @@ COMMAND_DECL(reopen){ for (Panel *panel = models->layout.used_sentinel.next; panel != &models->layout.used_sentinel; panel = panel->next){ - View *view = panel->view; - if (view->transient.file_data.file != file){ + View *view_it = panel->view; + if (view_it->transient.file_data.file != file){ continue; } - vptrs[vptr_count] = view; - edit_poss[vptr_count] = view->transient.edit_pos[0]; - line_number[vptr_count] = view->transient.edit_pos[0].cursor.line; - column_number[vptr_count] = view->transient.edit_pos[0].cursor.character; - view->transient.edit_pos = 0; + vptrs[vptr_count] = view_it; + edit_poss[vptr_count] = view_it->transient.edit_pos[0]; + line_number[vptr_count] = view_it->transient.edit_pos[0].cursor.line; + column_number[vptr_count] = view_it->transient.edit_pos[0].cursor.character; + view_it->transient.edit_pos = 0; ++vptr_count; } diff --git a/4ed_api_implementation.cpp b/4ed_api_implementation.cpp index 5824c36b..de767975 100644 --- a/4ed_api_implementation.cpp +++ b/4ed_api_implementation.cpp @@ -2301,9 +2301,9 @@ DOC(This call creates a new theme. If the given name is already the name of a s if (!hit_existing_theme){ if (library->count < library->max){ - Style *style = &library->styles[library->count++]; - style_set_colors(style, theme); - style_set_name(style, make_string(name, len)); + Style *new_style = &library->styles[library->count++]; + style_set_colors(new_style, theme); + style_set_name(new_style, make_string(name, len)); } } } diff --git a/4ed_edit.cpp b/4ed_edit.cpp index aeefc2a8..ca6b5652 100644 --- a/4ed_edit.cpp +++ b/4ed_edit.cpp @@ -88,7 +88,6 @@ edit_fix_marks(System_Functions *system, Models *models, Editing_File *file, Edi Assert(view->transient.edit_pos != 0); i32 cursor_pos = cursors[cursor_count++].pos; - Editing_File *file = view->transient.file_data.file; Full_Cursor new_cursor = file_compute_cursor(system, file, seek_pos(cursor_pos), 0); GUI_Scroll_Vars scroll = view->transient.edit_pos->scroll; diff --git a/4ed_view_ui.cpp b/4ed_view_ui.cpp index e2e86e71..97afb01c 100644 --- a/4ed_view_ui.cpp +++ b/4ed_view_ui.cpp @@ -683,20 +683,6 @@ step_view(System_Functions *system, View *view, Models *models, View *active_vie autocomplete_with_enter = false; } - String message = null_string; - switch (view->transient.action){ - case IAct_OpenOrNew: - case IAct_Open: - { - message = lit("Open: "); - }break; - - case IAct_New: - { - message = lit("New: "); - }break; - } - GUI_Item_Update update = {0}; Hot_Directory *hdir = &models->hot_directory; @@ -723,7 +709,23 @@ step_view(System_Functions *system, View *view, Models *models, View *active_vie } } - gui_do_text_field(target, message, hdir->string); + { + String message = {0}; + switch (view->transient.action){ + case IAct_OpenOrNew: + case IAct_Open: + { + message = lit("Open: "); + }break; + + case IAct_New: + { + message = lit("New: "); + }break; + } + + gui_do_text_field(target, message, hdir->string); + } b32 snap_into_view = false; scroll_context.id[0] = (u64)(hdir); @@ -764,7 +766,10 @@ step_view(System_Functions *system, View *view, Models *models, View *active_vie append(&full_path, info_ptr->filename); terminate_with_null(&full_path); - String filename = make_string_cap(info_ptr->filename, info_ptr->filename_len, info_ptr->filename_len + 1); + char *str = info_ptr->filename; + i32 len = info_ptr->filename_len; + String filename = make_string_cap(str, len, len + 1); + b32 is_folder = info_ptr->folder; if (wildcard_match_s(&absolutes, filename, false)){ Editing_File *file_ptr = working_set_contains_canon(working_set, full_path); @@ -791,11 +796,6 @@ step_view(System_Functions *system, View *view, Models *models, View *active_vie } } - char *str = info_ptr->filename; - i32 len = info_ptr->filename_len; - String filename = make_string_cap(str, len, len + 1); - b32 is_folder = info_ptr->folder; - if (gui_do_file_option(target, gui_id((u64)(info_ptr), high_id), filename, is_folder, message)){ if (is_folder){ set_last_folder(&hdir->string, info_ptr->filename, '/'); @@ -836,19 +836,6 @@ step_view(System_Functions *system, View *view, Models *models, View *active_vie case IInt_Live_File_List: { - String message = null_string; - switch (view->transient.action){ - case IAct_Switch: - { - message = lit("Switch: "); - }break; - - case IAct_Kill: - { - message = lit("Kill: "); - }break; - } - Working_Set *working_set = &models->working_set; Editing_Layout *layout = &models->layout; GUI_Item_Update update = {0}; @@ -865,7 +852,21 @@ step_view(System_Functions *system, View *view, Models *models, View *active_vie Absolutes absolutes = {0}; get_absolutes(view->transient.dest, &absolutes, 1, 1); - gui_do_text_field(target, message, view->transient.dest); + { + String message = {0}; + switch (view->transient.action){ + case IAct_Switch: + { + message = lit("Switch: "); + }break; + + case IAct_Kill: + { + message = lit("Kill: "); + }break; + } + gui_do_text_field(target, message, view->transient.dest); + } b32 snap_into_view = 0; scroll_context.id[0] = (u64)(working_set); @@ -1131,14 +1132,14 @@ do_step_file_view(System_Functions *system, View *view, Models *models, i32_Rect if (file_is_ready(file)){ Vec2 cursor = view_get_cursor_xy(view); - f32 w = view_width(view); - f32 h = view_height(view); + f32 width = view_width(view); + f32 height = view_height(view); - if (cursor.x >= target_x + w){ - target_x = round32(cursor.x - w*.35f); + if (cursor.x >= target_x + width){ + target_x = round32(cursor.x - width*.35f); } - target_y = clamp_bottom(0, floor32(cursor.y - h*.5f)); + target_y = clamp_bottom(0, floor32(cursor.y - height*.5f)); } result.vars.target_y = target_y; diff --git a/platform_win32/win32_4ed.cpp b/platform_win32/win32_4ed.cpp index b0bc9bb0..f3c34476 100644 --- a/platform_win32/win32_4ed.cpp +++ b/platform_win32/win32_4ed.cpp @@ -1400,12 +1400,12 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS Plat_Handle file_handle; if (system_load_handle(plat_settings.test_input, &file_handle)){ - u32 size = system_load_size(file_handle); - char *buffer = (char*)system_memory_allocate(size); + u32 test_size = system_load_size(file_handle); + char *test_buffer = (char*)system_memory_allocate(test_size); - if (system_load_file(file_handle, buffer, size)){ - sim_event_count = *(i32*)buffer; - sim_events = (Simulation_Event*)(buffer + 4); + if (system_load_file(file_handle, test_buffer, test_size)){ + sim_event_count = *(i32*)test_buffer; + sim_events = (Simulation_Event*)(test_buffer + 4); plat_settings.use_test_input = true; }