ZSTD_compress2(zc, dst, dstCapacity, src, srcSize);
ZSTD_customFree(dst, ZSTD_defaultCMem);
+
+ if (format == ZSTD_sf_noBlockDelimiters) {
+ /* Merge the dummy block delimiters */
+ size_t i = 0;
+ size_t totalSeqs = zc->seqCollector.seqIndex;
+ for (; i < totalSeqs; ++i) {
+ if (seqCollector.seqStart[i].offset == 0 && seqCollector.seqStart[i].matchLength == 0) {
+ /* Merge the block boundary or last literals */
+ if (i != totalSeqs-1) {
+ /* Add last literals to next sequence, then "delete" this sequence */
+ seqCollector.seqStart[i+1].litLength += seqCollector.seqStart[i].litLength;
+ memmove(seqCollector.seqStart+i, seqCollector.seqStart+i+1, (totalSeqs-i-1)*sizeof(ZSTD_sequence));
+ }
+ totalSeqs--;
+ }
+ }
+ zc->seqCollector.seqIndex = totalSeqs;
+ }
return zc->seqCollector.seqIndex;
}
*
* If invoked with ZSTD_sf_noBlockDelimiters, sequences will still be generated
* on a per-block basis, but any last literals of a block will be merged into the
- * last literals of the first sequence in the next block with the exception of the
- * final segment of last literals. As such, the final generated result has no
- * explicit representation of block boundaries.
+ * last literals of the first sequence in the next block.
+ * As such, the final generated result has no explicit representation of block boundaries,
+ * and the final last literals segment is not represented in the sequences.
*
* zc can be used to insert custom compression params.
* This function invokes ZSTD_compress2