diff options
author | Marti Bolivar <mbolivar@leaflabs.com> | 2011-03-01 20:30:44 -0500 |
---|---|---|
committer | Marti Bolivar <mbolivar@leaflabs.com> | 2011-03-01 20:30:44 -0500 |
commit | 617deeb6ef59b48e06d7cd7bd82c02e4bd4c962f (patch) | |
tree | 8a421ee43365c4f0ad596be0c3ef319e986ccea5 | |
parent | 04b7db07d15bd4fac7de1256bc69ec532f5148ba (diff) | |
download | librambutan-617deeb6ef59b48e06d7cd7bd82c02e4bd4c962f.tar.gz librambutan-617deeb6ef59b48e06d7cd7bd82c02e4bd4c962f.zip |
Fixing USBSerial::read(void*, uint32) return value (thanks, Crenn!)
-rw-r--r-- | wirish/usb_serial.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/wirish/usb_serial.cpp b/wirish/usb_serial.cpp index e2cdee3..e2751a2 100644 --- a/wirish/usb_serial.cpp +++ b/wirish/usb_serial.cpp @@ -103,18 +103,18 @@ uint32 USBSerial::available(void) { /* blocks forever until len_bytes is received */ uint32 USBSerial::read(void *buf, uint32 len) { - if (!buf) { + if (buf == 0) { return 0; } uint32 bytes_in = 0; while (len > 0) { - uint32 new_bytes = usbReceiveBytes((uint8*)((uint8*)buf+bytes_in), len); + uint32 new_bytes = usbReceiveBytes((uint8*)buf + bytes_in, len); len -= new_bytes; bytes_in += new_bytes; } - return len; + return bytes_in; } /* blocks forever until 1 byte is received */ |