···314314}
315315316316static float
317317-dist_3d_cv(cv::Point3f a, cv::Point3f b)
317317+dist_3d_cv(const cv::Point3f &a, const cv::Point3f &b)
318318{
319319 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));
320320}
···508508remove_outliers(std::vector<blob_point_t> *orig_points, std::vector<blob_point_t> *pruned_points, float outlier_thresh)
509509{
510510511511- if (orig_points->size() == 0) {
511511+ if (orig_points->empty()) {
512512 return;
513513 }
514514···523523 temp_points.push_back(orig_points->at(i));
524524 }
525525 }
526526- if (temp_points.size() == 0) {
526526+ if (temp_points.empty()) {
527527 return;
528528 }
529529···620620static void
621621match_triangles(Eigen::Matrix4f *t1_mat,
622622 Eigen::Matrix4f *t1_to_t2_mat,
623623- Eigen::Vector4f t1_a,
624624- Eigen::Vector4f t1_b,
625625- Eigen::Vector4f t1_c,
626626- Eigen::Vector4f t2_a,
627627- Eigen::Vector4f t2_b,
628628- Eigen::Vector4f t2_c)
623623+ const Eigen::Vector4f &t1_a,
624624+ const Eigen::Vector4f &t1_b,
625625+ const Eigen::Vector4f &t1_c,
626626+ const Eigen::Vector4f &t2_a,
627627+ const Eigen::Vector4f &t2_b,
628628+ const Eigen::Vector4f &t2_c)
629629{
630630 // given 3 vertices in 'model space', and a corresponding 3 vertices
631631 // in 'world space', compute the transformation matrix to map one
···834834 proximity_data.push_back(p);
835835 }
836836837837- if (proximity_data.size() > 0) {
837837+ if (!proximity_data.empty()) {
838838839839 // use the IMU rotation and the measured points in
840840 // world space to compute a transform from model to world space.
···899899 Eigen::Matrix4f imu_solved_pose =
900900 solve_with_imu(t, measured_points, last_measurement, solved, PSVR_SEARCH_RADIUS);
901901902902- if (measured_points->size() < PSVR_OPTICAL_SOLVE_THRESH && last_measurement->size() > 0) {
902902+ if (measured_points->size() < PSVR_OPTICAL_SOLVE_THRESH && !last_measurement->empty()) {
903903 return imu_solved_pose;
904904 }
905905···998998 float prev_diff = last_diff(t, &meas_solved, &t.last_vertices);
999999 float imu_diff = last_diff(t, &meas_solved, solved);
1000100010011001- Eigen::Vector4f tl_pos, tr_pos, bl_pos, br_pos;
10011001+ Eigen::Vector4f tl_pos;
10021002+ Eigen::Vector4f tr_pos;
10031003+ Eigen::Vector4f bl_pos;
10041004+ Eigen::Vector4f br_pos;
10021005 bool has_bl = false;
10031006 bool has_br = false;
10041007 bool has_tl = false;
···11471150 uint32_t indices[PSVR_NUM_LEDS];
114811511149115211501150-public:
11511153 ~Helper()
11521154 {
11531155 m_permutator_reset(&mp);
···126912711270127212711273static void
12721272-sample_line(cv::Mat &src, cv::Point2i start, cv::Point2i end, int *inside_length)
12741274+sample_line(cv::Mat &src, const cv::Point2i &start, const cv::Point2i &end, int *inside_length)
12731275{
12741276 // use bresenhams algorithm to sample the
12751277 // pixels between two points in an image
···15891591 // Convert our 2d point + disparities into 3d points.
15901592 std::vector<blob_data_t> blob_datas;
1591159315921592- if (t.l_blobs.size() > 0) {
15941594+ if (!t.l_blobs.empty()) {
15931595 for (uint32_t i = 0; i < t.l_blobs.size(); i++) {
15941596 float disp = t.r_blobs[i].pt.x - t.l_blobs[i].pt.x;
15951597 cv::Vec4d xydw(t.l_blobs[i].pt.x, t.l_blobs[i].pt.y, disp, 1.0f);
···17851787 t.last_vertices.push_back(solved[i]);
17861788 }
1787178917881788- if (t.last_vertices.size() > 0) {
17901790+ if (!t.last_vertices.empty()) {
17891791 filter_update(&t.last_vertices, t.track_filters, dt / 1000.0f);
17901792 }
17911793···19992001extern "C" void
20002002t_psvr_node_destroy(struct xrt_frame_node *node)
20012003{
20022002- auto t_ptr = container_of(node, TrackerPSVR, node);
20042004+ auto *t_ptr = container_of(node, TrackerPSVR, node);
2003200520042006 os_thread_helper_destroy(&t_ptr->oth);
20052007
+4-4
src/xrt/auxiliary/tracking/t_tracking.h
···9999};
100100101101/*!
102102- * Allocates a new stereo calibration data, unreferences the old @p calib.
102102+ * Allocates a new stereo calibration data, unreferences the old data pointed to by @p out_c.
103103 *
104104 * Also initializes t_camera_calibration::distortion_num in t_stereo_camera_calibration::view, only 5 and 14 is
105105 * accepted.
···107107 * @public @memberof t_stereo_camera_calibration
108108 */
109109void
110110-t_stereo_camera_calibration_alloc(struct t_stereo_camera_calibration **calib, uint32_t distortion_num);
110110+t_stereo_camera_calibration_alloc(struct t_stereo_camera_calibration **out_c, uint32_t distortion_num);
111111112112/*!
113113 * Only to be called by @p t_stereo_camera_calibration_reference.
···188188 * @relates t_stereo_camera_calibration
189189 */
190190bool
191191-t_stereo_camera_calibration_from_json_v2(cJSON *json, struct t_stereo_camera_calibration **out_data);
191191+t_stereo_camera_calibration_from_json_v2(cJSON *json, struct t_stereo_camera_calibration **out_stereo);
192192193193/*!
194194 * Convert the given stereo calibration data into a json object in v2 format.
···196196 * @relates t_stereo_camera_calibration
197197 */
198198bool
199199-t_stereo_camera_calibration_to_json_v2(cJSON **out_json, struct t_stereo_camera_calibration *data);
199199+t_stereo_camera_calibration_to_json_v2(cJSON **out_cjson, struct t_stereo_camera_calibration *data);
200200201201202202/*!
···103103104104static void
105105euroc_device_update_inputs(struct xrt_device *xdev)
106106-{
107107- return;
108108-}
106106+{}
109107110108//! Corrections specific for original euroc datasets and Kimera.
111109//! If your datasets comes from a different camera you should probably
+2-3
src/xrt/drivers/euroc/euroc_player.cpp
···453453{
454454 bool stereo = ep->playback.stereo;
455455456456- struct xrt_frame *left_xf = NULL, *right_xf = NULL;
456456+ struct xrt_frame *left_xf = NULL;
457457+ struct xrt_frame *right_xf = NULL;
457458 euroc_player_load_next_frame(ep, true, left_xf);
458459 if (stereo) {
459460 // TODO: Some SLAM systems expect synced frames, but that's not an
···787788 m_ff_vec3_f32_free(&ep->accel_ff);
788789789790 free(ep);
790790-791791- return;
792791}
793792794793
···209209210210211211Vector2
212212-OpticalSystem::DisplayUVToRenderUVPreviousSeed(Vector2 inputUV)
212212+OpticalSystem::DisplayUVToRenderUVPreviousSeed(const Vector2 &inputUV)
213213{
214214 // if we don't find a point we generate it and add it to our list
215215 Vector2 curDisplayUV;
···107107 assert(fabsf(out_fov.angle_right) < M_PI_2);
108108 memcpy(left_fov, &out_fov, sizeof(struct xrt_fov));
109109 memcpy(right_fov, &out_fov, sizeof(struct xrt_fov));
110110- return;
111110}
112111113112bool
···641640 // avoid unintended consequences. As soon as you have a specific reason to support it, go ahead and support it.
642641 ns->base.hmd->blend_mode_count = idx;
643642644644- uint64_t start, end;
643643+ uint64_t start;
644644+ uint64_t end;
645645646646 start = os_monotonic_get_ns();
647647 u_distortion_mesh_fill_in_compute(&ns->base);
+4-2
src/xrt/drivers/psmv/psmv_driver.c
···12951295 struct psmv_calibration_zcm1 data;
12961296 uint8_t *dst = (uint8_t *)&data;
12971297 int ret = 0;
12981298- size_t src_offset, dst_offset;
12981298+ size_t src_offset;
12991299+ size_t dst_offset;
1299130013001301 for (int i = 0; i < 3; i++) {
13011302 struct psmv_calibration_part part = {0};
···15111512 struct psmv_calibration_zcm2 data;
15121513 uint8_t *dst = (uint8_t *)&data;
15131514 int ret = 0;
15141514- size_t src_offset, dst_offset;
15151515+ size_t src_offset;
15161516+ size_t dst_offset;
1515151715161518 for (int i = 0; i < 2; i++) {
15171519 struct psmv_calibration_part part = {0};
···4646static struct qwerty_device *
4747default_qwerty_device(struct xrt_device **xdevs, size_t xdev_count, struct qwerty_system *qsys)
4848{
4949- int head, left, right;
4949+ int head;
5050+ int left;
5151+ int right;
5052 head = left = right = XRT_DEVICE_ROLE_UNASSIGNED;
5153 u_device_assign_xdev_roles(xdevs, xdev_count, &head, &left, &right);
5254···7274static struct qwerty_controller *
7375default_qwerty_controller(struct xrt_device **xdevs, size_t xdev_count, struct qwerty_system *qsys)
7476{
7575- int head, left, right;
7777+ int head;
7878+ int left;
7979+ int right;
7680 head = left = right = XRT_DEVICE_ROLE_UNASSIGNED;
7781 u_device_assign_xdev_roles(xdevs, xdev_count, &head, &left, &right);
7882
+7-4
src/xrt/drivers/remote/r_hub.c
···2929#define __USE_MISC // SOL_TCP on C11
3030#endif
3131#ifndef _BSD_SOURCE
3232-#define _BSD_SOURCE // same, but for musl
3232+#define _BSD_SOURCE // same, but for musl // NOLINT
3333#endif
34343535#include <netinet/tcp.h>
···8585do_accept(struct r_hub *r)
8686{
8787 struct sockaddr_in addr = {0};
8888- int ret, conn_fd;
8888+ int ret;
8989+ int conn_fd;
89909091 socklen_t addr_length = (socklen_t)sizeof(addr);
9192 ret = accept(r->accept_fd, (struct sockaddr *)&addr, &addr_length);
···286287 ssize_t ret = read(rc->fd, ptr, size - current);
287288 if (ret < 0) {
288289 return ret;
289289- } else if (ret > 0) {
290290+ }
291291+ if (ret > 0) {
290292 current += (size_t)ret;
291293 } else {
292294 U_LOG_I("Disconnected!");
···309311 ssize_t ret = write(rc->fd, ptr, size - current);
310312 if (ret < 0) {
311313 return ret;
312312- } else if (ret > 0) {
314314+ }
315315+ if (ret > 0) {
313316 current += (size_t)ret;
314317 } else {
315318 U_LOG_I("Disconnected!");
+2-1
src/xrt/drivers/vive/vive_device.c
···269269 const struct vive_imu_sample *sample = report->sample;
270270 uint8_t last_seq = d->imu.sequence;
271271 d->imu.ts_received_ns = os_monotonic_get_ns();
272272- int i, j;
272272+ int i;
273273+ int j;
273274274275 /*
275276 * The three samples are updated round-robin. New messages
+10-5
src/xrt/drivers/wmr/wmr_bt_controller.c
···7272 if (size < 0) {
7373 WMR_ERROR(d, "WMR Controller (Bluetooth): Error reading from device");
7474 return false;
7575- } else if (size == 0) {
7575+ }
7676+ if (size == 0) {
7677 WMR_TRACE(d, "WMR Controller (Bluetooth): No data to read from device");
7778 return true; // No more messages, return.
7879 }
···163164{
164165 struct wmr_controller_fw_cmd_response fw_cmd_response;
165166166166- uint8_t *data, *data_pos, *data_end;
167167- uint32_t data_size, remain;
167167+ uint8_t *data;
168168+ uint8_t *data_pos;
169169+ uint8_t *data_end;
170170+ uint32_t data_size;
171171+ uint32_t remain;
168172169173 struct wmr_controller_fw_cmd fw_cmd;
170174 memset(&fw_cmd, 0, sizeof(fw_cmd));
···224228static bool
225229read_controller_config(struct wmr_bt_controller *d)
226230{
227227- unsigned char *data = NULL, *config_json_block;
231231+ unsigned char *data = NULL;
232232+ unsigned char *config_json_block;
228233 size_t data_size;
229234 int ret;
230235···234239 // USB PID/VID are visible in them, but it's not clear
235240 // what the layout is and we don't use them currently,
236241 // so this if 0 code is just exemplary.
237237-242242+238243 // Read serials
239244 ret = wmr_read_fw_block(d, 0x03, &data, &data_size);
240245 if (ret < 0 || data == NULL)
+11-5
src/xrt/drivers/wmr/wmr_camera.c
···140140static bool
141141compute_frame_size(struct wmr_camera *cam)
142142{
143143- int i, cams_found = 0;
144144- int width, height;
145145- size_t F, n_packets, leftover;
143143+ int i;
144144+ int cams_found = 0;
145145+ int width;
146146+ int height;
147147+ size_t F;
148148+ size_t n_packets;
149149+ size_t leftover;
146150147151 F = 26;
148152···402406 DRV_TRACE_MARKER();
403407404408 struct wmr_camera *cam = calloc(1, sizeof(struct wmr_camera));
405405- int res, i;
409409+ int res;
410410+ int i;
406411407412 cam->log_level = log_level;
408413 cam->debug_gain = DEFAULT_GAIN;
···572577{
573578 DRV_TRACE_MARKER();
574579575575- int res, i;
580580+ int res;
581581+ int i;
576582577583 if (!cam->running) {
578584 return true;
···3232//! @todo IMU data should be generated from within the data source, but right
3333//! now we need this function because it is being generated from wmr_hmd
3434void
3535-wmr_source_push_imu_packet(struct xrt_fs *xfs, uint64_t ts[4], struct xrt_vec3 accels[4], struct xrt_vec3 gyros[4]);
3535+wmr_source_push_imu_packet(struct xrt_fs *xfs,
3636+ const uint64_t ts[4],
3737+ struct xrt_vec3 accels[4],
3838+ struct xrt_vec3 gyros[4]);
36393740/*!
3841 * @}
···347347 * @ingroup ipc_server
348348 */
349349void
350350-ipc_server_set_active_client(struct ipc_server *s, int active_client_index);
350350+ipc_server_set_active_client(struct ipc_server *s, int client_id);
351351352352/*!
353353 * Called by client threads to set a session to active.
···379379 * @ingroup ipc_server
380380 */
381381void *
382382-ipc_server_client_thread(void *_cs);
382382+ipc_server_client_thread(void *_ics);
383383384384/*!
385385 * This destroys the native compositor for this client and any extra objects
+4-2
src/xrt/ipc/server/ipc_server_mainloop_linux.c
···7676{
7777 // no fd provided
7878 struct sockaddr_un addr;
7979- int fd, ret;
7979+ int fd;
8080+ int ret;
80818182 fd = socket(PF_UNIX, SOCK_STREAM, 0);
8283 if (fd < 0) {
···143144static int
144145init_listen_socket(struct ipc_server_mainloop *ml)
145146{
146146- int fd = -1, ret;
147147+ int fd = -1;
148148+ int ret;
147149 ml->listen_socket = -1;
148150149151 ret = get_systemd_socket(ml, &fd);
···132132 * @ingroup gui
133133 */
134134void
135135-gui_ogl_sink_update(struct gui_ogl_texture *);
135135+gui_ogl_sink_update(struct gui_ogl_texture * /*tex*/);
136136137137/*!
138138 * Push the scene to the top of the lists.
···191191 * @public @memberof oxr_input_transform
192192 */
193193bool
194194-oxr_input_transform_init_root(struct oxr_input_transform *transform, const enum xrt_input_type input_type);
194194+oxr_input_transform_init_root(struct oxr_input_transform *transform, enum xrt_input_type input_type);
195195196196/*!
197197 * Allocate a transform to get the X component of a Vec2.
+3-1
src/xrt/state_trackers/oxr/oxr_instance.c
···182182{
183183 struct oxr_instance *inst = NULL;
184184 struct xrt_device *xdevs[NUM_XDEVS] = {0};
185185- int xinst_ret, m_ret, h_ret;
185185+ int xinst_ret;
186186+ int m_ret;
187187+ int h_ret;
186188 xrt_result_t xret;
187189 XrResult ret;
188190