4 * Dummy "match-finder" for Lempel-Ziv compression.
6 * Copyright (c) 2014 Eric Biggers. All rights reserved.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE
23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
26 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
28 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
29 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 #include "wimlib/lz_mf.h"
39 lz_null_params_valid(const struct lz_mf_params *_params)
45 lz_null_get_needed_memory(u32 max_window_size)
51 lz_null_init(struct lz_mf *mf)
53 if (mf->params.min_match_len == 0)
54 mf->params.min_match_len = 2;
56 if (mf->params.max_match_len == 0)
57 mf->params.max_match_len = mf->params.max_window_size;
63 lz_null_load_window(struct lz_mf *mf, const u8 window[], u32 size)
68 lz_null_get_matches(struct lz_mf *mf, struct lz_match matches[])
75 lz_null_skip_positions(struct lz_mf *mf, u32 n)
77 mf->cur_window_pos += n;
81 lz_null_destroy(struct lz_mf *mf)
85 const struct lz_mf_ops lz_null_ops = {
86 .params_valid = lz_null_params_valid,
87 .get_needed_memory = lz_null_get_needed_memory,
89 .load_window = lz_null_load_window,
90 .get_matches = lz_null_get_matches,
91 .skip_positions = lz_null_skip_positions,
92 .destroy = lz_null_destroy,
93 .struct_size = sizeof(struct lz_mf),