itsanjan / arduino

Automatically exported from code.google.com/p/arduino
Other
0 stars 0 forks source link

Stream.readBytes() doesn't handle 0-byte data in streams. #586

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It will stop at the first 0, rather than continuing to read data past it.

Original issue reported on code.google.com by dmel...@gmail.com on 17 Aug 2011 at 6:50

GoogleCodeExporter commented 9 years ago
This patch fixes the bug.

It also fixes return values for partial read, to return the actual number of 
bytes read before the timeout occurred, in both readBytes and readBytesUntil.

The return types are changed from int to size_t, as discussed on the developer 
mail list.  

Original comment by paul.sto...@gmail.com on 19 Nov 2011 at 5:49

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks!  Quick question, was it intentional to have the readBytesUntil() 
function stop on a zero character?  It seems like it should also be able to 
handle binary data.

Original comment by dmel...@gmail.com on 19 Nov 2011 at 6:21

GoogleCodeExporter commented 9 years ago
I do not know if that was intentional in the original design.  I only changed 
the return value.

Original comment by paul.sto...@gmail.com on 19 Nov 2011 at 6:42

GoogleCodeExporter commented 9 years ago
https://github.com/arduino/Arduino/commit/ed48d17e20142db73663375be09dd96b67b4ac
7c

Original comment by dmel...@gmail.com on 19 Nov 2011 at 9:25