summaryrefslogtreecommitdiffstats
path: root/src
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
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')
-rw-r--r--src/AFC.h41
-rw-r--r--src/usbmux.c7
2 files changed, 31 insertions, 17 deletions
diff --git a/src/AFC.h b/src/AFC.h
index de4e071..62ec659 100644
--- a/src/AFC.h
+++ b/src/AFC.h
@@ -58,21 +58,34 @@ struct iphone_afc_file_int {
58 58
59enum { 59enum {
60 AFC_ERROR = 0x00000001, 60 AFC_ERROR = 0x00000001,
61 AFC_GET_INFO = 0x0000000a,
62 AFC_GET_DEVINFO = 0x0000000b,
63 AFC_LIST_DIR = 0x00000003,
64 AFC_MAKE_DIR = 0x00000009,
65 AFC_DELETE = 0x00000008,
66 AFC_TRUNCATE = 0x00000007,
67 AFC_RENAME = 0x00000018,
68 AFC_SUCCESS_RESPONSE = 0x00000002, 61 AFC_SUCCESS_RESPONSE = 0x00000002,
69 AFC_FILE_OPEN = 0x0000000d, 62 AFC_LIST_DIR = 0x00000003, // ReadDir
70 AFC_FILE_CLOSE = 0x00000014, 63 // 0x00000004 // ReadFile
71 AFC_FILE_SEEK = 0x00000011, 64 // 0x00000005 // WriteFile
72 AFC_FILE_TRUNCATE = 0x00000015, 65 // 0x00000006 // WritePart
73 AFC_FILE_HANDLE = 0x0000000e, 66 AFC_TRUNCATE = 0x00000007, // Truncate
74 AFC_READ = 0x0000000f, 67 AFC_DELETE = 0x00000008, // RemovePath
75 AFC_WRITE = 0x00000010 68 AFC_MAKE_DIR = 0x00000009, // MakeDir
69 AFC_GET_INFO = 0x0000000a, // GetFileInfo
70 AFC_GET_DEVINFO = 0x0000000b, // GetDeviceInfo
71 // 0x0000000c // same as 5, but writes to temp file, then renames it.
72 AFC_FILE_OPEN = 0x0000000d, // FileRefOpen
73 AFC_FILE_HANDLE = 0x0000000e, // _unknownPacket
74 AFC_READ = 0x0000000f, // FileRefRead
75 AFC_WRITE = 0x00000010, // FileRefWrite
76 AFC_FILE_SEEK = 0x00000011, // FileRefSeek
77 AFC_FILE_TELL = 0x00000012, // FileRefTell
78 // 0x00000013 // _unknownPacket
79 AFC_FILE_CLOSE = 0x00000014, // FileRefClose
80 AFC_FILE_TRUNCATE = 0x00000015, // FileRefSetFileSize (ftruncate)
81 // 0x00000016 // SetFatalError
82 // 0x00000017 // SetConnectionOptions
83 AFC_RENAME = 0x00000018, // RenamePath
84 // 0x00000019 // SetFSBlockSize (0x800000)
85 // 0x0000001A // SetBlockSize (0x800000)
86 AFC_FILE_LOCK = 0x0000001B, // FileRefLock
87 AFC_MAKE_LINK = 0x0000001C // MakeLink
76}; 88};
77 89
78uint32 iphone_afc_get_file_handle(iphone_afc_file_t file); 90uint32 iphone_afc_get_file_handle(iphone_afc_file_t file);
91
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
309 } 309 }
310 310
311 // Since we were able to fill the data straight from our buffer, we can just return datalen. See 2a above. 311 // Since we were able to fill the data straight from our buffer, we can just return datalen. See 2a above.
312 return datalen; 312 *recv_bytes = datalen;
313 return IPHONE_E_SUCCESS;
313 } else { 314 } else {
314 memcpy(data, client->recv_buffer, client->r_len); 315 memcpy(data, client->recv_buffer, client->r_len);
315 free(client->recv_buffer); // don't need to deal with anymore, but... 316 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
361 if ((bytes - 28) > datalen) { 362 if ((bytes - 28) > datalen) {
362 // Copy what we need into the data, buffer the rest because we can. 363 // Copy what we need into the data, buffer the rest because we can.
363 memcpy(data + offset, buffer + 28, datalen); // data+offset: see #2b, above 364 memcpy(data + offset, buffer + 28, datalen); // data+offset: see #2b, above
364 complex = client->r_len + (bytes - 28) - datalen; 365 complex = client->r_len + ((bytes - 28) - datalen);
365 client->recv_buffer = (char *) realloc(client->recv_buffer, (sizeof(char) * complex)); 366 client->recv_buffer = (char *) realloc(client->recv_buffer, (sizeof(char) * complex));
366 client->r_len = complex; 367 client->r_len = complex;
367 complex = client->r_len - (bytes - 28) - datalen; 368 complex = client->r_len - ((bytes - 28) - datalen);
368 memcpy(client->recv_buffer + complex, buffer + 28 + datalen, (bytes - 28) - datalen); 369 memcpy(client->recv_buffer + complex, buffer + 28 + datalen, (bytes - 28) - datalen);
369 free(buffer); 370 free(buffer);
370 client->header->ocnt += bytes - 28; 371 client->header->ocnt += bytes - 28;