summaryrefslogtreecommitdiffstats
path: root/src/usbmux.c
diff options
context:
space:
mode:
authorGravatar Zach C2009-03-11 22:04:38 -0700
committerGravatar Matt Colyer2009-03-11 22:04:38 -0700
commit201e1ff5bf2054fcb1c0cc3cd7ba1e229dbde3fa (patch)
treee8510ae4a4828a6e6185a324439256c2a78b3dce /src/usbmux.c
parentd85a44994876b2c1f5b457e8f72c6edb3e32a365 (diff)
downloadlibimobiledevice-201e1ff5bf2054fcb1c0cc3cd7ba1e229dbde3fa.tar.gz
libimobiledevice-201e1ff5bf2054fcb1c0cc3cd7ba1e229dbde3fa.tar.bz2
Fixes a compile error and two usbmux bugs
Signed-off-by: Matt Colyer <matt@colyer.name>
Diffstat (limited to 'src/usbmux.c')
-rw-r--r--src/usbmux.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/usbmux.c b/src/usbmux.c
index c7ac7ef..d8e6b44 100644
--- a/src/usbmux.c
+++ b/src/usbmux.c
@@ -309,7 +309,8 @@ iphone_error_t iphone_mux_recv(iphone_umux_client_t client, char *data, uint32_t
}
// Since we were able to fill the data straight from our buffer, we can just return datalen. See 2a above.
- return datalen;
+ *recv_bytes = datalen;
+ return IPHONE_E_SUCCESS;
} else {
memcpy(data, client->recv_buffer, client->r_len);
free(client->recv_buffer); // don't need to deal with anymore, but...
@@ -361,10 +362,10 @@ iphone_error_t iphone_mux_recv(iphone_umux_client_t client, char *data, uint32_t
if ((bytes - 28) > datalen) {
// Copy what we need into the data, buffer the rest because we can.
memcpy(data + offset, buffer + 28, datalen); // data+offset: see #2b, above
- complex = client->r_len + (bytes - 28) - datalen;
+ complex = client->r_len + ((bytes - 28) - datalen);
client->recv_buffer = (char *) realloc(client->recv_buffer, (sizeof(char) * complex));
client->r_len = complex;
- complex = client->r_len - (bytes - 28) - datalen;
+ complex = client->r_len - ((bytes - 28) - datalen);
memcpy(client->recv_buffer + complex, buffer + 28 + datalen, (bytes - 28) - datalen);
free(buffer);
client->header->ocnt += bytes - 28;