From 455cb1c2b81ead849b2859d93ab4e386b17f1efa Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Fri, 29 Oct 2021 08:33:51 +0200 Subject: [PATCH] Cope with padding inside ZoneOptionValueTyped As it seems, ZoneOptionValueEnum is optimised by ARM-GCC to have only 8bits, rather than the 32bits used by the host compiler. Meaning that with "data" pointing at ZoneOptionValueTyped::value, we need the offset and not the size of the element before to properly rewind the data pointer. --- radio/src/storage/conversions/yaml/yaml_datastructs_funcs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radio/src/storage/conversions/yaml/yaml_datastructs_funcs.cpp b/radio/src/storage/conversions/yaml/yaml_datastructs_funcs.cpp index a4ad63050..823901ecb 100644 --- a/radio/src/storage/conversions/yaml/yaml_datastructs_funcs.cpp +++ b/radio/src/storage/conversions/yaml/yaml_datastructs_funcs.cpp @@ -166,7 +166,7 @@ bool w_vbat_max(const YamlNode* node, uint32_t val, yaml_writer_func wf, void* o uint8_t select_zov(void* user, uint8_t* data, uint32_t bitoffs) { data += bitoffs >> 3UL; - data -= sizeof(ZoneOptionValueEnum); + data -= offsetof(ZoneOptionValueTyped, value); ZoneOptionValueEnum* p_zovt = (ZoneOptionValueEnum*)data; if (*p_zovt > ZOV_Color) return 0; return *p_zovt;