line |
true |
false |
branch |
107
|
0 |
0 |
while (idx < target) { |
|
0 |
0 |
while (idx < target) { |
|
0 |
0 |
while (idx < target) { |
|
0 |
0 |
while (idx < target) { |
|
0 |
0 |
while (idx < target) { |
110
|
0 |
0 |
if (delta>MAX_DISTANCE) delta = MAX_DISTANCE; |
|
0 |
0 |
if (delta>MAX_DISTANCE) delta = MAX_DISTANCE; |
|
0 |
0 |
if (delta>MAX_DISTANCE) delta = MAX_DISTANCE; |
|
0 |
0 |
if (delta>MAX_DISTANCE) delta = MAX_DISTANCE; |
|
0 |
0 |
if (delta>MAX_DISTANCE) delta = MAX_DISTANCE; |
130
|
0 |
0 |
const U32 lowLimit = (hc4->lowLimit + 64 KB > (U32)(ip-base)) ? hc4->lowLimit : (U32)(ip - base) - (64 KB - 1); |
139
|
0 |
0 |
while ((matchIndex>=lowLimit) && (nbAttempts)) { |
|
0 |
0 |
while ((matchIndex>=lowLimit) && (nbAttempts)) { |
141
|
0 |
0 |
if (matchIndex >= dictLimit) { |
143
|
0 |
0 |
if ( (*(match+ml) == *(ip+ml)) /* can be longer */ |
144
|
0 |
0 |
&& (LZ4_read32(match) == LZ4_read32(ip)) ) |
147
|
0 |
0 |
if (mlt > ml) { ml = mlt; *matchpos = match; } |
151
|
0 |
0 |
if (LZ4_read32(match) == LZ4_read32(ip)) { |
154
|
0 |
0 |
if (vLimit > iLimit) vLimit = iLimit; |
156
|
0 |
0 |
if ((ip+mlt == vLimit) && (vLimit < iLimit)) |
|
0 |
0 |
if ((ip+mlt == vLimit) && (vLimit < iLimit)) |
158
|
0 |
0 |
if (mlt > ml) { ml = mlt; *matchpos = base + matchIndex; } /* virtual matchpos */ |
183
|
0 |
0 |
const U32 lowLimit = (hc4->lowLimit + 64 KB > (U32)(ip-base)) ? hc4->lowLimit : (U32)(ip - base) - (64 KB - 1); |
|
0 |
0 |
const U32 lowLimit = (hc4->lowLimit + 64 KB > (U32)(ip-base)) ? hc4->lowLimit : (U32)(ip - base) - (64 KB - 1); |
194
|
0 |
0 |
while ((matchIndex>=lowLimit) && (nbAttempts)) { |
|
0 |
0 |
while ((matchIndex>=lowLimit) && (nbAttempts)) { |
|
0 |
0 |
while ((matchIndex>=lowLimit) && (nbAttempts)) { |
|
0 |
0 |
while ((matchIndex>=lowLimit) && (nbAttempts)) { |
196
|
0 |
0 |
if (matchIndex >= dictLimit) { |
|
0 |
0 |
if (matchIndex >= dictLimit) { |
198
|
0 |
0 |
if (*(iLowLimit + longest) == *(matchPtr - delta + longest)) { |
|
0 |
0 |
if (*(iLowLimit + longest) == *(matchPtr - delta + longest)) { |
199
|
0 |
0 |
if (LZ4_read32(matchPtr) == LZ4_read32(ip)) { |
|
0 |
0 |
if (LZ4_read32(matchPtr) == LZ4_read32(ip)) { |
203
|
0 |
0 |
while ( (ip+back > iLowLimit) |
|
0 |
0 |
while ( (ip+back > iLowLimit) |
204
|
0 |
0 |
&& (matchPtr+back > lowPrefixPtr) |
|
0 |
0 |
&& (matchPtr+back > lowPrefixPtr) |
205
|
0 |
0 |
&& (ip[back-1] == matchPtr[back-1])) { |
|
0 |
0 |
&& (ip[back-1] == matchPtr[back-1])) { |
211
|
0 |
0 |
if (mlt > longest) { |
|
0 |
0 |
if (mlt > longest) { |
218
|
0 |
0 |
if (LZ4_read32(matchPtr) == LZ4_read32(ip)) { |
|
0 |
0 |
if (LZ4_read32(matchPtr) == LZ4_read32(ip)) { |
222
|
0 |
0 |
if (vLimit > iHighLimit) vLimit = iHighLimit; |
|
0 |
0 |
if (vLimit > iHighLimit) vLimit = iHighLimit; |
224
|
0 |
0 |
if ((ip+mlt == vLimit) && (vLimit < iHighLimit)) |
|
0 |
0 |
if ((ip+mlt == vLimit) && (vLimit < iHighLimit)) |
226
|
0 |
0 |
while ((ip+back > iLowLimit) && (matchIndex+back > lowLimit) && (ip[back-1] == matchPtr[back-1])) back--; |
|
0 |
0 |
while ((ip+back > iLowLimit) && (matchIndex+back > lowLimit) && (ip[back-1] == matchPtr[back-1])) back--; |
|
0 |
0 |
while ((ip+back > iLowLimit) && (matchIndex+back > lowLimit) && (ip[back-1] == matchPtr[back-1])) back--; |
|
0 |
0 |
while ((ip+back > iLowLimit) && (matchIndex+back > lowLimit) && (ip[back-1] == matchPtr[back-1])) back--; |
|
0 |
0 |
while ((ip+back > iLowLimit) && (matchIndex+back > lowLimit) && (ip[back-1] == matchPtr[back-1])) back--; |
|
0 |
0 |
while ((ip+back > iLowLimit) && (matchIndex+back > lowLimit) && (ip[back-1] == matchPtr[back-1])) back--; |
228
|
0 |
0 |
if (mlt > longest) { longest = mlt; *matchpos = base + matchIndex + back; *startpos = ip+back; } |
|
0 |
0 |
if (mlt > longest) { longest = mlt; *matchpos = base + matchIndex + back; *startpos = ip+back; } |
270
|
0 |
0 |
if ((limit) && ((*op + (length >> 8) + length + (2 + 1 + LASTLITERALS)) > oend)) return 1; /* Check output limit */ |
|
0 |
0 |
if ((limit) && ((*op + (length >> 8) + length + (2 + 1 + LASTLITERALS)) > oend)) return 1; /* Check output limit */ |
|
0 |
0 |
if ((limit) && ((*op + (length >> 8) + length + (2 + 1 + LASTLITERALS)) > oend)) return 1; /* Check output limit */ |
|
0 |
0 |
if ((limit) && ((*op + (length >> 8) + length + (2 + 1 + LASTLITERALS)) > oend)) return 1; /* Check output limit */ |
|
0 |
0 |
if ((limit) && ((*op + (length >> 8) + length + (2 + 1 + LASTLITERALS)) > oend)) return 1; /* Check output limit */ |
|
0 |
0 |
if ((limit) && ((*op + (length >> 8) + length + (2 + 1 + LASTLITERALS)) > oend)) return 1; /* Check output limit */ |
|
0 |
0 |
if ((limit) && ((*op + (length >> 8) + length + (2 + 1 + LASTLITERALS)) > oend)) return 1; /* Check output limit */ |
|
0 |
0 |
if ((limit) && ((*op + (length >> 8) + length + (2 + 1 + LASTLITERALS)) > oend)) return 1; /* Check output limit */ |
|
0 |
0 |
if ((limit) && ((*op + (length >> 8) + length + (2 + 1 + LASTLITERALS)) > oend)) return 1; /* Check output limit */ |
|
0 |
0 |
if ((limit) && ((*op + (length >> 8) + length + (2 + 1 + LASTLITERALS)) > oend)) return 1; /* Check output limit */ |
|
0 |
0 |
if ((limit) && ((*op + (length >> 8) + length + (2 + 1 + LASTLITERALS)) > oend)) return 1; /* Check output limit */ |
|
0 |
0 |
if ((limit) && ((*op + (length >> 8) + length + (2 + 1 + LASTLITERALS)) > oend)) return 1; /* Check output limit */ |
271
|
0 |
0 |
if (length >= RUN_MASK) { |
|
0 |
0 |
if (length >= RUN_MASK) { |
|
0 |
0 |
if (length >= RUN_MASK) { |
|
0 |
0 |
if (length >= RUN_MASK) { |
|
0 |
0 |
if (length >= RUN_MASK) { |
|
0 |
0 |
if (length >= RUN_MASK) { |
274
|
0 |
0 |
for(; len >= 255 ; len -= 255) *(*op)++ = 255; |
|
0 |
0 |
for(; len >= 255 ; len -= 255) *(*op)++ = 255; |
|
0 |
0 |
for(; len >= 255 ; len -= 255) *(*op)++ = 255; |
|
0 |
0 |
for(; len >= 255 ; len -= 255) *(*op)++ = 255; |
|
0 |
0 |
for(; len >= 255 ; len -= 255) *(*op)++ = 255; |
|
0 |
0 |
for(; len >= 255 ; len -= 255) *(*op)++ = 255; |
289
|
0 |
0 |
if ((limit) && (*op + (length >> 8) + (1 + LASTLITERALS) > oend)) return 1; /* Check output limit */ |
|
0 |
0 |
if ((limit) && (*op + (length >> 8) + (1 + LASTLITERALS) > oend)) return 1; /* Check output limit */ |
|
0 |
0 |
if ((limit) && (*op + (length >> 8) + (1 + LASTLITERALS) > oend)) return 1; /* Check output limit */ |
|
0 |
0 |
if ((limit) && (*op + (length >> 8) + (1 + LASTLITERALS) > oend)) return 1; /* Check output limit */ |
|
0 |
0 |
if ((limit) && (*op + (length >> 8) + (1 + LASTLITERALS) > oend)) return 1; /* Check output limit */ |
|
0 |
0 |
if ((limit) && (*op + (length >> 8) + (1 + LASTLITERALS) > oend)) return 1; /* Check output limit */ |
|
0 |
0 |
if ((limit) && (*op + (length >> 8) + (1 + LASTLITERALS) > oend)) return 1; /* Check output limit */ |
|
0 |
0 |
if ((limit) && (*op + (length >> 8) + (1 + LASTLITERALS) > oend)) return 1; /* Check output limit */ |
|
0 |
0 |
if ((limit) && (*op + (length >> 8) + (1 + LASTLITERALS) > oend)) return 1; /* Check output limit */ |
|
0 |
0 |
if ((limit) && (*op + (length >> 8) + (1 + LASTLITERALS) > oend)) return 1; /* Check output limit */ |
|
0 |
0 |
if ((limit) && (*op + (length >> 8) + (1 + LASTLITERALS) > oend)) return 1; /* Check output limit */ |
|
0 |
0 |
if ((limit) && (*op + (length >> 8) + (1 + LASTLITERALS) > oend)) return 1; /* Check output limit */ |
290
|
0 |
0 |
if (length >= ML_MASK) { |
|
0 |
0 |
if (length >= ML_MASK) { |
|
0 |
0 |
if (length >= ML_MASK) { |
|
0 |
0 |
if (length >= ML_MASK) { |
|
0 |
0 |
if (length >= ML_MASK) { |
|
0 |
0 |
if (length >= ML_MASK) { |
293
|
0 |
0 |
for(; length >= 510 ; length -= 510) { *(*op)++ = 255; *(*op)++ = 255; } |
|
0 |
0 |
for(; length >= 510 ; length -= 510) { *(*op)++ = 255; *(*op)++ = 255; } |
|
0 |
0 |
for(; length >= 510 ; length -= 510) { *(*op)++ = 255; *(*op)++ = 255; } |
|
0 |
0 |
for(; length >= 510 ; length -= 510) { *(*op)++ = 255; *(*op)++ = 255; } |
|
0 |
0 |
for(; length >= 510 ; length -= 510) { *(*op)++ = 255; *(*op)++ = 255; } |
|
0 |
0 |
for(; length >= 510 ; length -= 510) { *(*op)++ = 255; *(*op)++ = 255; } |
294
|
0 |
0 |
if (length >= 255) { length -= 255; *(*op)++ = 255; } |
|
0 |
0 |
if (length >= 255) { length -= 255; *(*op)++ = 255; } |
|
0 |
0 |
if (length >= 255) { length -= 255; *(*op)++ = 255; } |
|
0 |
0 |
if (length >= 255) { length -= 255; *(*op)++ = 255; } |
|
0 |
0 |
if (length >= 255) { length -= 255; *(*op)++ = 255; } |
|
0 |
0 |
if (length >= 255) { length -= 255; *(*op)++ = 255; } |
344
|
0 |
0 |
if (limit == limitedDestSize && maxOutputSize < 1) return 0; /* Impossible to store anything */ |
|
0 |
0 |
if (limit == limitedDestSize && maxOutputSize < 1) return 0; /* Impossible to store anything */ |
345
|
0 |
0 |
if ((U32)inputSize > (U32)LZ4_MAX_INPUT_SIZE) return 0; /* Unsupported input size, too large (or negative) */ |
348
|
0 |
0 |
if (limit == limitedDestSize) oend -= LASTLITERALS; /* Hack for support limitations LZ4 decompressor */ |
349
|
0 |
0 |
if (inputSize < LZ4_minLength) goto _last_literals; /* Input too small, no compression (all literals) */ |
354
|
0 |
0 |
while (ip < mflimit) { |
356
|
0 |
0 |
if (!ml) { ip++; continue; } |
364
|
0 |
0 |
if (ip+ml < mflimit) |
369
|
0 |
0 |
if (ml2 == ml) { /* No better match */ |
371
|
0 |
0 |
if (LZ4HC_encodeSequence(&ip, &op, &anchor, ml, ref, limit, oend)) goto _dest_overflow; |
375
|
0 |
0 |
if (start0 < ip) { |
376
|
0 |
0 |
if (start2 < ip + ml0) { /* empirical */ |
384
|
0 |
0 |
if ((start2 - ip) < 3) { /* First Match too small : removed */ |
395
|
0 |
0 |
if ((start2 - ip) < OPTIMAL_ML) { |
398
|
0 |
0 |
if (new_ml > OPTIMAL_ML) new_ml = OPTIMAL_ML; |
399
|
0 |
0 |
if (ip+new_ml > start2 + ml2 - MINMATCH) new_ml = (int)(start2 - ip) + ml2 - MINMATCH; |
401
|
0 |
0 |
if (correction > 0) { |
409
|
0 |
0 |
if (start2 + ml2 < mflimit) |
414
|
0 |
0 |
if (ml3 == ml2) { /* No better match : 2 sequences to encode */ |
416
|
0 |
0 |
if (start2 < ip+ml) ml = (int)(start2 - ip); |
419
|
0 |
0 |
if (LZ4HC_encodeSequence(&ip, &op, &anchor, ml, ref, limit, oend)) goto _dest_overflow; |
422
|
0 |
0 |
if (LZ4HC_encodeSequence(&ip, &op, &anchor, ml2, ref2, limit, oend)) goto _dest_overflow; |
426
|
0 |
0 |
if (start3 < ip+ml+3) { /* Not enough space for match 2 : remove it */ |
427
|
0 |
0 |
if (start3 >= (ip+ml)) { /* can write Seq1 immediately ==> Seq2 is removed, so Seq3 becomes Seq1 */ |
428
|
0 |
0 |
if (start2 < ip+ml) { |
433
|
0 |
0 |
if (ml2 < MINMATCH) { |
441
|
0 |
0 |
if (LZ4HC_encodeSequence(&ip, &op, &anchor, ml, ref, limit, oend)) goto _dest_overflow; |
462
|
0 |
0 |
if (start2 < ip+ml) { |
463
|
0 |
0 |
if ((start2 - ip) < (int)ML_MASK) { |
465
|
0 |
0 |
if (ml > OPTIMAL_ML) ml = OPTIMAL_ML; |
466
|
0 |
0 |
if (ip + ml > start2 + ml2 - MINMATCH) ml = (int)(start2 - ip) + ml2 - MINMATCH; |
468
|
0 |
0 |
if (correction > 0) { |
478
|
0 |
0 |
if (LZ4HC_encodeSequence(&ip, &op, &anchor, ml, ref, limit, oend)) goto _dest_overflow; |
496
|
0 |
0 |
if (limit == limitedDestSize) oend += LASTLITERALS; /* restore correct value */ |
497
|
0 |
0 |
if (limit && (op + totalSize > oend)) { |
|
0 |
0 |
if (limit && (op + totalSize > oend)) { |
498
|
0 |
0 |
if (limit == limitedOutput) return 0; /* Check output limit */ |
506
|
0 |
0 |
if (lastRunSize >= RUN_MASK) { |
509
|
0 |
0 |
for(; accumulator >= 255 ; accumulator -= 255) *op++ = 255; |
523
|
0 |
0 |
if (limit == limitedDestSize) { |
549
|
0 |
0 |
if (cLevel < 1) cLevel = LZ4HC_CLEVEL_DEFAULT; /* note : convention is different from lz4frame, maybe to reconsider */ |
550
|
0 |
0 |
if (cLevel > 9) { |
551
|
0 |
0 |
if (limit == limitedDestSize) cLevel = 10; |
575
|
0 |
0 |
if (((size_t)(state)&(sizeof(void*)-1)) != 0) return 0; /* Error : state is not aligned for pointers (32 or 64 bits) */ |
577
|
0 |
0 |
if (dstCapacity < LZ4_compressBound(srcSize)) |
616
|
0 |
0 |
if (!LZ4_streamHCPtr) return 0; /* support free on NULL */ |
627
|
0 |
0 |
if (compressionLevel > LZ4HC_CLEVEL_MAX) compressionLevel = LZ4HC_CLEVEL_MAX; /* cap compression level */ |
635
|
0 |
0 |
int const minCLevel = currentCLevel < LZ4HC_CLEVEL_OPT_MIN ? 1 : LZ4HC_CLEVEL_OPT_MIN; |
636
|
0 |
0 |
int const maxCLevel = currentCLevel < LZ4HC_CLEVEL_OPT_MIN ? LZ4HC_CLEVEL_OPT_MIN-1 : LZ4HC_CLEVEL_MAX; |
645
|
0 |
0 |
if (dictSize > 64 KB) { |
651
|
0 |
0 |
if (ctxPtr->compressionLevel >= LZ4HC_CLEVEL_OPT_MIN) |
654
|
0 |
0 |
if (dictSize >= 4) LZ4HC_Insert (ctxPtr, ctxPtr->end-3); |
663
|
0 |
0 |
if (ctxPtr->compressionLevel >= LZ4HC_CLEVEL_OPT_MIN) |
666
|
0 |
0 |
if (ctxPtr->end >= ctxPtr->base + 4) LZ4HC_Insert (ctxPtr, ctxPtr->end-3); /* Referencing remaining dictionary content */ |
684
|
0 |
0 |
if (ctxPtr->base == NULL) LZ4HC_init (ctxPtr, (const BYTE*) src); |
687
|
0 |
0 |
if ((size_t)(ctxPtr->end - ctxPtr->base) > 2 GB) { |
689
|
0 |
0 |
if (dictSize > 64 KB) dictSize = 64 KB; |
694
|
0 |
0 |
if ((const BYTE*)src != ctxPtr->end) LZ4HC_setExternalDict(ctxPtr, (const BYTE*)src); |
700
|
0 |
0 |
if ((sourceEnd > dictBegin) && ((const BYTE*)src < dictEnd)) { |
|
0 |
0 |
if ((sourceEnd > dictBegin) && ((const BYTE*)src < dictEnd)) { |
701
|
0 |
0 |
if (sourceEnd > dictEnd) sourceEnd = dictEnd; |
703
|
0 |
0 |
if (ctxPtr->dictLimit - ctxPtr->lowLimit < 4) ctxPtr->lowLimit = ctxPtr->dictLimit; |
712
|
0 |
0 |
if (dstCapacity < LZ4_compressBound(srcSize)) |
721
|
0 |
0 |
if (ctxPtr->compressionLevel >= LZ4HC_CLEVEL_OPT_MIN) LZ4HC_init(ctxPtr, (const BYTE*)src); /* not compatible with btopt implementation */ |
733
|
0 |
0 |
if (dictSize > 64 KB) dictSize = 64 KB; |
734
|
0 |
0 |
if (dictSize < 4) dictSize = 0; |
735
|
0 |
0 |
if (dictSize > prefixSize) dictSize = prefixSize; |
742
|
0 |
0 |
if (streamPtr->nextToUpdate < streamPtr->dictLimit) streamPtr->nextToUpdate = streamPtr->dictLimit; |
771
|
0 |
0 |
if ((((size_t)state) & (sizeof(void*)-1)) != 0) return 1; /* Error : pointer is not aligned for pointer (32 or 64 bits) */ |
780
|
0 |
0 |
if (hc4 == NULL) return NULL; /* not enough memory */ |
787
|
0 |
0 |
if (!LZ4HC_Data) return 0; /* support free on NULL */ |