1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-06-26 18:02:35 +00:00

chore(core): replace itoa with portable function

[no changelog]
This commit is contained in:
tychovrahe 2025-05-16 17:25:58 +02:00 committed by TychoVrahe
parent 1bd4d17d0e
commit c0c5003e08

View File

@ -17,6 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <trezor_bsp.h>
#include <trezor_model.h> #include <trezor_model.h>
#include <trezor_rtl.h> #include <trezor_rtl.h>
@ -25,6 +26,7 @@
#include <stdlib.h> #include <stdlib.h>
#include "prodtest_optiga.h" #include "prodtest_optiga.h"
#include "rtl/mini_printf.h"
static void prodtest_otp_variant_read(cli_t* cli) { static void prodtest_otp_variant_read(cli_t* cli) {
if (cli_arg_count(cli) > 0) { if (cli_arg_count(cli) > 0) {
@ -52,6 +54,7 @@ static void prodtest_otp_variant_read(cli_t* cli) {
cli_trace(cli, "Bytes read: %s", block_hex); cli_trace(cli, "Bytes read: %s", block_hex);
char block_text[FLASH_OTP_BLOCK_SIZE * 4 + 1] = {0}; char block_text[FLASH_OTP_BLOCK_SIZE * 4 + 1] = {0};
size_t buffer_size = sizeof(block_text);
// Make a list of integers separated by spaces // Make a list of integers separated by spaces
char* dst = block_text; char* dst = block_text;
@ -59,8 +62,9 @@ static void prodtest_otp_variant_read(cli_t* cli) {
if (i != 0) { if (i != 0) {
*dst++ = ' '; *dst++ = ' ';
} }
itoa(block[i], dst, 10); mini_snprintf(dst, buffer_size, "%d", block[i]);
dst += strlen(dst); dst += strlen(dst);
buffer_size -= strlen(dst);
} }
cli_ok(cli, "%s", block_text); cli_ok(cli, "%s", block_text);