summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2024-04-04 09:30:06 +0200
committerGravatar Nikias Bassen2024-04-04 09:30:06 +0200
commit6d40d0ab626eb0ffee4f005b7fdc915bc561deb9 (patch)
tree1decd93a79c1f279d46e608a689c069e796ac515 /src
parentd8f8cb126571f1db53b7638bc2cd170716571144 (diff)
downloadidevicerestore-6d40d0ab626eb0ffee4f005b7fdc915bc561deb9.tar.gz
idevicerestore-6d40d0ab626eb0ffee4f005b7fdc915bc561deb9.tar.bz2
dfu: A little code optimization
Diffstat (limited to 'src')
-rw-r--r--src/dfu.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/src/dfu.c b/src/dfu.c
index 62a3dc0..cc8e1fb 100644
--- a/src/dfu.c
+++ b/src/dfu.c
@@ -103,13 +103,13 @@ irecv_device_t dfu_get_irecv_device(struct idevicerestore_client_t* client)
return device;
}
-int dfu_send_buffer(struct idevicerestore_client_t* client, unsigned char* buffer, unsigned int size)
+int dfu_send_buffer_with_options(struct idevicerestore_client_t* client, unsigned char* buffer, unsigned int size, unsigned int irecv_options)
{
irecv_error_t err = 0;
info("Sending data (%d bytes)...\n", size);
- err = irecv_send_buffer(client->dfu->client, buffer, size, 1);
+ err = irecv_send_buffer(client->dfu->client, buffer, size, irecv_options);
if (err != IRECV_E_SUCCESS) {
error("ERROR: Unable to send data: %s\n", irecv_strerror(err));
return -1;
@@ -118,19 +118,9 @@ int dfu_send_buffer(struct idevicerestore_client_t* client, unsigned char* buffe
return 0;
}
-int dfu_send_buffer_with_options(struct idevicerestore_client_t* client, unsigned char* buffer, unsigned int size, unsigned int irecv_options)
+int dfu_send_buffer(struct idevicerestore_client_t* client, unsigned char* buffer, unsigned int size)
{
- irecv_error_t err = 0;
-
- info("Sending data (%d bytes)...\n", size);
-
- err = irecv_send_buffer(client->dfu->client, buffer, size, irecv_options);
- if (err != IRECV_E_SUCCESS) {
- error("ERROR: Unable to send data: %s\n", irecv_strerror(err));
- return -1;
- }
-
- return 0;
+ return dfu_send_buffer_with_options(client, buffer, size, IRECV_SEND_OPT_DFU_NOTIFY_FINISH);
}
int dfu_send_component(struct idevicerestore_client_t* client, plist_t build_identity, const char* component)
@@ -208,7 +198,7 @@ int dfu_send_component(struct idevicerestore_client_t* client, plist_t build_ide
info("Sending %s (%d bytes)...\n", component, size);
- irecv_error_t err = irecv_send_buffer(client->dfu->client, data, size, 1);
+ irecv_error_t err = irecv_send_buffer(client->dfu->client, data, size, IRECV_SEND_OPT_DFU_NOTIFY_FINISH);
if (err != IRECV_E_SUCCESS) {
error("ERROR: Unable to send %s component: %s\n", component, irecv_strerror(err));
free(data);