mynewt-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject [33/40] incubator-mynewt-core git commit: fixed console read function and typo in hal_uart
Date Mon, 08 May 2017 14:32:28 GMT
fixed console read function and typo in hal_uart


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/0a5821d5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/0a5821d5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/0a5821d5

Branch: refs/heads/bluetooth5
Commit: 0a5821d5b60a1af82dd5399f3126228ae9a52f2b
Parents: 9022af6
Author: julian <julian.ingram@imgtec.com>
Authored: Fri Apr 28 15:33:57 2017 +0100
Committer: julian <julian.ingram@imgtec.com>
Committed: Thu May 4 16:58:45 2017 +0100

----------------------------------------------------------------------
 hw/mcu/microchip/pic32mz2048efg100/src/hal_uart.c | 2 +-
 sys/console/full/src/console.c                    | 6 +++++-
 sys/console/minimal/src/console.c                 | 6 +++++-
 3 files changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0a5821d5/hw/mcu/microchip/pic32mz2048efg100/src/hal_uart.c
----------------------------------------------------------------------
diff --git a/hw/mcu/microchip/pic32mz2048efg100/src/hal_uart.c b/hw/mcu/microchip/pic32mz2048efg100/src/hal_uart.c
index 5131f57..aa33c2c 100644
--- a/hw/mcu/microchip/pic32mz2048efg100/src/hal_uart.c
+++ b/hw/mcu/microchip/pic32mz2048efg100/src/hal_uart.c
@@ -245,7 +245,7 @@ __attribute__((interrupt(IPL1AUTO), vector(_UART2_TX_VECTOR))) uart_2_tx_isr(voi
 }
 
 void
-__attribute__((interrupt(IPL1AUTO), vector(_UART3_RX_VECTOR))) uart_3_tx_rx_isr(void)
+__attribute__((interrupt(IPL1AUTO), vector(_UART3_RX_VECTOR))) uart_3_rx_isr(void)
 {
     uart_receive_ready(2);
     IFS4CLR = _IFS4_U3RXIF_MASK;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0a5821d5/sys/console/full/src/console.c
----------------------------------------------------------------------
diff --git a/sys/console/full/src/console.c b/sys/console/full/src/console.c
index 1bc4c3e..389d92f 100644
--- a/sys/console/full/src/console.c
+++ b/sys/console/full/src/console.c
@@ -116,7 +116,11 @@ console_read(char *str, int cnt, int *newline)
     }
     cmd = ev->ev_arg;
     len = strlen(cmd->line);
-    strncpy(str, cmd->line, len+1);
+    if (cnt < len) {
+        len = cnt;
+    }
+    memcpy(str, cmd->line, len);
+    str[len] = '\0';
     os_eventq_put(avail_queue, ev);
     *newline = 1;
     return len;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0a5821d5/sys/console/minimal/src/console.c
----------------------------------------------------------------------
diff --git a/sys/console/minimal/src/console.c b/sys/console/minimal/src/console.c
index 0dbccaf..21f9d20 100644
--- a/sys/console/minimal/src/console.c
+++ b/sys/console/minimal/src/console.c
@@ -86,7 +86,11 @@ console_read(char *str, int cnt, int *newline)
     }
     cmd = ev->ev_arg;
     len = strlen(cmd->line);
-    strncpy(str, cmd->line, len+1);
+    if (cnt < len) {
+        len = cnt;
+    }
+    memcpy(str, cmd->line, len);
+    str[len] = '\0';
     os_eventq_put(avail_queue, ev);
     *newline = 1;
     return len;


Mime
View raw message