@@ -48,10 +48,9 @@ int exi_basetypes_encoder_bool(exi_bitstream_t* stream, int value)
4848 stream->status_callback(EXI_DEBUG__BASETYPES_ENCODE_BOOL, 0, (int)value, 0);
4949 }
5050{% endif %}
51- int error;
5251 uint32_t bit = (value) ? 1 : 0;
5352
54- error = exi_bitstream_write_bits(stream, 1, bit);
53+ int error = exi_bitstream_write_bits(stream, 1, bit);
5554
5655 return error;
5756}
@@ -76,8 +75,7 @@ int exi_basetypes_encoder_bytes(exi_bitstream_t* stream, size_t bytes_len, const
7675
7776 for (size_t n = 0; n < bytes_len; n++)
7877 {
79- int error;
80- error = exi_bitstream_write_octet(stream, *current_byte);
78+ int error = exi_bitstream_write_octet(stream, *current_byte);
8179 if (error != EXI_ERROR__NO_ERROR)
8280 {
8381 return error;
@@ -105,11 +103,10 @@ int exi_basetypes_encoder_uint_8(exi_bitstream_t* stream, uint8_t value)
105103 stream->status_callback(EXI_DEBUG__BASETYPES_ENCODE_UINT_8, 0, (int)value, 0);
106104 }
107105{% endif %}
108- int error;
109106 exi_unsigned_t exi_unsigned;
110107 uint32_t result = (uint32_t)value;
111108
112- error = exi_basetypes_convert_to_unsigned(&exi_unsigned, result, EXI_BASETYPES_UINT8_MAX_OCTETS);
109+ int error = exi_basetypes_convert_to_unsigned(&exi_unsigned, result, EXI_BASETYPES_UINT8_MAX_OCTETS);
113110 if (error != EXI_ERROR__NO_ERROR)
114111 {
115112 return error;
@@ -126,11 +123,10 @@ int exi_basetypes_encoder_uint_16(exi_bitstream_t* stream, uint16_t value)
126123 stream->status_callback(EXI_DEBUG__BASETYPES_ENCODE_UINT_16, 0, (int)value, 0);
127124 }
128125{% endif %}
129- int error;
130126 exi_unsigned_t exi_unsigned;
131127 uint32_t result = (uint32_t)value;
132128
133- error = exi_basetypes_convert_to_unsigned(&exi_unsigned, result, EXI_BASETYPES_UINT16_MAX_OCTETS);
129+ int error = exi_basetypes_convert_to_unsigned(&exi_unsigned, result, EXI_BASETYPES_UINT16_MAX_OCTETS);
134130 if (error != EXI_ERROR__NO_ERROR)
135131 {
136132 return error;
@@ -147,10 +143,9 @@ int exi_basetypes_encoder_uint_32(exi_bitstream_t* stream, uint32_t value)
147143 stream->status_callback(EXI_DEBUG__BASETYPES_ENCODE_UINT_32, 0, (int)value, 0);
148144 }
149145{% endif %}
150- int error;
151146 exi_unsigned_t exi_unsigned;
152147
153- error = exi_basetypes_convert_to_unsigned(&exi_unsigned, value, EXI_BASETYPES_UINT32_MAX_OCTETS);
148+ int error = exi_basetypes_convert_to_unsigned(&exi_unsigned, value, EXI_BASETYPES_UINT32_MAX_OCTETS);
154149 if (error != EXI_ERROR__NO_ERROR)
155150 {
156151 return error;
@@ -161,10 +156,9 @@ int exi_basetypes_encoder_uint_32(exi_bitstream_t* stream, uint32_t value)
161156
162157int exi_basetypes_encoder_uint_64(exi_bitstream_t* stream, uint64_t value)
163158{
164- int error;
165159 exi_unsigned_t exi_unsigned;
166160
167- error = exi_basetypes_convert_64_to_unsigned(&exi_unsigned, value);
161+ int error = exi_basetypes_convert_64_to_unsigned(&exi_unsigned, value);
168162 if (error != EXI_ERROR__NO_ERROR)
169163 {
170164 return error;
@@ -189,10 +183,9 @@ int exi_basetypes_encoder_integer_8(exi_bitstream_t* stream, int8_t value)
189183 stream->status_callback(EXI_DEBUG__BASETYPES_ENCODE_INT_8, 0, (int)value, 0);
190184 }
191185{% endif %}
192- int error;
193186 int sign = (value < 0) ? 1 : 0;
194187
195- error = exi_basetypes_encoder_bool(stream, sign);
188+ int error = exi_basetypes_encoder_bool(stream, sign);
196189 if (error != EXI_ERROR__NO_ERROR)
197190 {
198191 return error;
@@ -216,10 +209,9 @@ int exi_basetypes_encoder_integer_16(exi_bitstream_t* stream, int16_t value)
216209 stream->status_callback(EXI_DEBUG__BASETYPES_ENCODE_INT_16, 0, (int)value, 0);
217210 }
218211{% endif %}
219- int error;
220212 int sign = (value < 0) ? 1 : 0;
221213
222- error = exi_basetypes_encoder_bool(stream, sign);
214+ int error = exi_basetypes_encoder_bool(stream, sign);
223215 if (error != EXI_ERROR__NO_ERROR)
224216 {
225217 return error;
@@ -243,10 +235,9 @@ int exi_basetypes_encoder_integer_32(exi_bitstream_t* stream, int32_t value)
243235 stream->status_callback(EXI_DEBUG__BASETYPES_ENCODE_INT_32, 0, (int)value, 0);
244236 }
245237{% endif %}
246- int error;
247238 int sign = (value < 0) ? 1 : 0;
248239
249- error = exi_basetypes_encoder_bool(stream, sign);
240+ int error = exi_basetypes_encoder_bool(stream, sign);
250241 if (error != EXI_ERROR__NO_ERROR)
251242 {
252243 return error;
@@ -264,10 +255,9 @@ int exi_basetypes_encoder_integer_32(exi_bitstream_t* stream, int32_t value)
264255
265256int exi_basetypes_encoder_integer_64(exi_bitstream_t* stream, int64_t value)
266257{
267- int error;
268258 int sign = (value < 0) ? 1 : 0;
269259
270- error = exi_basetypes_encoder_bool(stream, sign);
260+ int error = exi_basetypes_encoder_bool(stream, sign);
271261 if (error != EXI_ERROR__NO_ERROR)
272262 {
273263 return error;
@@ -285,9 +275,7 @@ int exi_basetypes_encoder_integer_64(exi_bitstream_t* stream, int64_t value)
285275
286276int exi_basetypes_encoder_signed(exi_bitstream_t* stream, const exi_signed_t* value)
287277{
288- int error;
289-
290- error = exi_basetypes_encoder_bool(stream, value->is_negative);
278+ int error = exi_basetypes_encoder_bool(stream, value->is_negative);
291279 if (error != EXI_ERROR__NO_ERROR)
292280 {
293281 return error;
0 commit comments