Building with clang gives some format string warnings as below, fix them
by using the correct format string when printing out the values.
.../libam7xxx/src/am7xxx.c:804:38: warning:
format specifies type 'unsigned char' but the argument has type 'int'
[-Wformat]
(*dev)->desc->configuration, current_configuration);
^~~~~~~~~~~~~~~~~~~~~
.../libam7xxx/src/am7xxx.c:65:85: note:
expanded from macro 'debug'
#define debug(ctx, ...) log_message(ctx, AM7XXX_LOG_DEBUG, __func__, 0, __VA_ARGS__)
^
1 warning generated.
[...]
.../libam7xxx/examples/am7xxx-modeswitch.c:75:5:
warning: format specifies type 'unsigned char' but the argument has type
'int' [-Wformat]
AM7XXX_STORAGE_CONFIGURATION);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
.../libam7xxx/examples/am7xxx-modeswitch.c:26:38:
note: expanded from macro 'AM7XXX_STORAGE_CONFIGURATION'
#define AM7XXX_STORAGE_CONFIGURATION 1
^
.../libam7xxx/examples/am7xxx-modeswitch.c:87:4:
warning: format specifies type 'unsigned char' but the argument has type
'int' [-Wformat]
AM7XXX_STORAGE_INTERFACE);
^~~~~~~~~~~~~~~~~~~~~~~~
.../libam7xxx/examples/am7xxx-modeswitch.c:27:38:
note: expanded from macro 'AM7XXX_STORAGE_INTERFACE'
#define AM7XXX_STORAGE_INTERFACE 0
^
.../libam7xxx/examples/am7xxx-modeswitch.c:104:4:
warning: format specifies type 'unsigned char' but the argument has type
'int' [-Wformat]
AM7XXX_STORAGE_CONFIGURATION, current_configuration);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
.../libam7xxx/examples/am7xxx-modeswitch.c:26:38:
note: expanded from macro 'AM7XXX_STORAGE_CONFIGURATION'
#define AM7XXX_STORAGE_CONFIGURATION 1
^
.../libam7xxx/examples/am7xxx-modeswitch.c:104:34:
warning: format specifies type 'unsigned char' but the argument has type
'int' [-Wformat]
AM7XXX_STORAGE_CONFIGURATION, current_configuration);
^~~~~~~~~~~~~~~~~~~~~
4 warnings generated.
if (ret < 0) {
fprintf(stderr, "libusb_set_configuration failed: %s\n",
libusb_error_name(ret));
if (ret < 0) {
fprintf(stderr, "libusb_set_configuration failed: %s\n",
libusb_error_name(ret));
- fprintf(stderr, "Cannot set configuration %hhu\n",
+ fprintf(stderr, "Cannot set configuration %d\n",
AM7XXX_STORAGE_CONFIGURATION);
goto out_libusb_close;
}
AM7XXX_STORAGE_CONFIGURATION);
goto out_libusb_close;
}
if (ret < 0) {
fprintf(stderr, "libusb_claim_interface failed: %s\n",
libusb_error_name(ret));
if (ret < 0) {
fprintf(stderr, "libusb_claim_interface failed: %s\n",
libusb_error_name(ret));
- fprintf(stderr, "Cannot claim interface %hhu\n",
+ fprintf(stderr, "Cannot claim interface %d\n",
AM7XXX_STORAGE_INTERFACE);
goto out_libusb_close;
}
AM7XXX_STORAGE_INTERFACE);
goto out_libusb_close;
}
}
if (current_configuration != AM7XXX_STORAGE_CONFIGURATION) {
}
if (current_configuration != AM7XXX_STORAGE_CONFIGURATION) {
- fprintf(stderr, "libusb configuration changed (expected: %hhu, current: %hhu\n",
+ fprintf(stderr, "libusb configuration changed (expected: %d, current: %d\n",
AM7XXX_STORAGE_CONFIGURATION, current_configuration);
ret = -EINVAL;
goto out_libusb_release_interface;
AM7XXX_STORAGE_CONFIGURATION, current_configuration);
ret = -EINVAL;
goto out_libusb_release_interface;
}
if (current_configuration != (*dev)->desc->configuration) {
}
if (current_configuration != (*dev)->desc->configuration) {
- debug(ctx, "libusb configuration changed (expected: %hhu, current: %hhu\n",
+ debug(ctx, "libusb configuration changed (expected: %hhu, current: %d\n",
(*dev)->desc->configuration, current_configuration);
ret = -EINVAL;
goto out_libusb_release_interface;
(*dev)->desc->configuration, current_configuration);
ret = -EINVAL;
goto out_libusb_release_interface;