Use PRIu32 to print uint32_t variable

As the variable underlying type size is different depending on the
toolchain used
pull/11392/head
Hugues Kamba 2019-09-03 09:15:22 +01:00
parent e65a0c0a99
commit 8c22bbbbc8
3 changed files with 3 additions and 3 deletions

View File

@ -1365,7 +1365,7 @@ void ATHandler::write_int(int32_t param)
// write the integer subparameter
const int32_t str_len = 12;
char number_string[str_len];
int32_t result = sprintf(number_string, "%ld", param);
int32_t result = sprintf(number_string, "%" PRIi32, param);
if (result > 0 && result < str_len) {
(void)write(number_string, strlen(number_string));
}

View File

@ -67,7 +67,7 @@ val_status_t mbed_val_execute_non_secure_tests(uint32_t test_num, client_test_t
while (tests_list[i] != NULL)
{
memset(testcase_name, 0, 100);
sprintf(testcase_name, "Check%d", i);
sprintf(testcase_name, "Check%" PRIu32, i);
GREENTEA_TESTCASE_START(testcase_name);
if (server_hs == TRUE)
{

View File

@ -305,7 +305,7 @@ WEAK MBED_NORETURN mbed_error_status_t mbed_error(mbed_error_status_t error_stat
mbed_error_printf("\n= System will be rebooted due to a fatal error =\n");
if (report_error_ctx->error_reboot_count >= MBED_CONF_PLATFORM_ERROR_REBOOT_MAX) {
//We have rebooted more than enough, hold the system here.
mbed_error_printf("= Reboot count(=%ld) reached maximum, system will halt after rebooting =\n", report_error_ctx->error_reboot_count);
mbed_error_printf("= Reboot count(=%" PRIi32") reached maximum, system will halt after rebooting =\n", report_error_ctx->error_reboot_count);
}
#endif
system_reset();//do a system reset to get the system rebooted