File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -75,19 +75,16 @@ void mbed_error_printf(const char* format, ...) {
75
75
76
76
void mbed_error_vfprintf (const char * format , va_list arg ) {
77
77
#if DEVICE_SERIAL
78
-
79
- #if MBED_CONF_PLATFORM_STDIO_CONVERT_NEWLINES
80
- char stdio_out_prev ;
81
- #endif
82
-
78
+ #define ERROR_BUF_SIZE (128)
83
79
core_util_critical_section_enter ();
84
- char buffer [128 ];
85
- int size = vsprintf (buffer , format , arg );
80
+ char buffer [ERROR_BUF_SIZE ];
81
+ int size = vsnprintf (buffer , ERROR_BUF_SIZE , format , arg );
86
82
if (size > 0 ) {
87
83
if (!stdio_uart_inited ) {
88
84
serial_init (& stdio_uart , STDIO_UART_TX , STDIO_UART_RX );
89
85
}
90
86
#if MBED_CONF_PLATFORM_STDIO_CONVERT_NEWLINES
87
+ char stdio_out_prev = '\0' ;
91
88
for (int i = 0 ; i < size ; i ++ ) {
92
89
if (buffer [i ] == '\n' && stdio_out_prev != '\r' ) {
93
90
serial_putc (& stdio_uart , '\r' );
You can’t perform that action at this time.
0 commit comments