@@ -118,7 +118,7 @@ void libusb_exit_function(bmp_info_s *info)
118118
119119static char * get_device_descriptor_string (libusb_device_handle * handle , uint16_t string_index )
120120{
121- char read_string [128 ] = {0 };
121+ char read_string [128U ] = {0 };
122122 if (string_index != 0 ) {
123123 const int result =
124124 libusb_get_string_descriptor_ascii (handle , string_index , (uint8_t * )read_string , sizeof (read_string ));
@@ -150,8 +150,8 @@ void bmp_read_product_version(libusb_device_descriptor_s *device_descriptor, lib
150150
151151 while (start_of_version [0 ] == ' ' && start_of_version != * product )
152152 -- start_of_version ;
153- start_of_version [1 ] = '\0' ;
154- start_of_version += 2 ;
153+ start_of_version [1U ] = '\0' ;
154+ start_of_version += 2U ;
155155 while (start_of_version [0 ] == ' ' )
156156 ++ start_of_version ;
157157 * version = strdup (start_of_version );
@@ -169,7 +169,7 @@ void stlinkv2_read_serial(libusb_device_descriptor_s *device_descriptor, libusb_
169169 (void )manufacturer ;
170170 (void )version ;
171171 /* libusb_get_string_descriptor requires a byte buffer, but returns char16_t's */
172- char16_t raw_serial [64 ] = {0 };
172+ char16_t raw_serial [64U ] = {0 };
173173 const int raw_length = libusb_get_string_descriptor (
174174 handle , device_descriptor -> iSerialNumber , 0x0409U , (uint8_t * )raw_serial , sizeof (raw_serial ));
175175 if (raw_length < LIBUSB_SUCCESS )
@@ -179,11 +179,11 @@ void stlinkv2_read_serial(libusb_device_descriptor_s *device_descriptor, libusb_
179179 * Re-encode the resulting chunk of data as hex, skipping the first char16_t which
180180 * contains the header of the string descriptor
181181 */
182- char encoded_serial [128 ] = {0 };
182+ char encoded_serial [128U ] = {0 };
183183 for (size_t offset = 0 ; offset < (size_t )raw_length - 2U ; offset += 2U ) {
184184 uint8_t digit = raw_serial [1 + (offset / 2U )];
185185 encoded_serial [offset + 0 ] = hex_digit (digit >> 4U );
186- encoded_serial [offset + 1 ] = hex_digit (digit & 0x0fU );
186+ encoded_serial [offset + 1U ] = hex_digit (digit & 0x0fU );
187187 }
188188 * serial = strdup (encoded_serial );
189189}
@@ -291,7 +291,7 @@ void orbtrace_read_version(libusb_device *device, libusb_device_handle *handle,
291291 const size_t version_len = strlen (version );
292292 if (begins_with (version , version_len , "Version" )) {
293293 /* Chop off the "Version: " prefix */
294- memmove (version , version + 9 , version_len - 8 );
294+ memmove (version , version + 9U , version_len - 8 );
295295 break ;
296296 }
297297 }
@@ -302,7 +302,7 @@ void orbtrace_read_version(libusb_device *device, libusb_device_handle *handle,
302302static void process_cmsis_interface (const libusb_device_descriptor_s * const device_descriptor ,
303303 libusb_device * const device , libusb_device_handle * const handle , probe_info_s * * probe_list )
304304{
305- char read_string [128 ];
305+ char read_string [128U ];
306306 char * version ;
307307 if (device_descriptor -> idVendor == VENDOR_ID_ORBCODE && device_descriptor -> idProduct == PRODUCT_ID_ORBTRACE ) {
308308 orbtrace_read_version (device , handle , read_string , sizeof (read_string ));
@@ -396,7 +396,7 @@ static void check_cmsis_interface_type(libusb_device *const device, bmp_info_s *
396396 /* If we've found an interface without a description string, ignore it */
397397 if (descriptor -> iInterface == 0 )
398398 continue ;
399- char interface_string [128 ];
399+ char interface_string [128U ];
400400 /* Read out the string */
401401 if (libusb_get_string_descriptor_ascii (
402402 handle , descriptor -> iInterface , (unsigned char * )interface_string , sizeof (interface_string )) < 0 )
0 commit comments