diff options
Diffstat (limited to 'util/cbfstool/compress.c')
-rw-r--r-- | util/cbfstool/compress.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/util/cbfstool/compress.c b/util/cbfstool/compress.c index ab94b35329..2bde7df96a 100644 --- a/util/cbfstool/compress.c +++ b/util/cbfstool/compress.c @@ -31,6 +31,10 @@ static int lzma_compress(char *in, int in_len, char *out, int *out_len) return do_lzma_compress(in, in_len, out, out_len); } +static int lzma_decompress(char *in, int in_len, char *out, unused int out_len) +{ + return do_lzma_uncompress(out, out_len, in, in_len); +} static int none_compress(char *in, int in_len, char *out, int *out_len) { memcpy(out, in, in_len); @@ -38,6 +42,12 @@ static int none_compress(char *in, int in_len, char *out, int *out_len) return 0; } +static int none_decompress(char *in, int in_len, char *out, unused int out_len) +{ + memcpy(out, in, in_len); + return 0; +} + comp_func_ptr compression_function(enum comp_algo algo) { comp_func_ptr compress; @@ -54,3 +64,20 @@ comp_func_ptr compression_function(enum comp_algo algo) } return compress; } + +decomp_func_ptr decompression_function(enum comp_algo algo) +{ + decomp_func_ptr decompress; + switch (algo) { + case CBFS_COMPRESS_NONE: + decompress = none_decompress; + break; + case CBFS_COMPRESS_LZMA: + decompress = lzma_decompress; + break; + default: + ERROR("Unknown compression algorithm %d!\n", algo); + return NULL; + } + return decompress; +} |