st/gui: Don't access first vec3 member as float array

It produces a warning

../src/xrt/state_trackers/gui/gui_scene_debug.c:141:9: warning: ‘igInputFloat3’ accessing 12 bytes in a region of size 4 [-Wstringop-overflow=]
  141 |         igInputFloat3(name, (float *) &value.x, "%+f", ImGuiInputTextFlags_ReadOnly);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This commit is contained in:
Christoph Haag 2021-07-15 00:58:14 +02:00
parent 3c86985646
commit e2e13b7ac3

View file

@ -130,6 +130,8 @@ on_ff_vec3_var(struct u_var_info *info, struct gui_program *p)
struct xrt_vec3 value = {0};
float value_arr[3] = {value.x, value.y, value.z};
uint64_t timestamp;
m_ff_vec3_f32_get(ff, 0, &value, &timestamp);
@ -137,7 +139,7 @@ on_ff_vec3_var(struct u_var_info *info, struct gui_program *p)
snprintf(tmp, sizeof(tmp), "%s.toggle", name);
igToggleButton(tmp, &info->gui.graphed);
igSameLine(0, 0);
igInputFloat3(name, &value.x, "%+f", ImGuiInputTextFlags_ReadOnly);
igInputFloat3(name, value_arr, "%+f", ImGuiInputTextFlags_ReadOnly);
if (!info->gui.graphed) {
return;