diff options
author | Michihiro NAKAJIMA <ggcueroad@gmail.com> | 2012-02-17 11:21:24 +0900 |
---|---|---|
committer | Michihiro NAKAJIMA <ggcueroad@gmail.com> | 2012-02-18 15:53:12 +0900 |
commit | 06de049737d2bc45ee439f38fb5e214ac54e38bb (patch) | |
tree | 369f3fee38868d437c8422215c4d98391c7ea4c4 /libarchive/archive_read_support_format_cab.c | |
parent | 4ad32f523b4517ca0b3c17510df451e1f90bead4 (diff) | |
download | libarchive-06de049737d2bc45ee439f38fb5e214ac54e38bb.tar.gz |
Issue 243: CAB decompression doesn't work when libarchive build with MSVC2010.
Prevent unexpected code optimization from MSVC /O2 option.
It made CAB reader fail to decompress LZX.
Diffstat (limited to 'libarchive/archive_read_support_format_cab.c')
-rw-r--r-- | libarchive/archive_read_support_format_cab.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libarchive/archive_read_support_format_cab.c b/libarchive/archive_read_support_format_cab.c index b634ed39..0bc7c999 100644 --- a/libarchive/archive_read_support_format_cab.c +++ b/libarchive/archive_read_support_format_cab.c @@ -2068,6 +2068,7 @@ lzx_decode_init(struct lzx_stream *strm, int w_bits) struct lzx_dec *ds; int slot, w_size, w_slot; int base, footer; + int base_inc[18]; if (strm->ds == NULL) { strm->ds = calloc(1, sizeof(*strm->ds)); @@ -2102,13 +2103,15 @@ lzx_decode_init(struct lzx_stream *strm, int w_bits) lzx_huffman_free(&(ds->mt)); } + for (footer = 0; footer < 18; footer++) + base_inc[footer] = 1 << footer; base = footer = 0; for (slot = 0; slot < w_slot; slot++) { int n; if (footer == 0) base = slot; else - base += 1 << footer; + base += base_inc[footer]; if (footer < 17) { footer = -2; for (n = base; n; n >>= 1) |