]> wimlib.net Git - wimlib/blob - src/compress_chunk.c
0f8b6c454c89445e1a9980a00d58a0322d0aaf57
[wimlib] / src / compress_chunk.c
1 #ifdef HAVE_CONFIG_H
2 #  include "config.h"
3 #endif
4
5 #include "wimlib.h"
6 #include "wimlib/compress_chunks.h"
7 #include "wimlib/error.h"
8 #include "wimlib/assert.h"
9
10 unsigned
11 compress_chunk(const void * uncompressed_data,
12                unsigned uncompressed_len,
13                void *compressed_data,
14                int out_ctype,
15                struct wimlib_lzx_context *comp_ctx)
16 {
17         switch (out_ctype) {
18         case WIMLIB_COMPRESSION_TYPE_XPRESS:
19                 return wimlib_xpress_compress(uncompressed_data,
20                                               uncompressed_len,
21                                               compressed_data);
22         case WIMLIB_COMPRESSION_TYPE_LZX:
23                 return wimlib_lzx_compress2(uncompressed_data,
24                                             uncompressed_len,
25                                             compressed_data,
26                                             comp_ctx);
27         case WIMLIB_COMPRESSION_TYPE_LZMS:
28                 WARNING("LZMS compression not implemented!  Writing uncompressed data.");
29                 return 0;
30
31         default:
32                 wimlib_assert(0);
33                 WARNING("Unknown compression type!");
34                 return 0;
35         }
36 }