Skip to content

Commit

Permalink
Updated internal XZ Utils liblzma version to 5.0.3.
Browse files Browse the repository at this point in the history
  • Loading branch information
kratz00 committed Feb 5, 2012
1 parent 0174ac9 commit ba6c7b2
Show file tree
Hide file tree
Showing 20 changed files with 61 additions and 25 deletions.
2 changes: 1 addition & 1 deletion liblzma/README.txt
Expand Up @@ -3,7 +3,7 @@ This is the source code to liblzma from XZ Utils:

http://tukaani.org/xz/

This is a snapshot of the xz-5.0.0 release. Changes I've made to it are
This is a snapshot of the xz-5.0.3 release. Changes I've made to it are
wrapped in #if __MOJOSETUP__ blocks. I've tried to agressively delete files
we don't use at all, too.

Expand Down
1 change: 1 addition & 0 deletions liblzma/api/lzma/block.h
Expand Up @@ -483,6 +483,7 @@ extern LZMA_API(size_t) lzma_block_buffer_bound(size_t uncompressed_size)
*
* \return - LZMA_OK: Encoding was successful.
* - LZMA_BUF_ERROR: Not enough output buffer space.
* - LZMA_UNSUPPORTED_CHECK
* - LZMA_OPTIONS_ERROR
* - LZMA_MEM_ERROR
* - LZMA_DATA_ERROR
Expand Down
12 changes: 12 additions & 0 deletions liblzma/api/lzma/container.h
Expand Up @@ -66,6 +66,10 @@
* This function is a wrapper for lzma_raw_encoder_memusage().
*
* \param preset Compression preset (level and possible flags)
*
* \return Number of bytes of memory required for the given
* preset when encoding. If an error occurs, for example
* due to unsupported preset, UINT64_MAX is returned.
*/
extern LZMA_API(uint64_t) lzma_easy_encoder_memusage(uint32_t preset)
lzma_nothrow lzma_attr_pure;
Expand All @@ -77,6 +81,11 @@ extern LZMA_API(uint64_t) lzma_easy_encoder_memusage(uint32_t preset)
* This function is a wrapper for lzma_raw_decoder_memusage().
*
* \param preset Compression preset (level and possible flags)
*
* \return Number of bytes of memory required to decompress a file
* that was compressed using the given preset. If an error
* occurs, for example due to unsupported preset, UINT64_MAX
* is returned.
*/
extern LZMA_API(uint64_t) lzma_easy_decoder_memusage(uint32_t preset)
lzma_nothrow lzma_attr_pure;
Expand Down Expand Up @@ -148,6 +157,7 @@ extern LZMA_API(lzma_ret) lzma_easy_encoder(
*
* \return - LZMA_OK: Encoding was successful.
* - LZMA_BUF_ERROR: Not enough output buffer space.
* - LZMA_UNSUPPORTED_CHECK
* - LZMA_OPTIONS_ERROR
* - LZMA_MEM_ERROR
* - LZMA_DATA_ERROR
Expand All @@ -171,6 +181,7 @@ extern LZMA_API(lzma_ret) lzma_easy_buffer_encode(
*
* \return - LZMA_OK: Initialization was successful.
* - LZMA_MEM_ERROR
* - LZMA_UNSUPPORTED_CHECK
* - LZMA_OPTIONS_ERROR
* - LZMA_PROG_ERROR
*/
Expand Down Expand Up @@ -250,6 +261,7 @@ extern LZMA_API(size_t) lzma_stream_buffer_bound(size_t uncompressed_size)
*
* \return - LZMA_OK: Encoding was successful.
* - LZMA_BUF_ERROR: Not enough output buffer space.
* - LZMA_UNSUPPORTED_CHECK
* - LZMA_OPTIONS_ERROR
* - LZMA_MEM_ERROR
* - LZMA_DATA_ERROR
Expand Down
8 changes: 6 additions & 2 deletions liblzma/api/lzma/filter.h
Expand Up @@ -131,7 +131,9 @@ extern LZMA_API(lzma_ret) lzma_filters_copy(const lzma_filter *src,
* .id == LZMA_VLI_UNKNOWN.
*
* \return Number of bytes of memory required for the given
* filter chain when encoding.
* filter chain when encoding. If an error occurs,
* for example due to unsupported filter chain,
* UINT64_MAX is returned.
*/
extern LZMA_API(uint64_t) lzma_raw_encoder_memusage(const lzma_filter *filters)
lzma_nothrow lzma_attr_pure;
Expand All @@ -148,7 +150,9 @@ extern LZMA_API(uint64_t) lzma_raw_encoder_memusage(const lzma_filter *filters)
* .id == LZMA_VLI_UNKNOWN.
*
* \return Number of bytes of memory required for the given
* filter chain when decoding.
* filter chain when decoding. If an error occurs,
* for example due to unsupported filter chain,
* UINT64_MAX is returned.
*/
extern LZMA_API(uint64_t) lzma_raw_decoder_memusage(const lzma_filter *filters)
lzma_nothrow lzma_attr_pure;
Expand Down
3 changes: 3 additions & 0 deletions liblzma/api/lzma/lzma.h
Expand Up @@ -412,6 +412,9 @@ typedef struct {
*
* This function is available only if LZMA1 or LZMA2 encoder has been enabled
* when building liblzma.
*
* \return On success, false is returned. If the preset is not
* supported, true is returned.
*/
extern LZMA_API(lzma_bool) lzma_lzma_preset(
lzma_options_lzma *options, uint32_t preset) lzma_nothrow;
2 changes: 1 addition & 1 deletion liblzma/api/lzma/version.h
Expand Up @@ -22,7 +22,7 @@
*/
#define LZMA_VERSION_MAJOR 5
#define LZMA_VERSION_MINOR 0
#define LZMA_VERSION_PATCH 0
#define LZMA_VERSION_PATCH 3
#define LZMA_VERSION_STABILITY LZMA_VERSION_STABILITY_STABLE

#ifndef LZMA_VERSION_COMMIT
Expand Down
2 changes: 1 addition & 1 deletion liblzma/common/alone_decoder.c
Expand Up @@ -46,7 +46,7 @@ struct lzma_coder_s {

static lzma_ret
alone_decode(lzma_coder *coder,
lzma_allocator *allocator lzma_attribute((unused)),
lzma_allocator *allocator lzma_attribute((__unused__)),
const uint8_t *restrict in, size_t *restrict in_pos,
size_t in_size, uint8_t *restrict out,
size_t *restrict out_pos, size_t out_size,
Expand Down
2 changes: 1 addition & 1 deletion liblzma/common/common.c
Expand Up @@ -35,7 +35,7 @@ lzma_version_string(void)
// Memory allocation //
///////////////////////

extern void * lzma_attribute((malloc))
extern void * lzma_attribute((__malloc__)) lzma_attr_alloc_size(1)
lzma_alloc(size_t size, lzma_allocator *allocator)
{
// Some malloc() variants return NULL if called with size == 0.
Expand Down
2 changes: 1 addition & 1 deletion liblzma/common/common.h
Expand Up @@ -217,7 +217,7 @@ struct lzma_internal_s {

/// Allocates memory
extern void *lzma_alloc(size_t size, lzma_allocator *allocator)
lzma_attribute((malloc));
lzma_attribute((__malloc__)) lzma_attr_alloc_size(1);

/// Frees memory
extern void lzma_free(void *ptr, lzma_allocator *allocator);
Expand Down
6 changes: 3 additions & 3 deletions liblzma/common/filter_common.c
Expand Up @@ -43,7 +43,7 @@ static const struct {
.changes_size = true,
},
#endif
#ifdef HAVE_DECODER_LZMA2
#if defined(HAVE_ENCODER_LZMA2) || defined(HAVE_DECODER_LZMA2)
{
.id = LZMA_FILTER_LZMA2,
.options_size = sizeof(lzma_options_lzma),
Expand All @@ -52,7 +52,7 @@ static const struct {
.changes_size = true,
},
#endif
#ifdef HAVE_DECODER_X86
#if defined(HAVE_ENCODER_X86) || defined(HAVE_DECODER_X86)
{
.id = LZMA_FILTER_X86,
.options_size = sizeof(lzma_options_bcj),
Expand All @@ -70,7 +70,7 @@ static const struct {
.changes_size = false,
},
#endif
#ifdef HAVE_DECODER_IA64
#if defined(HAVE_ENCODER_IA64) || defined(HAVE_DECODER_IA64)
{
.id = LZMA_FILTER_IA64,
.options_size = sizeof(lzma_options_bcj),
Expand Down
9 changes: 5 additions & 4 deletions liblzma/common/index_decoder.c
Expand Up @@ -56,10 +56,11 @@ struct lzma_coder_s {
static lzma_ret
index_decode(lzma_coder *coder, lzma_allocator *allocator,
const uint8_t *restrict in, size_t *restrict in_pos,
size_t in_size, uint8_t *restrict out lzma_attribute((unused)),
size_t *restrict out_pos lzma_attribute((unused)),
size_t out_size lzma_attribute((unused)),
lzma_action action lzma_attribute((unused)))
size_t in_size,
uint8_t *restrict out lzma_attribute((__unused__)),
size_t *restrict out_pos lzma_attribute((__unused__)),
size_t out_size lzma_attribute((__unused__)),
lzma_action action lzma_attribute((__unused__)))
{
// Similar optimization as in index_encoder.c
const size_t in_start = *in_pos;
Expand Down
15 changes: 15 additions & 0 deletions liblzma/common/sysdefs.h
Expand Up @@ -75,6 +75,9 @@
#ifndef PRIu32
# define PRIu32 "u"
#endif
#ifndef PRIx32
# define PRIx32 "x"
#endif
#ifndef PRIX32
# define PRIX32 "X"
#endif
Expand All @@ -86,6 +89,9 @@
# ifndef PRIu64
# define PRIu64 "llu"
# endif
# ifndef PRIx64
# define PRIx64 "llx"
# endif
# ifndef PRIX64
# define PRIX64 "llX"
# endif
Expand All @@ -96,6 +102,9 @@
# ifndef PRIu64
# define PRIu64 "lu"
# endif
# ifndef PRIx64
# define PRIx64 "lx"
# endif
# ifndef PRIX64
# define PRIX64 "lX"
# endif
Expand Down Expand Up @@ -181,4 +190,10 @@ typedef unsigned char _Bool;
# define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
#endif

#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) || __GNUC__ > 4
# define lzma_attr_alloc_size(x) __attribute__((__alloc_size__(x)))
#else
# define lzma_attr_alloc_size(x)
#endif

#endif
2 changes: 1 addition & 1 deletion liblzma/lz/lz_decoder.c
Expand Up @@ -126,7 +126,7 @@ decode_buffer(lzma_coder *coder,

static lzma_ret
lz_decode(lzma_coder *coder,
lzma_allocator *allocator lzma_attribute((unused)),
lzma_allocator *allocator lzma_attribute((__unused__)),
const uint8_t *restrict in, size_t *restrict in_pos,
size_t in_size, uint8_t *restrict out,
size_t *restrict out_pos, size_t out_size,
Expand Down
8 changes: 4 additions & 4 deletions liblzma/lzma/lzma2_decoder.c
Expand Up @@ -67,6 +67,10 @@ lzma2_decode(lzma_coder *restrict coder, lzma_dict *restrict dict,
const uint32_t control = in[*in_pos];
++*in_pos;

// End marker
if (control == 0x00)
return LZMA_STREAM_END;

if (control >= 0xE0 || control == 1) {
// Dictionary reset implies that next LZMA chunk has
// to set new properties.
Expand Down Expand Up @@ -104,10 +108,6 @@ lzma2_decode(lzma_coder *restrict coder, lzma_dict *restrict dict,
&coder->options);
}
} else {
// End marker
if (control == 0x00)
return LZMA_STREAM_END;

// Invalid control values
if (control > 2)
return LZMA_DATA_ERROR;
Expand Down
2 changes: 1 addition & 1 deletion liblzma/simple/arm.c
Expand Up @@ -15,7 +15,7 @@


static size_t
arm_code(lzma_simple *simple lzma_attribute((unused)),
arm_code(lzma_simple *simple lzma_attribute((__unused__)),
uint32_t now_pos, bool is_encoder,
uint8_t *buffer, size_t size)
{
Expand Down
2 changes: 1 addition & 1 deletion liblzma/simple/armthumb.c
Expand Up @@ -15,7 +15,7 @@


static size_t
armthumb_code(lzma_simple *simple lzma_attribute((unused)),
armthumb_code(lzma_simple *simple lzma_attribute((__unused__)),
uint32_t now_pos, bool is_encoder,
uint8_t *buffer, size_t size)
{
Expand Down
2 changes: 1 addition & 1 deletion liblzma/simple/ia64.c
Expand Up @@ -15,7 +15,7 @@


static size_t
ia64_code(lzma_simple *simple lzma_attribute((unused)),
ia64_code(lzma_simple *simple lzma_attribute((__unused__)),
uint32_t now_pos, bool is_encoder,
uint8_t *buffer, size_t size)
{
Expand Down
2 changes: 1 addition & 1 deletion liblzma/simple/powerpc.c
Expand Up @@ -15,7 +15,7 @@


static size_t
powerpc_code(lzma_simple *simple lzma_attribute((unused)),
powerpc_code(lzma_simple *simple lzma_attribute((__unused__)),
uint32_t now_pos, bool is_encoder,
uint8_t *buffer, size_t size)
{
Expand Down
2 changes: 1 addition & 1 deletion liblzma/simple/simple_coder.c
Expand Up @@ -212,7 +212,7 @@ simple_coder_end(lzma_coder *coder, lzma_allocator *allocator)

static lzma_ret
simple_coder_update(lzma_coder *coder, lzma_allocator *allocator,
const lzma_filter *filters_null lzma_attribute((unused)),
const lzma_filter *filters_null lzma_attribute((__unused__)),
const lzma_filter *reversed_filters)
{
// No update support, just call the next filter in the chain.
Expand Down
2 changes: 1 addition & 1 deletion liblzma/simple/sparc.c
Expand Up @@ -15,7 +15,7 @@


static size_t
sparc_code(lzma_simple *simple lzma_attribute((unused)),
sparc_code(lzma_simple *simple lzma_attribute((__unused__)),
uint32_t now_pos, bool is_encoder,
uint8_t *buffer, size_t size)
{
Expand Down

0 comments on commit ba6c7b2

Please sign in to comment.