Lines Matching +full:src +full:- +full:2

4  *  Copyright (C) 1996-2005 Markus F.X.J. Oberhumer <markus@oberhumer.com>
20 #define HAVE_IP(x, ip_end, ip) ((size_t)(ip_end - ip) < (x))
21 #define HAVE_OP(x, op_end, op) ((size_t)(op_end - op) < (x))
24 #define COPY4(dst, src) \ argument
25 put_unaligned(get_unaligned((const u32 *)(src)), (u32 *)(dst))
34 bool lzop_is_valid_header(const unsigned char *src) in lzop_is_valid_header() argument
39 if (*src++ != lzop_magic[i]) in lzop_is_valid_header()
45 static inline const unsigned char *parse_header(const unsigned char *src) in parse_header() argument
50 if (!lzop_is_valid_header(src)) in parse_header()
54 src += 9; in parse_header()
56 /* get version (2bytes), skip library version (2), in parse_header()
57 * 'need to be extracted' version (2) and in parse_header()
59 version = get_unaligned_be16(src); in parse_header()
60 src += 7; in parse_header()
62 src++; in parse_header()
63 if (get_unaligned_be32(src) & HEADER_HAS_FILTER) in parse_header()
64 src += 4; /* filter info */ in parse_header()
67 src += 12; in parse_header()
69 src += 4; /* skip mtime_high */ in parse_header()
71 i = *src++; in parse_header()
73 src += i + 4; in parse_header()
75 return src; in parse_header()
78 int lzop_decompress(const unsigned char *src, size_t src_len, in lzop_decompress() argument
82 const unsigned char *send = src + src_len; in lzop_decompress()
87 src = parse_header(src); in lzop_decompress()
88 if (!src) in lzop_decompress()
92 while (src < send) { in lzop_decompress()
94 dlen = get_unaligned_be32(src); in lzop_decompress()
95 src += 4; in lzop_decompress()
99 *dst_len = dst - start; in lzop_decompress()
104 slen = get_unaligned_be32(src); in lzop_decompress()
105 src += 8; in lzop_decompress()
118 memcpy(dst, src, slen); in lzop_decompress()
122 r = lzo1x_decompress_safe((u8 *)src, slen, dst, &tmp); in lzop_decompress()
125 *dst_len = dst - start; in lzop_decompress()
133 src += slen; in lzop_decompress()
135 remaining -= dlen; in lzop_decompress()
153 t = *ip++ - 17; in lzo1x_decompress_safe()
162 } while (--t > 0); in lzo1x_decompress_safe()
189 if (--t > 0) { in lzo1x_decompress_safe()
195 t -= 4; in lzo1x_decompress_safe()
200 } while (--t > 0); in lzo1x_decompress_safe()
205 } while (--t > 0); in lzo1x_decompress_safe()
213 m_pos = op - (1 + M2_MAX_OFFSET); in lzo1x_decompress_safe()
214 m_pos -= t >> 2; in lzo1x_decompress_safe()
215 m_pos -= *ip++ << 2; in lzo1x_decompress_safe()
231 m_pos = op - 1; in lzo1x_decompress_safe()
232 m_pos -= (t >> 2) & 7; in lzo1x_decompress_safe()
233 m_pos -= *ip++ << 3; in lzo1x_decompress_safe()
234 t = (t >> 5) - 1; in lzo1x_decompress_safe()
237 if (HAVE_OP(t + 3 - 1, op_end, op)) in lzo1x_decompress_safe()
253 m_pos = op - 1; in lzo1x_decompress_safe()
254 m_pos -= get_unaligned_le16(ip) >> 2; in lzo1x_decompress_safe()
255 ip += 2; in lzo1x_decompress_safe()
258 m_pos -= (t & 8) << 11; in lzo1x_decompress_safe()
272 m_pos -= get_unaligned_le16(ip) >> 2; in lzo1x_decompress_safe()
273 ip += 2; in lzo1x_decompress_safe()
276 m_pos -= 0x4000; in lzo1x_decompress_safe()
278 m_pos = op - 1; in lzo1x_decompress_safe()
279 m_pos -= t >> 2; in lzo1x_decompress_safe()
280 m_pos -= *ip++ << 2; in lzo1x_decompress_safe()
284 if (HAVE_OP(2, op_end, op)) in lzo1x_decompress_safe()
294 if (HAVE_OP(t + 3 - 1, op_end, op)) in lzo1x_decompress_safe()
297 if (t >= 2 * 4 - (3 - 1) && (op - m_pos) >= 4) { in lzo1x_decompress_safe()
301 t -= 4 - (3 - 1); in lzo1x_decompress_safe()
306 t -= 4; in lzo1x_decompress_safe()
311 } while (--t > 0); in lzo1x_decompress_safe()
318 } while (--t > 0); in lzo1x_decompress_safe()
321 t = ip[-2] & 3; in lzo1x_decompress_safe()
333 if (t > 2) in lzo1x_decompress_safe()
341 *out_len = op - out; in lzo1x_decompress_safe()
345 *out_len = op - out; in lzo1x_decompress_safe()
349 *out_len = op - out; in lzo1x_decompress_safe()
353 *out_len = op - out; in lzo1x_decompress_safe()
357 *out_len = op - out; in lzo1x_decompress_safe()