zstd-ruby 1.5.4.1 → 1.5.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1232,11 +1232,7 @@ ZSTD_decodeSequence(seqState_t* seqState, const ZSTD_longOffset_e longOffsets)
1232
1232
 
1233
1233
  /* sequence */
1234
1234
  { size_t offset;
1235
- #if defined(__clang__)
1236
- if (LIKELY(ofBits > 1)) {
1237
- #else
1238
1235
  if (ofBits > 1) {
1239
- #endif
1240
1236
  ZSTD_STATIC_ASSERT(ZSTD_lo_isLongOffset == 1);
1241
1237
  ZSTD_STATIC_ASSERT(LONG_OFFSETS_MAX_EXTRA_BITS_32 == 5);
1242
1238
  ZSTD_STATIC_ASSERT(STREAM_ACCUMULATOR_MIN_32 > LONG_OFFSETS_MAX_EXTRA_BITS_32);
@@ -1273,11 +1269,7 @@ ZSTD_decodeSequence(seqState_t* seqState, const ZSTD_longOffset_e longOffsets)
1273
1269
  seq.offset = offset;
1274
1270
  }
1275
1271
 
1276
- #if defined(__clang__)
1277
- if (UNLIKELY(mlBits > 0))
1278
- #else
1279
1272
  if (mlBits > 0)
1280
- #endif
1281
1273
  seq.matchLength += BIT_readBitsFast(&seqState->DStream, mlBits/*>0*/);
1282
1274
 
1283
1275
  if (MEM_32bits() && (mlBits+llBits >= STREAM_ACCUMULATOR_MIN_32-LONG_OFFSETS_MAX_EXTRA_BITS_32))
@@ -1287,11 +1279,7 @@ ZSTD_decodeSequence(seqState_t* seqState, const ZSTD_longOffset_e longOffsets)
1287
1279
  /* Ensure there are enough bits to read the rest of data in 64-bit mode. */
1288
1280
  ZSTD_STATIC_ASSERT(16+LLFSELog+MLFSELog+OffFSELog < STREAM_ACCUMULATOR_MIN_64);
1289
1281
 
1290
- #if defined(__clang__)
1291
- if (UNLIKELY(llBits > 0))
1292
- #else
1293
1282
  if (llBits > 0)
1294
- #endif
1295
1283
  seq.litLength += BIT_readBitsFast(&seqState->DStream, llBits/*>0*/);
1296
1284
 
1297
1285
  if (MEM_32bits())
@@ -1987,7 +1975,7 @@ ZSTD_decompressSequencesLong(ZSTD_DCtx* dctx,
1987
1975
 
1988
1976
 
1989
1977
  /**
1990
- * @returns The total size of the history referencable by zstd, including
1978
+ * @returns The total size of the history referenceable by zstd, including
1991
1979
  * both the prefix and the extDict. At @p op any offset larger than this
1992
1980
  * is invalid.
1993
1981
  */
@@ -2124,7 +2112,9 @@ ZSTD_decompressBlock_internal(ZSTD_DCtx* dctx,
2124
2112
  ip += seqHSize;
2125
2113
  srcSize -= seqHSize;
2126
2114
 
2127
- RETURN_ERROR_IF(dst == NULL && nbSeq > 0, dstSize_tooSmall, "NULL not handled");
2115
+ RETURN_ERROR_IF((dst == NULL || dstCapacity == 0) && nbSeq > 0, dstSize_tooSmall, "NULL not handled");
2116
+ RETURN_ERROR_IF(MEM_64bits() && sizeof(size_t) == sizeof(void*) && (size_t)(-1) - (size_t)dst < (size_t)(1 << 20), dstSize_tooSmall,
2117
+ "invalid dst");
2128
2118
 
2129
2119
  /* If we could potentially have long offsets, or we might want to use the prefetch decoder,
2130
2120
  * compute information about the share of long offsets, and the maximum nbAdditionalBits.
@@ -2181,9 +2171,9 @@ void ZSTD_checkContinuity(ZSTD_DCtx* dctx, const void* dst, size_t dstSize)
2181
2171
  }
2182
2172
 
2183
2173
 
2184
- size_t ZSTD_decompressBlock(ZSTD_DCtx* dctx,
2185
- void* dst, size_t dstCapacity,
2186
- const void* src, size_t srcSize)
2174
+ size_t ZSTD_decompressBlock_deprecated(ZSTD_DCtx* dctx,
2175
+ void* dst, size_t dstCapacity,
2176
+ const void* src, size_t srcSize)
2187
2177
  {
2188
2178
  size_t dSize;
2189
2179
  ZSTD_checkContinuity(dctx, dst, dstCapacity);
@@ -2191,3 +2181,12 @@ size_t ZSTD_decompressBlock(ZSTD_DCtx* dctx,
2191
2181
  dctx->previousDstEnd = (char*)dst + dSize;
2192
2182
  return dSize;
2193
2183
  }
2184
+
2185
+
2186
+ /* NOTE: Must just wrap ZSTD_decompressBlock_deprecated() */
2187
+ size_t ZSTD_decompressBlock(ZSTD_DCtx* dctx,
2188
+ void* dst, size_t dstCapacity,
2189
+ const void* src, size_t srcSize)
2190
+ {
2191
+ return ZSTD_decompressBlock_deprecated(dctx, dst, dstCapacity, src, srcSize);
2192
+ }
@@ -64,5 +64,10 @@ void ZSTD_buildFSETable(ZSTD_seqSymbol* dt,
64
64
  unsigned tableLog, void* wksp, size_t wkspSize,
65
65
  int bmi2);
66
66
 
67
+ /* Internal definition of ZSTD_decompressBlock() to avoid deprecation warnings. */
68
+ size_t ZSTD_decompressBlock_deprecated(ZSTD_DCtx* dctx,
69
+ void* dst, size_t dstCapacity,
70
+ const void* src, size_t srcSize);
71
+
67
72
 
68
73
  #endif /* ZSTD_DEC_BLOCK_H */
@@ -566,11 +566,11 @@ static void ZDICT_countEStats(EStats_ress_t esr, const ZSTD_parameters* params,
566
566
  size_t cSize;
567
567
 
568
568
  if (srcSize > blockSizeMax) srcSize = blockSizeMax; /* protection vs large samples */
569
- { size_t const errorCode = ZSTD_compressBegin_usingCDict(esr.zc, esr.dict);
569
+ { size_t const errorCode = ZSTD_compressBegin_usingCDict_deprecated(esr.zc, esr.dict);
570
570
  if (ZSTD_isError(errorCode)) { DISPLAYLEVEL(1, "warning : ZSTD_compressBegin_usingCDict failed \n"); return; }
571
571
 
572
572
  }
573
- cSize = ZSTD_compressBlock(esr.zc, esr.workPlace, ZSTD_BLOCKSIZE_MAX, src, srcSize);
573
+ cSize = ZSTD_compressBlock_deprecated(esr.zc, esr.workPlace, ZSTD_BLOCKSIZE_MAX, src, srcSize);
574
574
  if (ZSTD_isError(cSize)) { DISPLAYLEVEL(3, "warning : could not compress sample size %u \n", (unsigned)srcSize); return; }
575
575
 
576
576
  if (cSize) { /* if == 0; block is not compressible */