25 #define COMPRESSION_LEVEL 6
28 #define COMPRESSION_EXTREME true
31 #define INTEGRITY_CHECK LZMA_CHECK_CRC64
35 #define IN_BUF_MAX 4096
36 #define OUT_BUF_MAX 4096
40 #define RET_ERROR_INIT 1
41 #define RET_ERROR_INPUT 2
42 #define RET_ERROR_OUTPUT 3
43 #define RET_ERROR_COMPRESSION 4
56 bool in_finished =
false;
57 bool out_finished =
false;
67 fprintf (stderr,
"lzma_easy_encoder error: %d\n", (
int) ret_xz);
71 while ((! in_finished) && (! out_finished)) {
78 if (ferror (in_file)) {
101 fprintf (stderr,
"lzma_code error: %d\n", (
int) ret_xz);
107 fwrite (
out_buf, 1, out_len, out_file);
108 if (ferror (out_file)) {
lzma_check
Type of the integrity check (Check ID)
static io_buf in_buf
Input and output buffers.
#define LZMA_PRESET_EXTREME
Extreme compression preset.
The public API of liblzma data compression library.
Passing data to and from liblzma.
lzma_ret
Return values used by several functions in liblzma.
@ LZMA_STREAM_END
End of stream was reached.
@ LZMA_OK
Operation completed successfully.
lzma_action
The ‘action’ argument for lzma_code()
@ LZMA_FINISH
Finish the coding operation.
@ LZMA_RUN
Continue coding.
#define LZMA_STREAM_INIT
Initialization for lzma_stream.
int xz_compress(FILE *in_file, FILE *out_file)
#define COMPRESSION_LEVEL
#define COMPRESSION_EXTREME
#define RET_ERROR_COMPRESSION