From 91c94f015eccad6e33f83c7611d018ae678ffe1f Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Tue, 12 Apr 2022 14:36:53 -0500 Subject: [PATCH] st/oxr: Fix or silence a number of MSVC warnings --- src/xrt/state_trackers/oxr/oxr_binding.c | 2 +- src/xrt/state_trackers/oxr/oxr_objects.h | 6 +++--- src/xrt/state_trackers/oxr/oxr_session_frame_end.c | 8 ++++---- src/xrt/state_trackers/oxr/oxr_space.c | 2 +- src/xrt/state_trackers/oxr/oxr_two_call.h | 12 ++++++------ 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/xrt/state_trackers/oxr/oxr_binding.c b/src/xrt/state_trackers/oxr/oxr_binding.c index c2bfafe5e..8ac9c69a0 100644 --- a/src/xrt/state_trackers/oxr/oxr_binding.c +++ b/src/xrt/state_trackers/oxr/oxr_binding.c @@ -158,7 +158,7 @@ add_key_to_matching_bindings(struct oxr_binding *bindings, size_t binding_count, bool found = false; uint32_t preferred_path_index; - for (size_t y = 0; y < b->path_count; y++) { + for (uint32_t y = 0; y < b->path_count; y++) { if (b->paths[y] == path) { found = true; preferred_path_index = y; diff --git a/src/xrt/state_trackers/oxr/oxr_objects.h b/src/xrt/state_trackers/oxr/oxr_objects.h index 9c8ac7bd3..87596c629 100644 --- a/src/xrt/state_trackers/oxr/oxr_objects.h +++ b/src/xrt/state_trackers/oxr/oxr_objects.h @@ -717,7 +717,7 @@ oxr_space_to_openxr(struct oxr_space *spc) XrResult oxr_space_action_create(struct oxr_logger *log, struct oxr_session *sess, - uint64_t key, + uint32_t key, const XrActionSpaceCreateInfo *createInfo, struct oxr_space **out_space); @@ -1500,14 +1500,14 @@ struct oxr_interaction_profile struct oxr_binding { XrPath *paths; - size_t path_count; + uint32_t path_count; //! Name presented to the user. const char *localized_name; enum oxr_subaction_path subaction_path; - size_t key_count; + uint32_t key_count; uint32_t *keys; //! store which entry in paths was suggested, for each action key uint32_t *preferred_binding_path_index; diff --git a/src/xrt/state_trackers/oxr/oxr_session_frame_end.c b/src/xrt/state_trackers/oxr/oxr_session_frame_end.c index 16f349e24..b98ccc3f6 100644 --- a/src/xrt/state_trackers/oxr/oxr_session_frame_end.c +++ b/src/xrt/state_trackers/oxr/oxr_session_frame_end.c @@ -149,10 +149,10 @@ fill_in_sub_image(const struct oxr_swapchain *sc, const XrSwapchainSubImage *oxr xsub->image_index = sc->released.index; xsub->array_index = oxr_sub->imageArrayIndex; xsub->rect = *rect; - xsub->norm_rect.w = rect->extent.w / (double)sc->width; - xsub->norm_rect.h = rect->extent.h / (double)sc->height; - xsub->norm_rect.x = rect->offset.w / (double)sc->width; - xsub->norm_rect.y = rect->offset.h / (double)sc->height; + xsub->norm_rect.w = (float)(rect->extent.w / (double)sc->width); + xsub->norm_rect.h = (float)(rect->extent.h / (double)sc->height); + xsub->norm_rect.x = (float)(rect->offset.w / (double)sc->width); + xsub->norm_rect.y = (float)(rect->offset.h / (double)sc->height); } diff --git a/src/xrt/state_trackers/oxr/oxr_space.c b/src/xrt/state_trackers/oxr/oxr_space.c index ab4aa4d7e..ea1db51c5 100644 --- a/src/xrt/state_trackers/oxr/oxr_space.c +++ b/src/xrt/state_trackers/oxr/oxr_space.c @@ -57,7 +57,7 @@ oxr_space_destroy(struct oxr_logger *log, struct oxr_handle_base *hb) XrResult oxr_space_action_create(struct oxr_logger *log, struct oxr_session *sess, - uint64_t key, + uint32_t key, const XrActionSpaceCreateInfo *createInfo, struct oxr_space **out_space) { diff --git a/src/xrt/state_trackers/oxr/oxr_two_call.h b/src/xrt/state_trackers/oxr/oxr_two_call.h index 012ddace1..19bfc0937 100644 --- a/src/xrt/state_trackers/oxr/oxr_two_call.h +++ b/src/xrt/state_trackers/oxr/oxr_two_call.h @@ -17,21 +17,21 @@ extern "C" { #define OXR_TWO_CALL_HELPER(log, cnt_input, cnt_output, output, count, data, sval) \ do { \ - if (cnt_output == NULL) { \ + if ((cnt_output) == NULL) { \ return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, #cnt_output); \ } \ - *cnt_output = count; \ + *(cnt_output) = (uint32_t)(count); \ \ - if (cnt_input == 0) { \ + if ((cnt_input) == 0) { \ return sval; \ } \ - if (cnt_input < count) { \ + if ((cnt_input) < (uint32_t)(count)) { \ return oxr_error(log, XR_ERROR_SIZE_INSUFFICIENT, #cnt_input); \ } \ - for (uint32_t i = 0; i < count; i++) { \ + for (uint32_t i = 0; i < (count); i++) { \ (output)[i] = (data)[i]; \ } \ - return sval; \ + return (sval); \ } while (false) //! Calls fill_fn(&output_struct[i], &source_struct[i]) to fill output_structs