Opencv 3.1 project on GR-PEACH board

Fork of gr-peach-opencv-project by the do

Revision:
163:74e0ce7f98e8
Parent:
160:d5399cc887bb
diff -r e13f6fdb2ac4 -r 74e0ce7f98e8 platform/mbed_board.c
--- a/platform/mbed_board.c	Wed Apr 12 16:21:43 2017 +0100
+++ b/platform/mbed_board.c	Fri Apr 28 14:04:18 2017 +0100
@@ -75,20 +75,17 @@
 
 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
-        for (unsigned int i = 0; i < size; i++) {
+        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');
             }
@@ -96,7 +93,7 @@
             stdio_out_prev = buffer[i];
         }
 #else
-        for (unsigned int i = 0; i < size; i++) {
+        for (int i = 0; i < size; i++) {
             serial_putc(&stdio_uart, buffer[i]);
         }
 #endif