X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=src%2Fxpress-compress.c;h=6d2836f050e6b3b02f86c3b0b3c6410a2324d292;hb=a3bb2e86f2640f5d593d00250a627d3dcc9747a2;hp=2b3a6a6e9d980a14ce7ca2e6f062b5505c53656a;hpb=c9812a5d413382b81552979b10e5c478b3721316;p=wimlib diff --git a/src/xpress-compress.c b/src/xpress-compress.c index 2b3a6a6e..6d2836f0 100644 --- a/src/xpress-compress.c +++ b/src/xpress-compress.c @@ -7,7 +7,7 @@ */ /* - * Copyright (C) 2012 Eric Biggers + * Copyright (C) 2012, 2013 Eric Biggers * * This file is part of wimlib, a library for working with WIM files. * @@ -36,8 +36,9 @@ * * @codewords and @lens provide the Huffman code that is being used. */ -static int xpress_write_match(struct output_bitstream *ostream, u32 match, - const u16 codewords[], const u8 lens[]) +static int +xpress_write_match(struct output_bitstream *ostream, u32 match, + const u16 codewords[], const u8 lens[]) { u32 adjusted_match_len = match & 0xffff; u32 match_offset = match >> 16; @@ -65,11 +66,12 @@ static int xpress_write_match(struct output_bitstream *ostream, u32 match, match_offset ^ (1 << offset_bsr), offset_bsr); } -static int xpress_write_compressed_literals(struct output_bitstream *ostream, - const u32 match_tab[], - unsigned num_matches, - const u16 codewords[], - const u8 lens[]) +static int +xpress_write_compressed_literals(struct output_bitstream *ostream, + const u32 match_tab[], + unsigned num_matches, + const u16 codewords[], + const u8 lens[]) { for (unsigned i = 0; i < num_matches; i++) { int ret; @@ -88,15 +90,17 @@ static int xpress_write_compressed_literals(struct output_bitstream *ostream, lens[XPRESS_END_OF_DATA]); } -static u32 xpress_record_literal(u8 literal, void *__freq_tab) +static u32 +xpress_record_literal(u8 literal, void *__freq_tab) { - u32 *freq_tab = __freq_tab; + freq_t *freq_tab = __freq_tab; freq_tab[literal]++; return literal; } -static u32 xpress_record_match(unsigned match_offset, unsigned match_len, - void *freq_tab, void *ignore) +static u32 +xpress_record_match(unsigned match_offset, unsigned match_len, + void *freq_tab, void *ignore) { wimlib_assert(match_len >= XPRESS_MIN_MATCH && match_len <= XPRESS_MAX_MATCH); @@ -121,7 +125,7 @@ static u32 xpress_record_match(unsigned match_offset, unsigned match_len, u32 len_hdr = min(adjusted_match_len, 0xf); u32 offset_bsr = bsr32(match_offset); u32 sym = len_hdr | (offset_bsr << 4) | XPRESS_NUM_CHARS; - ((u32*)freq_tab)[sym]++; + ((freq_t*)freq_tab)[sym]++; return adjusted_match_len | (match_offset << 16); } @@ -152,14 +156,15 @@ static const struct lz_params xpress_lz_params = { * not reduce its size, and @compressed_data will not contain the full * compressed data. */ -int xpress_compress(const void *__uncompressed_data, unsigned uncompressed_len, - void *__compressed_data, unsigned *compressed_len_ret) +int +xpress_compress(const void *__uncompressed_data, unsigned uncompressed_len, + void *__compressed_data, unsigned *compressed_len_ret) { const u8 *uncompressed_data = __uncompressed_data; u8 *compressed_data = __compressed_data; struct output_bitstream ostream; u32 match_tab[uncompressed_len]; - u32 freq_tab[XPRESS_NUM_SYMBOLS]; + freq_t freq_tab[XPRESS_NUM_SYMBOLS]; u16 codewords[XPRESS_NUM_SYMBOLS]; u8 lens[XPRESS_NUM_SYMBOLS]; unsigned num_matches;