summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Rosen Penev2020-12-23 17:39:01 -0800
committerGravatar Nikias Bassen2022-04-30 13:34:21 +0200
commitcf2c7d48380969200034afeab93169e68c34c397 (patch)
treea96f518be279922d00898a3ce81dc0ff483a40b2
parent6cb13f9e6d3939930aecf91d8e23d1896a3b92e5 (diff)
downloadlibimobiledevice-cf2c7d48380969200034afeab93169e68c34c397.tar.gz
libimobiledevice-cf2c7d48380969200034afeab93169e68c34c397.tar.bz2
[clang-tidy] Do not use else after return
Signed-off-by: Rosen Penev <rosenp@gmail.com>
-rw-r--r--src/afc.c34
-rw-r--r--src/idevice.c76
-rw-r--r--src/lockdown.c20
-rw-r--r--src/misagent.c3
-rw-r--r--src/mobileactivation.c15
-rw-r--r--src/mobilebackup2.c9
-rw-r--r--src/preboard.c3
-rw-r--r--src/restore.c18
-rw-r--r--src/syslog_relay.c9
-rw-r--r--tools/idevicebackup.c13
-rw-r--r--tools/idevicebackup2.c28
-rw-r--r--tools/idevicecrashreport.c6
-rw-r--r--tools/ideviceprovision.c4
-rw-r--r--tools/idevicesyslog.c22
14 files changed, 133 insertions, 127 deletions
diff --git a/src/afc.c b/src/afc.c
index 17273e2..d8c3db0 100644
--- a/src/afc.c
+++ b/src/afc.c
@@ -229,7 +229,9 @@ static afc_error_t afc_receive_data(afc_client_t client, char **bytes, uint32_t
if (recv_len == 0) {
debug_info("Just didn't get enough.");
return AFC_E_MUX_ERROR;
- } else if (recv_len < sizeof(AFCPacket)) {
+ }
+
+ if (recv_len < sizeof(AFCPacket)) {
debug_info("Did not even get the AFCPacket header");
return AFC_E_MUX_ERROR;
}
@@ -250,14 +252,14 @@ static afc_error_t afc_receive_data(afc_client_t client, char **bytes, uint32_t
if (header.this_length < sizeof(AFCPacket)) {
debug_info("Invalid AFCPacket header received!");
return AFC_E_OP_HEADER_INVALID;
- } else if ((header.this_length == header.entire_length)
- && header.entire_length == sizeof(AFCPacket)) {
+ }
+ if ((header.this_length == header.entire_length)
+ && header.entire_length == sizeof(AFCPacket)) {
debug_info("Empty AFCPacket received!");
if (header.operation == AFC_OP_DATA) {
return AFC_E_SUCCESS;
- } else {
- return AFC_E_IO_ERROR;
}
+ return AFC_E_IO_ERROR;
}
debug_info("received AFC packet, full len=%lld, this len=%lld, operation=0x%llx", header.entire_length, header.this_length, header.operation);
@@ -273,7 +275,8 @@ static afc_error_t afc_receive_data(afc_client_t client, char **bytes, uint32_t
free(buf);
debug_info("Did not get packet contents!");
return AFC_E_NOT_ENOUGH_DATA;
- } else if (recv_len < this_len) {
+ }
+ if (recv_len < this_len) {
free(buf);
debug_info("Could not receive this_len=%d bytes", this_len);
return AFC_E_NOT_ENOUGH_DATA;
@@ -749,22 +752,23 @@ LIBIMOBILEDEVICE_API afc_error_t afc_file_read(afc_client_t client, uint64_t han
if (ret != AFC_E_SUCCESS) {
afc_unlock(client);
return ret;
- } else if (bytes_loc == 0) {
+ }
+ if (bytes_loc == 0) {
if (input)
free(input);
afc_unlock(client);
*bytes_read = current_count;
/* FIXME: check that's actually a success */
return ret;
- } else {
- if (input) {
- debug_info("%d", bytes_loc);
- memcpy(data + current_count, input, (bytes_loc > length) ? length : bytes_loc);
- free(input);
- input = NULL;
- current_count += (bytes_loc > length) ? length : bytes_loc;
- }
}
+ if (input) {
+ debug_info("%d", bytes_loc);
+ memcpy(data + current_count, input, (bytes_loc > length) ? length : bytes_loc);
+ free(input);
+ input = NULL;
+ current_count += (bytes_loc > length) ? length : bytes_loc;
+ }
+
afc_unlock(client);
*bytes_read = current_count;
return ret;
diff --git a/src/idevice.c b/src/idevice.c
index f64570b..adf47f4 100644
--- a/src/idevice.c
+++ b/src/idevice.c
@@ -473,7 +473,8 @@ LIBIMOBILEDEVICE_API idevice_error_t idevice_connect(idevice_t device, uint16_t
new_connection->status = IDEVICE_E_SUCCESS;
*connection = new_connection;
return IDEVICE_E_SUCCESS;
- } else if (device->conn_type == CONNECTION_NETWORK) {
+ }
+ if (device->conn_type == CONNECTION_NETWORK) {
struct sockaddr_storage saddr_storage;
struct sockaddr* saddr = (struct sockaddr*)&saddr_storage;
@@ -529,10 +530,9 @@ LIBIMOBILEDEVICE_API idevice_error_t idevice_connect(idevice_t device, uint16_t
*connection = new_connection;
return IDEVICE_E_SUCCESS;
- } else {
- debug_info("Unknown connection type %d", device->conn_type);
}
+ debug_info("Unknown connection type %d", device->conn_type);
return IDEVICE_E_UNKNOWN_ERROR;
}
@@ -583,7 +583,8 @@ static idevice_error_t internal_connection_send(idevice_connection_t connection,
return IDEVICE_E_UNKNOWN_ERROR;
}
return IDEVICE_E_SUCCESS;
- } else if (connection->type == CONNECTION_NETWORK) {
+ }
+ if (connection->type == CONNECTION_NETWORK) {
int s = socket_send((int)(long)connection->data, (void*)data, len);
if (s < 0) {
*sent_bytes = 0;
@@ -591,9 +592,9 @@ static idevice_error_t internal_connection_send(idevice_connection_t connection,
}
*sent_bytes = s;
return IDEVICE_E_SUCCESS;
- } else {
- debug_info("Unknown connection type %d", connection->type);
}
+
+ debug_info("Unknown connection type %d", connection->type);
return IDEVICE_E_UNKNOWN_ERROR;
}
@@ -638,27 +639,26 @@ LIBIMOBILEDEVICE_API idevice_error_t idevice_connection_send(idevice_connection_
}
*sent_bytes = sent;
return IDEVICE_E_SUCCESS;
- } else {
- uint32_t sent = 0;
- while (sent < len) {
- uint32_t bytes = 0;
- int s = internal_connection_send(connection, data+sent, len-sent, &bytes);
- if (s < 0) {
- break;
- }
- sent += bytes;
- }
- debug_info("len %d, sent %d", len, sent);
- if (sent < len) {
- *sent_bytes = sent;
- if (sent == 0) {
- return IDEVICE_E_UNKNOWN_ERROR;
- }
- return IDEVICE_E_NOT_ENOUGH_DATA;
+ }
+ uint32_t sent = 0;
+ while (sent < len) {
+ uint32_t bytes = 0;
+ int s = internal_connection_send(connection, data+sent, len-sent, &bytes);
+ if (s < 0) {
+ break;
}
+ sent += bytes;
+ }
+ debug_info("internal_connection_send %d, sent %d", len, sent);
+ if (sent < len) {
*sent_bytes = sent;
- return IDEVICE_E_SUCCESS;
+ if (sent == 0) {
+ return IDEVICE_E_UNKNOWN_ERROR;
+ }
+ return IDEVICE_E_NOT_ENOUGH_DATA;
}
+ *sent_bytes = sent;
+ return IDEVICE_E_SUCCESS;
}
static inline idevice_error_t socket_recv_to_idevice_error(int conn_error, uint32_t len, uint32_t received)
@@ -698,7 +698,8 @@ static idevice_error_t internal_connection_receive_timeout(idevice_connection_t
debug_info("ERROR: usbmuxd_recv_timeout returned %d (%s)", conn_error, strerror(-conn_error));
}
return error;
- } else if (connection->type == CONNECTION_NETWORK) {
+ }
+ if (connection->type == CONNECTION_NETWORK) {
int res = socket_receive_timeout((int)(long)connection->data, data, len, 0, timeout);
idevice_error_t error = socket_recv_to_idevice_error(res, 0, 0);
if (error == IDEVICE_E_SUCCESS) {
@@ -707,9 +708,9 @@ static idevice_error_t internal_connection_receive_timeout(idevice_connection_t
debug_info("ERROR: socket_receive_timeout returned %d (%s)", res, strerror(-res));
}
return error;
- } else {
- debug_info("Unknown connection type %d", connection->type);
}
+
+ debug_info("Unknown connection type %d", connection->type);
return IDEVICE_E_UNKNOWN_ERROR;
}
@@ -793,7 +794,8 @@ static idevice_error_t internal_connection_receive(idevice_connection_t connecti
return IDEVICE_E_UNKNOWN_ERROR;
}
return IDEVICE_E_SUCCESS;
- } else if (connection->type == CONNECTION_NETWORK) {
+ }
+ if (connection->type == CONNECTION_NETWORK) {
int res = socket_receive((int)(long)connection->data, data, len);
if (res < 0) {
debug_info("ERROR: socket_receive returned %d (%s)", res, strerror(-res));
@@ -801,9 +803,9 @@ static idevice_error_t internal_connection_receive(idevice_connection_t connecti
}
*recv_bytes = (uint32_t)res;
return IDEVICE_E_SUCCESS;
- } else {
- debug_info("Unknown connection type %d", connection->type);
}
+
+ debug_info("Unknown connection type %d", connection->type);
return IDEVICE_E_UNKNOWN_ERROR;
}
@@ -846,17 +848,17 @@ LIBIMOBILEDEVICE_API idevice_error_t idevice_connection_get_fd(idevice_connectio
return IDEVICE_E_INVALID_ARG;
}
- idevice_error_t result = IDEVICE_E_UNKNOWN_ERROR;
if (connection->type == CONNECTION_USBMUXD) {
*fd = (int)(long)connection->data;
- result = IDEVICE_E_SUCCESS;
- } else if (connection->type == CONNECTION_NETWORK) {
+ return IDEVICE_E_SUCCESS;
+ }
+ if (connection->type == CONNECTION_NETWORK) {
*fd = (int)(long)connection->data;
- result = IDEVICE_E_SUCCESS;
- } else {
- debug_info("Unknown connection type %d", connection->type);
+ return IDEVICE_E_SUCCESS;
}
- return result;
+
+ debug_info("Unknown connection type %d", connection->type);
+ return IDEVICE_E_UNKNOWN_ERROR;
}
LIBIMOBILEDEVICE_API idevice_error_t idevice_get_handle(idevice_t device, uint32_t *handle)
diff --git a/src/lockdown.c b/src/lockdown.c
index 25e8c87..d0922dd 100644
--- a/src/lockdown.c
+++ b/src/lockdown.c
@@ -163,22 +163,22 @@ lockdownd_error_t lockdown_check_result(plist_t dict, const char *query_match)
if (plist_get_node_type(query_node) != PLIST_STRING) {
return ret;
- } else {
- char *query_value = NULL;
+ }
- plist_get_string_val(query_node, &query_value);
- if (!query_value) {
- return ret;
- }
+ char *query_value = NULL;
- if (query_match && (strcmp(query_value, query_match) != 0)) {
- free(query_value);
- return ret;
- }
+ plist_get_string_val(query_node, &query_value);
+ if (!query_value) {
+ return ret;
+ }
+ if (query_match && (strcmp(query_value, query_match) != 0)) {
free(query_value);
+ return ret;
}
+ free(query_value);
+
plist_t result_node = plist_dict_get_item(dict, "Result");
if (!result_node) {
/* iOS 5: the 'Result' key is not present anymore.
diff --git a/src/misagent.c b/src/misagent.c
index d790a05..af925f9 100644
--- a/src/misagent.c
+++ b/src/misagent.c
@@ -85,9 +85,8 @@ static misagent_error_t misagent_check_result(plist_t response, int* status_code
*status_code = (int)(val & 0xFFFFFFFF);
if (*status_code == 0) {
return MISAGENT_E_SUCCESS;
- } else {
- return MISAGENT_E_REQUEST_FAILED;
}
+ return MISAGENT_E_REQUEST_FAILED;
}
LIBIMOBILEDEVICE_API misagent_error_t misagent_client_new(idevice_t device, lockdownd_service_descriptor_t service, misagent_client_t *client)
diff --git a/src/mobileactivation.c b/src/mobileactivation.c
index 2de4333..79c7003 100644
--- a/src/mobileactivation.c
+++ b/src/mobileactivation.c
@@ -109,8 +109,6 @@ static plist_t plist_data_from_plist(plist_t plist)
static mobileactivation_error_t mobileactivation_check_result(plist_t dict, const char *command)
{
- mobileactivation_error_t ret = MOBILEACTIVATION_E_UNKNOWN_ERROR;
-
if (!dict || plist_get_node_type(dict) != PLIST_DICT) {
return MOBILEACTIVATION_E_PLIST_ERROR;
}
@@ -118,14 +116,13 @@ static mobileactivation_error_t mobileactivation_check_result(plist_t dict, cons
plist_t err_node = plist_dict_get_item(dict, "Error");
if (!err_node) {
return MOBILEACTIVATION_E_SUCCESS;
- } else {
- char *errmsg = NULL;
- plist_get_string_val(err_node, &errmsg);
- debug_info("ERROR: %s: %s", command, errmsg);
- ret = MOBILEACTIVATION_E_REQUEST_FAILED;
- free(errmsg);
}
- return ret;
+
+ char *errmsg = NULL;
+ plist_get_string_val(err_node, &errmsg);
+ debug_info("ERROR: %s: %s", command, errmsg);
+ free(errmsg);
+ return MOBILEACTIVATION_E_REQUEST_FAILED;
}
static mobileactivation_error_t mobileactivation_send_command_plist(mobileactivation_client_t client, plist_t command, plist_t *result)
diff --git a/src/mobilebackup2.c b/src/mobilebackup2.c
index f4fde95..3726065 100644
--- a/src/mobilebackup2.c
+++ b/src/mobilebackup2.c
@@ -240,9 +240,8 @@ LIBIMOBILEDEVICE_API mobilebackup2_error_t mobilebackup2_send_raw(mobilebackup2_
if (sent > 0) {
*bytes = sent;
return MOBILEBACKUP2_E_SUCCESS;
- } else {
- return MOBILEBACKUP2_E_MUX_ERROR;
}
+ return MOBILEBACKUP2_E_MUX_ERROR;
}
LIBIMOBILEDEVICE_API mobilebackup2_error_t mobilebackup2_receive_raw(mobilebackup2_client_t client, char *data, uint32_t length, uint32_t *bytes)
@@ -265,11 +264,11 @@ LIBIMOBILEDEVICE_API mobilebackup2_error_t mobilebackup2_receive_raw(mobilebacku
if (received > 0) {
*bytes = received;
return MOBILEBACKUP2_E_SUCCESS;
- } else if (received == 0) {
+ }
+ if (received == 0) {
return MOBILEBACKUP2_E_SUCCESS;
- } else {
- return MOBILEBACKUP2_E_MUX_ERROR;
}
+ return MOBILEBACKUP2_E_MUX_ERROR;
}
LIBIMOBILEDEVICE_API mobilebackup2_error_t mobilebackup2_version_exchange(mobilebackup2_client_t client, double local_versions[], char count, double *remote_version)
diff --git a/src/preboard.c b/src/preboard.c
index b975f0e..4b3b444 100644
--- a/src/preboard.c
+++ b/src/preboard.c
@@ -162,7 +162,8 @@ static void* preboard_receive_status_loop_thread(void* arg)
preboard_error_t perr = preboard_receive_with_timeout(data->client, &pl, 1000);
if (perr == PREBOARD_E_TIMEOUT) {
continue;
- } else if (perr == PREBOARD_E_SUCCESS) {
+ }
+ if (perr == PREBOARD_E_SUCCESS) {
data->cbfunc(pl, data->user_data);
}
plist_free(pl);
diff --git a/src/restore.c b/src/restore.c
index 4e9d65a..591fd16 100644
--- a/src/restore.c
+++ b/src/restore.c
@@ -268,29 +268,27 @@ LIBIMOBILEDEVICE_API restored_error_t restored_query_value(restored_client_t cli
LIBIMOBILEDEVICE_API restored_error_t restored_get_value(restored_client_t client, const char *key, plist_t *value)
{
+ plist_t item;
+
if (!client || !value || (value && *value))
return RESTORE_E_INVALID_ARG;
if (!client->info)
return RESTORE_E_NOT_ENOUGH_DATA;
- restored_error_t ret = RESTORE_E_SUCCESS;
- plist_t item = NULL;
-
if (!key) {
*value = plist_copy(client->info);
return RESTORE_E_SUCCESS;
- } else {
- item = plist_dict_get_item(client->info, key);
}
- if (item) {
- *value = plist_copy(item);
- } else {
- ret = RESTORE_E_PLIST_ERROR;
+ item = plist_dict_get_item(client->info, key);
+ if (!item) {
+ return RESTORE_E_PLIST_ERROR;
}
- return ret;
+ *value = plist_copy(item);
+ free(item);
+ return RESTORE_E_SUCCESS;
}
LIBIMOBILEDEVICE_API restored_error_t restored_client_new(idevice_t device, restored_client_t *client, const char *label)
diff --git a/src/syslog_relay.c b/src/syslog_relay.c
index c137297..ec9eca5 100644
--- a/src/syslog_relay.c
+++ b/src/syslog_relay.c
@@ -154,16 +154,15 @@ void *syslog_relay_worker(void *arg)
ret = syslog_relay_receive_with_timeout(srwt->client, &c, 1, &bytes, 100);
if (ret == SYSLOG_RELAY_E_TIMEOUT || ret == SYSLOG_RELAY_E_NOT_ENOUGH_DATA || ((bytes == 0) && (ret == SYSLOG_RELAY_E_SUCCESS))) {
continue;
- } else if (ret < 0) {
+ }
+ if (ret < 0) {
debug_info("Connection to syslog relay interrupted");
break;
}
if (srwt->is_raw) {
srwt->cbfunc(c, srwt->user_data);
- } else {
- if (c != 0) {
- srwt->cbfunc(c, srwt->user_data);
- }
+ } else if (c != 0) {
+ srwt->cbfunc(c, srwt->user_data);
}
}
diff --git a/tools/idevicebackup.c b/tools/idevicebackup.c
index 0affd7a..2856fda 100644
--- a/tools/idevicebackup.c
+++ b/tools/idevicebackup.c
@@ -926,15 +926,16 @@ int main(int argc, char *argv[])
if (aerr == AFC_E_SUCCESS) {
do_post_notification(NP_SYNC_DID_START);
break;
- } else if (aerr == AFC_E_OP_WOULD_BLOCK) {
+ }
+ if (aerr == AFC_E_OP_WOULD_BLOCK) {
usleep(LOCK_WAIT);
continue;
- } else {
- fprintf(stderr, "ERROR: could not lock file! error code: %d\n", aerr);
- afc_file_close(afc, lockfile);
- lockfile = 0;
- cmd = CMD_LEAVE;
}
+
+ fprintf(stderr, "ERROR: could not lock file! error code: %d\n", aerr);
+ afc_file_close(afc, lockfile);
+ lockfile = 0;
+ cmd = CMD_LEAVE;
}
if (i == LOCK_ATTEMPTS) {
fprintf(stderr, "ERROR: timeout while locking for sync\n");
diff --git a/tools/idevicebackup2.c b/tools/idevicebackup2.c
index d1ef0d6..ec7eacd 100644
--- a/tools/idevicebackup2.c
+++ b/tools/idevicebackup2.c
@@ -184,9 +184,8 @@ static int mkdir_with_parents(const char *dir, int mode)
if (!dir) return -1;
if (__mkdir(dir, mode) == 0) {
return 0;
- } else {
- if (errno == EEXIST) return 0;
}
+ if (errno == EEXIST) return 0;
int res;
char *parent = strdup(dir);
char *parentdir = dirname(parent);
@@ -973,10 +972,12 @@ static int mb2_receive_filename(mobilebackup2_client_t mobilebackup2, char** fil
if ((nlen == 0) && (rlen == 4)) {
// a zero length means no more files to receive
return 0;
- } else if(rlen == 0) {
+ }
+ if (rlen == 0) {
// device needs more time, waiting...
continue;
- } else if (nlen > 4096) {
+ }
+ if (nlen > 4096) {
// filename length is too large
printf("ERROR: %s: too large filename length (%d)!\n", __func__, nlen);
return 0;
@@ -1368,7 +1369,8 @@ static void get_hidden_input(char *buf, int maxlen)
while ((c = my_getch())) {
if ((c == '\r') || (c == '\n')) {
break;
- } else if (isprint(c)) {
+ }
+ if (isprint(c)) {
if (pwlen < maxlen-1)
buf[pwlen++] = c;
fputc('*', stderr);
@@ -1961,15 +1963,16 @@ int main(int argc, char *argv[])
if (aerr == AFC_E_SUCCESS) {
do_post_notification(device, NP_SYNC_DID_START);
break;
- } else if (aerr == AFC_E_OP_WOULD_BLOCK) {
+ }
+ if (aerr == AFC_E_OP_WOULD_BLOCK) {
usleep(LOCK_WAIT);
continue;
- } else {
- fprintf(stderr, "ERROR: could not lock file! error code: %d\n", aerr);
- afc_file_close(afc, lockfile);
- lockfile = 0;
- cmd = CMD_LEAVE;
}
+
+ fprintf(stderr, "ERROR: could not lock file! error code: %d\n", aerr);
+ afc_file_close(afc, lockfile);
+ lockfile = 0;
+ cmd = CMD_LEAVE;
}
if (i == LOCK_ATTEMPTS) {
fprintf(stderr, "ERROR: timeout while locking for sync\n");
@@ -2103,9 +2106,8 @@ checkpoint:
if (write_restore_applications(info_plist, afc) < 0) {
cmd = CMD_LEAVE;
break;
- } else {
- PRINT_VERBOSE(1, "Wrote RestoreApplications.plist\n");
}
+ PRINT_VERBOSE(1, "Wrote RestoreApplications.plist\n");
}
/* Start restore */
diff --git a/tools/idevicecrashreport.c b/tools/idevicecrashreport.c
index 48bda3a..d0d2147 100644
--- a/tools/idevicecrashreport.c
+++ b/tools/idevicecrashreport.c
@@ -475,10 +475,10 @@ int main(int argc, char* argv[])
if (service_error == SERVICE_E_SUCCESS || service_error == SERVICE_E_TIMEOUT) {
attempts++;
continue;
- } else {
- fprintf(stderr, "ERROR: Crash logs could not be moved. Connection interrupted (%d).\n", service_error);
- break;
}
+
+ fprintf(stderr, "ERROR: Crash logs could not be moved. Connection interrupted (%d).\n", service_error);
+ break;
}
service_client_free(svcmove);
free(ping);
diff --git a/tools/ideviceprovision.c b/tools/ideviceprovision.c
index 981a7ee..7cd4f3f 100644
--- a/tools/ideviceprovision.c
+++ b/tools/ideviceprovision.c
@@ -448,7 +448,9 @@ int main(int argc, char *argv[])
plist_free(pl);
return res;
- } else if (op == OP_COPY) {
+ }
+
+ if (op == OP_COPY) {
struct stat st;
const char *checkdir = (param2) ? param2 : param;
if ((stat(checkdir, &st) < 0) || !S_ISDIR(st.st_mode)) {
diff --git a/tools/idevicesyslog.c b/tools/idevicesyslog.c
index 2a72d72..f85c7cc 100644
--- a/tools/idevicesyslog.c
+++ b/tools/idevicesyslog.c
@@ -151,7 +151,9 @@ static void syslog_callback(char c, void *user_data)
shall_print = 1;
cprintf(COLOR_WHITE);
break;
- } else if (line[3] == ' ' && line[6] == ' ' && line[15] == ' ') {
+ }
+
+ if (line[3] == ' ' && line[6] == ' ' && line[15] == ' ') {
char* end = &line[lp];
char* p = &line[16];
@@ -190,10 +192,9 @@ static void syslog_callback(char c, void *user_data)
if (!found) {
shall_print = 0;
break;
- } else {
- triggered = 1;
- shall_print = 1;
}
+ triggered = 1;
+ shall_print = 1;
} else if (num_trigger_filters == 0 && num_untrigger_filters > 0 && !triggered) {
shall_print = 0;
quit_flag++;
@@ -213,9 +214,8 @@ static void syslog_callback(char c, void *user_data)
if (!found) {
shall_print = 0;
break;
- } else {
- shall_print = 1;
}
+ shall_print = 1;
}
/* process name */
@@ -430,7 +430,8 @@ static void device_event_cb(const idevice_event_t* event, void* userdata)
{
if (use_network && event->conn_type != CONNECTION_NETWORK) {
return;
- } else if (!use_network && event->conn_type != CONNECTION_USBMUXD) {
+ }
+ if (!use_network && event->conn_type != CONNECTION_USBMUXD) {
return;
}
if (event->event == IDEVICE_DEVICE_ADD) {
@@ -656,7 +657,8 @@ int main(int argc, char *argv[])
fprintf(stderr, "ERROR: -p and -e/-q cannot be used together.\n");
print_usage(argc, argv, 1);
return 2;
- } else if (include_filter > 0 && exclude_kernel > 0) {
+ }
+ if (include_filter > 0 && exclude_kernel > 0) {
fprintf(stderr, "ERROR: -p and -K cannot be used together.\n");
print_usage(argc, argv, 1);
return 2;
@@ -699,9 +701,9 @@ int main(int argc, char *argv[])
if (!udid) {
fprintf(stderr, "No device found. Plug in a device or pass UDID with -u to wait for device to be available.\n");
return -1;
- } else {
- fprintf(stderr, "Waiting for device with UDID %s to become available...\n", udid);
}
+
+ fprintf(stderr, "Waiting for device with UDID %s to become available...\n", udid);
}
line_buffer_size = 1024;