The open source OpenXR runtime

monado: Apply clang-tidy fixes to most of the codebase.

All at least visually inspected, some revised from the auto-fixit

+447 -349
+25 -19
.clang-tidy
··· 1 1 --- 2 2 # SPDX-License-Identifier: CC0-1.0 3 - # SPDX-FileCopyrightText: 2018-2020 Collabora, Ltd. and the Monado contributors 4 - # Ideally we'd turn back on a few of these that are disabled near the end 5 - Checks: 'clang-diagnostic-*, 6 - clang-analyzer-*, 7 - performance-*, 8 - bugprone-*, 9 - cert-*, 10 - readability-*, 11 - misc-*, 12 - -modernize-*, 13 - -clang-analyzer-security.insecureAPI.strcpy, 14 - -bugprone-macro-parentheses, 15 - -readability-braces-around-statements, 16 - -misc-unused-parameters, 17 - -readability-implicit-bool-conversion, 18 - -clang-diagnostic-missing-field-initializers, 19 - -clang-diagnostic-missing-braces, 20 - -readability-uppercase-literal-suffix, 21 - -misc-non-private-member-variables-in-classes' 3 + # SPDX-FileCopyrightText: 2018-2022, Collabora, Ltd. and the Monado contributors 4 + # Ideally we'd turn back on some of these that are disabled. 5 + # Things on the same line are synonyms 6 + Checks: | 7 + clang-diagnostic-*, 8 + clang-analyzer-*, 9 + performance-*, 10 + bugprone-*, 11 + cert-*, 12 + readability-*, 13 + misc-*, 14 + -modernize-*, 15 + -misc-static-assert, 16 + -bugprone-macro-parentheses, 17 + -bugprone-reserved-identifier,-cert-dcl37-c,-cert-dcl51-cpp, 18 + -clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling, 19 + -clang-analyzer-security.insecureAPI.strcpy, 20 + -clang-diagnostic-missing-braces, 21 + -clang-diagnostic-missing-field-initializers, 22 + -misc-non-private-member-variables-in-classes, 23 + -misc-unused-parameters, 24 + -readability-braces-around-statements, 25 + -readability-implicit-bool-conversion, 26 + -readability-redundant-access-specifiers, 27 + -readability-uppercase-literal-suffix, 22 28 WarningsAsErrors: '' 23 29 HeaderFilterRegex: 'src/xrt/.*' 24 30 AnalyzeTemporaryDtors: false
+1 -1
src/xrt/auxiliary/gstreamer/gst_sink.h
··· 20 20 21 21 22 22 void 23 - gstreamer_sink_send_eos(struct gstreamer_sink *gp); 23 + gstreamer_sink_send_eos(struct gstreamer_sink *gs); 24 24 25 25 uint64_t 26 26 gstreamer_sink_get_timestamp_offset(struct gstreamer_sink *gs);
+1 -1
src/xrt/auxiliary/math/m_api.h
··· 327 327 * @ingroup aux_math 328 328 */ 329 329 void 330 - math_quat_rotate_derivative(const struct xrt_quat *rot, const struct xrt_vec3 *deriv, struct xrt_vec3 *result); 330 + math_quat_rotate_derivative(const struct xrt_quat *quat, const struct xrt_vec3 *deriv, struct xrt_vec3 *result); 331 331 332 332 333 333 /*!
+3 -1
src/xrt/auxiliary/math/m_filter_fifo.c
··· 127 127 size_t num_sampled = 0; 128 128 size_t count = 0; 129 129 // Use double precision internally. 130 - double x = 0, y = 0, z = 0; 130 + double x = 0; 131 + double y = 0; 132 + double z = 0; 131 133 132 134 // Error, skip averaging. 133 135 if (start_ns > stop_ns) {
+1 -1
src/xrt/auxiliary/math/m_filter_one_euro.c
··· 125 125 126 126 127 127 void 128 - m_filter_euro_f32_init(struct m_filter_euro_f32 *f, double fc_min, double beta, double fc_min_d) 128 + m_filter_euro_f32_init(struct m_filter_euro_f32 *f, double fc_min, double fc_min_d, double beta) 129 129 { 130 130 filter_one_euro_init(&f->base, fc_min, beta, fc_min_d); 131 131 }
+2 -2
src/xrt/auxiliary/math/m_filter_one_euro.h
··· 102 102 }; 103 103 104 104 void 105 - m_filter_euro_f32_init(struct m_filter_euro_f32 *f, double fc_min, double beta, double fc_min_d); 105 + m_filter_euro_f32_init(struct m_filter_euro_f32 *f, double fc_min, double fc_min_d, double beta); 106 106 void 107 107 m_filter_euro_f32_run(struct m_filter_euro_f32 *f, uint64_t ts, const float *in_y, float *out_y); 108 108 109 109 void 110 - m_filter_euro_vec2_init(struct m_filter_euro_vec2 *f, double fc_min, double beta, double fc_min_d); 110 + m_filter_euro_vec2_init(struct m_filter_euro_vec2 *f, double fc_min, double fc_min_d, double beta); 111 111 void 112 112 m_filter_euro_vec2_run(struct m_filter_euro_vec2 *f, uint64_t ts, const struct xrt_vec2 *in_y, struct xrt_vec2 *out_y); 113 113 void
+6 -3
src/xrt/auxiliary/math/m_imu_3dof.c
··· 117 117 return; 118 118 } 119 119 120 - const float gravity_tolerance = .9f, gyro_tolerance = .1f; 121 - const float min_tilt_error = 0.05f, max_tilt_error = 0.01f; 120 + const float gravity_tolerance = .9f; 121 + const float gyro_tolerance = .1f; 122 + const float min_tilt_error = 0.05f; 123 + const float max_tilt_error = 0.01f; 122 124 123 125 /* 124 126 * If the device is within tolerance levels, count this ··· 196 198 f->grav.error_angle += correction_radians; 197 199 198 200 // Perform the correction. 199 - struct xrt_quat corr_quat, old_orient; 201 + struct xrt_quat corr_quat; 202 + struct xrt_quat old_orient; 200 203 math_quat_from_angle_vector(correction_radians, &f->grav.error_axis, &corr_quat); 201 204 old_orient = f->rot; 202 205 math_quat_rotate(&corr_quat, &old_orient, &f->rot);
+1 -1
src/xrt/auxiliary/math/m_imu_3dof.h
··· 86 86 87 87 void 88 88 m_imu_3dof_update(struct m_imu_3dof *f, 89 - uint64_t timepoint_ns, 89 + uint64_t timestamp_ns, 90 90 const struct xrt_vec3 *accel, 91 91 const struct xrt_vec3 *gyro); 92 92
+4 -2
src/xrt/auxiliary/math/m_imu_pre.c
··· 64 64 struct xrt_vec3 *out_accel, 65 65 struct xrt_vec3 *out_gyro) 66 66 { 67 - struct m_imu_pre_filter_part fa, fg; 68 - struct xrt_vec3 a, g; 67 + struct m_imu_pre_filter_part fa; 68 + struct m_imu_pre_filter_part fg; 69 + struct xrt_vec3 a; 70 + struct xrt_vec3 g; 69 71 struct xrt_matrix_3x3 m; 70 72 71 73 fa = imu->accel;
+4 -4
src/xrt/auxiliary/math/m_permutation.c
··· 60 60 mp->indices[mp->i]++; 61 61 mp->i = 0; 62 62 return true; 63 - } else { 64 - mp->indices[mp->i] = 0; 65 - mp->i++; 66 63 } 64 + mp->indices[mp->i] = 0; 65 + mp->i++; 67 66 } 68 67 69 68 return false; ··· 83 82 setup(mp, num_elements); 84 83 copy(mp, out_elements); 85 84 return true; 86 - } else if (step(mp)) { 85 + } 86 + if (step(mp)) { 87 87 88 88 copy(mp, out_elements); 89 89 return true;
+6 -2
src/xrt/auxiliary/math/m_relation_history.h
··· 54 54 * @public @memberof m_relation_history 55 55 */ 56 56 bool 57 - m_relation_history_push(struct m_relation_history *rh, struct xrt_space_relation const *in_relation, uint64_t ts); 57 + m_relation_history_push(struct m_relation_history *rh, 58 + struct xrt_space_relation const *in_relation, 59 + uint64_t timestamp); 58 60 59 61 /*! 60 62 * @brief Interpolates or extrapolates to the desired timestamp. ··· 65 67 * @public @memberof m_relation_history 66 68 */ 67 69 enum m_relation_history_result 68 - m_relation_history_get(struct m_relation_history *rh, uint64_t at_time_ns, struct xrt_space_relation *out_relation); 70 + m_relation_history_get(struct m_relation_history *rh, 71 + uint64_t at_timestamp_ns, 72 + struct xrt_space_relation *out_relation); 69 73 70 74 /*! 71 75 * @brief Get the latest report in the buffer, if any.
+1 -2
src/xrt/auxiliary/math/m_space.h
··· 113 113 { 114 114 if (xrc->step_count < XRT_RELATION_CHAIN_CAPACITY) { 115 115 return &xrc->steps[xrc->step_count++]; 116 - } else { 117 - return NULL; 118 116 } 117 + return NULL; 119 118 } 120 119 121 120 /*!
+1 -1
src/xrt/auxiliary/os/os_ble.h
··· 84 84 * @ingroup aux_os 85 85 */ 86 86 int 87 - os_ble_broadcast_write_value(const char *dev_uuid, const char *char_uuid, uint8_t value); 87 + os_ble_broadcast_write_value(const char *service_uuid, const char *char_uuid, uint8_t value); 88 88 #endif 89 89 90 90
+18 -9
src/xrt/auxiliary/os/os_ble_dbus.c
··· 72 72 { 73 73 // Create an array of bytes. 74 74 const char *container_signature = "y"; // dbus type signature string 75 - DBusMessageIter iter, array; 75 + DBusMessageIter iter; 76 + DBusMessageIter array; 76 77 77 78 // attach it to our dbus message 78 79 dbus_message_iter_init_append(msg, &iter); ··· 86 87 { 87 88 // Create an empty array of string variant dicts. 88 89 const char *container_signature = "{sv}"; // dbus type signature string 89 - DBusMessageIter iter, options; 90 + DBusMessageIter iter; 91 + DBusMessageIter options; 90 92 91 93 // attach it to our dbus message 92 94 dbus_message_iter_init_append(msg, &iter); ··· 521 523 static int 522 524 device_has_uuid(const DBusMessageIter *dict, const char *uuid, const char **out_path_str) 523 525 { 524 - DBusMessageIter iface_elm, first_elm; 526 + DBusMessageIter iface_elm; 527 + DBusMessageIter first_elm; 525 528 const char *iface_str; 526 529 const char *path_str; 527 530 ··· 616 619 static int 617 620 gatt_char_has_uuid_and_notify(const DBusMessageIter *dict, const char *uuid, const char **out_path_str) 618 621 { 619 - DBusMessageIter first_elm, iface_elm; 622 + DBusMessageIter first_elm; 623 + DBusMessageIter iface_elm; 620 624 const char *iface_str; 621 625 const char *path_str; 622 626 const char *uuid_str; ··· 753 757 DBusMessage *msg = NULL; 754 758 DBusMessageIter args; 755 759 char *response = NULL; 756 - int ret, type; 760 + int ret; 761 + int type; 757 762 758 763 I(bch, "Connecting '%s'", dbus_address); 759 764 ··· 794 799 static int 795 800 ble_connect_all_devices_with_service_uuid(struct ble_conn_helper *bch, const char *service_uuid) 796 801 { 797 - DBusMessageIter args, first_elm; 802 + DBusMessageIter args; 803 + DBusMessageIter first_elm; 798 804 DBusMessage *msg = NULL; 799 805 800 806 int ret = ble_get_managed_objects(bch, &msg); ··· 833 839 DBusMessage *msg = NULL; 834 840 DBusMessageIter args; 835 841 char *response = NULL; 836 - int ret, type; 842 + int ret; 843 + int type; 837 844 838 845 msg = dbus_message_new_method_call("org.bluez", // target for the method call 839 846 dbus_address, // object to call on ··· 877 884 get_path_to_notify_char( 878 885 struct ble_conn_helper *bch, const char *dev_uuid, const char *char_uuid, char *output, size_t output_len) 879 886 { 880 - DBusMessageIter args, first_elm; 887 + DBusMessageIter args; 888 + DBusMessageIter first_elm; 881 889 DBusMessage *msg; 882 890 883 891 int ret = ble_get_managed_objects(bch, &msg); ··· 1078 1086 os_ble_broadcast_write_value(const char *service_uuid, const char *char_uuid, uint8_t value) 1079 1087 { 1080 1088 struct ble_conn_helper bch = {0}; 1081 - DBusMessageIter args, first_elm; 1089 + DBusMessageIter args; 1090 + DBusMessageIter first_elm; 1082 1091 DBusMessage *msg = NULL; 1083 1092 int ret = 0; 1084 1093
+2 -2
src/xrt/auxiliary/tracking/t_calibration.cpp
··· 1390 1390 1391 1391 //! Helper for NormalizedCoordsCache constructors 1392 1392 static inline std::vector<cv::Vec2f> 1393 - generateInputCoordsAndReserveOutputCoords(cv::Size size, std::vector<cv::Vec2f> &outputCoords) 1393 + generateInputCoordsAndReserveOutputCoords(const cv::Size &size, std::vector<cv::Vec2f> &outputCoords) 1394 1394 { 1395 1395 std::vector<cv::Vec2f> inputCoords; 1396 1396 ··· 1408 1408 1409 1409 //! Helper for NormalizedCoordsCache constructors 1410 1410 static inline void 1411 - populateCacheMats(cv::Size size, 1411 + populateCacheMats(const cv::Size &size, 1412 1412 const std::vector<cv::Vec2f> &inputCoords, 1413 1413 const std::vector<cv::Vec2f> &outputCoords, 1414 1414 cv::Mat_<float> &cacheX,
+1 -1
src/xrt/auxiliary/tracking/t_debug_hsv_filter.cpp
··· 99 99 extern "C" void 100 100 t_debug_hsv_filter_destroy(struct xrt_frame_node *node) 101 101 { 102 - auto d = container_of(node, DebugHSVFilter, node); 102 + auto *d = container_of(node, DebugHSVFilter, node); 103 103 delete d; 104 104 } 105 105
+3 -3
src/xrt/auxiliary/tracking/t_debug_hsv_picker.cpp
··· 79 79 { 80 80 for (uint32_t y = 0; y < xf->height; y++) { 81 81 uint8_t *src = (uint8_t *)xf->data + y * xf->stride; 82 - auto hsv = d.debug.hsv.ptr<uint8_t>(y); 82 + auto *hsv = d.debug.hsv.ptr<uint8_t>(y); 83 83 for (uint32_t x = 0; x < xf->width; x++) { 84 84 uint8_t y = src[0]; 85 85 uint8_t cb = src[1]; ··· 106 106 { 107 107 for (uint32_t y = 0; y < xf->height; y++) { 108 108 uint8_t *src = (uint8_t *)xf->data + y * xf->stride; 109 - auto hsv = d.debug.hsv.ptr<uint8_t>(y); 109 + auto *hsv = d.debug.hsv.ptr<uint8_t>(y); 110 110 for (uint32_t x = 0; x < xf->width; x += 2) { 111 111 uint8_t y1 = src[0]; 112 112 uint8_t cb = src[1]; ··· 211 211 extern "C" void 212 212 t_debug_hsv_picker_destroy(struct xrt_frame_node *node) 213 213 { 214 - auto d = container_of(node, DebugHSVPicker, node); 214 + auto *d = container_of(node, DebugHSVPicker, node); 215 215 delete d; 216 216 } 217 217
+4 -4
src/xrt/auxiliary/tracking/t_debug_hsv_viewer.cpp
··· 107 107 108 108 for (uint32_t yp = 0; yp < SIZE; yp++) { 109 109 for (int chan = 0; chan < NUM_CHAN; chan++) { 110 - auto hsv_cap = bgr.ptr<uint8_t>(yp + SIZE * chan); 111 - auto hsv_opt = bgr.ptr<uint8_t>(yp + SIZE * chan) + 256 * 3; 112 - auto hsv_diff = bgr.ptr<uint8_t>(yp + SIZE * chan) + 512 * 3; 110 + auto *hsv_cap = bgr.ptr<uint8_t>(yp + SIZE * chan); 111 + auto *hsv_opt = bgr.ptr<uint8_t>(yp + SIZE * chan) + 256 * 3; 112 + auto *hsv_diff = bgr.ptr<uint8_t>(yp + SIZE * chan) + 512 * 3; 113 113 int mask = 1 << chan; 114 114 115 115 for (uint32_t xp = 0; xp < SIZE; xp++) { ··· 160 160 extern "C" void 161 161 t_debug_hsv_viewer_destroy(struct xrt_frame_node *node) 162 162 { 163 - auto d = container_of(node, DebugHSVViewer, node); 163 + auto *d = container_of(node, DebugHSVViewer, node); 164 164 delete d; 165 165 } 166 166
+2 -2
src/xrt/auxiliary/tracking/t_frame_cv_mat_wrapper.cpp
··· 79 79 */ 80 80 81 81 void 82 - FrameMat::wrapR8G8B8(cv::Mat mat, xrt_frame **fm_out, const Params /*&&?*/ params) 82 + FrameMat::wrapR8G8B8(const cv::Mat &mat, xrt_frame **fm_out, const Params /*&&?*/ params) 83 83 { 84 84 assert(mat.channels() == 3); 85 85 assert(mat.type() == CV_8UC3); ··· 96 96 } 97 97 98 98 void 99 - FrameMat::wrapL8(cv::Mat mat, xrt_frame **fm_out, const Params /*&&?*/ params) 99 + FrameMat::wrapL8(const cv::Mat &mat, xrt_frame **fm_out, const Params /*&&?*/ params) 100 100 { 101 101 assert(mat.channels() == 1); 102 102 assert(mat.type() == CV_8UC1);
+4 -4
src/xrt/auxiliary/tracking/t_frame_cv_mat_wrapper.hpp
··· 29 29 }; 30 30 31 31 32 - public: 32 + 33 33 // Exposed to the C api. 34 34 struct xrt_frame frame = {}; 35 35 ··· 37 37 cv::Mat matrix = cv::Mat(); 38 38 39 39 40 - public: 40 + 41 41 /*! 42 42 * Only public due to C needed to destroy it. 43 43 */ ··· 50 50 * its reference count decremented so make sure it's a valid pointer. 51 51 */ 52 52 static void 53 - wrapR8G8B8(cv::Mat mat, xrt_frame **xf_ptr, const Params params = {}); 53 + wrapR8G8B8(const cv::Mat &mat, xrt_frame **fm_out, Params params = {}); 54 54 55 55 /*! 56 56 * Wraps the given cv::Mat assuming it's a 8bit format matrix. ··· 59 59 * its reference count decremented so make sure it's a valid pointer. 60 60 */ 61 61 static void 62 - wrapL8(cv::Mat mat, xrt_frame **xf_ptr, const Params params = {}); 62 + wrapL8(const cv::Mat &mat, xrt_frame **fm_out, Params params = {}); 63 63 64 64 65 65 private:
+6 -3
src/xrt/auxiliary/tracking/t_helper_debug_sink.hpp
··· 28 28 AlwaysSingle, 29 29 }; 30 30 31 - public: 31 + 32 32 Kind kind = AllAvailable; 33 33 struct u_sink_debug usd = {}; 34 34 struct xrt_frame *frame = {}; ··· 36 36 cv::Mat rgb[2] = {}; 37 37 38 38 39 - public: 39 + 40 40 HelperDebugSink(Kind kind) 41 41 { 42 42 this->kind = kind; ··· 60 60 61 61 // But what about second breakfast? 62 62 bool second_view = false; 63 - int rows, cols, width, height; 63 + int rows; 64 + int cols; 65 + int width; 66 + int height; 64 67 65 68 cols = xf->width; 66 69 rows = xf->height;
+1 -1
src/xrt/auxiliary/tracking/t_tracker_hand.cpp
··· 295 295 extern "C" void 296 296 t_hand_node_destroy(struct xrt_frame_node *node) 297 297 { 298 - auto t_ptr = container_of(node, TrackerHand, node); 298 + auto *t_ptr = container_of(node, TrackerHand, node); 299 299 os_thread_helper_destroy(&t_ptr->oth); 300 300 301 301 // Tidy variable setup.
+5 -5
src/xrt/auxiliary/tracking/t_tracker_psmv.cpp
··· 215 215 216 216 //! Convert our 2d point + disparities into 3d points. 217 217 static cv::Point3f 218 - world_point_from_blobs(cv::Point2f left, cv::Point2f right, const cv::Matx44d &disparity_to_depth) 218 + world_point_from_blobs(const cv::Point2f &left, const cv::Point2f &right, const cv::Matx44d &disparity_to_depth) 219 219 { 220 220 float disp = left.x - right.x; 221 221 cv::Vec4d xydw(left.x, left.y, disp, 1.0f); ··· 278 278 do_view(t, t.view[1], r_grey, t.debug.rgb[1]); 279 279 280 280 cv::Point3f last_point(t.tracked_object_position.x, t.tracked_object_position.y, t.tracked_object_position.z); 281 - auto nearest_world = make_lowest_score_finder<cv::Point3f>([&](cv::Point3f world_point) { 281 + auto nearest_world = make_lowest_score_finder<cv::Point3f>([&](const cv::Point3f &world_point) { 282 282 //! @todo don't really need the square root to be done here. 283 283 return cv::norm(world_point - last_point); 284 284 }); ··· 289 289 for (const cv::KeyPoint &l_keypoint : t.view[0].keypoints) { 290 290 cv::Point2f l_blob = l_keypoint.pt; 291 291 292 - auto nearest_blob = 293 - make_lowest_score_finder<cv::Point2f>([&](cv::Point2f r_blob) { return l_blob.x - r_blob.x; }); 292 + auto nearest_blob = make_lowest_score_finder<cv::Point2f>( 293 + [&](const cv::Point2f &r_blob) { return l_blob.x - r_blob.x; }); 294 294 295 295 for (const cv::KeyPoint &r_keypoint : t.view[1].keypoints) { 296 296 cv::Point2f r_blob = r_keypoint.pt; ··· 507 507 extern "C" void 508 508 t_psmv_node_destroy(struct xrt_frame_node *node) 509 509 { 510 - auto t_ptr = container_of(node, TrackerPSMV, node); 510 + auto *t_ptr = container_of(node, TrackerPSMV, node); 511 511 os_thread_helper_destroy(&t_ptr->oth); 512 512 513 513 // Tidy variable setup.
+19 -17
src/xrt/auxiliary/tracking/t_tracker_psvr.cpp
··· 314 314 } 315 315 316 316 static float 317 - dist_3d_cv(cv::Point3f a, cv::Point3f b) 317 + dist_3d_cv(const cv::Point3f &a, const cv::Point3f &b) 318 318 { 319 319 return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y) + (a.z - b.z) * (a.z - b.z)); 320 320 } ··· 508 508 remove_outliers(std::vector<blob_point_t> *orig_points, std::vector<blob_point_t> *pruned_points, float outlier_thresh) 509 509 { 510 510 511 - if (orig_points->size() == 0) { 511 + if (orig_points->empty()) { 512 512 return; 513 513 } 514 514 ··· 523 523 temp_points.push_back(orig_points->at(i)); 524 524 } 525 525 } 526 - if (temp_points.size() == 0) { 526 + if (temp_points.empty()) { 527 527 return; 528 528 } 529 529 ··· 620 620 static void 621 621 match_triangles(Eigen::Matrix4f *t1_mat, 622 622 Eigen::Matrix4f *t1_to_t2_mat, 623 - Eigen::Vector4f t1_a, 624 - Eigen::Vector4f t1_b, 625 - Eigen::Vector4f t1_c, 626 - Eigen::Vector4f t2_a, 627 - Eigen::Vector4f t2_b, 628 - Eigen::Vector4f t2_c) 623 + const Eigen::Vector4f &t1_a, 624 + const Eigen::Vector4f &t1_b, 625 + const Eigen::Vector4f &t1_c, 626 + const Eigen::Vector4f &t2_a, 627 + const Eigen::Vector4f &t2_b, 628 + const Eigen::Vector4f &t2_c) 629 629 { 630 630 // given 3 vertices in 'model space', and a corresponding 3 vertices 631 631 // in 'world space', compute the transformation matrix to map one ··· 834 834 proximity_data.push_back(p); 835 835 } 836 836 837 - if (proximity_data.size() > 0) { 837 + if (!proximity_data.empty()) { 838 838 839 839 // use the IMU rotation and the measured points in 840 840 // world space to compute a transform from model to world space. ··· 899 899 Eigen::Matrix4f imu_solved_pose = 900 900 solve_with_imu(t, measured_points, last_measurement, solved, PSVR_SEARCH_RADIUS); 901 901 902 - if (measured_points->size() < PSVR_OPTICAL_SOLVE_THRESH && last_measurement->size() > 0) { 902 + if (measured_points->size() < PSVR_OPTICAL_SOLVE_THRESH && !last_measurement->empty()) { 903 903 return imu_solved_pose; 904 904 } 905 905 ··· 998 998 float prev_diff = last_diff(t, &meas_solved, &t.last_vertices); 999 999 float imu_diff = last_diff(t, &meas_solved, solved); 1000 1000 1001 - Eigen::Vector4f tl_pos, tr_pos, bl_pos, br_pos; 1001 + Eigen::Vector4f tl_pos; 1002 + Eigen::Vector4f tr_pos; 1003 + Eigen::Vector4f bl_pos; 1004 + Eigen::Vector4f br_pos; 1002 1005 bool has_bl = false; 1003 1006 bool has_br = false; 1004 1007 bool has_tl = false; ··· 1147 1150 uint32_t indices[PSVR_NUM_LEDS]; 1148 1151 1149 1152 1150 - public: 1151 1153 ~Helper() 1152 1154 { 1153 1155 m_permutator_reset(&mp); ··· 1269 1271 1270 1272 1271 1273 static void 1272 - sample_line(cv::Mat &src, cv::Point2i start, cv::Point2i end, int *inside_length) 1274 + sample_line(cv::Mat &src, const cv::Point2i &start, const cv::Point2i &end, int *inside_length) 1273 1275 { 1274 1276 // use bresenhams algorithm to sample the 1275 1277 // pixels between two points in an image ··· 1589 1591 // Convert our 2d point + disparities into 3d points. 1590 1592 std::vector<blob_data_t> blob_datas; 1591 1593 1592 - if (t.l_blobs.size() > 0) { 1594 + if (!t.l_blobs.empty()) { 1593 1595 for (uint32_t i = 0; i < t.l_blobs.size(); i++) { 1594 1596 float disp = t.r_blobs[i].pt.x - t.l_blobs[i].pt.x; 1595 1597 cv::Vec4d xydw(t.l_blobs[i].pt.x, t.l_blobs[i].pt.y, disp, 1.0f); ··· 1785 1787 t.last_vertices.push_back(solved[i]); 1786 1788 } 1787 1789 1788 - if (t.last_vertices.size() > 0) { 1790 + if (!t.last_vertices.empty()) { 1789 1791 filter_update(&t.last_vertices, t.track_filters, dt / 1000.0f); 1790 1792 } 1791 1793 ··· 1999 2001 extern "C" void 2000 2002 t_psvr_node_destroy(struct xrt_frame_node *node) 2001 2003 { 2002 - auto t_ptr = container_of(node, TrackerPSVR, node); 2004 + auto *t_ptr = container_of(node, TrackerPSVR, node); 2003 2005 2004 2006 os_thread_helper_destroy(&t_ptr->oth); 2005 2007
+4 -4
src/xrt/auxiliary/tracking/t_tracking.h
··· 99 99 }; 100 100 101 101 /*! 102 - * Allocates a new stereo calibration data, unreferences the old @p calib. 102 + * Allocates a new stereo calibration data, unreferences the old data pointed to by @p out_c. 103 103 * 104 104 * Also initializes t_camera_calibration::distortion_num in t_stereo_camera_calibration::view, only 5 and 14 is 105 105 * accepted. ··· 107 107 * @public @memberof t_stereo_camera_calibration 108 108 */ 109 109 void 110 - t_stereo_camera_calibration_alloc(struct t_stereo_camera_calibration **calib, uint32_t distortion_num); 110 + t_stereo_camera_calibration_alloc(struct t_stereo_camera_calibration **out_c, uint32_t distortion_num); 111 111 112 112 /*! 113 113 * Only to be called by @p t_stereo_camera_calibration_reference. ··· 188 188 * @relates t_stereo_camera_calibration 189 189 */ 190 190 bool 191 - t_stereo_camera_calibration_from_json_v2(cJSON *json, struct t_stereo_camera_calibration **out_data); 191 + t_stereo_camera_calibration_from_json_v2(cJSON *json, struct t_stereo_camera_calibration **out_stereo); 192 192 193 193 /*! 194 194 * Convert the given stereo calibration data into a json object in v2 format. ··· 196 196 * @relates t_stereo_camera_calibration 197 197 */ 198 198 bool 199 - t_stereo_camera_calibration_to_json_v2(cJSON **out_json, struct t_stereo_camera_calibration *data); 199 + t_stereo_camera_calibration_to_json_v2(cJSON **out_cjson, struct t_stereo_camera_calibration *data); 200 200 201 201 202 202 /*!
+3 -7
src/xrt/auxiliary/util/u_config_json.c
··· 7 7 * @ingroup st_prober 8 8 */ 9 9 10 - #ifdef _MSC_VER 11 - #define _CRT_SECURE_NO_WARNINGS 12 - #endif 13 - 14 10 #include <xrt/xrt_device.h> 15 11 #include "xrt/xrt_settings.h" 16 12 #include "xrt/xrt_config.h" ··· 311 307 bad |= !get_obj_str(override, "tracker_device_serial", o->tracker_device_serial, XRT_DEVICE_NAME_LEN); 312 308 313 309 char override_type[256]; 314 - bad |= !get_obj_str(override, "type", override_type, 256); 315 - if (strncmp(override_type, "direct", 256) == 0) { 310 + bad |= !get_obj_str(override, "type", override_type, sizeof(override_type)); 311 + if (strncmp(override_type, "direct", sizeof(override_type) - 1) == 0) { 316 312 o->override_type = XRT_TRACKING_OVERRIDE_DIRECT; 317 - } else if (strncmp(override_type, "attached", 256) == 0) { 313 + } else if (strncmp(override_type, "attached", sizeof(override_type) - 1) == 0) { 318 314 o->override_type = XRT_TRACKING_OVERRIDE_ATTACHED; 319 315 } 320 316
+8 -8
src/xrt/auxiliary/util/u_distortion.c
··· 83 83 84 84 // Tan-angle to texture coordinates 85 85 // clang-format off 86 - l_values.texture.size.x = tan(-args->fov.angle_left) + tan(args->fov.angle_right); 87 - l_values.texture.size.y = tan(args->fov.angle_up) + tan(-args->fov.angle_down); 88 - l_values.texture.offset.x = tan(-args->fov.angle_left); 89 - l_values.texture.offset.y = tan(-args->fov.angle_down); 86 + l_values.texture.size.x = tanf(-args->fov.angle_left) + tanf(args->fov.angle_right); 87 + l_values.texture.size.y = tanf(args->fov.angle_up) + tanf(-args->fov.angle_down); 88 + l_values.texture.offset.x = tanf(-args->fov.angle_left); 89 + l_values.texture.offset.y = tanf(-args->fov.angle_down); 90 90 // clang-format on 91 91 92 92 // Fix up views not covering the entire screen. ··· 118 118 119 119 // Tanangle to texture coordinates 120 120 // clang-format off 121 - r_values.texture.size.x = tan(-args->fov.angle_left) + tan(args->fov.angle_right); 122 - r_values.texture.size.y = tan(args->fov.angle_up) + tan(-args->fov.angle_down); 123 - r_values.texture.offset.x = tan(-args->fov.angle_left); 124 - r_values.texture.offset.y = tan(-args->fov.angle_down); 121 + r_values.texture.size.x = tanf(-args->fov.angle_left) + tanf(args->fov.angle_right); 122 + r_values.texture.size.y = tanf(args->fov.angle_up) + tanf(-args->fov.angle_down); 123 + r_values.texture.offset.x = tanf(-args->fov.angle_left); 124 + r_values.texture.offset.y = tanf(-args->fov.angle_down); 125 125 // clang-format on 126 126 127 127 // Fix up views not covering the entire screen.
+8 -8
src/xrt/auxiliary/util/u_distortion_mesh.c
··· 301 301 302 302 struct xrt_fov fov = values->fov[view]; 303 303 304 - float left_ray_bound = tan(fov.angle_left); 305 - float right_ray_bound = tan(fov.angle_right); 306 - float up_ray_bound = tan(fov.angle_up); 307 - float down_ray_bound = tan(fov.angle_down); 304 + float left_ray_bound = tanf(fov.angle_left); 305 + float right_ray_bound = tanf(fov.angle_right); 306 + float up_ray_bound = tanf(fov.angle_up); 307 + float down_ray_bound = tanf(fov.angle_down); 308 308 309 309 float u_eye = math_map_ranges(x_ray, left_ray_bound, right_ray_bound, 0, 1); 310 310 ··· 363 363 364 364 struct xrt_fov fov = values->fov[view]; 365 365 366 - float left_ray_bound = tan(fov.angle_left); 367 - float right_ray_bound = tan(fov.angle_right); 368 - float up_ray_bound = tan(fov.angle_up); 369 - float down_ray_bound = tan(fov.angle_down); 366 + float left_ray_bound = tanf(fov.angle_left); 367 + float right_ray_bound = tanf(fov.angle_right); 368 + float up_ray_bound = tanf(fov.angle_up); 369 + float down_ray_bound = tanf(fov.angle_down); 370 370 // printf("%f %f", fov.angle_down, fov.angle_up); 371 371 372 372 float u_eye = math_map_ranges(x_ray, left_ray_bound, right_ray_bound, 0, 1);
+4 -4
src/xrt/auxiliary/util/u_file.c
··· 66 66 } 67 67 68 68 ssize_t 69 - u_file_get_path_in_config_dir(const char *filename, char *out_path, size_t out_path_size) 69 + u_file_get_path_in_config_dir(const char *suffix, char *out_path, size_t out_path_size) 70 70 { 71 71 char tmp[PATH_MAX]; 72 72 ssize_t i = u_file_get_config_dir(tmp, sizeof(tmp)); ··· 74 74 return -1; 75 75 } 76 76 77 - return snprintf(out_path, out_path_size, "%s/%s", tmp, filename); 77 + return snprintf(out_path, out_path_size, "%s/%s", tmp, suffix); 78 78 } 79 79 80 80 FILE * ··· 117 117 } 118 118 119 119 ssize_t 120 - u_file_get_path_in_runtime_dir(const char *filename, char *out_path, size_t out_path_size) 120 + u_file_get_path_in_runtime_dir(const char *suffix, char *out_path, size_t out_path_size) 121 121 { 122 122 char tmp[PATH_MAX]; 123 123 ssize_t i = u_file_get_runtime_dir(tmp, sizeof(tmp)); ··· 125 125 return -1; 126 126 } 127 127 128 - return snprintf(out_path, out_path_size, "%s/%s", tmp, filename); 128 + return snprintf(out_path, out_path_size, "%s/%s", tmp, suffix); 129 129 } 130 130 131 131 #endif
+1 -1
src/xrt/auxiliary/util/u_file.h
··· 35 35 u_file_read_content(FILE *file); 36 36 37 37 ssize_t 38 - u_file_get_path_in_runtime_dir(const char *filename, char *out_path, size_t out_path_size); 38 + u_file_get_path_in_runtime_dir(const char *suffix, char *out_path, size_t out_path_size); 39 39 40 40 #ifdef __cplusplus 41 41 }
+2 -2
src/xrt/auxiliary/util/u_hashmap.cpp
··· 34 34 extern "C" int 35 35 u_hashmap_int_create(struct u_hashmap_int **out_hashmap_int) 36 36 { 37 - auto hs = new u_hashmap_int; 37 + auto *hs = new u_hashmap_int; 38 38 *out_hashmap_int = hs; 39 39 return 0; 40 40 } ··· 91 91 92 92 hmi->map.clear(); 93 93 94 - for (auto n : tmp) { 94 + for (auto *n : tmp) { 95 95 cb(n, priv); 96 96 } 97 97 }
+2 -2
src/xrt/auxiliary/util/u_hashset.cpp
··· 37 37 extern "C" int 38 38 u_hashset_create(struct u_hashset **out_hashset) 39 39 { 40 - auto hs = new u_hashset; 40 + auto *hs = new u_hashset; 41 41 *out_hashset = hs; 42 42 return 0; 43 43 } ··· 159 159 160 160 hs->map.clear(); 161 161 162 - for (auto n : tmp) { 162 + for (auto *n : tmp) { 163 163 cb(n, priv); 164 164 } 165 165 }
+1 -3
src/xrt/auxiliary/util/u_id_ringbuffer.cpp
··· 45 45 46 46 container_type *container_{nullptr}; 47 47 48 - IdRingbufferIterator(container_type *container, base &&iter_base) 49 - : base(std::move(iter_base)), container_(container) 50 - {} 48 + IdRingbufferIterator(container_type *container, base &&iter_base) : base(iter_base), container_(container) {} 51 49 52 50 static Self 53 51 begin(container_type &container)
+2 -4
src/xrt/auxiliary/util/u_index_fifo.h
··· 24 24 { 25 25 if (uif->start == uif->end) { 26 26 return 1; 27 - } else { 28 - return 0; 29 27 } 28 + return 0; 30 29 } 31 30 32 31 static inline int ··· 34 33 { 35 34 if (((uif->end + 1) % U_MAX_FIFO_INDICES) == uif->start) { 36 35 return 1; 37 - } else { 38 - return 0; 39 36 } 37 + return 0; 40 38 } 41 39 42 40 static inline int
+1 -1
src/xrt/auxiliary/util/u_json.hpp
··· 299 299 } 300 300 301 301 bool 302 - hasKey(const string &key) 302 + hasKey(const string &key) const 303 303 { 304 304 return asObject().count(key) == 1; 305 305 }
+2 -2
src/xrt/auxiliary/util/u_pacing_app.c
··· 442 442 */ 443 443 444 444 xrt_result_t 445 - u_pa_create(struct u_pacing_app **out_urt) 445 + u_pa_create(struct u_pacing_app **out_upa) 446 446 { 447 447 struct pacing_app *pa = U_TYPED_CALLOC(struct pacing_app); 448 448 pa->base.predict = pa_predict; ··· 461 461 pa->frames[i].frame_id = -1; 462 462 } 463 463 464 - *out_urt = &pa->base; 464 + *out_upa = &pa->base; 465 465 466 466 return XRT_SUCCESS; 467 467 }
+2 -2
src/xrt/auxiliary/util/u_pacing_compositor.c
··· 675 675 xrt_result_t 676 676 u_pc_display_timing_create(uint64_t estimated_frame_period_ns, 677 677 const struct u_pc_display_timing_config *config, 678 - struct u_pacing_compositor **out_uft) 678 + struct u_pacing_compositor **out_upc) 679 679 { 680 680 struct pacing_compositor *pc = U_TYPED_CALLOC(struct pacing_compositor); 681 681 pc->base.predict = pc_predict; ··· 699 699 // Extra margin that is added to compositor time. 700 700 pc->margin_ns = config->margin_ns; 701 701 702 - *out_uft = &pc->base; 702 + *out_upc = &pc->base; 703 703 704 704 double estimated_frame_period_ms = ns_to_ms(estimated_frame_period_ns); 705 705 UPC_LOG_I("Created compositor pacing (%.2fms)", estimated_frame_period_ms);
+2 -2
src/xrt/auxiliary/util/u_pacing_compositor_fake.c
··· 177 177 */ 178 178 179 179 xrt_result_t 180 - u_pc_fake_create(uint64_t estimated_frame_period_ns, uint64_t now_ns, struct u_pacing_compositor **out_uft) 180 + u_pc_fake_create(uint64_t estimated_frame_period_ns, uint64_t now_ns, struct u_pacing_compositor **out_upc) 181 181 { 182 182 struct fake_timing *ft = U_TYPED_CALLOC(struct fake_timing); 183 183 ft->base.predict = pc_predict; ··· 200 200 ft->last_display_time_ns = now_ns + U_TIME_1MS_IN_NS * 50.0; 201 201 202 202 // Return value. 203 - *out_uft = &ft->base; 203 + *out_upc = &ft->base; 204 204 205 205 U_LOG_I("Created fake timing"); 206 206
+2 -1
src/xrt/auxiliary/util/u_sink_stereo_sbs_to_slam_sbs.c
··· 40 40 41 41 int one_frame_width = xf->width / 2; 42 42 43 - struct xrt_rect left, right; 43 + struct xrt_rect left; 44 + struct xrt_rect right; 44 45 45 46 left.offset.h = 0; 46 47 left.offset.w = 0;
+1 -4
src/xrt/auxiliary/util/u_string_list.hpp
··· 125 125 } 126 126 std::string needle{str}; 127 127 auto it = std::find_if(vec.begin(), vec.end(), [needle](const char *elt) { return needle == elt; }); 128 - if (it != vec.end()) { 129 - return true; 130 - } 131 - return false; 128 + return it != vec.end(); 132 129 } 133 130 134 131 /*!
+5 -5
src/xrt/auxiliary/util/u_template_historybuf_const_iterator.inl
··· 42 42 43 43 // copy and move as you wish 44 44 HistoryBufConstIterator(HistoryBufConstIterator const &) = default; 45 - HistoryBufConstIterator(HistoryBufConstIterator &&) = default; 45 + HistoryBufConstIterator(HistoryBufConstIterator &&) noexcept = default; 46 46 HistoryBufConstIterator & 47 47 operator=(HistoryBufConstIterator const &) = default; 48 48 HistoryBufConstIterator & 49 - operator=(HistoryBufConstIterator &&) = default; 49 + operator=(HistoryBufConstIterator &&) noexcept = default; 50 50 51 51 //! Implicit conversion from a non-const iterator 52 52 HistoryBufConstIterator(const HistoryBufIterator<T, MaxSize> &other); ··· 119 119 static Self 120 120 begin(container_type &container, const RingBufferHelper &helper) 121 121 { 122 - return {&container, std::move(base::begin(helper))}; 122 + return {&container, base::begin(helper)}; 123 123 } 124 124 125 125 //! Construct the "past the end" iterator that can be decremented safely 126 126 static Self 127 127 end(container_type &container, const RingBufferHelper &helper) 128 128 { 129 - return {&container, std::move(base::end(helper))}; 129 + return {&container, base::end(helper)}; 130 130 } 131 131 132 132 // for use internally 133 133 HistoryBufConstIterator(container_type *container, base &&iter_base) 134 - : base(std::move(iter_base)), container_(container) 134 + : base(iter_base), container_(container) 135 135 {} 136 136 container_type *container_{nullptr}; 137 137 };
+6 -7
src/xrt/auxiliary/util/u_template_historybuf_iterator.inl
··· 41 41 42 42 // copy and move as you wish 43 43 HistoryBufIterator(HistoryBufIterator const &) = default; 44 - HistoryBufIterator(HistoryBufIterator &&) = default; 44 + HistoryBufIterator(HistoryBufIterator &&) noexcept = default; 45 45 HistoryBufIterator & 46 46 operator=(HistoryBufIterator const &) = default; 47 47 HistoryBufIterator & 48 - operator=(HistoryBufIterator &&) = default; 48 + operator=(HistoryBufIterator &&) noexcept = default; 49 49 50 50 //! Is this iterator valid? 51 51 bool ··· 115 115 static Self 116 116 begin(container_type &container, const RingBufferHelper &helper) 117 117 { 118 - return {&container, std::move(base::begin(helper))}; 118 + return {&container, base::begin(helper)}; 119 119 } 120 120 121 121 //! Construct the "past the end" iterator that can be decremented safely 122 122 static Self 123 123 end(container_type &container, const RingBufferHelper &helper) 124 124 { 125 - return {&container, std::move(base::end(helper))}; 125 + return {&container, base::end(helper)}; 126 126 } 127 127 128 128 // for use internally 129 - HistoryBufIterator(container_type *container, base &&iter_base) 130 - : base(std::move(iter_base)), container_(container) 129 + HistoryBufIterator(container_type *container, base &&iter_base) : base(iter_base), container_(container) 131 130 {} 132 131 container_type *container_{nullptr}; 133 132 }; ··· 136 135 inline typename HistoryBufIterator<T, MaxSize>::reference 137 136 HistoryBufIterator<T, MaxSize>::operator*() const 138 137 { 139 - auto ptr = container_->get_at_index(base::index()); 138 + auto *ptr = container_->get_at_index(base::index()); 140 139 if (ptr == nullptr) { 141 140 throw std::out_of_range("Iterator index out of range"); 142 141 }
+11 -11
src/xrt/auxiliary/util/u_worker.c
··· 109 109 */ 110 110 111 111 static inline struct group * 112 - group(struct u_worker_group *uwp) 112 + group(struct u_worker_group *uwg) 113 113 { 114 - return (struct group *)uwp; 114 + return (struct group *)uwg; 115 115 } 116 116 117 117 static inline struct pool * ··· 464 464 } 465 465 466 466 void 467 - u_worker_group_push(struct u_worker_group *uwp, u_worker_group_func_t f, void *data) 467 + u_worker_group_push(struct u_worker_group *uwg, u_worker_group_func_t f, void *data) 468 468 { 469 469 XRT_TRACE_MARKER(); 470 470 471 - struct group *g = group(uwp); 471 + struct group *g = group(uwg); 472 472 struct pool *p = pool(g->uwtp); 473 473 474 474 os_mutex_lock(&p->mutex); ··· 476 476 os_mutex_unlock(&p->mutex); 477 477 478 478 //! @todo Don't wait all, wait one. 479 - u_worker_group_wait_all(uwp); 479 + u_worker_group_wait_all(uwg); 480 480 481 481 os_mutex_lock(&p->mutex); 482 482 } ··· 492 492 } 493 493 494 494 void 495 - u_worker_group_wait_all(struct u_worker_group *uwp) 495 + u_worker_group_wait_all(struct u_worker_group *uwg) 496 496 { 497 497 XRT_TRACE_MARKER(); 498 498 499 - struct group *g = group(uwp); 499 + struct group *g = group(uwg); 500 500 struct pool *p = pool(g->uwtp); 501 501 502 502 os_mutex_lock(&p->mutex); ··· 517 517 } 518 518 519 519 void 520 - u_worker_group_destroy(struct u_worker_group *uwp) 520 + u_worker_group_destroy(struct u_worker_group *uwg) 521 521 { 522 522 XRT_TRACE_MARKER(); 523 523 524 - struct group *g = group(uwp); 524 + struct group *g = group(uwg); 525 525 assert(g->base.reference.count == 0); 526 526 527 - u_worker_group_wait_all(uwp); 527 + u_worker_group_wait_all(uwg); 528 528 529 529 u_worker_thread_pool_reference(&g->uwtp, NULL); 530 530 531 531 os_cond_destroy(&g->waiting.cond); 532 532 533 - free(uwp); 533 + free(uwg); 534 534 }
+9 -4
src/xrt/auxiliary/vive/vive_config.c
··· 60 60 static void 61 61 _get_pose_from_pos_x_z(const cJSON *obj, struct xrt_pose *pose) 62 62 { 63 - struct xrt_vec3 plus_x, plus_z; 63 + struct xrt_vec3 plus_x; 64 + struct xrt_vec3 plus_z; 64 65 JSON_VEC3(obj, "plus_x", &plus_x); 65 66 JSON_VEC3(obj, "plus_z", &plus_z); 66 67 JSON_VEC3(obj, "position", &pose->position); ··· 248 249 if (!found_camera_json) { 249 250 U_LOG_W("HMD is Index, but no cameras in json file!"); 250 251 return false; 251 - } else if (!succeeded_parsing_json) { 252 + } 253 + if (!succeeded_parsing_json) { 252 254 U_LOG_E("Failed to parse Index camera calibration!"); 253 255 return false; 254 256 } ··· 264 266 d->cameras.view[1].headref = camera_to_head; 265 267 266 268 // Calculate where in the right camera space the left camera is. 267 - struct xrt_pose invert, left_in_right; 269 + struct xrt_pose invert; 270 + struct xrt_pose left_in_right; 268 271 math_pose_invert(&d->cameras.view[1].headref, &invert); 269 272 math_pose_transform(&d->cameras.view[0].headref, &invert, &left_in_right); 270 273 d->cameras.left_in_right = left_in_right; ··· 321 324 } 322 325 323 326 struct xrt_vec3 pos = d->cameras.opencv.position; 324 - struct xrt_vec3 x = {1, 0, 0}, y = {0, 1, 0}, z = {0, 0, 1}; 327 + struct xrt_vec3 x = XRT_VEC3_UNIT_X; 328 + struct xrt_vec3 y = XRT_VEC3_UNIT_Y; 329 + struct xrt_vec3 z = XRT_VEC3_UNIT_Z; 325 330 math_quat_rotate_vec3(&d->cameras.opencv.orientation, &x, &x); 326 331 math_quat_rotate_vec3(&d->cameras.opencv.orientation, &y, &y); 327 332 math_quat_rotate_vec3(&d->cameras.opencv.orientation, &z, &z);
+1 -1
src/xrt/auxiliary/vive/vive_config.h
··· 209 209 * Free any allocated resources on this config. 210 210 */ 211 211 void 212 - vive_config_teardown(struct vive_config *d); 212 + vive_config_teardown(struct vive_config *config); 213 213 214 214 struct vive_controller_device; 215 215
+2 -2
src/xrt/auxiliary/vk/vk_helpers.h
··· 540 540 vk_create_device(struct vk_bundle *vk, 541 541 int forced_index, 542 542 bool only_compute, 543 - VkQueueGlobalPriorityEXT global_priorty, 543 + VkQueueGlobalPriorityEXT global_priority, 544 544 struct u_string_list *required_device_ext_list, 545 545 struct u_string_list *optional_device_ext_list, 546 546 const struct vk_device_features *optional_device_features); ··· 953 953 * Does error logging. 954 954 */ 955 955 VkResult 956 - vk_create_command_buffer(struct vk_bundle *vk, VkCommandBuffer *out_cmd); 956 + vk_create_command_buffer(struct vk_bundle *vk, VkCommandBuffer *out_command_buffer); 957 957 958 958 /*! 959 959 * Destroys a command buffer, takes the cmd_pool_mutex.
-2
src/xrt/auxiliary/vk/vk_image_readback_to_xf_pool.c
··· 116 116 im->base_frame.height = extent.height; 117 117 im->base_frame.size = stride * extent.height; 118 118 im->base_frame.format = pool->desired_format; 119 - 120 - return; 121 119 } 122 120 123 121 /*
+3 -8
src/xrt/auxiliary/vk/vk_sync_objects.c
··· 29 29 #if defined(XRT_GRAPHICS_SYNC_HANDLE_IS_FD) 30 30 if (vk->external.binary_semaphore_opaque_fd) { 31 31 return VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT; 32 - } else { 33 - return 0; 34 32 } 33 + 35 34 #elif defined(XRT_GRAPHICS_SYNC_HANDLE_IS_WIN32_HANDLE) 36 35 if (vk->external.binary_semaphore_win32_handle) { 37 36 return VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT; 38 - } else { 39 - return 0; 40 37 } 41 38 #else 42 39 #error "Need to port semaphore type code." 43 40 #endif 41 + return 0; 44 42 } 45 43 46 44 #ifdef VK_KHR_timeline_semaphore ··· 50 48 #if defined(XRT_GRAPHICS_SYNC_HANDLE_IS_FD) 51 49 if (vk->external.timeline_semaphore_opaque_fd) { 52 50 return VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT; 53 - } else { 54 - return 0; 55 51 } 56 52 #elif defined(XRT_GRAPHICS_SYNC_HANDLE_IS_WIN32_HANDLE) 57 53 if (vk->external.timeline_semaphore_win32_handle) { 58 54 return VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT; 59 - } else { 60 - return 0; 61 55 } 62 56 #else 63 57 #error "Need to port semaphore type code." 64 58 #endif 59 + return 0; 65 60 } 66 61 #endif 67 62
+6 -2
src/xrt/compositor/client/comp_gl_client.c
··· 233 233 const struct xrt_layer_data *data) 234 234 { 235 235 struct client_gl_compositor *c = client_gl_compositor(xc); 236 - struct xrt_swapchain *l_xscn, *r_xscn; 236 + struct xrt_swapchain *l_xscn; 237 + struct xrt_swapchain *r_xscn; 237 238 238 239 assert(data->type == XRT_LAYER_STEREO_PROJECTION); 239 240 ··· 256 257 const struct xrt_layer_data *data) 257 258 { 258 259 struct client_gl_compositor *c = client_gl_compositor(xc); 259 - struct xrt_swapchain *l_xscn, *r_xscn, *l_d_xscn, *r_d_xscn; 260 + struct xrt_swapchain *l_xscn; 261 + struct xrt_swapchain *r_xscn; 262 + struct xrt_swapchain *l_d_xscn; 263 + struct xrt_swapchain *r_d_xscn; 260 264 261 265 assert(data->type == XRT_LAYER_STEREO_PROJECTION_DEPTH); 262 266
+1 -1
src/xrt/compositor/client/comp_gl_memobj_swapchain.h
··· 49 49 client_gl_memobj_swapchain_create(struct xrt_compositor *xc, 50 50 const struct xrt_swapchain_create_info *info, 51 51 struct xrt_swapchain_native *xscn, 52 - struct client_gl_swapchain **out_sc); 52 + struct client_gl_swapchain **out_cglsc); 53 53 54 54 55 55 #ifdef __cplusplus
+6 -2
src/xrt/compositor/client/comp_vk_client.c
··· 451 451 const struct xrt_layer_data *data) 452 452 { 453 453 struct client_vk_compositor *c = client_vk_compositor(xc); 454 - struct xrt_swapchain *l_xscn, *r_xscn; 454 + struct xrt_swapchain *l_xscn; 455 + struct xrt_swapchain *r_xscn; 455 456 456 457 assert(data->type == XRT_LAYER_STEREO_PROJECTION); 457 458 ··· 472 473 const struct xrt_layer_data *data) 473 474 { 474 475 struct client_vk_compositor *c = client_vk_compositor(xc); 475 - struct xrt_swapchain *l_xscn, *r_xscn, *l_d_xscn, *r_d_xscn; 476 + struct xrt_swapchain *l_xscn; 477 + struct xrt_swapchain *r_xscn; 478 + struct xrt_swapchain *l_d_xscn; 479 + struct xrt_swapchain *r_d_xscn; 476 480 477 481 assert(data->type == XRT_LAYER_STEREO_PROJECTION_DEPTH); 478 482
+4 -5
src/xrt/compositor/main/comp_renderer.c
··· 732 732 renderer_close_renderings_and_fences(r); 733 733 return; 734 734 } 735 - 736 - renderer_ensure_images_and_renderings(r, true); // Force recreate. 737 - 738 - return; 735 + // Force recreate. 736 + renderer_ensure_images_and_renderings(r, true); 739 737 } 740 738 741 739 static void ··· 1572 1570 } 1573 1571 1574 1572 void 1575 - comp_renderer_add_debug_vars(struct comp_renderer *r) 1573 + comp_renderer_add_debug_vars(struct comp_renderer *self) 1576 1574 { 1575 + struct comp_renderer *r = self; 1577 1576 r->mirror_to_debug_gui.push_every_frame_out_of_X = 2; 1578 1577 1579 1578 u_frame_times_widget_init(&r->mirror_to_debug_gui.push_frame_times, 0.f, 0.f);
+4 -2
src/xrt/drivers/arduino/arduino_device.c
··· 149 149 timepoint_ns timestamp_ns, 150 150 time_duration_ns delta_ns) 151 151 { 152 - struct xrt_vec3 accel, gyro; 152 + struct xrt_vec3 accel; 153 + struct xrt_vec3 gyro; 153 154 m_imu_pre_filter_data(&ad->pre_filter, &sample->accel, &sample->gyro, &accel, &gyro); 154 155 155 156 ad->device_time += (uint64_t)sample->delta * 1000; ··· 231 232 { 232 233 struct arduino_device *ad = (struct arduino_device *)ptr; 233 234 uint8_t buffer[20]; 234 - timepoint_ns then_ns, now_ns; 235 + timepoint_ns then_ns; 236 + timepoint_ns now_ns; 235 237 struct arduino_parsed_input input; // = {0}; 236 238 237 239 // wait for a package to sync up, it's discarded but that's okay.
+2 -1
src/xrt/drivers/daydream/daydream_device.c
··· 88 88 time_duration_ns delta_ns) 89 89 { 90 90 91 - struct xrt_vec3 accel, gyro; 91 + struct xrt_vec3 accel; 92 + struct xrt_vec3 gyro; 92 93 m_imu_pre_filter_data(&dd->pre_filter, &sample->accel, &sample->gyro, &accel, &gyro); 93 94 94 95 DAYDREAM_DEBUG(dd,
+1 -3
src/xrt/drivers/euroc/euroc_device.c
··· 103 103 104 104 static void 105 105 euroc_device_update_inputs(struct xrt_device *xdev) 106 - { 107 - return; 108 - } 106 + {} 109 107 110 108 //! Corrections specific for original euroc datasets and Kimera. 111 109 //! If your datasets comes from a different camera you should probably
+2 -3
src/xrt/drivers/euroc/euroc_player.cpp
··· 453 453 { 454 454 bool stereo = ep->playback.stereo; 455 455 456 - struct xrt_frame *left_xf = NULL, *right_xf = NULL; 456 + struct xrt_frame *left_xf = NULL; 457 + struct xrt_frame *right_xf = NULL; 457 458 euroc_player_load_next_frame(ep, true, left_xf); 458 459 if (stereo) { 459 460 // TODO: Some SLAM systems expect synced frames, but that's not an ··· 787 788 m_ff_vec3_f32_free(&ep->accel_ff); 788 789 789 790 free(ep); 790 - 791 - return; 792 791 } 793 792 794 793
+1 -1
src/xrt/drivers/north_star/distortion_3d/deformation_northstar.cpp
··· 209 209 210 210 211 211 Vector2 212 - OpticalSystem::DisplayUVToRenderUVPreviousSeed(Vector2 inputUV) 212 + OpticalSystem::DisplayUVToRenderUVPreviousSeed(const Vector2 &inputUV) 213 213 { 214 214 // if we don't find a point we generate it and add it to our list 215 215 Vector2 curDisplayUV;
+17 -11
src/xrt/drivers/north_star/distortion_3d/deformation_northstar.h
··· 20 20 LoadOpticalData(struct ns_3d_eye *eye); 21 21 22 22 Vector3 23 - GetEyePosition() 23 + GetEyePosition() const 24 24 { 25 25 return eyePosition; 26 26 } ··· 35 35 SolveDisplayUVToRenderUV(const Vector2 &inputUV, Vector2 const &initialGuess, int iterations); 36 36 37 37 Vector2 38 - DisplayUVToRenderUVPreviousSeed(Vector2 inputUV); 38 + DisplayUVToRenderUVPreviousSeed(const Vector2 &inputUV); 39 39 40 40 void 41 41 RegenerateMesh(); 42 42 43 43 void 44 - UpdateEyePosition(const Vector3 pos) 44 + UpdateEyePosition(const Vector3 &pos) 45 45 { 46 46 eyePosition.x = pos.x; 47 47 eyePosition.y = pos.y; 48 48 eyePosition.z = pos.z; 49 49 } 50 50 51 - const Vector4 51 + Vector4 52 52 GetCameraProjection() 53 53 { 54 54 return cameraProjection; ··· 62 62 } 63 63 64 64 void 65 - UpdateClipToWorld(Matrix4x4 eyeRotationMatrix) 65 + UpdateClipToWorld(const Matrix4x4 &eyeRotationMatrix) 66 66 { 67 67 Matrix4x4 eyeToWorld = Matrix4x4::Translate(eyePosition) * eyeRotationMatrix; 68 68 eyeToWorld.m02 *= -1; ··· 73 73 74 74 Vector3 eyePosition; 75 75 76 - inline void 77 - ViewportPointToRayDirection(Vector2 UV, Vector3 cameraPosition, Matrix4x4 clipToWorld, Vector3 &out) 76 + static inline void 77 + ViewportPointToRayDirection(const Vector2 &UV, 78 + const Vector3 &cameraPosition, 79 + const Matrix4x4 &clipToWorld, 80 + Vector3 &out) 78 81 { 79 82 Vector3 tmp; 80 83 tmp.x = UV.x - 0.5f; ··· 84 87 85 88 float mag = dir.Magnitude(); 86 89 out = dir / mag; 87 - return; 88 90 } 89 91 90 92 private: ··· 107 109 108 110 // supporting functions 109 111 inline Vector3 110 - Project(Vector3 v1, Vector3 v2) 112 + Project(const Vector3 &v1, const Vector3 &v2) 111 113 { 112 114 Vector3 v2Norm = (v2 / v2.Magnitude()); 113 115 return v2Norm * Vector3::Dot(v1, v2Norm); 114 116 } 115 117 116 118 inline float 117 - intersectLineSphere(Vector3 Origin, Vector3 Direction, Vector3 spherePos, float SphereRadiusSqrd, bool frontSide = true) 119 + intersectLineSphere(const Vector3 &Origin, 120 + const Vector3 &Direction, 121 + const Vector3 &spherePos, 122 + float SphereRadiusSqrd, 123 + bool frontSide = true) 118 124 { 119 125 Vector3 L = spherePos - Origin; 120 126 Vector3 offsetFromSphereCenterToRay = Project(L, Direction) - L; ··· 125 131 } 126 132 127 133 inline float 128 - intersectPlane(Vector3 n, Vector3 p0, Vector3 l0, Vector3 l) 134 + intersectPlane(const Vector3 &n, const Vector3 &p0, const Vector3 &l0, const Vector3 &l) 129 135 { 130 136 131 137 float denom = Vector3::Dot((Vector3::Zero() - n), l);
+24 -18
src/xrt/drivers/north_star/distortion_3d/utility_northstar.h
··· 84 84 }; 85 85 86 86 inline Vector3 87 - operator-(Vector3 &rhs) const 87 + operator-(const Vector3 &rhs) const 88 88 { 89 89 Vector3 ret; 90 90 ret.x = (x - rhs.x); ··· 158 158 } 159 159 160 160 inline static float 161 - Angle(Vector3 v0, Vector3 v1) 161 + Angle(const Vector3 &v0, const Vector3 &v1) 162 162 { 163 163 Vector3 dir0 = v0.Normalized(); 164 164 Vector3 dir1 = v1.Normalized(); ··· 196 196 } 197 197 198 198 inline static Vector3 199 - Reflect(Vector3 inDirection, Vector3 inNormal) 199 + Reflect(const Vector3 &inDirection, const Vector3 &inNormal) 200 200 { 201 201 return inNormal * -2.F * Dot(inNormal, inDirection) + inDirection; 202 202 } ··· 235 235 236 236 237 237 inline void 238 - rotate(Vector3 axis, float radians) 238 + rotate(const Vector3 &axis, float radians) 239 239 { 240 240 float cos_theta = cosf(radians); 241 241 float sin_theta = sinf(radians); ··· 251 251 } 252 252 253 253 inline Vector3 254 - Cross(const Vector3 in) const 254 + Cross(const Vector3 &in) const 255 255 { 256 256 Vector3 ret; 257 257 ret.x = y * in.z - z * in.y; ··· 489 489 } 490 490 491 491 inline Matrix4x4 // Until clang-format-11 is on the CI. 492 - operator*(const Matrix4x4 &_in) 492 + operator*(const Matrix4x4 &_in) const 493 493 { 494 494 Matrix4x4 ret; 495 495 ret.m00 = (m00 * _in.m00) + (m01 * _in.m10) + (m02 * _in.m20) + (m03 * _in.m30); ··· 536 536 } 537 537 538 538 inline static Matrix4x4 539 - Translate(Vector3 vector) 539 + Translate(const Vector3 &vector) 540 540 { 541 541 Matrix4x4 m; 542 542 m.m00 = 1.f; ··· 559 559 } 560 560 561 561 inline Vector3 562 - MultiplyVector(Vector3 vector) const 562 + MultiplyVector(const Vector3 &vector) const 563 563 { 564 564 Vector3 res; 565 565 res.x = m00 * vector.x + m01 * vector.y + m02 * vector.z; ··· 569 569 } 570 570 571 571 inline Vector3 572 - MultiplyPoint3x4(Vector3 point) const 572 + MultiplyPoint3x4(const Vector3 &point) const 573 573 { 574 574 Vector3 res; 575 575 res.x = m00 * point.x + m01 * point.y + m02 * point.z + m03; ··· 744 744 class Ray 745 745 { 746 746 public: 747 - inline Ray(Vector3 origin, Vector3 direction) 747 + inline Ray(const Vector3 &origin, Vector3 direction) 748 748 { 749 749 m_Origin = origin; 750 750 direction.Normalize(); ··· 754 754 } 755 755 756 756 inline Vector3 757 - GetPoint(float distance) 757 + GetPoint(float distance) const 758 758 { 759 759 return m_Origin + m_Direction * distance; 760 760 } ··· 872 872 Vector3 euler; 873 873 const static float PI_OVER_2 = M_PI * 0.5f; 874 874 const static float EPSILON = 1e-10f; 875 - float sqw, sqx, sqy, sqz; 875 + float sqw; 876 + float sqx; 877 + float sqy; 878 + float sqz; 876 879 877 880 // quick conversion to Euler angles to give tilt to user 878 881 sqw = in.w * in.w; ··· 974 977 } 975 978 976 979 inline static Quaternion 977 - AxisAngle(Vector3 axis, float angle) 980 + AxisAngle(const Vector3 &axis, float angle) 978 981 { 979 982 float halfAngle = angle * .5f; 980 983 float s = (float)sin(halfAngle); ··· 987 990 } 988 991 989 992 inline static Quaternion 990 - LookAt(Vector3 sourcePoint, Vector3 destPoint) 993 + LookAt(const Vector3 &sourcePoint, const Vector3 &destPoint) 991 994 { 992 995 Vector3 forwardVector = (destPoint - sourcePoint).Normalized(); 993 996 ··· 1007 1010 } 1008 1011 1009 1012 inline static Quaternion 1010 - QuaternionLookRotation(Vector3 forward, Vector3 Up) 1013 + QuaternionLookRotation(const Vector3 &forward, const Vector3 &Up) 1011 1014 { 1012 1015 1013 1016 Vector3 vector1 = forward.Normalized(); ··· 1066 1069 } 1067 1070 1068 1071 inline static Quaternion 1069 - FromMatrix(const Matrix4x4 m) 1072 + FromMatrix(const Matrix4x4 &m) 1070 1073 { 1071 1074 float tr = m.m00 + m.m11 + m.m22; 1072 - float qx, qy, qz, qw; 1075 + float qx; 1076 + float qy; 1077 + float qz; 1078 + float qw; 1073 1079 1074 1080 if (tr > 0) { 1075 1081 float S = sqrtf(tr + 1.f) * 2.f; ··· 1166 1172 //} 1167 1173 1168 1174 inline static Quaternion 1169 - FromToRotation(Vector3 dir0, Vector3 dir1) 1175 + FromToRotation(const Vector3 &dir0, const Vector3 &dir1) 1170 1176 { 1171 1177 Vector3 axis = dir0.Cross(dir1).Normalized(); 1172 1178 float angle = Vector3::Angle(dir0, dir1);
+2 -2
src/xrt/drivers/north_star/ns_hmd.c
··· 107 107 assert(fabsf(out_fov.angle_right) < M_PI_2); 108 108 memcpy(left_fov, &out_fov, sizeof(struct xrt_fov)); 109 109 memcpy(right_fov, &out_fov, sizeof(struct xrt_fov)); 110 - return; 111 110 } 112 111 113 112 bool ··· 641 640 // avoid unintended consequences. As soon as you have a specific reason to support it, go ahead and support it. 642 641 ns->base.hmd->blend_mode_count = idx; 643 642 644 - uint64_t start, end; 643 + uint64_t start; 644 + uint64_t end; 645 645 646 646 start = os_monotonic_get_ns(); 647 647 u_distortion_mesh_fill_in_compute(&ns->base);
+4 -2
src/xrt/drivers/psmv/psmv_driver.c
··· 1295 1295 struct psmv_calibration_zcm1 data; 1296 1296 uint8_t *dst = (uint8_t *)&data; 1297 1297 int ret = 0; 1298 - size_t src_offset, dst_offset; 1298 + size_t src_offset; 1299 + size_t dst_offset; 1299 1300 1300 1301 for (int i = 0; i < 3; i++) { 1301 1302 struct psmv_calibration_part part = {0}; ··· 1511 1512 struct psmv_calibration_zcm2 data; 1512 1513 uint8_t *dst = (uint8_t *)&data; 1513 1514 int ret = 0; 1514 - size_t src_offset, dst_offset; 1515 + size_t src_offset; 1516 + size_t dst_offset; 1515 1517 1516 1518 for (int i = 0; i < 2; i++) { 1517 1519 struct psmv_calibration_part part = {0};
+4 -2
src/xrt/drivers/qwerty/qwerty_device.c
··· 177 177 qd->yaw_delta = 0; 178 178 qd->pitch_delta = 0; 179 179 180 - struct xrt_quat x_rotation, y_rotation; 180 + struct xrt_quat x_rotation; 181 + struct xrt_quat y_rotation; 181 182 const struct xrt_vec3 x_axis = XRT_VEC3_UNIT_X; 182 183 const struct xrt_vec3 y_axis = XRT_VEC3_UNIT_Y; 183 184 math_quat_from_angle_vector(x_look_speed, &x_axis, &x_rotation); ··· 231 232 qwerty_hmd_create(void) 232 233 { 233 234 enum u_device_alloc_flags flags = U_DEVICE_ALLOC_HMD | U_DEVICE_ALLOC_TRACKING_NONE; 234 - size_t input_count = 1, output_count = 0; 235 + size_t input_count = 1; 236 + size_t output_count = 0; 235 237 struct qwerty_hmd *qh = U_DEVICE_ALLOCATE(struct qwerty_hmd, flags, input_count, output_count); 236 238 assert(qh); 237 239
+6 -2
src/xrt/drivers/qwerty/qwerty_sdl.c
··· 46 46 static struct qwerty_device * 47 47 default_qwerty_device(struct xrt_device **xdevs, size_t xdev_count, struct qwerty_system *qsys) 48 48 { 49 - int head, left, right; 49 + int head; 50 + int left; 51 + int right; 50 52 head = left = right = XRT_DEVICE_ROLE_UNASSIGNED; 51 53 u_device_assign_xdev_roles(xdevs, xdev_count, &head, &left, &right); 52 54 ··· 72 74 static struct qwerty_controller * 73 75 default_qwerty_controller(struct xrt_device **xdevs, size_t xdev_count, struct qwerty_system *qsys) 74 76 { 75 - int head, left, right; 77 + int head; 78 + int left; 79 + int right; 76 80 head = left = right = XRT_DEVICE_ROLE_UNASSIGNED; 77 81 u_device_assign_xdev_roles(xdevs, xdev_count, &head, &left, &right); 78 82
+7 -4
src/xrt/drivers/remote/r_hub.c
··· 29 29 #define __USE_MISC // SOL_TCP on C11 30 30 #endif 31 31 #ifndef _BSD_SOURCE 32 - #define _BSD_SOURCE // same, but for musl 32 + #define _BSD_SOURCE // same, but for musl // NOLINT 33 33 #endif 34 34 35 35 #include <netinet/tcp.h> ··· 85 85 do_accept(struct r_hub *r) 86 86 { 87 87 struct sockaddr_in addr = {0}; 88 - int ret, conn_fd; 88 + int ret; 89 + int conn_fd; 89 90 90 91 socklen_t addr_length = (socklen_t)sizeof(addr); 91 92 ret = accept(r->accept_fd, (struct sockaddr *)&addr, &addr_length); ··· 286 287 ssize_t ret = read(rc->fd, ptr, size - current); 287 288 if (ret < 0) { 288 289 return ret; 289 - } else if (ret > 0) { 290 + } 291 + if (ret > 0) { 290 292 current += (size_t)ret; 291 293 } else { 292 294 U_LOG_I("Disconnected!"); ··· 309 311 ssize_t ret = write(rc->fd, ptr, size - current); 310 312 if (ret < 0) { 311 313 return ret; 312 - } else if (ret > 0) { 314 + } 315 + if (ret > 0) { 313 316 current += (size_t)ret; 314 317 } else { 315 318 U_LOG_I("Disconnected!");
+2 -1
src/xrt/drivers/vive/vive_device.c
··· 269 269 const struct vive_imu_sample *sample = report->sample; 270 270 uint8_t last_seq = d->imu.sequence; 271 271 d->imu.ts_received_ns = os_monotonic_get_ns(); 272 - int i, j; 272 + int i; 273 + int j; 273 274 274 275 /* 275 276 * The three samples are updated round-robin. New messages
+10 -5
src/xrt/drivers/wmr/wmr_bt_controller.c
··· 72 72 if (size < 0) { 73 73 WMR_ERROR(d, "WMR Controller (Bluetooth): Error reading from device"); 74 74 return false; 75 - } else if (size == 0) { 75 + } 76 + if (size == 0) { 76 77 WMR_TRACE(d, "WMR Controller (Bluetooth): No data to read from device"); 77 78 return true; // No more messages, return. 78 79 } ··· 163 164 { 164 165 struct wmr_controller_fw_cmd_response fw_cmd_response; 165 166 166 - uint8_t *data, *data_pos, *data_end; 167 - uint32_t data_size, remain; 167 + uint8_t *data; 168 + uint8_t *data_pos; 169 + uint8_t *data_end; 170 + uint32_t data_size; 171 + uint32_t remain; 168 172 169 173 struct wmr_controller_fw_cmd fw_cmd; 170 174 memset(&fw_cmd, 0, sizeof(fw_cmd)); ··· 224 228 static bool 225 229 read_controller_config(struct wmr_bt_controller *d) 226 230 { 227 - unsigned char *data = NULL, *config_json_block; 231 + unsigned char *data = NULL; 232 + unsigned char *config_json_block; 228 233 size_t data_size; 229 234 int ret; 230 235 ··· 234 239 // USB PID/VID are visible in them, but it's not clear 235 240 // what the layout is and we don't use them currently, 236 241 // so this if 0 code is just exemplary. 237 - 242 + 238 243 // Read serials 239 244 ret = wmr_read_fw_block(d, 0x03, &data, &data_size); 240 245 if (ret < 0 || data == NULL)
+11 -5
src/xrt/drivers/wmr/wmr_camera.c
··· 140 140 static bool 141 141 compute_frame_size(struct wmr_camera *cam) 142 142 { 143 - int i, cams_found = 0; 144 - int width, height; 145 - size_t F, n_packets, leftover; 143 + int i; 144 + int cams_found = 0; 145 + int width; 146 + int height; 147 + size_t F; 148 + size_t n_packets; 149 + size_t leftover; 146 150 147 151 F = 26; 148 152 ··· 402 406 DRV_TRACE_MARKER(); 403 407 404 408 struct wmr_camera *cam = calloc(1, sizeof(struct wmr_camera)); 405 - int res, i; 409 + int res; 410 + int i; 406 411 407 412 cam->log_level = log_level; 408 413 cam->debug_gain = DEFAULT_GAIN; ··· 572 577 { 573 578 DRV_TRACE_MARKER(); 574 579 575 - int res, i; 580 + int res; 581 + int i; 576 582 577 583 if (!cam->running) { 578 584 return true;
+2 -2
src/xrt/drivers/wmr/wmr_controller_protocol.c
··· 20 20 */ 21 21 22 22 static inline void 23 - vec3_from_wmr_controller_accel(int32_t sample[3], struct xrt_vec3 *out_vec) 23 + vec3_from_wmr_controller_accel(const int32_t sample[3], struct xrt_vec3 *out_vec) 24 24 { 25 25 // Reverb G1 observation: 1g is approximately 490,000. 26 26 ··· 31 31 32 32 33 33 static inline void 34 - vec3_from_wmr_controller_gyro(int32_t sample[3], struct xrt_vec3 *out_vec) 34 + vec3_from_wmr_controller_gyro(const int32_t sample[3], struct xrt_vec3 *out_vec) 35 35 { 36 36 out_vec->x = (float)sample[0] * 0.00001f; 37 37 out_vec->y = (float)sample[1] * 0.00001f;
+14 -8
src/xrt/drivers/wmr/wmr_hmd.c
··· 124 124 for (int i = 0; i < 4; i++) { 125 125 pkt->video_timestamp[i] = read64(&buffer); 126 126 } 127 - 128 - return; 129 127 } 130 128 131 129 ··· 349 347 if (size < 0) { 350 348 WMR_ERROR(wh, "Error reading from Hololens Sensors device. Call to os_hid_read returned %i", size); 351 349 return false; 352 - } else if (size == 0) { 350 + } 351 + if (size == 0) { 353 352 WMR_TRACE(wh, "No more data to read"); 354 353 return true; // No more messages, return. 355 354 } else { ··· 432 431 WMR_ERROR(wh, "Error reading from companion (HMD control) device. Call to os_hid_read returned %i", 433 432 size); 434 433 return false; 435 - } else if (size == 0) { 434 + } 435 + if (size == 0) { 436 436 WMR_TRACE(wh, "No more data to read"); 437 437 return true; // No more messages, return. 438 438 } else { ··· 797 797 798 798 unsigned char meta[84]; 799 799 uint8_t *data; 800 - int size, data_size; 800 + int size; 801 + int data_size; 801 802 802 803 size = wmr_read_config_part(wh, 0x06, meta, sizeof(meta)); 803 804 WMR_DEBUG(wh, "(0x06, meta) => %d", size); ··· 837 838 { 838 839 DRV_TRACE_MARKER(); 839 840 840 - unsigned char *data = NULL, *config_json_block; 841 + unsigned char *data = NULL; 842 + unsigned char *config_json_block; 841 843 size_t data_size; 842 844 int ret; 843 845 ··· 1117 1119 1118 1120 assert(view == 0 || view == 1); 1119 1121 1120 - float tanangle_left = 0.0f, tanangle_right = 0.0f, tanangle_up = 0.0f, tanangle_down = 0.0f; 1122 + float tanangle_left = 0.0f; 1123 + float tanangle_right = 0.0f; 1124 + float tanangle_up = 0.0f; 1125 + float tanangle_down = 0.0f; 1121 1126 1122 1127 const struct wmr_distortion_eye_config *ec = wh->config.eye_params + view; 1123 1128 struct wmr_hmd_distortion_params *distortion_params = wh->distortion_params + view; ··· 1241 1246 1242 1247 enum u_device_alloc_flags flags = 1243 1248 (enum u_device_alloc_flags)(U_DEVICE_ALLOC_HMD | U_DEVICE_ALLOC_TRACKING_NONE); 1244 - int ret = 0, i; 1249 + int ret = 0; 1250 + int i; 1245 1251 int eye; 1246 1252 1247 1253 struct wmr_hmd *wh = U_DEVICE_ALLOCATE(struct wmr_hmd, flags, 1, 0);
+4 -1
src/xrt/drivers/wmr/wmr_source.c
··· 357 357 } 358 358 359 359 void 360 - wmr_source_push_imu_packet(struct xrt_fs *xfs, uint64_t ts[4], struct xrt_vec3 accels[4], struct xrt_vec3 gyros[4]) 360 + wmr_source_push_imu_packet(struct xrt_fs *xfs, 361 + const uint64_t ts[4], 362 + struct xrt_vec3 accels[4], 363 + struct xrt_vec3 gyros[4]) 361 364 { 362 365 DRV_TRACE_MARKER(); 363 366
+4 -1
src/xrt/drivers/wmr/wmr_source.h
··· 32 32 //! @todo IMU data should be generated from within the data source, but right 33 33 //! now we need this function because it is being generated from wmr_hmd 34 34 void 35 - wmr_source_push_imu_packet(struct xrt_fs *xfs, uint64_t ts[4], struct xrt_vec3 accels[4], struct xrt_vec3 gyros[4]); 35 + wmr_source_push_imu_packet(struct xrt_fs *xfs, 36 + const uint64_t ts[4], 37 + struct xrt_vec3 accels[4], 38 + struct xrt_vec3 gyros[4]); 36 39 37 40 /*! 38 41 * @}
+2 -2
src/xrt/include/xrt/xrt_gfx_egl.h
··· 19 19 typedef void *EGLDisplay; 20 20 typedef void *EGLConfig; 21 21 typedef void *EGLContext; 22 - typedef void (*__eglMustCastToProperFunctionPointerType)(void); 22 + typedef void (*__eglMustCastToProperFunctionPointerType)(void); // NOLINT 23 23 typedef __eglMustCastToProperFunctionPointerType (*PFNEGLGETPROCADDRESSPROC)(const char *proc); 24 24 struct time_state; 25 25 ··· 34 34 EGLDisplay display, 35 35 EGLConfig config, 36 36 EGLContext context, 37 - PFNEGLGETPROCADDRESSPROC getProcAddress, 37 + PFNEGLGETPROCADDRESSPROC get_gl_procaddr, 38 38 struct xrt_compositor_gl **out_xcgl); 39 39 40 40 #ifdef __cplusplus
+1 -1
src/xrt/include/xrt/xrt_gfx_xlib.h
··· 17 17 #endif 18 18 19 19 20 - typedef struct _XDisplay Display; 20 + typedef struct _XDisplay Display; // NOLINT 21 21 typedef void *GLXFBConfig; 22 22 typedef void *GLXDrawable; 23 23 typedef void *GLXContext;
+1 -1
src/xrt/include/xrt/xrt_openxr_includes.h
··· 34 34 typedef void *EGLContext; 35 35 typedef void *EGLConfig; 36 36 typedef unsigned int EGLenum; 37 - typedef void (*__eglMustCastToProperFunctionPointerType)(void); 37 + typedef void (*__eglMustCastToProperFunctionPointerType)(void); // NOLINT 38 38 typedef __eglMustCastToProperFunctionPointerType (*PFNEGLGETPROCADDRESSPROC)(const char *procname); 39 39 #endif 40 40
+2 -2
src/xrt/ipc/server/ipc_server.h
··· 347 347 * @ingroup ipc_server 348 348 */ 349 349 void 350 - ipc_server_set_active_client(struct ipc_server *s, int active_client_index); 350 + ipc_server_set_active_client(struct ipc_server *s, int client_id); 351 351 352 352 /*! 353 353 * Called by client threads to set a session to active. ··· 379 379 * @ingroup ipc_server 380 380 */ 381 381 void * 382 - ipc_server_client_thread(void *_cs); 382 + ipc_server_client_thread(void *_ics); 383 383 384 384 /*! 385 385 * This destroys the native compositor for this client and any extra objects
+4 -2
src/xrt/ipc/server/ipc_server_mainloop_linux.c
··· 76 76 { 77 77 // no fd provided 78 78 struct sockaddr_un addr; 79 - int fd, ret; 79 + int fd; 80 + int ret; 80 81 81 82 fd = socket(PF_UNIX, SOCK_STREAM, 0); 82 83 if (fd < 0) { ··· 143 144 static int 144 145 init_listen_socket(struct ipc_server_mainloop *ml) 145 146 { 146 - int fd = -1, ret; 147 + int fd = -1; 148 + int ret; 147 149 ml->listen_socket = -1; 148 150 149 151 ret = get_systemd_socket(ml, &fd);
+2 -4
src/xrt/ipc/shared/ipc_utils.c
··· 326 326 //! @todo Temporary hack to send no handles. 327 327 if (handle_count == 0) { 328 328 return ipc_receive(imc, out_data, size); 329 - } else { 330 - return ipc_receive_fds(imc, out_data, size, out_handles, handle_count); 331 329 } 330 + return ipc_receive_fds(imc, out_data, size, out_handles, handle_count); 332 331 } 333 332 334 333 xrt_result_t ··· 341 340 //! @todo Temporary hack to send no handles. 342 341 if (handle_count == 0) { 343 342 return ipc_send(imc, data, size); 344 - } else { 345 - return ipc_send_fds(imc, data, size, handles, handle_count); 346 343 } 344 + return ipc_send_fds(imc, data, size, handles, handle_count); 347 345 } 348 346 349 347 #else
+1 -1
src/xrt/state_trackers/gui/gui_common.h
··· 132 132 * @ingroup gui 133 133 */ 134 134 void 135 - gui_ogl_sink_update(struct gui_ogl_texture *); 135 + gui_ogl_sink_update(struct gui_ogl_texture * /*tex*/); 136 136 137 137 /*! 138 138 * Push the scene to the top of the lists.
+3 -1
src/xrt/state_trackers/gui/gui_ogl.c
··· 124 124 return; 125 125 } 126 126 127 - GLint w, h, stride; 127 + GLint w; 128 + GLint h; 129 + GLint stride; 128 130 uint8_t *data; 129 131 130 132 w = frame->width;
+2 -1
src/xrt/state_trackers/gui/gui_scene_tracking_overrides.c
··· 214 214 struct xrt_tracking_override *o = &ts->overrides[ts->gui_edit_override_index]; 215 215 216 216 igBegin("Tracker Device Offset", NULL, 0); 217 - int target = -1, tracker = -1; 217 + int target = -1; 218 + int tracker = -1; 218 219 if (get_indices(p, ts, o, &target, &tracker)) { 219 220 igText("Editing %s [%s] <- %s [%s]", p->xdevs[target]->str, o->target_device_serial, 220 221 p->xdevs[tracker]->str, o->tracker_device_serial);
+4 -2
src/xrt/state_trackers/oxr/oxr_api_session.c
··· 33 33 34 34 XrResult ret; 35 35 struct oxr_instance *inst; 36 - struct oxr_session *sess, **link; 36 + struct oxr_session *sess; 37 + struct oxr_session **link; 37 38 struct oxr_logger log; 38 39 OXR_VERIFY_INSTANCE_AND_INIT_LOG(&log, instance, inst, "xrCreateSession"); 39 40 ··· 64 65 { 65 66 OXR_TRACE_MARKER(); 66 67 67 - struct oxr_session *sess, **link; 68 + struct oxr_session *sess; 69 + struct oxr_session **link; 68 70 struct oxr_instance *inst; 69 71 struct oxr_logger log; 70 72 OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess, "xrDestroySession");
+27 -22
src/xrt/state_trackers/oxr/oxr_api_verify.h
··· 14 14 #endif 15 15 16 16 17 - #define _OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, oxr_thing, THING, name, lookup) \ 17 + #define OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, oxr_thing, THING, name, lookup) \ 18 18 do { \ 19 19 oxr_log_init(log, name); \ 20 20 if (thing == XR_NULL_HANDLE) { \ ··· 31 31 oxr_log_set_instance(log, lookup); \ 32 32 } while (0) 33 33 34 - #define _OXR_VERIFY_SET(log, arg, new_arg, oxr_thing, THING) \ 34 + #define OXR_VERIFY_SET(log, arg, new_arg, oxr_thing, THING) \ 35 35 do { \ 36 36 if (arg == XR_NULL_HANDLE) { \ 37 37 return oxr_error(log, XR_ERROR_HANDLE_INVALID, "(" #arg " == NULL)"); \ ··· 50 50 51 51 // clang-format off 52 52 #define OXR_VERIFY_INSTANCE_AND_INIT_LOG(log, thing, new_thing, name) \ 53 - _OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, oxr_instance, INSTANCE, name, new_thing) 53 + OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, oxr_instance, INSTANCE, name, new_thing) 54 54 #define OXR_VERIFY_MESSENGER_AND_INIT_LOG(log, thing, new_thing, name) \ 55 - _OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, oxr_messenger, MESSENGER, name, new_thing->inst) 55 + OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, oxr_messenger, MESSENGER, name, new_thing->inst) 56 56 #define OXR_VERIFY_SESSION_AND_INIT_LOG(log, thing, new_thing, name) \ 57 - _OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, oxr_session, SESSION, name, new_thing->sys->inst) 57 + OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, oxr_session, SESSION, name, new_thing->sys->inst) 58 58 #define OXR_VERIFY_SPACE_AND_INIT_LOG(log, thing, new_thing, name) \ 59 - _OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, oxr_space, SPACE, name, new_thing->sess->sys->inst) 59 + OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, oxr_space, SPACE, name, new_thing->sess->sys->inst) 60 60 #define OXR_VERIFY_ACTION_AND_INIT_LOG(log, thing, new_thing, name) \ 61 - _OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, oxr_action, ACTION, name, new_thing->act_set->inst) 61 + OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, oxr_action, ACTION, name, new_thing->act_set->inst) 62 62 #define OXR_VERIFY_SWAPCHAIN_AND_INIT_LOG(log, thing, new_thing, name) \ 63 - _OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, oxr_swapchain, SWAPCHAIN, name, new_thing->sess->sys->inst) 63 + OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, oxr_swapchain, SWAPCHAIN, name, new_thing->sess->sys->inst) 64 64 #define OXR_VERIFY_ACTIONSET_AND_INIT_LOG(log, thing, new_thing, name) \ 65 - _OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, oxr_action_set, ACTIONSET, name, new_thing->inst) 65 + OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, oxr_action_set, ACTIONSET, name, new_thing->inst) 66 66 #define OXR_VERIFY_HAND_TRACKER_AND_INIT_LOG(log, thing, new_thing, name) \ 67 - _OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, oxr_hand_tracker, HTRACKER, name, new_thing->sess->sys->inst) 67 + OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, oxr_hand_tracker, HTRACKER, name, new_thing->sess->sys->inst) 68 68 // clang-format on 69 69 70 - #define OXR_VERIFY_INSTANCE_NOT_NULL(log, arg, new_arg) _OXR_VERIFY_SET(log, arg, new_arg, oxr_instance, INSTANCE); 71 - #define OXR_VERIFY_MESSENGER_NOT_NULL(log, arg, new_arg) _OXR_VERIFY_SET(log, arg, new_arg, oxr_messenger, MESSENGER); 72 - #define OXR_VERIFY_SESSION_NOT_NULL(log, arg, new_arg) _OXR_VERIFY_SET(log, arg, new_arg, oxr_session, SESSION); 73 - #define OXR_VERIFY_SPACE_NOT_NULL(log, arg, new_arg) _OXR_VERIFY_SET(log, arg, new_arg, oxr_space, SPACE); 74 - #define OXR_VERIFY_ACTION_NOT_NULL(log, arg, new_arg) _OXR_VERIFY_SET(log, arg, new_arg, oxr_action, ACTION); 75 - #define OXR_VERIFY_SWAPCHAIN_NOT_NULL(log, arg, new_arg) _OXR_VERIFY_SET(log, arg, new_arg, oxr_swapchain, SWAPCHAIN); 76 - #define OXR_VERIFY_ACTIONSET_NOT_NULL(log, arg, new_arg) _OXR_VERIFY_SET(log, arg, new_arg, oxr_action_set, ACTIONSET); 70 + #define OXR_VERIFY_INSTANCE_NOT_NULL(log, arg, new_arg) OXR_VERIFY_SET(log, arg, new_arg, oxr_instance, INSTANCE); 71 + #define OXR_VERIFY_MESSENGER_NOT_NULL(log, arg, new_arg) OXR_VERIFY_SET(log, arg, new_arg, oxr_messenger, MESSENGER); 72 + #define OXR_VERIFY_SESSION_NOT_NULL(log, arg, new_arg) OXR_VERIFY_SET(log, arg, new_arg, oxr_session, SESSION); 73 + #define OXR_VERIFY_SPACE_NOT_NULL(log, arg, new_arg) OXR_VERIFY_SET(log, arg, new_arg, oxr_space, SPACE); 74 + #define OXR_VERIFY_ACTION_NOT_NULL(log, arg, new_arg) OXR_VERIFY_SET(log, arg, new_arg, oxr_action, ACTION); 75 + #define OXR_VERIFY_SWAPCHAIN_NOT_NULL(log, arg, new_arg) OXR_VERIFY_SET(log, arg, new_arg, oxr_swapchain, SWAPCHAIN); 76 + #define OXR_VERIFY_ACTIONSET_NOT_NULL(log, arg, new_arg) OXR_VERIFY_SET(log, arg, new_arg, oxr_action_set, ACTIONSET); 77 77 78 78 /*! 79 79 * Checks if a required extension is enabled. ··· 203 203 * Verify a single path level that sits inside of a fixed sized array. 204 204 */ 205 205 XrResult 206 - oxr_verify_fixed_size_single_level_path(struct oxr_logger *, const char *path, uint32_t array_size, const char *name); 206 + oxr_verify_fixed_size_single_level_path(struct oxr_logger * /*log*/, 207 + const char *path, 208 + uint32_t array_size, 209 + const char *name); 207 210 208 211 /*! 209 212 * Verify an arbitrary UTF-8 string that sits inside of a fixed sized array. 210 213 */ 211 214 XrResult 212 - oxr_verify_localized_name(struct oxr_logger *, const char *string, uint32_t array_size, const char *name); 215 + oxr_verify_localized_name(struct oxr_logger * /*log*/, const char *string, uint32_t array_size, const char *name); 213 216 214 217 /*! 215 218 * Verify a set of subaction paths for action creation. ··· 248 251 const char *view_conf_name); 249 252 250 253 XrResult 251 - oxr_verify_XrSessionCreateInfo(struct oxr_logger *, const struct oxr_instance *, const XrSessionCreateInfo *); 254 + oxr_verify_XrSessionCreateInfo(struct oxr_logger * /*log*/, 255 + const struct oxr_instance * /*inst*/, 256 + const XrSessionCreateInfo * /*createInfo*/); 252 257 253 258 #if defined(XR_USE_PLATFORM_XLIB) && defined(XR_USE_GRAPHICS_API_OPENGL) 254 259 XrResult 255 - oxr_verify_XrGraphicsBindingOpenGLXlibKHR(struct oxr_logger *, const XrGraphicsBindingOpenGLXlibKHR *); 260 + oxr_verify_XrGraphicsBindingOpenGLXlibKHR(struct oxr_logger * /*log*/, const XrGraphicsBindingOpenGLXlibKHR * /*next*/); 256 261 #endif // defined(XR_USE_PLATFORM_XLIB) && defined(XR_USE_GRAPHICS_API_OPENGL) 257 262 258 263 #if defined(XR_USE_GRAPHICS_API_VULKAN) 259 264 XrResult 260 - oxr_verify_XrGraphicsBindingVulkanKHR(struct oxr_logger *, const XrGraphicsBindingVulkanKHR *); 265 + oxr_verify_XrGraphicsBindingVulkanKHR(struct oxr_logger * /*log*/, const XrGraphicsBindingVulkanKHR * /*next*/); 261 266 #endif // defined(XR_USE_GRAPHICS_API_VULKAN) 262 267 263 268 #if defined(XR_USE_PLATFORM_EGL) && defined(XR_USE_GRAPHICS_API_OPENGL)
+7 -8
src/xrt/state_trackers/oxr/oxr_input.c
··· 557 557 matched_path, // 558 558 outputs, // 559 559 output_count); // 560 - } else { 561 - return do_inputs( // 562 - binding_point, // 563 - xdev, // 564 - xbp, // 565 - matched_path, // 566 - inputs, // 567 - input_count); // 568 560 } 561 + return do_inputs( // 562 + binding_point, // 563 + xdev, // 564 + xbp, // 565 + matched_path, // 566 + inputs, // 567 + input_count); // 569 568 } 570 569 571 570 static struct xrt_binding_profile *
+1 -1
src/xrt/state_trackers/oxr/oxr_input_transform.h
··· 191 191 * @public @memberof oxr_input_transform 192 192 */ 193 193 bool 194 - oxr_input_transform_init_root(struct oxr_input_transform *transform, const enum xrt_input_type input_type); 194 + oxr_input_transform_init_root(struct oxr_input_transform *transform, enum xrt_input_type input_type); 195 195 196 196 /*! 197 197 * Allocate a transform to get the X component of a Vec2.
+3 -1
src/xrt/state_trackers/oxr/oxr_instance.c
··· 182 182 { 183 183 struct oxr_instance *inst = NULL; 184 184 struct xrt_device *xdevs[NUM_XDEVS] = {0}; 185 - int xinst_ret, m_ret, h_ret; 185 + int xinst_ret; 186 + int m_ret; 187 + int h_ret; 186 188 xrt_result_t xret; 187 189 XrResult ret; 188 190
+6 -6
src/xrt/state_trackers/oxr/oxr_objects.h
··· 815 815 } 816 816 817 817 XrResult 818 - oxr_create_swapchain(struct oxr_logger *, 818 + oxr_create_swapchain(struct oxr_logger * /*log*/, 819 819 struct oxr_session *sess, 820 - const XrSwapchainCreateInfo *, 820 + const XrSwapchainCreateInfo * /*createInfo*/, 821 821 struct oxr_swapchain **out_swapchain); 822 822 823 823 ··· 1007 1007 1008 1008 #if defined(XR_USE_GRAPHICS_API_OPENGL) || defined(XR_USE_GRAPHICS_API_OPENGL_ES) 1009 1009 XrResult 1010 - oxr_swapchain_gl_create(struct oxr_logger *, 1010 + oxr_swapchain_gl_create(struct oxr_logger * /*log*/, 1011 1011 struct oxr_session *sess, 1012 - const XrSwapchainCreateInfo *, 1012 + const XrSwapchainCreateInfo * /*createInfo*/, 1013 1013 struct oxr_swapchain **out_swapchain); 1014 1014 1015 1015 #endif // XR_USE_GRAPHICS_API_OPENGL || XR_USE_GRAPHICS_API_OPENGL_ES ··· 1081 1081 struct oxr_session *sess); 1082 1082 1083 1083 XrResult 1084 - oxr_swapchain_vk_create(struct oxr_logger *, 1084 + oxr_swapchain_vk_create(struct oxr_logger * /*log*/, 1085 1085 struct oxr_session *sess, 1086 - const XrSwapchainCreateInfo *, 1086 + const XrSwapchainCreateInfo * /*createInfo*/, 1087 1087 struct oxr_swapchain **out_swapchain); 1088 1088 1089 1089 #endif
+2 -1
src/xrt/state_trackers/oxr/oxr_space.c
··· 274 274 struct xrt_device *head_xdev = GET_XDEV_BY_ROLE(spc->sess->sys, head); 275 275 *out_xdev = head_xdev; 276 276 return oxr_space_ref_get_pure_relation(log, spc->sess, spc->space_type, head_xdev, time, out_relation); 277 - } else if (spc->space_type == OXR_SPACE_TYPE_ACTION) { 277 + } 278 + if (spc->space_type == OXR_SPACE_TYPE_ACTION) { 278 279 struct oxr_action_input *input = NULL; 279 280 oxr_action_get_pose_input(spc->sess, spc->act_key, &spc->subaction_paths, &input); 280 281
+2 -1
src/xrt/state_trackers/oxr/oxr_swapchain.c
··· 212 212 return oxr_error(log, XR_ERROR_FEATURE_UNSUPPORTED, 213 213 "Specified swapchain creation flag is valid, " 214 214 "but not supported"); 215 - } else if (xret == XRT_ERROR_SWAPCHAIN_FORMAT_UNSUPPORTED) { 215 + } 216 + if (xret == XRT_ERROR_SWAPCHAIN_FORMAT_UNSUPPORTED) { 216 217 return oxr_error(log, XR_ERROR_SWAPCHAIN_FORMAT_UNSUPPORTED, 217 218 "Specified swapchain format is not supported"); 218 219 }
+25 -11
src/xrt/state_trackers/prober/p_udev.c
··· 148 148 p_udev_enumerate_usb(struct prober *p, struct udev *udev) 149 149 { 150 150 struct udev_enumerate *enumerate; 151 - struct udev_list_entry *devices, *dev_list_entry; 151 + struct udev_list_entry *devices; 152 + struct udev_list_entry *dev_list_entry; 152 153 153 154 enumerate = udev_enumerate_new(udev); 154 155 udev_enumerate_add_match_subsystem(enumerate, "usb"); ··· 253 254 p_udev_enumerate_v4l2(struct prober *p, struct udev *udev) 254 255 { 255 256 struct udev_enumerate *enumerate; 256 - struct udev_list_entry *devices, *dev_list_entry; 257 + struct udev_list_entry *devices; 258 + struct udev_list_entry *dev_list_entry; 257 259 258 260 enumerate = udev_enumerate_new(udev); 259 261 udev_enumerate_add_match_subsystem(enumerate, "video4linux"); ··· 371 373 p_udev_enumerate_hidraw(struct prober *p, struct udev *udev) 372 374 { 373 375 struct udev_enumerate *enumerate; 374 - struct udev_list_entry *devices, *dev_list_entry; 376 + struct udev_list_entry *devices; 377 + struct udev_list_entry *dev_list_entry; 375 378 376 379 enumerate = udev_enumerate_new(udev); 377 380 udev_enumerate_add_match_subsystem(enumerate, "hidraw"); ··· 383 386 { 384 387 struct prober_device *pdev = NULL; 385 388 struct udev_device *raw_dev = NULL; 386 - uint16_t vendor_id, product_id, interface; 389 + uint16_t vendor_id; 390 + uint16_t product_id; 391 + uint16_t interface; 387 392 uint8_t dev_class = 0; 388 393 uint16_t usb_bus = 0; 389 394 uint16_t usb_addr = 0; ··· 497 502 uint16_t *out_usb_bus, 498 503 uint16_t *out_usb_addr) 499 504 { 500 - uint16_t dummy_vendor, dummy_product; 505 + uint16_t dummy_vendor; 506 + uint16_t dummy_product; 501 507 struct udev_device *usb_dev; 502 508 503 509 if (bus_type != HIDRAW_BUS_USB) { ··· 549 555 struct udev_device *hid_dev; 550 556 char *serial_utf8 = NULL; 551 557 uint64_t bluetooth_serial = 0; 552 - uint16_t vendor_id = 0, product_id = 0; 558 + uint16_t vendor_id = 0; 559 + uint16_t product_id = 0; 553 560 char product_name[sizeof(*out_product_name)]; 554 561 uint32_t bus_type; 555 562 const char *uevent; ··· 626 633 uint16_t *out_usb_addr, 627 634 struct udev_device **out_usb_device) 628 635 { 629 - struct udev_device *parent_dev, *usb_interface, *usb_device; 636 + struct udev_device *parent_dev; 637 + struct udev_device *usb_interface; 638 + struct udev_device *usb_device; 630 639 631 640 parent_dev = udev_device_get_parent(raw_dev); 632 641 usb_interface = udev_device_get_parent_with_subsystem_devtype(raw_dev, "usb", "usb_interface"); ··· 664 673 static int 665 674 p_udev_get_vendor_id_product(struct udev_device *usb_dev, uint16_t *out_vendor_id, uint16_t *out_product_id) 666 675 { 667 - uint16_t vendor_id, product_id; 676 + uint16_t vendor_id; 677 + uint16_t product_id; 668 678 int ret; 669 679 670 680 ret = p_udev_get_sysattr_u16_base16(usb_dev, "idVendor", &vendor_id); ··· 691 701 uint16_t *out_usb_bus, 692 702 uint16_t *out_usb_addr) 693 703 { 694 - uint16_t vendor_id, product_id, dev_class; 704 + uint16_t vendor_id; 705 + uint16_t product_id; 706 + uint16_t dev_class; 695 707 int ret; 696 708 697 709 // First get the vendor and product ids. ··· 727 739 static int 728 740 p_udev_get_usb_device_address_path(struct udev_device *usb_dev, uint16_t *out_usb_bus, uint16_t *out_usb_addr) 729 741 { 730 - uint16_t bus = 0, addr = 0; 742 + uint16_t bus = 0; 743 + uint16_t addr = 0; 731 744 732 745 const char *dev_path = udev_device_get_devnode(usb_dev); 733 746 if (dev_path == NULL) { ··· 748 761 static int 749 762 p_udev_get_usb_device_address_sysfs(struct udev_device *usb_dev, uint16_t *out_usb_bus, uint16_t *out_usb_addr) 750 763 { 751 - uint16_t usb_bus = 0, usb_addr = 0; 764 + uint16_t usb_bus = 0; 765 + uint16_t usb_addr = 0; 752 766 int ret; 753 767 754 768 ret = p_udev_get_sysattr_u16_base16(usb_dev, "busnum", &usb_bus);
+5 -5
src/xrt/state_trackers/steamvr_drv/ovrd_driver.cpp
··· 359 359 } 360 360 } 361 361 362 - struct profile_template * 362 + static struct profile_template * 363 363 get_profile_template(enum xrt_device_name device_name) 364 364 { 365 365 for (int i = 0; i < NUM_PROFILE_TEMPLATES; i++) { ··· 1155 1155 1156 1156 ret = xrt_instance_select(m_xinst, xdevs, NUM_XDEVS); 1157 1157 1158 - int head, left, right; 1158 + int head; 1159 + int left; 1160 + int right; 1159 1161 1160 1162 u_device_assign_xdev_roles(xdevs, NUM_XDEVS, &head, &left, &right); 1161 1163 ··· 1212 1214 if (m_xinst) { 1213 1215 xrt_instance_destroy(&m_xinst); 1214 1216 } 1215 - 1216 - return; 1217 1217 } 1218 1218 1219 1219 void ··· 1247 1247 } 1248 1248 out.vibration.frequency = freq; 1249 1249 1250 - if (controller->m_output_controls.size() < 1) { 1250 + if (controller->m_output_controls.empty()) { 1251 1251 ovrd_log("Controller %s has no outputs\n", controller->m_xdev->str); 1252 1252 return; 1253 1253 }
+1 -1
src/xrt/targets/common/target_instance.c
··· 42 42 */ 43 43 44 44 int 45 - xrt_instance_create(struct xrt_instance_info *i_info, struct xrt_instance **out_xinst) 45 + xrt_instance_create(struct xrt_instance_info *ii, struct xrt_instance **out_xinst) 46 46 { 47 47 struct xrt_prober *xp = NULL; 48 48
+1 -1
src/xrt/targets/common/target_instance_no_comp.c
··· 28 28 */ 29 29 30 30 int 31 - xrt_instance_create(struct xrt_instance_info *i_info, struct xrt_instance **out_xinst) 31 + xrt_instance_create(struct xrt_instance_info *ii, struct xrt_instance **out_xinst) 32 32 { 33 33 struct xrt_prober *xp = NULL; 34 34
+2 -2
src/xrt/targets/openxr/target.c
··· 23 23 ipc_instance_create(struct xrt_instance_info *i_info, struct xrt_instance **out_xinst); 24 24 25 25 int 26 - xrt_instance_create(struct xrt_instance_info *i_info, struct xrt_instance **out_xinst) 26 + xrt_instance_create(struct xrt_instance_info *ii, struct xrt_instance **out_xinst) 27 27 { 28 28 u_trace_marker_init(); 29 29 30 30 XRT_TRACE_MARKER(); 31 31 32 - return ipc_instance_create(i_info, out_xinst); 32 + return ipc_instance_create(ii, out_xinst); 33 33 } 34 34 35 35 #else
+1 -1
tests/tests_history_buf.cpp
··· 213 213 SECTION("behavior when empty") 214 214 { 215 215 CHECK(buffer.empty()); 216 - CHECK(0 == buffer.size()); 216 + CHECK(0 == buffer.size()); // NOLINT 217 217 CHECK_FALSE(buffer.begin().valid()); 218 218 CHECK_FALSE(buffer.end().valid()); 219 219 CHECK(buffer.begin() == buffer.end());
+1 -1
tests/tests_id_ringbuffer.cpp
··· 15 15 16 16 TEST_CASE("u_template_historybuf") 17 17 { 18 - auto buffer = u_id_ringbuffer_create(4); 18 + auto *buffer = u_id_ringbuffer_create(4); 19 19 SECTION("behavior when empty") 20 20 { 21 21 CHECK(u_id_ringbuffer_is_empty(buffer));