]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Merge branch 'dev' into tomerge2051
authorYann Collet <cyan@fb.com>
Wed, 1 Dec 2021 23:29:49 +0000 (15:29 -0800)
committerYann Collet <cyan@fb.com>
Wed, 1 Dec 2021 23:29:49 +0000 (15:29 -0800)
1  2 
lib/Makefile
lib/compress/zstd_compress.c
lib/zstd.h

diff --cc lib/Makefile
Simple merge
Simple merge
diff --cc lib/zstd.h
index c3f642d47e637580446066895d96c70e7287bae4,571d5fe903d9a10c6d8cdf71e324e859c75abbb2..66ec125d00e9566243662122dbb5ca5530d1cc59
@@@ -1451,9 -1439,29 +1452,29 @@@ ZSTDLIB_STATIC_API size_t ZSTD_compress
   *
   * @return : number of bytes written or a ZSTD error.
   */
 -ZSTDLIB_API size_t ZSTD_writeSkippableFrame(void* dst, size_t dstCapacity,
 +ZSTDLIB_STATIC_API size_t ZSTD_writeSkippableFrame(void* dst, size_t dstCapacity,
                                              const void* src, size_t srcSize, unsigned magicVariant);
  
+ /*! ZSTD_readSkippableFrame() :
+  * Retrieves a zstd skippable frame containing data given by src, and writes it to dst buffer.
+  *
+  * The parameter magicVariant will receive the magicVariant that was supplied when the frame was written,
+  * i.e. magicNumber - ZSTD_MAGIC_SKIPPABLE_START.  This can be NULL if the caller is not interested
+  * in the magicVariant.
+  *
+  * Returns an error if destination buffer is not large enough, or if the frame is not skippable.
+  *
+  * @return : number of bytes written or a ZSTD error.
+  */
+ ZSTDLIB_API size_t ZSTD_readSkippableFrame(void* dst, size_t dstCapacity, unsigned* magicVariant,
+                                             const void* src, size_t srcSize);
+ /*! ZSTD_isSkippableFrame() :
+  *  Tells if the content of `buffer` starts with a valid Frame Identifier for a skippable frame.
+  */
+ ZSTDLIB_API unsigned ZSTD_isSkippableFrame(const void* buffer, size_t size);
  
  /***************************************
  *  Memory management
@@@ -1581,20 -1589,20 +1602,20 @@@ ZSTDLIB_STATIC_API ZSTD_CDict* ZSTD_cre
                                                    ZSTD_compressionParameters cParams,
                                                    ZSTD_customMem customMem);
  
- /* ! Thread pool :
-  * These prototypes make it possible to share a thread pool among multiple compression contexts.
-  * This can limit resources for applications with multiple threads where each one uses
-  * a threaded compression mode (via ZSTD_c_nbWorkers parameter).
-  * ZSTD_createThreadPool creates a new thread pool with a given number of threads.
-  * Note that the lifetime of such pool must exist while being used.
-  * ZSTD_CCtx_refThreadPool assigns a thread pool to a context (use NULL argument value
-  * to use an internal thread pool).
-  * ZSTD_freeThreadPool frees a thread pool, accepts NULL pointer.
+ /*! Thread pool :
+  *  These prototypes make it possible to share a thread pool among multiple compression contexts.
+  *  This can limit resources for applications with multiple threads where each one uses
+  *  a threaded compression mode (via ZSTD_c_nbWorkers parameter).
+  *  ZSTD_createThreadPool creates a new thread pool with a given number of threads.
+  *  Note that the lifetime of such pool must exist while being used.
+  *  ZSTD_CCtx_refThreadPool assigns a thread pool to a context (use NULL argument value
+  *  to use an internal thread pool).
+  *  ZSTD_freeThreadPool frees a thread pool, accepts NULL pointer.
   */
  typedef struct POOL_ctx_s ZSTD_threadPool;
 -ZSTDLIB_API ZSTD_threadPool* ZSTD_createThreadPool(size_t numThreads);
 -ZSTDLIB_API void ZSTD_freeThreadPool (ZSTD_threadPool* pool);  /* accept NULL pointer */
 -ZSTDLIB_API size_t ZSTD_CCtx_refThreadPool(ZSTD_CCtx* cctx, ZSTD_threadPool* pool);
 +ZSTDLIB_STATIC_API ZSTD_threadPool* ZSTD_createThreadPool(size_t numThreads);
 +ZSTDLIB_STATIC_API void ZSTD_freeThreadPool (ZSTD_threadPool* pool);  /* accept NULL pointer */
 +ZSTDLIB_STATIC_API size_t ZSTD_CCtx_refThreadPool(ZSTD_CCtx* cctx, ZSTD_threadPool* pool);
  
  
  /*