Skip to content

Fix gcc [-Wsign-compare] warning #4192

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 20, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions platform/mbed_board.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,16 @@ void mbed_error_printf(const char* format, ...) {

void mbed_error_vfprintf(const char * format, va_list arg) {
#if DEVICE_SERIAL

#if MBED_CONF_PLATFORM_STDIO_CONVERT_NEWLINES
char stdio_out_prev;
#endif

#define ERROR_BUF_SIZE (128)
core_util_critical_section_enter();
char buffer[128];
int size = vsprintf(buffer, format, arg);
char buffer[ERROR_BUF_SIZE];
int size = vsnprintf(buffer, ERROR_BUF_SIZE, format, arg);
if (size > 0) {
if (!stdio_uart_inited) {
serial_init(&stdio_uart, STDIO_UART_TX, STDIO_UART_RX);
}
#if MBED_CONF_PLATFORM_STDIO_CONVERT_NEWLINES
char stdio_out_prev = '\0';
for (int i = 0; i < size; i++) {
if (buffer[i] == '\n' && stdio_out_prev != '\r') {
serial_putc(&stdio_uart, '\r');
Expand Down