]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
add dedicated error code for special case
authorYann Collet <cyan@fb.com>
Thu, 19 Dec 2024 17:45:28 +0000 (09:45 -0800)
committerYann Collet <cyan@fb.com>
Fri, 20 Dec 2024 18:37:00 +0000 (10:37 -0800)
ZSTD_compressSequencesAndLiterals() cannot produce an uncompressed block

doc/zstd_manual.html
lib/common/error_private.c
lib/compress/zstd_compress.c
lib/zstd_errors.h

index a50dd3c5ddd0dccafcfe5382eb89162a3931bd58..30908e0aa677ad27e1c84d12740b720d4fd32618 100644 (file)
@@ -1431,7 +1431,6 @@ ZSTD_compressSequencesAndLiterals(ZSTD_CCtx* cctx,
  but it also features the following limitations:
  - Only supports explicit delimiter mode
  - Not compatible with frame checksum, which must disabled
- - Does not write the content size in frame header
  - If any block is incompressible, will fail and return an error
  - @litSize must be == sum of all @.litLength fields in @inSeqs. Any discrepancy will generate an error.
  - the buffer @literals must be larger than @litSize by at least 8 bytes.
index 075fc5ef42fab0a69a1298bde84807fc24156299..7e7f24f6756535cf379251987e49421a2341df5e 100644 (file)
@@ -40,6 +40,7 @@ const char* ERR_getErrorString(ERR_enum code)
     case PREFIX(tableLog_tooLarge): return "tableLog requires too much memory : unsupported";
     case PREFIX(maxSymbolValue_tooLarge): return "Unsupported max Symbol Value : too large";
     case PREFIX(maxSymbolValue_tooSmall): return "Specified maxSymbolValue is too small";
+    case PREFIX(cannotProduce_uncompressedBlock): return "This mode cannot generate an uncompressed block";
     case PREFIX(stabilityCondition_notRespected): return "pledged buffer stability condition is not respected";
     case PREFIX(dictionary_corrupted): return "Dictionary is corrupted";
     case PREFIX(dictionary_wrong): return "Dictionary mismatch";
index 655adf34b01e69e146d92977bac864cc0aedcac5..d5adeb68e1f70b2056006f85c32d4ce28e2d37c5 100644 (file)
@@ -7254,7 +7254,7 @@ ZSTD_compressSequencesAndLiterals_internal(ZSTD_CCtx* cctx,
              * but it's complex, and memory hungry, killing the purpose of this variant.
              * Current outcome: generate an error code.
              */
-            RETURN_ERROR(dstSize_tooSmall, "Data is not compressible"); /* note: error code could be clearer */
+            RETURN_ERROR(cannotProduce_uncompressedBlock, "ZSTD_compressSequencesAndLiterals cannot generate an uncompressed block");
         } else {
             U32 cBlockHeader;
             assert(compressedSeqsSize > 1); /* no RLE */
index 20e488f155199f3ebd4d2a05c6fad7eb0e7b3f70..8ebc95cbb2ab882027a3e6cc92cdd5abc1a0dee4 100644 (file)
@@ -76,6 +76,7 @@ typedef enum {
   ZSTD_error_tableLog_tooLarge       = 44,
   ZSTD_error_maxSymbolValue_tooLarge = 46,
   ZSTD_error_maxSymbolValue_tooSmall = 48,
+  ZSTD_error_cannotProduce_uncompressedBlock = 49,
   ZSTD_error_stabilityCondition_notRespected = 50,
   ZSTD_error_stage_wrong       = 60,
   ZSTD_error_init_missing      = 62,