diff options
author | Rosen Penev | 2020-12-23 17:32:57 -0800 |
---|---|---|
committer | Nikias Bassen | 2022-04-22 16:30:45 +0200 |
commit | c461e6d76b27b11284dda66316263696d5266764 (patch) | |
tree | 3d612fc904046a381438cf008448aaf4a1424f10 /src | |
parent | 95316d81633120244d53b85303447beb1a917f74 (diff) | |
download | libimobiledevice-c461e6d76b27b11284dda66316263696d5266764.tar.gz libimobiledevice-c461e6d76b27b11284dda66316263696d5266764.tar.bz2 |
[clang-tidy] Fix bugprone string compare
Found with bugprone-suspicious-string-compare
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/afc.c | 2 | ||||
-rw-r--r-- | src/device_link_service.c | 8 | ||||
-rw-r--r-- | src/file_relay.c | 2 | ||||
-rw-r--r-- | src/lockdown.c | 2 | ||||
-rw-r--r-- | src/mobilesync.c | 2 | ||||
-rw-r--r-- | src/screenshotr.c | 2 |
6 files changed, 9 insertions, 9 deletions
@@ -235,7 +235,7 @@ static afc_error_t afc_receive_data(afc_client_t client, char **bytes, uint32_t } /* check if it's a valid AFC header */ - if (strncmp(header.magic, AFC_MAGIC, AFC_MAGIC_LEN)) { + if (strncmp(header.magic, AFC_MAGIC, AFC_MAGIC_LEN) != 0) { debug_info("Invalid AFC packet received (magic != " AFC_MAGIC ")!"); } diff --git a/src/device_link_service.c b/src/device_link_service.c index 6daf84d..66c2461 100644 --- a/src/device_link_service.c +++ b/src/device_link_service.c @@ -83,7 +83,7 @@ static int device_link_service_get_message(plist_t dl_msg, char **message) return 0; } - if ((strlen(cmd_str) < 9) || (strncmp(cmd_str, "DL", 2))) { + if ((strlen(cmd_str) < 9) || (strncmp(cmd_str, "DL", 2) != 0)) { free(cmd_str); return 0; } @@ -184,7 +184,7 @@ device_link_service_error_t device_link_service_version_exchange(device_link_ser goto leave; } device_link_service_get_message(array, &msg); - if (!msg || strcmp(msg, "DLMessageVersionExchange")) { + if (!msg || strcmp(msg, "DLMessageVersionExchange") != 0) { debug_info("Did not receive DLMessageVersionExchange from device!"); err = DEVICE_LINK_SERVICE_E_PLIST_ERROR; goto leave; @@ -239,7 +239,7 @@ device_link_service_error_t device_link_service_version_exchange(device_link_ser goto leave; } device_link_service_get_message(array, &msg); - if (!msg || strcmp(msg, "DLMessageDeviceReady")) { + if (!msg || strcmp(msg, "DLMessageDeviceReady") != 0) { debug_info("Did not get DLMessageDeviceReady!"); err = DEVICE_LINK_SERVICE_E_PLIST_ERROR; goto leave; @@ -403,7 +403,7 @@ device_link_service_error_t device_link_service_receive_process_message(device_l char *msg = NULL; device_link_service_get_message(pmsg, &msg); - if (!msg || strcmp(msg, "DLMessageProcessMessage")) { + if (!msg || strcmp(msg, "DLMessageProcessMessage") != 0) { debug_info("Did not receive DLMessageProcessMessage as expected!"); err = DEVICE_LINK_SERVICE_E_PLIST_ERROR; goto leave; diff --git a/src/file_relay.c b/src/file_relay.c index e304d31..aa77ae6 100644 --- a/src/file_relay.c +++ b/src/file_relay.c @@ -143,7 +143,7 @@ LIBIMOBILEDEVICE_API file_relay_error_t file_relay_request_sources_timeout(file_ goto leave; } - if (strcmp(ack, "Acknowledged")) { + if (strcmp(ack, "Acknowledged") != 0) { debug_info("ERROR: Did not receive 'Acknowledged' but '%s'", ack); goto leave; } diff --git a/src/lockdown.c b/src/lockdown.c index 1786536..25e8c87 100644 --- a/src/lockdown.c +++ b/src/lockdown.c @@ -680,7 +680,7 @@ LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_client_new_with_handshake(idevi ret = lockdownd_query_type(client_loc, &type); if (LOCKDOWN_E_SUCCESS != ret) { debug_info("QueryType failed in the lockdownd client."); - } else if (strcmp("com.apple.mobile.lockdown", type)) { + } else if (strcmp("com.apple.mobile.lockdown", type) != 0) { debug_info("Warning QueryType request returned \"%s\".", type); } free(type); diff --git a/src/mobilesync.c b/src/mobilesync.c index 8881e75..e50226c 100644 --- a/src/mobilesync.c +++ b/src/mobilesync.c @@ -473,7 +473,7 @@ LIBIMOBILEDEVICE_API mobilesync_error_t mobilesync_clear_all_records_on_device(m goto out; } - if (strcmp(response_type, "SDMessageDeviceWillClearAllRecords")) { + if (strcmp(response_type, "SDMessageDeviceWillClearAllRecords") != 0) { err = MOBILESYNC_E_PLIST_ERROR; } diff --git a/src/screenshotr.c b/src/screenshotr.c index 11d6506..77835da 100644 --- a/src/screenshotr.c +++ b/src/screenshotr.c @@ -142,7 +142,7 @@ LIBIMOBILEDEVICE_API screenshotr_error_t screenshotr_take_screenshot(screenshotr plist_t node = plist_dict_get_item(dict, "MessageType"); char *strval = NULL; plist_get_string_val(node, &strval); - if (!strval || strcmp(strval, "ScreenShotReply")) { + if (!strval || strcmp(strval, "ScreenShotReply") != 0) { debug_info("invalid screenshot data received!"); res = SCREENSHOTR_E_PLIST_ERROR; goto leave; |