]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
cab: Adjust lzx_read_bitlen API
authorTobias Stoeckmann <tobias@stoeckmann.org>
Mon, 6 Jul 2026 16:15:51 +0000 (18:15 +0200)
committerTobias Stoeckmann <tobias@stoeckmann.org>
Thu, 9 Jul 2026 06:37:34 +0000 (08:37 +0200)
Use 0 as marker for maximum symbol count to be able to eventually switch
to another data type.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
libarchive/archive_read_support_format_cab.c

index 0c5d48219881d8ffaac72b1ca40b0daafd9fcf16..18b22a165476d774a63e648c64c316de80ea127e 100644 (file)
@@ -2782,7 +2782,7 @@ lzx_read_blocks(struct lzx_stream *strm, int last)
                        /*
                         * Get path lengths of remaining elements of main tree.
                         */
-                       r = lzx_read_bitlen(strm, &ds->mt, -1);
+                       r = lzx_read_bitlen(strm, &ds->mt, 0);
                        if (r == ARCHIVE_EOF) {
                                ds->state = ST_MAIN_TREE_REM;
                                if (last)
@@ -2812,7 +2812,7 @@ lzx_read_blocks(struct lzx_stream *strm, int last)
                        /*
                         * Get path lengths of remaining elements of main tree.
                         */
-                       r = lzx_read_bitlen(strm, &ds->lt, -1);
+                       r = lzx_read_bitlen(strm, &ds->lt, 0);
                        if (r == ARCHIVE_EOF) {
                                ds->state = ST_LENGTH_TREE;
                                if (last)
@@ -3141,7 +3141,7 @@ lzx_read_bitlen(struct lzx_stream *strm, struct huffman *d, int end)
        if (i == 0)
                memset(d->freq, 0, sizeof(d->freq));
        ret = ARCHIVE_EOF;
-       if (end < 0)
+       if (end == 0)
                end = d->symbol_count;
        while (i < end) {
                ds->loop = i;