[gnoduino: 74/237] Stream.readBytesUntil() now writes null terminator within length.
- From: Lucian Langa <lucilanga src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnoduino: 74/237] Stream.readBytesUntil() now writes null terminator within length.
- Date: Sat, 31 Mar 2012 20:21:02 +0000 (UTC)
commit 1ef1e9089f5da394d4ac6f84382febe96f6ffb51
Author: David A. Mellis <d mellis arduino cc>
Date: Thu Aug 18 15:13:47 2011 -0400
Stream.readBytesUntil() now writes null terminator within length.
arduino/cores/arduino/Stream.cpp | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/arduino/cores/arduino/Stream.cpp b/arduino/cores/arduino/Stream.cpp
index bf8304f..d267bf0 100644
--- a/arduino/cores/arduino/Stream.cpp
+++ b/arduino/cores/arduino/Stream.cpp
@@ -214,7 +214,7 @@ int Stream::readBytesUntil( char terminator, char *buffer, size_t length)
{
int index = 0;
*buffer = 0;
- while(index < length ){
+ while(index < length-1 ){
int c = timedRead();
if( c <= 0 ){
return 0; // timeout returns 0 !
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]