2 * compression handling for cbfstool
4 * Copyright (C) 2009 coresystems GmbH
5 * written by Patrick Georgi <patrick.georgi@coresystems.de>
8 * Copyright (C) 2008 Jordan Crouse <jordan@cosmicpenguin.net>, released
9 * under identical license terms
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; version 2 of the License.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
29 extern void do_lzma_compress(char *in, int in_len, char *out, int *out_len);
31 void lzma_compress(char *in, int in_len, char *out, int *out_len)
33 do_lzma_compress(in, in_len, out, out_len);
36 void none_compress(char *in, int in_len, char *out, int *out_len)
38 memcpy(out, in, in_len);
42 comp_func_ptr compression_function(comp_algo algo)
44 comp_func_ptr compress;
46 case CBFS_COMPRESS_NONE:
47 compress = none_compress;
49 case CBFS_COMPRESS_LZMA:
50 compress = lzma_compress;
53 fprintf(stderr, "E: Unknown compression algorithm %d!\n", algo);