diff options
author | Rosen Penev | 2020-12-23 17:39:01 -0800 |
---|---|---|
committer | Nikias Bassen | 2022-04-30 13:34:21 +0200 |
commit | cf2c7d48380969200034afeab93169e68c34c397 (patch) | |
tree | a96f518be279922d00898a3ce81dc0ff483a40b2 /src/afc.c | |
parent | 6cb13f9e6d3939930aecf91d8e23d1896a3b92e5 (diff) | |
download | libimobiledevice-cf2c7d48380969200034afeab93169e68c34c397.tar.gz libimobiledevice-cf2c7d48380969200034afeab93169e68c34c397.tar.bz2 |
[clang-tidy] Do not use else after return
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Diffstat (limited to 'src/afc.c')
-rw-r--r-- | src/afc.c | 34 |
1 files changed, 19 insertions, 15 deletions
@@ -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; |