@@ -120,33 +120,33 @@ int exi_basetypes_convert_64_from_unsigned(const exi_unsigned_t* exi_unsigned, u
120120
121121int exi_basetypes_convert_from_signed(const exi_signed_t* exi_signed, int32_t* value, size_t max_octets)
122122{
123- uint32_t uValue = 0;
124- int res = exi_basetypes_convert_from_unsigned(&exi_signed->data, &uValue , max_octets);
125- *value = (exi_signed->is_negative == 0) ? uValue : -uValue ;
123+ uint32_t u_value = 0;
124+ int res = exi_basetypes_convert_from_unsigned(&exi_signed->data, &u_value , max_octets);
125+ *value = (exi_signed->is_negative == 0) ? u_value : -u_value ;
126126 return res;
127127}
128128
129129int exi_basetypes_convert_64_from_signed(const exi_signed_t* exi_signed, int64_t* value)
130130{
131- uint64_t uValue = 0;
132- int res = exi_basetypes_convert_64_from_unsigned(&exi_signed->data, &uValue );
133- *value = (exi_signed->is_negative == 0) ? uValue : -uValue ;
131+ uint64_t u_value = 0;
132+ int res = exi_basetypes_convert_64_from_unsigned(&exi_signed->data, &u_value );
133+ *value = (exi_signed->is_negative == 0) ? u_value : -u_value ;
134134 return res;
135135}
136136
137137int exi_basetypes_convert_bytes_from_unsigned(const exi_unsigned_t* exi_unsigned, uint8_t* data, size_t* data_len, size_t data_size)
138- {
138+ {
139139 const uint8_t* current_octet = exi_unsigned->octets;
140140 uint16_t temp = 0;
141141 *data_len = 0;
142142 size_t total_offset = 0;
143143
144144 for (size_t n = 0; n < exi_unsigned->octets_count; n++) {
145- temp = temp + ((uint16_t)(*current_octet & EXI_BASETYPES_OCTET_SEQ_VALUE_MASK) << ( total_offset) );
145+ temp += ((uint16_t)(*current_octet & EXI_BASETYPES_OCTET_SEQ_VALUE_MASK) << total_offset);
146146 total_offset += 7;
147147 if (total_offset >= 8) {
148148 if (data_size == *data_len) {
149- return -1 ;
149+ return EXI_ERROR__ENCODED_INTEGER_SIZE_LARGER_THAN_DESTINATION ;
150150 }
151151 total_offset -= 8;
152152 data[(*data_len)++] = temp & 0xFF;
@@ -156,11 +156,11 @@ int exi_basetypes_convert_bytes_from_unsigned(const exi_unsigned_t* exi_unsigned
156156 }
157157 if (total_offset != 0) {
158158 if (data_size == *data_len) {
159- return -1 ;
159+ return EXI_ERROR__ENCODED_INTEGER_SIZE_LARGER_THAN_DESTINATION ;
160160 }
161161 data[(*data_len)++] = temp & 0xFF;
162162 }
163- return 0 ;
163+ return EXI_ERROR__NO_ERROR ;
164164}
165165
166166int exi_basetypes_convert_bytes_to_unsigned(exi_unsigned_t* exi_unsigned, const uint8_t* data, size_t data_len)
@@ -171,13 +171,13 @@ int exi_basetypes_convert_bytes_to_unsigned(exi_unsigned_t* exi_unsigned, const
171171
172172 for (size_t n = 0; n != data_len; n++, current_octet++) {
173173 if (dummy_count <= 8) {
174- dummy = dummy | (( data[n]) << dummy_count);
174+ dummy |= ( data[n] << dummy_count);
175175 dummy_count += 8;
176176 }
177177 exi_unsigned->octets_count++;
178178 *current_octet = (uint8_t)(dummy & EXI_BASETYPES_OCTET_SEQ_VALUE_MASK);
179179
180- dummy = dummy >> 7u;
180+ dummy >>= 7u;
181181 dummy_count -= 7;
182182 if (n == data_len) {
183183 break;
@@ -190,7 +190,7 @@ int exi_basetypes_convert_bytes_to_unsigned(exi_unsigned_t* exi_unsigned, const
190190 exi_unsigned->octets_count++;
191191 *current_octet = (uint8_t)(dummy & EXI_BASETYPES_OCTET_SEQ_VALUE_MASK);
192192 }
193- return 0 ;
193+ return EXI_ERROR__NO_ERROR ;
194194}
195195
196196{% endblock %}
0 commit comments