bool zcbor_tag_decode(zcbor_state_t *state, uint32_t *result)
{
ZCBOR_PRINT_FUNC_NAME();
INITIAL_CHECKS_WITH_TYPE(ZCBOR_MAJOR_TYPE_TAG);
if (!value_extract(state, result, sizeof(*result), NULL)) {
ZCBOR_FAIL();
}
state->elem_count++;
// !!! elem_count is not consumend
return true;
}
bool zcbor_tag_expect(zcbor_state_t *state, uint32_t expected)
{
ZCBOR_PRINT_FUNC_NAME();
uint32_t actual;
if (!zcbor_tag_decode(state, &actual)) {
ZCBOR_FAIL();
}
if (actual != expected) {
// !!! BUG restore increments elem_count, which it shouldn't as elem_count was not consumend
ERR_RESTORE(ZCBOR_ERR_WRONG_VALUE);
}
return true;
}
zcbor_tag_decode does not consume elem_count so should not be used with ERR_RESTORE
zcbor_tag_decode does not consume elem_count so should not be used with ERR_RESTORE