aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@leaflabs.com>2011-05-02 14:35:58 -0400
committerMarti Bolivar <mbolivar@leaflabs.com>2011-05-04 13:31:53 -0400
commit9ad170c63ddac17301566e69fe6a0e7a8d0d4639 (patch)
tree13bddf8f891da198ab215a849fcce4fd7a9eb87c
parent11a0da5c63faffd45bde43da2777a9771cfdf5e9 (diff)
downloadlibrambutan-9ad170c63ddac17301566e69fe6a0e7a8d0d4639.tar.gz
librambutan-9ad170c63ddac17301566e69fe6a0e7a8d0d4639.zip
Fixing USBSerial::read(void*, uint32).
-rw-r--r--wirish/usb_serial.cpp6
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 */