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.
This commit is contained in:
@@ -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)
|
uint8_t select_zov(void* user, uint8_t* data, uint32_t bitoffs)
|
||||||
{
|
{
|
||||||
data += bitoffs >> 3UL;
|
data += bitoffs >> 3UL;
|
||||||
data -= sizeof(ZoneOptionValueEnum);
|
data -= offsetof(ZoneOptionValueTyped, value);
|
||||||
ZoneOptionValueEnum* p_zovt = (ZoneOptionValueEnum*)data;
|
ZoneOptionValueEnum* p_zovt = (ZoneOptionValueEnum*)data;
|
||||||
if (*p_zovt > ZOV_Color) return 0;
|
if (*p_zovt > ZOV_Color) return 0;
|
||||||
return *p_zovt;
|
return *p_zovt;
|
||||||
|
|||||||
Reference in New Issue
Block a user