From 6fdd8ab93a46c81d9dee05934ea81cfecddb8352 Mon Sep 17 00:00:00 2001 From: Christoph Haag Date: Fri, 18 Mar 2022 22:56:54 +0100 Subject: [PATCH] aux/config_json: Only check version for camera tracking config Only the camera tracking config writes and uses the version field. Unfortunately the tracking override config is written into the same json object while not making use of the version field. --- src/xrt/auxiliary/util/u_config_json.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/xrt/auxiliary/util/u_config_json.c b/src/xrt/auxiliary/util/u_config_json.c index a9b0d64bc..22a459603 100644 --- a/src/xrt/auxiliary/util/u_config_json.c +++ b/src/xrt/auxiliary/util/u_config_json.c @@ -279,15 +279,6 @@ open_tracking_settings(struct u_config_json *json) return NULL; } - int ver = -1; - bool bad = false; - - bad |= !get_obj_int(t, "version", &ver); - if (bad || ver >= 1) { - U_LOG_E("Missing or unknown version tag '%i' in tracking config", ver); - return NULL; - } - return t; } @@ -363,6 +354,15 @@ u_config_json_get_tracking_settings(struct u_config_json *json, struct xrt_setti bool bad = false; + int ver = -1; + + bad |= !get_obj_int(t, "version", &ver); + if (bad || ver >= 1) { + U_LOG_E("Missing or unknown version tag '%i' in tracking config", ver); + return NULL; + } + + bad |= !get_obj_str(t, "camera_name", s->camera_name, sizeof(s->camera_name)); bad |= !get_obj_int(t, "camera_mode", &s->camera_mode); bad |= !get_obj_str(t, "camera_type", tmp, sizeof(tmp));