44 * SPDX-License-Identifier: Apache-2.0
55 */
66/*
7- * Generated using zcbor version 0.3.99
7+ * Generated using zcbor version 0.4.0
88 * https://github.com/zephyrproject-rtos/zcbor
99 * Generated with a --default-max-qty of 99
1010 */
@@ -43,47 +43,31 @@ static bool decode_repeated_record_n(zcbor_state_t *state, struct record_n *resu
4343 return tmp_result ;
4444}
4545
46- static bool decode_numeric (zcbor_state_t * state , struct numeric_ * result )
47- {
48- zcbor_print ("%s\r\n" , __func__ );
49- bool int_res ;
50-
51- bool tmp_result =
52- (((zcbor_union_start_code (state ) &&
53- (int_res = ((((zcbor_int64_decode (state , (& (* result )._numeric_int ))) &&
54- ((((* result )._numeric_int >= -9223372036854775807LL ) &&
55- ((* result )._numeric_int <= 9223372036854775807LL )) ||
56- (zcbor_error (state , ZCBOR_ERR_WRONG_RANGE ), false))) &&
57- (((* result )._numeric_choice = _numeric_int ) || 1 )) ||
58- (((zcbor_float_decode (state , (& (* result )._numeric_float )))) &&
59- (((* result )._numeric_choice = _numeric_float ) || 1 ))),
60- zcbor_union_end_code (state ), int_res ))));
61-
62- if (!tmp_result )
63- zcbor_trace ();
64-
65- return tmp_result ;
66- }
67-
6846static bool decode_repeated_record_union (zcbor_state_t * state , struct record_union_ * result )
6947{
7048 zcbor_print ("%s\r\n" , __func__ );
7149 bool int_res ;
7250
73- bool tmp_result = (((zcbor_union_start_code (state ) &&
74- (int_res = (((((zcbor_uint32_expect_union (state , (2 )))) &&
75- (decode_numeric (state , (& (* result )._union_v )))) &&
76- (((* result )._record_union_choice = _union_v ) || 1 )) ||
77- ((((zcbor_uint32_expect_union (state , (3 )))) &&
78- (zcbor_tstr_decode (state , (& (* result )._union_vs )))) &&
79- (((* result )._record_union_choice = _union_vs ) || 1 )) ||
80- ((((zcbor_uint32_expect_union (state , (4 )))) &&
81- (zcbor_bool_decode (state , (& (* result )._union_vb )))) &&
82- (((* result )._record_union_choice = _union_vb ) || 1 )) ||
83- ((((zcbor_uint32_expect_union (state , (8 )))) &&
84- (zcbor_bstr_decode (state , (& (* result )._union_vd )))) &&
85- (((* result )._record_union_choice = _union_vd ) || 1 ))),
86- zcbor_union_end_code (state ), int_res ))));
51+ bool tmp_result = (((zcbor_union_start_code (state ) && (int_res = (
52+ ((((zcbor_uint32_expect_union (state , (2 )))) &&
53+ (zcbor_int64_decode (state , (& (* result )._union_vi ))) &&
54+ ((((* result )._union_vi >= -9223372036854775807LL ) &&
55+ ((* result )._union_vi <= 9223372036854775807LL )) ||
56+ (zcbor_error (state , ZCBOR_ERR_WRONG_RANGE ), false))) &&
57+ (((* result )._record_union_choice = _union_vi ) || 1 )) ||
58+ ((((zcbor_uint32_expect_union (state , (2 )))) &&
59+ (zcbor_float_decode (state , (& (* result )._union_vf )))) &&
60+ (((* result )._record_union_choice = _union_vf ) || 1 )) ||
61+ ((((zcbor_uint32_expect_union (state , (3 )))) &&
62+ (zcbor_tstr_decode (state , (& (* result )._union_vs )))) &&
63+ (((* result )._record_union_choice = _union_vs ) || 1 )) ||
64+ ((((zcbor_uint32_expect_union (state , (4 )))) &&
65+ (zcbor_bool_decode (state , (& (* result )._union_vb )))) &&
66+ (((* result )._record_union_choice = _union_vb ) || 1 )) ||
67+ ((((zcbor_uint32_expect_union (state , (8 )))) &&
68+ (zcbor_bstr_decode (state , (& (* result )._union_vd )))) &&
69+ (((* result )._record_union_choice = _union_vd ) || 1 ))),
70+ zcbor_union_end_code (state ), int_res ))));
8771
8872 if (!tmp_result )
8973 zcbor_trace ();
@@ -97,18 +81,21 @@ static bool decode_value(zcbor_state_t *state, struct value_ *result)
9781 bool int_res ;
9882
9983 bool tmp_result =
100- (((zcbor_union_start_code (state ) &&
101- ( int_res = ( (((zcbor_tstr_decode (state , (& (* result )._value_tstr )))) &&
84+ (((zcbor_union_start_code (state ) && ( int_res = (
85+ (((zcbor_tstr_decode (state , (& (* result )._value_tstr )))) &&
10286 (((* result )._value_choice = _value_tstr ) || 1 )) ||
103- (((zcbor_bstr_decode (state , (& (* result )._value_bstr )))) &&
87+ (((zcbor_bstr_decode (state , (& (* result )._value_bstr )))) &&
10488 (((* result )._value_choice = _value_bstr ) || 1 )) ||
105- (zcbor_union_elem_code (state ) &&
106- (((decode_numeric (state , (& (* result )._value__numeric )))) &&
107- (((* result )._value_choice = _value__numeric ) || 1 ))) ||
108- (zcbor_union_elem_code (state ) &&
109- (((zcbor_bool_decode (state , (& (* result )._value_bool )))) &&
110- (((* result )._value_choice = _value_bool ) || 1 )))),
111- zcbor_union_end_code (state ), int_res ))));
89+ (((zcbor_int64_decode (state , (& (* result )._value_int ))) &&
90+ ((((* result )._value_int >= -9223372036854775807LL ) &&
91+ ((* result )._value_int <= 9223372036854775807LL )) ||
92+ (zcbor_error (state , ZCBOR_ERR_WRONG_RANGE ), false))) &&
93+ (((* result )._value_choice = _value_int ) || 1 )) ||
94+ (((zcbor_float_decode (state , (& (* result )._value_float )))) &&
95+ (((* result )._value_choice = _value_float ) || 1 )) ||
96+ (((zcbor_bool_decode (state , (& (* result )._value_bool )))) &&
97+ (((* result )._value_choice = _value_bool ) || 1 ))),
98+ zcbor_union_end_code (state ), int_res ))));
11299
113100 if (!tmp_result )
114101 zcbor_trace ();
@@ -163,7 +150,7 @@ static bool decode_record(zcbor_state_t *state, struct record *result)
163150 state , (& (* result )._record__key_value_pair ),
164151 sizeof (struct record__key_value_pair ))) ||
165152 (zcbor_list_map_end_force_decode (state ), false)) &&
166- zcbor_map_end_decode (state ))));
153+ zcbor_map_end_decode (state ))));
167154
168155 if (!tmp_result )
169156 zcbor_trace ();
@@ -190,10 +177,10 @@ static bool decode_lwm2m_senml(zcbor_state_t *state, struct lwm2m_senml *result)
190177 return tmp_result ;
191178}
192179
193- uint_fast8_t cbor_decode_lwm2m_senml (const uint8_t * payload , size_t payload_len ,
180+ int cbor_decode_lwm2m_senml (const uint8_t * payload , size_t payload_len ,
194181 struct lwm2m_senml * result , size_t * payload_len_out )
195182{
196- zcbor_state_t states [6 ];
183+ zcbor_state_t states [5 ];
197184
198185 zcbor_new_state (states , sizeof (states ) / sizeof (zcbor_state_t ), payload , payload_len , 1 );
199186
@@ -204,7 +191,7 @@ uint_fast8_t cbor_decode_lwm2m_senml(const uint8_t *payload, size_t payload_len,
204191 }
205192
206193 if (!ret ) {
207- uint_fast8_t ret = zcbor_pop_error (states );
194+ int ret = zcbor_pop_error (states );
208195
209196 return (ret == ZCBOR_SUCCESS ) ? ZCBOR_ERR_UNKNOWN : ret ;
210197 }
0 commit comments