RPM Package Manager, CVS Repository http://rpm5.org/cvs/ ____________________________________________________________________________
Server: rpm5.org Name: Anders F. Björklund Root: /v/rpm/cvs Email: [EMAIL PROTECTED] Module: xar Date: 19-Jun-2008 12:39:17 Branch: HEAD Handle: 2008061910391700 Modified files: xar/lib lzmaxar.c Log: make xar compile with newer liblzma (doesn't work yet though) Summary: Revision Changes Path 1.5 +22 -1 xar/lib/lzmaxar.c ____________________________________________________________________________ patch -p0 <<'@@ .' Index: xar/lib/lzmaxar.c ============================================================================ $ cvs diff -u -r1.4 -r1.5 lzmaxar.c --- xar/lib/lzmaxar.c 9 Dec 2007 21:24:37 -0000 1.4 +++ xar/lib/lzmaxar.c 19 Jun 2008 10:39:17 -0000 1.5 @@ -54,12 +54,23 @@ #ifdef HAVE_LIBLZMA +#ifndef UINT32_C +#define UINT32_C(v) (v ## U) /* from <stdint.h> normally */ +#endif +#ifndef LZMA_VERSION +#define LZMA_VERSION UINT32_C(40420000) /* = 4.42.0alpha6 */ +#endif + struct _lzma_context{ uint8_t lzmacompressed; lzma_stream lzma; lzma_options_stream options; lzma_allocator allocator; +#if LZMA_VERSION < 40420010U lzma_memory_limitter *limit; +#else + lzma_memlimit *limit; +#endif }; #define preset_level 7 @@ -165,7 +176,11 @@ if( LZMA_CONTEXT(context)->lzmacompressed){ lzma_end(&LZMA_CONTEXT(context)->lzma); +#if LZMA_VERSION < 40420010U lzma_memory_limitter_end(LZMA_CONTEXT(context)->limit, 1); +#else + lzma_memlimit_end(LZMA_CONTEXT(context)->limit, 1); +#endif tmpp = xar_prop_pset(f, p, "encoding", NULL); if( tmpp ) @@ -227,10 +242,16 @@ /* Terminate the filter options array. */ LZMA_CONTEXT(context)->options.filters[2].id = UINT64_MAX; LZMA_CONTEXT(context)->lzma = LZMA_STREAM_INIT_VAR; +#if LZMA_VERSION < 40420010U LZMA_CONTEXT(context)->limit = lzma_memory_limitter_create(memory_limit); - LZMA_CONTEXT(context)->allocator.opaque = LZMA_CONTEXT(context)->limit; LZMA_CONTEXT(context)->allocator.alloc = (void*) lzma_memory_alloc; LZMA_CONTEXT(context)->allocator.free = (void*) lzma_memory_free; +#else + LZMA_CONTEXT(context)->limit = lzma_memlimit_create(memory_limit); + LZMA_CONTEXT(context)->allocator.alloc = (void*) lzma_memlimit_alloc; + LZMA_CONTEXT(context)->allocator.free = (void*) lzma_memlimit_free; +#endif + LZMA_CONTEXT(context)->allocator.opaque = LZMA_CONTEXT(context)->limit; LZMA_CONTEXT(context)->lzma.allocator = &LZMA_CONTEXT(context)->allocator; r = lzma_stream_encoder_single(&LZMA_CONTEXT(context)->lzma, &(LZMA_CONTEXT(context)->options)); if( (r != LZMA_OK) ) { @@ . ______________________________________________________________________ RPM Package Manager http://rpm5.org CVS Sources Repository rpm-cvs@rpm5.org