openbsd-ports/archivers/lzma/patches/patch-src_liblzmadec_main_c
2006-07-17 12:10:22 +00:00

42 lines
1.4 KiB
Plaintext

$OpenBSD: patch-src_liblzmadec_main_c,v 1.1 2006/07/17 12:10:22 steven Exp $
--- src/liblzmadec/main.c.orig Sat Dec 24 21:02:46 2005
+++ src/liblzmadec/main.c Sun Jul 2 15:56:00 2006
@@ -227,9 +227,9 @@ lzmadec_header_uncompressed (uint_fast64
{
/* 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)
@@ -253,6 +253,7 @@ lzmadec_internal_init (lzmadec_stream *s
{
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
@@ -285,7 +286,7 @@ lzmadec_internal_init (lzmadec_stream *s
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)));
@@ -668,8 +669,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);