]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Fix assert edge case, improve documentation in zstd.h
authorsenhuang42 <senhuang96@fb.com>
Mon, 16 Nov 2020 23:05:35 +0000 (18:05 -0500)
committersenhuang42 <senhuang96@fb.com>
Mon, 16 Nov 2020 23:05:35 +0000 (18:05 -0500)
lib/compress/zstd_compress.c
lib/zstd.h

index e6257ba6f2a40d24075dc9b9d202c9ef682a5bbe..069835b23999e28e709ebd05c22f3f8a2dcc8e37 100644 (file)
@@ -4691,7 +4691,8 @@ static size_t ZSTD_copySequencesToSeqStore(seqStore_t* seqStore, ZSTD_sequencePo
         ZSTD_storeSeq(seqStore, litLength, ip, iend, offCode, matchLength - MINMATCH);
         ip += matchLength + litLength;
     }
-    assert(endPosInSequence <= inSeqs[idx].litLength + inSeqs[idx].matchLength);
+    DEBUGLOG(5, "Ending seq: idx: %zu (of: %u ml: %u ll: %u)", idx, inSeqs[idx].offset, inSeqs[idx].matchLength, inSeqs[idx].litLength);
+    assert(idx == inSeqsSize || endPosInSequence <= inSeqs[idx].litLength + inSeqs[idx].matchLength);
     seqPos->idx = idx;
     seqPos->posInSequence = endPosInSequence;
     ZSTD_memcpy(cctx->blockState.nextCBlock->rep, updatedRepcodes.rep, sizeof(repcodes_t));
index a0aa6d3ace45bddc9e8335c598c641dcf39fabc1..05aebc4395875564f4475ae0c6f0af7911356619 100644 (file)
@@ -1340,13 +1340,15 @@ ZSTDLIB_API size_t ZSTD_mergeBlockDelimiters(ZSTD_Sequence* sequences, size_t se
  * Compress sequences given by inSeqs, generated from source buffer 'src', using a cctx.
  * The entire source is compressed into a single frame. 
  * 
- * If invoked with ZSTD_sf_noBlockDelimiters, the array of ZSTD_Sequence is expected to contain
+ * If ZSTD_c_blockDelimiters == ZSTD_sf_noBlockDelimiters, the array of ZSTD_Sequence is expected to contain
  * no block delimiters (defined in ZSTD_Sequence). Block boundaries are roughly determined based on
  * the block size derived from the cctx, and sequences may be split.
  * 
- * If invoked with ZSTD_sf_explicitBlockDelimiters, the array of ZSTD_Sequence is expected to contain
+ * If STD_c_blockDelimiters == ZSTD_sf_explicitBlockDelimiters, the array of ZSTD_Sequence is expected to contain
  * block delimiters.
  * 
+ * Repcodes are, as of now, always re-calculated.
+ * 
  * @return : final compressed size.
  */
 ZSTDLIB_API size_t ZSTD_compressSequences(ZSTD_CCtx* const cctx, void* dst, size_t dstSize,