summaryrefslogtreecommitdiffstats
path: root/depends/lzma/include/decompress.h
blob: cb10b2ba55589fff0c5a6390088423f2ef683ad5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
 * Written in 2009 by Lloyd Hilaiel
 *
 * License
 *
 * All the cruft you find here is public domain.  You don't have to credit
 * anyone to use this code, but my personal request is that you mention
 * Igor Pavlov for his hard, high quality work.
 *
 * easylzma/decompress.h - The API for LZMA decompression using easylzma
 */

#pragma once

#include "include/common.h"

#ifdef __cplusplus
extern "C" {
#endif

/** an opaque handle to an lzma decompressor */
typedef struct _elzma_decompress_handle *elzma_decompress_handle;

/**
 * Allocate a handle to an LZMA decompressor object.
 */
elzma_decompress_handle EASYLZMA_API elzma_decompress_alloc();

/**
 * set allocation routines (optional, if not called malloc & free will
 * be used)
 */
void EASYLZMA_API
elzma_decompress_set_allocation_callbacks(elzma_decompress_handle hand, elzma_malloc mallocFunc,
										  void *mallocFuncContext, elzma_free freeFunc,
										  void *freeFuncContext);

/**
 * Free all data associated with an LZMA decompressor object.
 */
void EASYLZMA_API elzma_decompress_free(elzma_decompress_handle *hand);

/**
 * Perform decompression
 *
 * XXX: should the library automatically detect format by reading stream?
 *      currently it's based on data external to stream (such as extension
 *      or convention)
 */
int EASYLZMA_API elzma_decompress_run(elzma_decompress_handle hand,
									  elzma_read_callback inputStream, void *inputContext,
									  elzma_write_callback outputStream, void *outputContext,
									  elzma_file_format format);

#ifdef __cplusplus
}
;
#endif