st/oxr: Fix or silence a number of MSVC warnings

This commit is contained in:
Ryan Pavlik 2022-04-12 14:36:53 -05:00 committed by Jakob Bornecrantz
parent ef9b15ee67
commit 91c94f015e
5 changed files with 15 additions and 15 deletions

View file

@ -158,7 +158,7 @@ add_key_to_matching_bindings(struct oxr_binding *bindings, size_t binding_count,
bool found = false; bool found = false;
uint32_t preferred_path_index; 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) { if (b->paths[y] == path) {
found = true; found = true;
preferred_path_index = y; preferred_path_index = y;

View file

@ -717,7 +717,7 @@ oxr_space_to_openxr(struct oxr_space *spc)
XrResult XrResult
oxr_space_action_create(struct oxr_logger *log, oxr_space_action_create(struct oxr_logger *log,
struct oxr_session *sess, struct oxr_session *sess,
uint64_t key, uint32_t key,
const XrActionSpaceCreateInfo *createInfo, const XrActionSpaceCreateInfo *createInfo,
struct oxr_space **out_space); struct oxr_space **out_space);
@ -1500,14 +1500,14 @@ struct oxr_interaction_profile
struct oxr_binding struct oxr_binding
{ {
XrPath *paths; XrPath *paths;
size_t path_count; uint32_t path_count;
//! Name presented to the user. //! Name presented to the user.
const char *localized_name; const char *localized_name;
enum oxr_subaction_path subaction_path; enum oxr_subaction_path subaction_path;
size_t key_count; uint32_t key_count;
uint32_t *keys; uint32_t *keys;
//! store which entry in paths was suggested, for each action key //! store which entry in paths was suggested, for each action key
uint32_t *preferred_binding_path_index; uint32_t *preferred_binding_path_index;

View file

@ -149,10 +149,10 @@ fill_in_sub_image(const struct oxr_swapchain *sc, const XrSwapchainSubImage *oxr
xsub->image_index = sc->released.index; xsub->image_index = sc->released.index;
xsub->array_index = oxr_sub->imageArrayIndex; xsub->array_index = oxr_sub->imageArrayIndex;
xsub->rect = *rect; xsub->rect = *rect;
xsub->norm_rect.w = rect->extent.w / (double)sc->width; xsub->norm_rect.w = (float)(rect->extent.w / (double)sc->width);
xsub->norm_rect.h = rect->extent.h / (double)sc->height; xsub->norm_rect.h = (float)(rect->extent.h / (double)sc->height);
xsub->norm_rect.x = rect->offset.w / (double)sc->width; xsub->norm_rect.x = (float)(rect->offset.w / (double)sc->width);
xsub->norm_rect.y = rect->offset.h / (double)sc->height; xsub->norm_rect.y = (float)(rect->offset.h / (double)sc->height);
} }

View file

@ -57,7 +57,7 @@ oxr_space_destroy(struct oxr_logger *log, struct oxr_handle_base *hb)
XrResult XrResult
oxr_space_action_create(struct oxr_logger *log, oxr_space_action_create(struct oxr_logger *log,
struct oxr_session *sess, struct oxr_session *sess,
uint64_t key, uint32_t key,
const XrActionSpaceCreateInfo *createInfo, const XrActionSpaceCreateInfo *createInfo,
struct oxr_space **out_space) struct oxr_space **out_space)
{ {

View file

@ -17,21 +17,21 @@ extern "C" {
#define OXR_TWO_CALL_HELPER(log, cnt_input, cnt_output, output, count, data, sval) \ #define OXR_TWO_CALL_HELPER(log, cnt_input, cnt_output, output, count, data, sval) \
do { \ do { \
if (cnt_output == NULL) { \ if ((cnt_output) == NULL) { \
return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, #cnt_output); \ 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; \ return sval; \
} \ } \
if (cnt_input < count) { \ if ((cnt_input) < (uint32_t)(count)) { \
return oxr_error(log, XR_ERROR_SIZE_INSUFFICIENT, #cnt_input); \ 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]; \ (output)[i] = (data)[i]; \
} \ } \
return sval; \ return (sval); \
} while (false) } while (false)
//! Calls fill_fn(&output_struct[i], &source_struct[i]) to fill output_structs //! Calls fill_fn(&output_struct[i], &source_struct[i]) to fill output_structs