Lines Matching defs:pctx
131 * This function sets pctx->size and pctx->rel to the length and offset,
135 * length is assumed to be pctx->mxsz. If this function produces
136 * pctx->size < 3, then no match was found.
139 * *the* longest match up to pctx->mxsz:
149 static void ntfs_best_match(struct COMPRESS_CONTEXT *pctx, const int i,
152 const u8 * const inbuf = pctx->inbuf;
154 s16 * const prev = pctx->prev;
155 const int max_len = min(pctx->bufsize - i, pctx->mxsz);
169 cur_match = pctx->head[hash];
171 pctx->head[hash] = i;
241 pctx->size = best_len;
242 pctx->rel = best_matchptr - strptr; /* given as a negative number! */
248 static void ntfs_skip_position(struct COMPRESS_CONTEXT *pctx, const int i)
252 if (pctx->bufsize - i < 4)
256 hash = ntfs_hash(pctx->inbuf + i);
257 pctx->prev[i] = pctx->head[hash];
258 pctx->head[hash] = i;
279 struct COMPRESS_CONTEXT *pctx;
294 pctx = ntfs_malloc(sizeof(struct COMPRESS_CONTEXT));
295 if (!pctx) {
302 memset(pctx->head, 0xFF, sizeof(pctx->head));
304 pctx->inbuf = (const unsigned char*)inbuf;
305 pctx->bufsize = bufsize;
310 pctx->mxsz = (1 << (16 - bp)) + 2;
331 pctx->mxsz = (pctx->mxsz + 2) >> 1;
333 ntfs_best_match(pctx, i, 2);
336 if (pctx->size >= 3) {
340 j = i + pctx->size;
342 offs = pctx->rel;
344 if (pctx->size >= NICE_MATCH_LEN) {
362 ntfs_skip_position(pctx, i);
375 pctx->mxsz = (pctx->mxsz + 2) >> 1;
377 ntfs_best_match(pctx, i + 1, pctx->size);
378 k = i + 1 + pctx->size;
401 ntfs_skip_position(pctx, i);
445 free(pctx);