diff options
| author | 2024-10-26 02:24:01 +0200 | |
|---|---|---|
| committer | 2024-10-26 02:24:01 +0200 | |
| commit | 205fd58693636581afb064a43e75fb429c5677c7 (patch) | |
| tree | cf603f06d13e41c8eb39870ea44f3d2c8d246fef | |
| parent | dc445fd7e81d4ec7a5ec38f5943a5b766ee6b6d2 (diff) | |
| download | libimobiledevice-205fd58693636581afb064a43e75fb429c5677c7.tar.gz libimobiledevice-205fd58693636581afb064a43e75fb429c5677c7.tar.bz2 | |
idevice: Use proper cast for pointer to fd
| -rw-r--r-- | src/idevice.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/idevice.c b/src/idevice.c index b9bbb1f..d4ecf60 100644 --- a/src/idevice.c +++ b/src/idevice.c | |||
| @@ -548,7 +548,7 @@ idevice_error_t idevice_connect(idevice_t device, uint16_t port, idevice_connect | |||
| 548 | } | 548 | } |
| 549 | idevice_connection_t new_connection = (idevice_connection_t)malloc(sizeof(struct idevice_connection_private)); | 549 | idevice_connection_t new_connection = (idevice_connection_t)malloc(sizeof(struct idevice_connection_private)); |
| 550 | new_connection->type = CONNECTION_USBMUXD; | 550 | new_connection->type = CONNECTION_USBMUXD; |
| 551 | new_connection->data = (void*)(long)sfd; | 551 | new_connection->data = (void*)(uintptr_t)sfd; |
| 552 | new_connection->ssl_data = NULL; | 552 | new_connection->ssl_data = NULL; |
| 553 | new_connection->device = device; | 553 | new_connection->device = device; |
| 554 | new_connection->ssl_recv_timeout = (unsigned int)-1; | 554 | new_connection->ssl_recv_timeout = (unsigned int)-1; |
| @@ -593,7 +593,7 @@ idevice_error_t idevice_connect(idevice_t device, uint16_t port, idevice_connect | |||
| 593 | 593 | ||
| 594 | idevice_connection_t new_connection = (idevice_connection_t)malloc(sizeof(struct idevice_connection_private)); | 594 | idevice_connection_t new_connection = (idevice_connection_t)malloc(sizeof(struct idevice_connection_private)); |
| 595 | new_connection->type = CONNECTION_NETWORK; | 595 | new_connection->type = CONNECTION_NETWORK; |
| 596 | new_connection->data = (void*)(long)sfd; | 596 | new_connection->data = (void*)(uintptr_t)sfd; |
| 597 | new_connection->ssl_data = NULL; | 597 | new_connection->ssl_data = NULL; |
| 598 | new_connection->device = device; | 598 | new_connection->device = device; |
| 599 | new_connection->ssl_recv_timeout = (unsigned int)-1; | 599 | new_connection->ssl_recv_timeout = (unsigned int)-1; |
| @@ -618,11 +618,11 @@ idevice_error_t idevice_disconnect(idevice_connection_t connection) | |||
| 618 | } | 618 | } |
| 619 | idevice_error_t result = IDEVICE_E_UNKNOWN_ERROR; | 619 | idevice_error_t result = IDEVICE_E_UNKNOWN_ERROR; |
| 620 | if (connection->type == CONNECTION_USBMUXD) { | 620 | if (connection->type == CONNECTION_USBMUXD) { |
| 621 | usbmuxd_disconnect((int)(long)connection->data); | 621 | usbmuxd_disconnect((int)(uintptr_t)connection->data); |
| 622 | connection->data = NULL; | 622 | connection->data = NULL; |
| 623 | result = IDEVICE_E_SUCCESS; | 623 | result = IDEVICE_E_SUCCESS; |
| 624 | } else if (connection->type == CONNECTION_NETWORK) { | 624 | } else if (connection->type == CONNECTION_NETWORK) { |
| 625 | socket_close((int)(long)connection->data); | 625 | socket_close((int)(uintptr_t)connection->data); |
| 626 | connection->data = NULL; | 626 | connection->data = NULL; |
| 627 | result = IDEVICE_E_SUCCESS; | 627 | result = IDEVICE_E_SUCCESS; |
| 628 | } else { | 628 | } else { |
| @@ -647,7 +647,7 @@ static idevice_error_t internal_connection_send(idevice_connection_t connection, | |||
| 647 | if (connection->type == CONNECTION_USBMUXD) { | 647 | if (connection->type == CONNECTION_USBMUXD) { |
| 648 | int res; | 648 | int res; |
| 649 | do { | 649 | do { |
| 650 | res = usbmuxd_send((int)(long)connection->data, data, len, sent_bytes); | 650 | res = usbmuxd_send((int)(uintptr_t)connection->data, data, len, sent_bytes); |
| 651 | } while (res == -EAGAIN); | 651 | } while (res == -EAGAIN); |
| 652 | if (res < 0) { | 652 | if (res < 0) { |
| 653 | debug_info("ERROR: usbmuxd_send returned %d (%s)", res, strerror(-res)); | 653 | debug_info("ERROR: usbmuxd_send returned %d (%s)", res, strerror(-res)); |
| @@ -656,7 +656,7 @@ static idevice_error_t internal_connection_send(idevice_connection_t connection, | |||
| 656 | return IDEVICE_E_SUCCESS; | 656 | return IDEVICE_E_SUCCESS; |
| 657 | } | 657 | } |
| 658 | if (connection->type == CONNECTION_NETWORK) { | 658 | if (connection->type == CONNECTION_NETWORK) { |
| 659 | int s = socket_send((int)(long)connection->data, (void*)data, len); | 659 | int s = socket_send((int)(uintptr_t)connection->data, (void*)data, len); |
| 660 | if (s < 0) { | 660 | if (s < 0) { |
| 661 | *sent_bytes = 0; | 661 | *sent_bytes = 0; |
| 662 | return IDEVICE_E_UNKNOWN_ERROR; | 662 | return IDEVICE_E_UNKNOWN_ERROR; |
| @@ -763,7 +763,7 @@ static idevice_error_t internal_connection_receive_timeout(idevice_connection_t | |||
| 763 | } | 763 | } |
| 764 | 764 | ||
| 765 | if (connection->type == CONNECTION_USBMUXD) { | 765 | if (connection->type == CONNECTION_USBMUXD) { |
| 766 | int conn_error = usbmuxd_recv_timeout((int)(long)connection->data, data, len, recv_bytes, timeout); | 766 | int conn_error = usbmuxd_recv_timeout((int)(uintptr_t)connection->data, data, len, recv_bytes, timeout); |
| 767 | idevice_error_t error = socket_recv_to_idevice_error(conn_error, len, *recv_bytes); | 767 | idevice_error_t error = socket_recv_to_idevice_error(conn_error, len, *recv_bytes); |
| 768 | if (error == IDEVICE_E_UNKNOWN_ERROR) { | 768 | if (error == IDEVICE_E_UNKNOWN_ERROR) { |
| 769 | debug_info("ERROR: usbmuxd_recv_timeout returned %d (%s)", conn_error, strerror(-conn_error)); | 769 | debug_info("ERROR: usbmuxd_recv_timeout returned %d (%s)", conn_error, strerror(-conn_error)); |
| @@ -771,7 +771,7 @@ static idevice_error_t internal_connection_receive_timeout(idevice_connection_t | |||
| 771 | return error; | 771 | return error; |
| 772 | } | 772 | } |
| 773 | if (connection->type == CONNECTION_NETWORK) { | 773 | if (connection->type == CONNECTION_NETWORK) { |
| 774 | int res = socket_receive_timeout((int)(long)connection->data, data, len, 0, timeout); | 774 | int res = socket_receive_timeout((int)(uintptr_t)connection->data, data, len, 0, timeout); |
| 775 | idevice_error_t error = socket_recv_to_idevice_error(res, 0, 0); | 775 | idevice_error_t error = socket_recv_to_idevice_error(res, 0, 0); |
| 776 | if (error == IDEVICE_E_SUCCESS) { | 776 | if (error == IDEVICE_E_SUCCESS) { |
| 777 | *recv_bytes = (uint32_t)res; | 777 | *recv_bytes = (uint32_t)res; |
| @@ -863,7 +863,7 @@ static idevice_error_t internal_connection_receive(idevice_connection_t connecti | |||
| 863 | } | 863 | } |
| 864 | 864 | ||
| 865 | if (connection->type == CONNECTION_USBMUXD) { | 865 | if (connection->type == CONNECTION_USBMUXD) { |
| 866 | int res = usbmuxd_recv((int)(long)connection->data, data, len, recv_bytes); | 866 | int res = usbmuxd_recv((int)(uintptr_t)connection->data, data, len, recv_bytes); |
| 867 | if (res < 0) { | 867 | if (res < 0) { |
| 868 | debug_info("ERROR: usbmuxd_recv returned %d (%s)", res, strerror(-res)); | 868 | debug_info("ERROR: usbmuxd_recv returned %d (%s)", res, strerror(-res)); |
| 869 | return IDEVICE_E_UNKNOWN_ERROR; | 869 | return IDEVICE_E_UNKNOWN_ERROR; |
| @@ -871,7 +871,7 @@ static idevice_error_t internal_connection_receive(idevice_connection_t connecti | |||
| 871 | return IDEVICE_E_SUCCESS; | 871 | return IDEVICE_E_SUCCESS; |
| 872 | } | 872 | } |
| 873 | if (connection->type == CONNECTION_NETWORK) { | 873 | if (connection->type == CONNECTION_NETWORK) { |
| 874 | int res = socket_receive((int)(long)connection->data, data, len); | 874 | int res = socket_receive((int)(uintptr_t)connection->data, data, len); |
| 875 | if (res < 0) { | 875 | if (res < 0) { |
| 876 | debug_info("ERROR: socket_receive returned %d (%s)", res, strerror(-res)); | 876 | debug_info("ERROR: socket_receive returned %d (%s)", res, strerror(-res)); |
| 877 | return IDEVICE_E_UNKNOWN_ERROR; | 877 | return IDEVICE_E_UNKNOWN_ERROR; |
| @@ -924,11 +924,11 @@ idevice_error_t idevice_connection_get_fd(idevice_connection_t connection, int * | |||
| 924 | } | 924 | } |
| 925 | 925 | ||
| 926 | if (connection->type == CONNECTION_USBMUXD) { | 926 | if (connection->type == CONNECTION_USBMUXD) { |
| 927 | *fd = (int)(long)connection->data; | 927 | *fd = (int)(uintptr_t)connection->data; |
| 928 | return IDEVICE_E_SUCCESS; | 928 | return IDEVICE_E_SUCCESS; |
| 929 | } | 929 | } |
| 930 | if (connection->type == CONNECTION_NETWORK) { | 930 | if (connection->type == CONNECTION_NETWORK) { |
| 931 | *fd = (int)(long)connection->data; | 931 | *fd = (int)(uintptr_t)connection->data; |
| 932 | return IDEVICE_E_SUCCESS; | 932 | return IDEVICE_E_SUCCESS; |
| 933 | } | 933 | } |
| 934 | 934 | ||
