diff options
Diffstat (limited to 'src/service.c')
| -rw-r--r-- | src/service.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/service.c b/src/service.c index 661c4f6..091b599 100644 --- a/src/service.c +++ b/src/service.c | |||
| @@ -135,19 +135,19 @@ LIBIMOBILEDEVICE_API service_error_t service_client_free(service_client_t client | |||
| 135 | LIBIMOBILEDEVICE_API service_error_t service_send(service_client_t client, const char* data, uint32_t size, uint32_t *sent) | 135 | LIBIMOBILEDEVICE_API service_error_t service_send(service_client_t client, const char* data, uint32_t size, uint32_t *sent) |
| 136 | { | 136 | { |
| 137 | service_error_t res = SERVICE_E_UNKNOWN_ERROR; | 137 | service_error_t res = SERVICE_E_UNKNOWN_ERROR; |
| 138 | int bytes = 0; | 138 | uint32_t bytes = 0; |
| 139 | 139 | ||
| 140 | if (!client || (client && !client->connection) || !data || (size == 0)) { | 140 | if (!client || (client && !client->connection) || !data || (size == 0)) { |
| 141 | return SERVICE_E_INVALID_ARG; | 141 | return SERVICE_E_INVALID_ARG; |
| 142 | } | 142 | } |
| 143 | 143 | ||
| 144 | debug_info("sending %d bytes", size); | 144 | debug_info("sending %d bytes", size); |
| 145 | res = idevice_to_service_error(idevice_connection_send(client->connection, data, size, (uint32_t*)&bytes)); | 145 | res = idevice_to_service_error(idevice_connection_send(client->connection, data, size, &bytes)); |
| 146 | if (bytes <= 0) { | 146 | if (res != SERVICE_E_SUCCESS) { |
| 147 | debug_info("ERROR: sending to device failed."); | 147 | debug_info("ERROR: sending to device failed."); |
| 148 | } | 148 | } |
| 149 | if (sent) { | 149 | if (sent) { |
| 150 | *sent = (uint32_t)bytes; | 150 | *sent = bytes; |
| 151 | } | 151 | } |
| 152 | 152 | ||
| 153 | return res; | 153 | return res; |
| @@ -156,19 +156,19 @@ LIBIMOBILEDEVICE_API service_error_t service_send(service_client_t client, const | |||
| 156 | LIBIMOBILEDEVICE_API service_error_t service_receive_with_timeout(service_client_t client, char* data, uint32_t size, uint32_t *received, unsigned int timeout) | 156 | LIBIMOBILEDEVICE_API service_error_t service_receive_with_timeout(service_client_t client, char* data, uint32_t size, uint32_t *received, unsigned int timeout) |
| 157 | { | 157 | { |
| 158 | service_error_t res = SERVICE_E_UNKNOWN_ERROR; | 158 | service_error_t res = SERVICE_E_UNKNOWN_ERROR; |
| 159 | int bytes = 0; | 159 | uint32_t bytes = 0; |
| 160 | 160 | ||
| 161 | if (!client || (client && !client->connection) || !data || (size == 0)) { | 161 | if (!client || (client && !client->connection) || !data || (size == 0)) { |
| 162 | return SERVICE_E_INVALID_ARG; | 162 | return SERVICE_E_INVALID_ARG; |
| 163 | } | 163 | } |
| 164 | 164 | ||
| 165 | res = idevice_to_service_error(idevice_connection_receive_timeout(client->connection, data, size, (uint32_t*)&bytes, timeout)); | 165 | res = idevice_to_service_error(idevice_connection_receive_timeout(client->connection, data, size, &bytes, timeout)); |
| 166 | if (res != SERVICE_E_SUCCESS) { | 166 | if (res != SERVICE_E_SUCCESS && res != SERVICE_E_TIMEOUT) { |
| 167 | debug_info("could not read data"); | 167 | debug_info("could not read data"); |
| 168 | return res; | 168 | return res; |
| 169 | } | 169 | } |
| 170 | if (received) { | 170 | if (received) { |
| 171 | *received = (uint32_t)bytes; | 171 | *received = bytes; |
| 172 | } | 172 | } |
| 173 | 173 | ||
| 174 | return res; | 174 | return res; |
