From 0103af1ddda6a2aa31227965141dd7d3a513e081 Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Thu, 29 Sep 2022 12:53:28 +0300 Subject: Fix MSVC warnings, rename shadowed variables, fix uninitialized values, change warnings=all to use /W4. --- modules/openxr/action_map/openxr_action.cpp | 6 +-- modules/openxr/openxr_interface.cpp | 24 ++++----- modules/openxr/util.h | 84 ++++++++++++++--------------- 3 files changed, 57 insertions(+), 57 deletions(-) (limited to 'modules/openxr') diff --git a/modules/openxr/action_map/openxr_action.cpp b/modules/openxr/action_map/openxr_action.cpp index 359975a480..0fb4f0773f 100644 --- a/modules/openxr/action_map/openxr_action.cpp +++ b/modules/openxr/action_map/openxr_action.cpp @@ -64,13 +64,13 @@ Ref OpenXRAction::new_action(const char *p_name, const char *p_loc } String OpenXRAction::get_name_with_set() const { - String name = get_name(); + String action_name = get_name(); if (action_set != nullptr) { - name = action_set->get_name() + "/" + name; + action_name = action_set->get_name() + "/" + action_name; } - return name; + return action_name; } void OpenXRAction::set_localized_name(const String p_localized_name) { diff --git a/modules/openxr/openxr_interface.cpp b/modules/openxr/openxr_interface.cpp index 31dc2bbf43..68414ae84e 100644 --- a/modules/openxr/openxr_interface.cpp +++ b/modules/openxr/openxr_interface.cpp @@ -132,10 +132,10 @@ void OpenXRInterface::_load_action_map() { if (action_map.is_valid()) { HashMap, Action *> xr_actions; - Array action_sets = action_map->get_action_sets(); - for (int i = 0; i < action_sets.size(); i++) { + Array action_set_array = action_map->get_action_sets(); + for (int i = 0; i < action_set_array.size(); i++) { // Create our action set - Ref xr_action_set = action_sets[i]; + Ref xr_action_set = action_set_array[i]; ActionSet *action_set = create_action_set(xr_action_set->get_name(), xr_action_set->get_localized_name(), xr_action_set->get_priority()); if (!action_set) { continue; @@ -147,20 +147,20 @@ void OpenXRInterface::_load_action_map() { Ref xr_action = actions[j]; PackedStringArray toplevel_paths = xr_action->get_toplevel_paths(); - Vector trackers; + Vector trackers_new; for (int k = 0; k < toplevel_paths.size(); k++) { Tracker *tracker = find_tracker(toplevel_paths[k], true); if (tracker) { - trackers.push_back(tracker); + trackers_new.push_back(tracker); } } Action *action = create_action(action_set, xr_action->get_name(), xr_action->get_localized_name(), xr_action->get_action_type(), trackers); if (action) { // we link our actions back to our trackers so we know which actions to check when we're processing our trackers - for (int t = 0; t < trackers.size(); t++) { - link_action_to_tracker(trackers[t], action); + for (int t = 0; t < trackers_new.size(); t++) { + link_action_to_tracker(trackers_new[t], action); } // add this to our map for creating our interaction profiles @@ -170,9 +170,9 @@ void OpenXRInterface::_load_action_map() { } // now do our suggestions - Array interaction_profiles = action_map->get_interaction_profiles(); - for (int i = 0; i < interaction_profiles.size(); i++) { - Ref xr_interaction_profile = interaction_profiles[i]; + Array interaction_profile_array = action_map->get_interaction_profiles(); + for (int i = 0; i < interaction_profile_array.size(); i++) { + Ref xr_interaction_profile = interaction_profile_array[i]; // Note, we can only have one entry per interaction profile so if it already exists we clear it out RID ip = openxr_api->interaction_profile_create(xr_interaction_profile->get_interaction_profile_path()); @@ -202,8 +202,8 @@ void OpenXRInterface::_load_action_map() { openxr_api->interaction_profile_suggest_bindings(ip); // And record it in our array so we can clean it up later on - if (interaction_profiles.has(ip)) { - interaction_profiles.push_back(ip); + if (interaction_profile_array.has(ip)) { + interaction_profile_array.push_back(ip); } } } diff --git a/modules/openxr/util.h b/modules/openxr/util.h index 5c79890830..1b5e0451dc 100644 --- a/modules/openxr/util.h +++ b/modules/openxr/util.h @@ -53,58 +53,58 @@ #define EXT_INIT_XR_FUNC(name) INIT_XR_FUNC(openxr_api, name) #define OPENXR_API_INIT_XR_FUNC(name) INIT_XR_FUNC(this, name) -#define EXT_PROTO_XRRESULT_FUNC1(func_name, arg1_type, arg1) \ - PFN_##func_name func_name##_ptr = nullptr; \ - XRAPI_ATTR XrResult XRAPI_CALL func_name(UNPACK arg1_type arg1) const { \ - if (!func_name##_ptr) { \ - return XR_ERROR_HANDLE_INVALID; \ - } \ - return (*func_name##_ptr)(arg1); \ +#define EXT_PROTO_XRRESULT_FUNC1(func_name, arg1_type, arg1) \ + PFN_##func_name func_name##_ptr = nullptr; \ + XRAPI_ATTR XrResult XRAPI_CALL func_name(UNPACK arg1_type p_##arg1) const { \ + if (!func_name##_ptr) { \ + return XR_ERROR_HANDLE_INVALID; \ + } \ + return (*func_name##_ptr)(p_##arg1); \ } -#define EXT_PROTO_XRRESULT_FUNC2(func_name, arg1_type, arg1, arg2_type, arg2) \ - PFN_##func_name func_name##_ptr = nullptr; \ - XRAPI_ATTR XrResult XRAPI_CALL func_name(UNPACK arg1_type arg1, UNPACK arg2_type arg2) const { \ - if (!func_name##_ptr) { \ - return XR_ERROR_HANDLE_INVALID; \ - } \ - return (*func_name##_ptr)(arg1, arg2); \ +#define EXT_PROTO_XRRESULT_FUNC2(func_name, arg1_type, arg1, arg2_type, arg2) \ + PFN_##func_name func_name##_ptr = nullptr; \ + XRAPI_ATTR XrResult XRAPI_CALL func_name(UNPACK arg1_type p_##arg1, UNPACK arg2_type p_##arg2) const { \ + if (!func_name##_ptr) { \ + return XR_ERROR_HANDLE_INVALID; \ + } \ + return (*func_name##_ptr)(p_##arg1, p_##arg2); \ } -#define EXT_PROTO_XRRESULT_FUNC3(func_name, arg1_type, arg1, arg2_type, arg2, arg3_type, arg3) \ - PFN_##func_name func_name##_ptr = nullptr; \ - XRAPI_ATTR XrResult XRAPI_CALL func_name(UNPACK arg1_type arg1, UNPACK arg2_type arg2, UNPACK arg3_type arg3) const { \ - if (!func_name##_ptr) { \ - return XR_ERROR_HANDLE_INVALID; \ - } \ - return (*func_name##_ptr)(arg1, arg2, arg3); \ +#define EXT_PROTO_XRRESULT_FUNC3(func_name, arg1_type, arg1, arg2_type, arg2, arg3_type, arg3) \ + PFN_##func_name func_name##_ptr = nullptr; \ + XRAPI_ATTR XrResult XRAPI_CALL func_name(UNPACK arg1_type p_##arg1, UNPACK arg2_type p_##arg2, UNPACK arg3_type p_##arg3) const { \ + if (!func_name##_ptr) { \ + return XR_ERROR_HANDLE_INVALID; \ + } \ + return (*func_name##_ptr)(p_##arg1, p_##arg2, p_##arg3); \ } -#define EXT_PROTO_XRRESULT_FUNC4(func_name, arg1_type, arg1, arg2_type, arg2, arg3_type, arg3, arg4_type, arg4) \ - PFN_##func_name func_name##_ptr = nullptr; \ - XRAPI_ATTR XrResult XRAPI_CALL func_name(UNPACK arg1_type arg1, UNPACK arg2_type arg2, UNPACK arg3_type arg3, UNPACK arg4_type arg4) const { \ - if (!func_name##_ptr) { \ - return XR_ERROR_HANDLE_INVALID; \ - } \ - return (*func_name##_ptr)(arg1, arg2, arg3, arg4); \ +#define EXT_PROTO_XRRESULT_FUNC4(func_name, arg1_type, arg1, arg2_type, arg2, arg3_type, arg3, arg4_type, arg4) \ + PFN_##func_name func_name##_ptr = nullptr; \ + XRAPI_ATTR XrResult XRAPI_CALL func_name(UNPACK arg1_type p_##arg1, UNPACK arg2_type p_##arg2, UNPACK arg3_type p_##arg3, UNPACK arg4_type p_##arg4) const { \ + if (!func_name##_ptr) { \ + return XR_ERROR_HANDLE_INVALID; \ + } \ + return (*func_name##_ptr)(p_##arg1, p_##arg2, p_##arg3, p_##arg4); \ } -#define EXT_PROTO_XRRESULT_FUNC5(func_name, arg1_type, arg1, arg2_type, arg2, arg3_type, arg3, arg4_type, arg4, arg5_type, arg5) \ - PFN_##func_name func_name##_ptr = nullptr; \ - XRAPI_ATTR XrResult XRAPI_CALL func_name(UNPACK arg1_type arg1, UNPACK arg2_type arg2, UNPACK arg3_type arg3, UNPACK arg4_type arg4, UNPACK arg5_type arg5) const { \ - if (!func_name##_ptr) { \ - return XR_ERROR_HANDLE_INVALID; \ - } \ - return (*func_name##_ptr)(arg1, arg2, arg3, arg4, arg5); \ +#define EXT_PROTO_XRRESULT_FUNC5(func_name, arg1_type, arg1, arg2_type, arg2, arg3_type, arg3, arg4_type, arg4, arg5_type, arg5) \ + PFN_##func_name func_name##_ptr = nullptr; \ + XRAPI_ATTR XrResult XRAPI_CALL func_name(UNPACK arg1_type p_##arg1, UNPACK arg2_type p_##arg2, UNPACK arg3_type p_##arg3, UNPACK arg4_type p_##arg4, UNPACK arg5_type p_##arg5) const { \ + if (!func_name##_ptr) { \ + return XR_ERROR_HANDLE_INVALID; \ + } \ + return (*func_name##_ptr)(p_##arg1, p_##arg2, p_##arg3, p_##arg4, p_##arg5); \ } -#define EXT_PROTO_XRRESULT_FUNC6(func_name, arg1_type, arg1, arg2_type, arg2, arg3_type, arg3, arg4_type, arg4, arg5_type, arg5, arg6_type, arg6) \ - PFN_##func_name func_name##_ptr = nullptr; \ - XRAPI_ATTR XrResult XRAPI_CALL func_name(UNPACK arg1_type arg1, UNPACK arg2_type arg2, UNPACK arg3_type arg3, UNPACK arg4_type arg4, UNPACK arg5_type arg5, UNPACK arg6_type arg6) const { \ - if (!func_name##_ptr) { \ - return XR_ERROR_HANDLE_INVALID; \ - } \ - return (*func_name##_ptr)(arg1, arg2, arg3, arg4, arg5, arg6); \ +#define EXT_PROTO_XRRESULT_FUNC6(func_name, arg1_type, arg1, arg2_type, arg2, arg3_type, arg3, arg4_type, arg4, arg5_type, arg5, arg6_type, arg6) \ + PFN_##func_name func_name##_ptr = nullptr; \ + XRAPI_ATTR XrResult XRAPI_CALL func_name(UNPACK arg1_type p_##arg1, UNPACK arg2_type p_##arg2, UNPACK arg3_type p_##arg3, UNPACK arg4_type p_##arg4, UNPACK arg5_type p_##arg5, UNPACK arg6_type p_##arg6) const { \ + if (!func_name##_ptr) { \ + return XR_ERROR_HANDLE_INVALID; \ + } \ + return (*func_name##_ptr)(p_##arg1, p_##arg2, p_##arg3, p_##arg4, p_##arg5, p_##arg6); \ } #endif // UTIL_H -- cgit v1.2.3