Skip to content

Commit 8c22bbb

Browse files
committed
Use PRIu32 to print uint32_t variable
As the variable underlying type size is different depending on the toolchain used
1 parent e65a0c0 commit 8c22bbb

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

features/cellular/framework/AT/ATHandler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1365,7 +1365,7 @@ void ATHandler::write_int(int32_t param)
13651365
// write the integer subparameter
13661366
const int32_t str_len = 12;
13671367
char number_string[str_len];
1368-
int32_t result = sprintf(number_string, "%ld", param);
1368+
int32_t result = sprintf(number_string, "%" PRIi32, param);
13691369
if (result > 0 && result < str_len) {
13701370
(void)write(number_string, strlen(number_string));
13711371
}

features/frameworks/TARGET_PSA/val_greentea.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ val_status_t mbed_val_execute_non_secure_tests(uint32_t test_num, client_test_t
6767
while (tests_list[i] != NULL)
6868
{
6969
memset(testcase_name, 0, 100);
70-
sprintf(testcase_name, "Check%d", i);
70+
sprintf(testcase_name, "Check%" PRIu32, i);
7171
GREENTEA_TESTCASE_START(testcase_name);
7272
if (server_hs == TRUE)
7373
{

platform/source/mbed_error.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ WEAK MBED_NORETURN mbed_error_status_t mbed_error(mbed_error_status_t error_stat
305305
mbed_error_printf("\n= System will be rebooted due to a fatal error =\n");
306306
if (report_error_ctx->error_reboot_count >= MBED_CONF_PLATFORM_ERROR_REBOOT_MAX) {
307307
//We have rebooted more than enough, hold the system here.
308-
mbed_error_printf("= Reboot count(=%ld) reached maximum, system will halt after rebooting =\n", report_error_ctx->error_reboot_count);
308+
mbed_error_printf("= Reboot count(=%" PRIi32") reached maximum, system will halt after rebooting =\n", report_error_ctx->error_reboot_count);
309309
}
310310
#endif
311311
system_reset();//do a system reset to get the system rebooted

0 commit comments

Comments
 (0)