"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "xdelta3-lzma.h" between
xdelta3-3.0.11.tar.gz and xdelta3-3.1.0.tar.gz

About: xdelta is a tool and library for differential compression (supports VCDIFF encoding and decoding). Beta version.

xdelta3-lzma.h  (xdelta3-3.0.11):xdelta3-lzma.h  (xdelta3-3.1.0)
skipping to change at line 35 skipping to change at line 35
#include <lzma.h> #include <lzma.h>
typedef struct _xd3_lzma_stream xd3_lzma_stream; typedef struct _xd3_lzma_stream xd3_lzma_stream;
struct _xd3_lzma_stream { struct _xd3_lzma_stream {
lzma_stream lzma; lzma_stream lzma;
lzma_options_lzma options; lzma_options_lzma options;
lzma_filter filters[2]; lzma_filter filters[2];
}; };
xd3_sec_stream* static xd3_sec_stream*
xd3_lzma_alloc (xd3_stream *stream) xd3_lzma_alloc (xd3_stream *stream)
{ {
return (xd3_sec_stream*) xd3_alloc (stream, sizeof (xd3_lzma_stream), 1); return (xd3_sec_stream*) xd3_alloc (stream, sizeof (xd3_lzma_stream), 1);
} }
void static void
xd3_lzma_destroy (xd3_stream *stream, xd3_sec_stream *sec_stream) xd3_lzma_destroy (xd3_stream *stream, xd3_sec_stream *sec_stream)
{ {
xd3_lzma_stream *ls = (xd3_lzma_stream*) sec_stream; xd3_lzma_stream *ls = (xd3_lzma_stream*) sec_stream;
lzma_end (&ls->lzma); lzma_end (&ls->lzma);
xd3_free (stream, ls); xd3_free (stream, ls);
} }
int static int
xd3_lzma_init (xd3_stream *stream, xd3_lzma_stream *sec, int is_encode) xd3_lzma_init (xd3_stream *stream, xd3_lzma_stream *sec, int is_encode)
{ {
int ret; int ret;
memset (&sec->lzma, 0, sizeof(sec->lzma)); memset (&sec->lzma, 0, sizeof(sec->lzma));
if (is_encode) if (is_encode)
{ {
int preset = (stream->flags & XD3_COMPLEVEL_MASK) >> XD3_COMPLEVEL_SHIFT; uint32_t preset =
(stream->flags & XD3_COMPLEVEL_MASK) >> XD3_COMPLEVEL_SHIFT;
if (lzma_lzma_preset(&sec->options, preset)) if (lzma_lzma_preset(&sec->options, preset))
{ {
stream->msg = "invalid lzma preset"; stream->msg = "invalid lzma preset";
return XD3_INVALID; return XD3_INVALID;
} }
sec->filters[0].id = LZMA_FILTER_LZMA2; sec->filters[0].id = LZMA_FILTER_LZMA2;
sec->filters[0].options = &sec->options; sec->filters[0].options = &sec->options;
sec->filters[1].id = LZMA_VLI_UNKNOWN; sec->filters[1].id = LZMA_VLI_UNKNOWN;
skipping to change at line 86 skipping to change at line 87
if (ret != LZMA_OK) if (ret != LZMA_OK)
{ {
stream->msg = "lzma stream init failed"; stream->msg = "lzma stream init failed";
return XD3_INTERNAL; return XD3_INTERNAL;
} }
return 0; return 0;
} }
int xd3_decode_lzma (xd3_stream *stream, xd3_lzma_stream *sec, static int xd3_decode_lzma (xd3_stream *stream, xd3_lzma_stream *sec,
const uint8_t **input_pos, const uint8_t **input_pos,
const uint8_t *const input_end, const uint8_t *const input_end,
uint8_t **output_pos, uint8_t **output_pos,
const uint8_t *const output_end) const uint8_t *const output_end)
{ {
uint8_t *output = *output_pos; uint8_t *output = *output_pos;
const uint8_t *input = *input_pos; const uint8_t *input = *input_pos;
size_t avail_in = input_end - input; size_t avail_in = input_end - input;
size_t avail_out = output_end - output; size_t avail_out = output_end - output;
skipping to change at line 127 skipping to change at line 128
default: default:
stream->msg = "lzma decoding error"; stream->msg = "lzma decoding error";
return XD3_INTERNAL; return XD3_INTERNAL;
} }
} }
} }
#if XD3_ENCODER #if XD3_ENCODER
int xd3_encode_lzma (xd3_stream *stream, static int xd3_encode_lzma (xd3_stream *stream,
xd3_lzma_stream *sec, xd3_lzma_stream *sec,
xd3_output *input, xd3_output *input,
xd3_output *output, xd3_output *output,
xd3_sec_cfg *cfg) xd3_sec_cfg *cfg)
{ {
lzma_action action = LZMA_RUN; lzma_action action = LZMA_RUN;
cfg->inefficient = 1; /* Can't skip windows */ cfg->inefficient = 1; /* Can't skip windows */
sec->lzma.next_in = NULL; sec->lzma.next_in = NULL;
 End of changes. 6 change blocks. 
6 lines changed or deleted 7 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS