openbsd-ports/archivers/lzma/patches/patch-src_liblzmadec_main_c
steven b09b618411 update to 4.32.5
also tested by sthen@, thanks
2008-03-15 14:02:31 +00:00

42 lines
1.4 KiB
Plaintext

$OpenBSD: patch-src_liblzmadec_main_c,v 1.2 2008/03/15 14:02:32 steven Exp $
--- src/liblzmadec/main.c.orig Sun Jan 6 19:05:28 2008
+++ src/liblzmadec/main.c Sat Mar 15 09:31:50 2008
@@ -233,9 +233,9 @@ lzmadec_header_uncompressed (uint_fast64_t *size, uint
{
/* Streamed files have all 64 bits set in the size field.
We don't know the uncompressed size beforehand. */
+ uint_fast32_t i;
*is_streamed = 1; /* Assume streamed. */
*size = 0;
- uint_fast32_t i;
for (i = 0; i < 8; i++) {
*size += (uint_fast64_t)buffer[i] << (i * 8);
if (buffer[i] != 255)
@@ -259,6 +259,7 @@ lzmadec_internal_init (lzmadec_stream *strm)
{
uint_fast32_t i;
uint32_t num_probs;
+ size_t lzmadec_num_probs;
/* Make sure we have been called sanely */
if (STATE->probs != NULL || STATE->dictionary != NULL
@@ -291,7 +292,7 @@ lzmadec_internal_init (lzmadec_stream *strm)
strm->avail_in -= 8;
/* Allocate memory for internal data */
- const size_t lzmadec_num_probs = (LZMA_BASE_SIZE
+ lzmadec_num_probs = (LZMA_BASE_SIZE
+ (LZMA_LIT_SIZE << (STATE->lc + STATE->lp)));
STATE->probs = (CProb *)((strm->lzma_alloc)(strm->opaque, 1,
lzmadec_num_probs * sizeof(CProb)));
@@ -674,8 +675,8 @@ assert (state >= 0);
numDirectBits = LZMA_NUM_ALIGN_BITS;
}
{
- i = 1;
int_fast32_t mi = 1;
+ i = 1;
do {
CProb *prob3 = prob + mi;
RC_GET_BIT2(prob3, mi, ; , rep0 |= i);