diff options
author | Martin Matuska <martin@matuska.org> | 2020-01-16 16:13:40 +0100 |
---|---|---|
committer | Martin Matuska <martin@matuska.org> | 2020-01-16 16:15:37 +0100 |
commit | 0bf726cfec99b0f03791a028d44493b19f5bf61b (patch) | |
tree | d92933a5a69d968e83759d4aa01d35962dbd3898 | |
parent | d5475620534c70cb5b9fc78b97d6206625ca9dc3 (diff) | |
download | libarchive-0bf726cfec99b0f03791a028d44493b19f5bf61b.tar.gz |
RAR5 and WARC readers: move unnecessary comparsion into a comment
RAR5 reader: comment out unreachable code
Found by LGTM.com code analysis
-rw-r--r-- | libarchive/archive_read_support_format_rar5.c | 9 | ||||
-rw-r--r-- | libarchive/archive_read_support_format_warc.c | 3 |
2 files changed, 9 insertions, 3 deletions
diff --git a/libarchive/archive_read_support_format_rar5.c b/libarchive/archive_read_support_format_rar5.c index 6e91eab8..26374582 100644 --- a/libarchive/archive_read_support_format_rar5.c +++ b/libarchive/archive_read_support_format_rar5.c @@ -1821,12 +1821,16 @@ static int process_head_file(struct archive_read* a, struct rar5* rar, int ret = process_head_file_extra(a, entry, rar, extra_data_size); - /* Sanity check. */ + /* + * TODO: rewrite or remove useless sanity check + * as extra_data_size is not passed as a pointer + * if(extra_data_size < 0) { archive_set_error(&a->archive, ARCHIVE_ERRNO_PROGRAMMER, "File extra data size is not zero"); return ARCHIVE_FATAL; } + */ if(ret != ARCHIVE_OK) return ret; @@ -3043,7 +3047,8 @@ static int do_uncompress_block(struct archive_read* a, const uint8_t* p) { } continue; - } else if(num < 262) { + } else { + /* num < 262 */ const int idx = num - 258; const int dist = dist_cache_touch(rar, idx); diff --git a/libarchive/archive_read_support_format_warc.c b/libarchive/archive_read_support_format_warc.c index c1c54450..72977b8e 100644 --- a/libarchive/archive_read_support_format_warc.c +++ b/libarchive/archive_read_support_format_warc.c @@ -626,7 +626,8 @@ _warc_rdver(const char *buf, size_t bsz) if (ver >= 1200U) { if (memcmp(c, "\r\n", 2U) != 0) ver = 0U; - } else if (ver < 1200U) { + } else { + /* ver < 1200U */ if (*c != ' ' && *c != '\t') ver = 0U; } |