Lines Matching +full:full +full:- +full:length
1 // SPDX-License-Identifier: BSD-2-Clause
3 LZ4 - Fast LZ compression algorithm
4 Copyright (C) 2011-2015, Yann Collet.
7 - LZ4 source repository : https://github.com/Cyan4973/lz4
8 - LZ4 public forum : https://groups.google.com/forum/#!forum/lz4c
41 #define MAX_DISTANCE ((1 << MAXD_LOG) - 1)
44 #define ML_MASK ((1U<<ML_BITS)-1)
45 #define RUN_BITS (8-ML_BITS)
46 #define RUN_MASK ((1U<<RUN_BITS)-1)
54 typedef enum { full = 0, partial = 1 } earlyEnd_directive; enumerator
74 int partialDecoding, /* full, partial */ in LZ4_decompress_generic()
90 const BYTE* const lowLimit = lowPrefix - dictSize; in LZ4_decompress_generic()
94 const size_t dec64table[] = {0, 0, 0, (size_t)-1, 0, 1, 2, 3}; in LZ4_decompress_generic()
101 …if ((partialDecoding) && (oexit> oend-MFLIMIT)) oexit = oend-MFLIMIT; /* t… in LZ4_decompress_generic()
102 …if ((endOnInput) && (unlikely(outputSize==0))) return ((inputSize==1) && (*ip==0)) ? 0 : -1; /* E… in LZ4_decompress_generic()
103 if ((!endOnInput) && (unlikely(outputSize==0))) return (*ip==0?1:-1); in LZ4_decompress_generic()
110 size_t length; in LZ4_decompress_generic() local
113 /* get literal length */ in LZ4_decompress_generic()
115 if ((length=(token>>ML_BITS)) == RUN_MASK) in LZ4_decompress_generic()
121 length += s; in LZ4_decompress_generic()
123 while (likely((endOnInput)?ip<iend-RUN_MASK:1) && (s==255)); in LZ4_decompress_generic()
124 …if ((safeDecode) && unlikely((size_t)(op+length)<(size_t)(op))) goto _output_error; /* overflow … in LZ4_decompress_generic()
125 …if ((safeDecode) && unlikely((size_t)(ip+length)<(size_t)(ip))) goto _output_error; /* overflow … in LZ4_decompress_generic()
129 cpy = op+length; in LZ4_decompress_generic()
130 …if (((endOnInput) && ((cpy>(partialDecoding?oexit:oend-MFLIMIT)) || (ip+length>iend-(2+1+LASTLITER… in LZ4_decompress_generic()
131 || ((!endOnInput) && (cpy>oend-COPYLENGTH))) in LZ4_decompress_generic()
136 …if ((endOnInput) && (ip+length > iend)) goto _output_error; /* Error : read attempt beyond end o… in LZ4_decompress_generic()
141 …if ((endOnInput) && ((ip+length != iend) || (cpy > oend))) goto _output_error; /* Error : input … in LZ4_decompress_generic()
143 memcpy(op, ip, length); in LZ4_decompress_generic()
144 ip += length; in LZ4_decompress_generic()
145 op += length; in LZ4_decompress_generic()
149 ip += length; op = cpy; in LZ4_decompress_generic()
152 match = cpy - LZ4_readLE16(ip); ip+=2; in LZ4_decompress_generic()
156 length = token & ML_MASK; in LZ4_decompress_generic()
157 if (length == ML_MASK) in LZ4_decompress_generic()
162 if ((endOnInput) && (ip > iend-LASTLITERALS)) goto _output_error; in LZ4_decompress_generic()
164 length += s; in LZ4_decompress_generic()
166 …if ((safeDecode) && unlikely((size_t)(op+length)<(size_t)op)) goto _output_error; /* overflow de… in LZ4_decompress_generic()
168 length += MINMATCH; in LZ4_decompress_generic()
173 …if (unlikely(op+length > oend-LASTLITERALS)) goto _output_error; /* doesn't respect parsing rest… in LZ4_decompress_generic()
175 if (length <= (size_t)(lowPrefix-match)) in LZ4_decompress_generic()
178 match = dictEnd - (lowPrefix-match); in LZ4_decompress_generic()
179 memmove(op, match, length); op += length; in LZ4_decompress_generic()
184 size_t copySize = (size_t)(lowPrefix-match); in LZ4_decompress_generic()
185 memcpy(op, dictEnd - copySize, copySize); in LZ4_decompress_generic()
187 copySize = length - copySize; in LZ4_decompress_generic()
188 if (copySize > (size_t)(op-lowPrefix)) /* overlap within current segment */ in LZ4_decompress_generic()
204 cpy = op + length; in LZ4_decompress_generic()
205 if (unlikely((op-match)<8)) in LZ4_decompress_generic()
207 const size_t dec64 = dec64table[op-match]; in LZ4_decompress_generic()
212 match += dec32table[op-match]; in LZ4_decompress_generic()
214 op += 8; match -= dec64; in LZ4_decompress_generic()
217 if (unlikely(cpy>oend-12)) in LZ4_decompress_generic()
219 …if (cpy > oend-LASTLITERALS) goto _output_error; /* Error : last LASTLITERALS bytes must be lit… in LZ4_decompress_generic()
220 if (op < oend-8) in LZ4_decompress_generic()
222 LZ4_wildCopy(op, match, oend-8); in LZ4_decompress_generic()
223 match += (oend-8) - op; in LZ4_decompress_generic()
224 op = oend-8; in LZ4_decompress_generic()
235 return (int) (((char*)op)-dest); /* Nb of output bytes decoded */ in LZ4_decompress_generic()
237 return (int) (((const char*)ip)-source); /* Nb of input bytes read */ in LZ4_decompress_generic()
241 return (int) (-(((const char*)ip)-source))-1; in LZ4_decompress_generic()