summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Volovich <vvv@vsu.ru>2008-05-10 21:50:29 +0000
committerVladimir Volovich <vvv@vsu.ru>2008-05-10 21:50:29 +0000
commit6d0fb1d4f30a6342f6c0f891719046d64f3e12de (patch)
tree9ba5019c5d00cf41f88fb6913f923cd40e54594c
parented878915b3d49329ed1128f13893495a8c9186c2 (diff)
portability fixes for lzma-utils: variable declarations in main.c and
allow to redefine _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS in lzma/gettext.h (for getopt.c) on systems which don't support variable size arrays. sent upstream to Lasse Collin <lasse.collin@tukaani.org>, and accepted by him git-svn-id: svn://tug.org/texlive/trunk@8033 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Build/source/utils/lzma-utils/src/liblzmadec/main.c7
-rw-r--r--Build/source/utils/lzma-utils/src/lzma/gettext.h2
2 files changed, 6 insertions, 3 deletions
diff --git a/Build/source/utils/lzma-utils/src/liblzmadec/main.c b/Build/source/utils/lzma-utils/src/liblzmadec/main.c
index 26f0772b6a6..2288e933ff5 100644
--- a/Build/source/utils/lzma-utils/src/liblzmadec/main.c
+++ b/Build/source/utils/lzma-utils/src/liblzmadec/main.c
@@ -231,11 +231,11 @@ static void
lzmadec_header_uncompressed (uint_fast64_t *size, uint_fast8_t *is_streamed,
const uint8_t *buffer)
{
+ uint_fast32_t i;
/* Streamed files have all 64 bits set in the size field.
We don't know the uncompressed size beforehand. */
*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);
diff --git a/Build/source/utils/lzma-utils/src/lzma/gettext.h b/Build/source/utils/lzma-utils/src/lzma/gettext.h
index b6282e54c8a..89fff807bb0 100644
--- a/Build/source/utils/lzma-utils/src/lzma/gettext.h
+++ b/Build/source/utils/lzma-utils/src/lzma/gettext.h
@@ -154,7 +154,9 @@ npgettext_aux (const char *domain,
#include <string.h>
+#ifndef _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
#define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 1
+#endif
#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
#include <stdlib.h>