]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
RAR5 and WARC readers: move unnecessary comparsion into a comment
authorMartin Matuska <martin@matuska.org>
Thu, 16 Jan 2020 15:13:40 +0000 (16:13 +0100)
committerMartin Matuska <martin@matuska.org>
Thu, 16 Jan 2020 15:15:37 +0000 (16:15 +0100)
RAR5 reader: comment out unreachable code

Found by LGTM.com code analysis

libarchive/archive_read_support_format_rar5.c
libarchive/archive_read_support_format_warc.c

index 6e91eab851bb082bd5c1d08e479068f5b1d8eb61..26374582e4d60f37ce792e45442b73ea65628b1b 100644 (file)
@@ -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);
 
index c1c54450c39648fe01abe71db4a041b06140a0f1..72977b8e0739dd4873a2fb6272e92cadc400e81a 100644 (file)
@@ -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;
                }